New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-45859][ML] Make UDF objects in ml.functions lazy #43739
Conversation
Could you add a unit test for this change? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add unit test first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending tests
test("SPARK-45859: 'functions$' should not be affected by a broken class loader") { | ||
quietly { | ||
// Only one SparkContext should be running in this JVM (see SPARK-2243) | ||
sc.stop() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we add this after each test run ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, we'd better close sc
in this UT, in case contributors add new UTs after this one and tested with non-expected sc
|
||
// this UT should be the last one in this test suite, since it uses | ||
// a different `sc` from the standard one. | ||
// stop it here in case new UTs are added after this one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to create a separate suite, and document this on the top to avoid such mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good, let me move it to a separate file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@WeichenXu123 would you mind taking another look? |
Merged to master. |
What changes were proposed in this pull request?
Since JVM runs static codes only once, if loading functions$ fails, it will always report java.lang.NoClassDefFoundError: Could not initialize class
This PR just changes
functions.*
as lazy avoid hitting this issue because the initialization codes of a lazy val is not in static codes.Why are the changes needed?
to fix a intermittent bug
Does this PR introduce any user-facing change?
no
How was this patch tested?
new UT
Was this patch authored or co-authored using generative AI tooling?
no