Uh oh!
There was an error while loading. Please reload this page.
[SPARK-30260][SQL] Spark-Shell throw ClassNotFoundException exception for more than one statement to use UDF jar - #26888
Closed
southernriver wants to merge 1 commit into
Closed
Conversation
southernriver
commented
Dec 14, 2019
ContributorAuthor
southernriver
commented
Dec 14, 2019
ContributorAuthor
dongjoon-hyun
commented
Dec 15, 2019
Member
ok to test |
maropu
commented
Dec 15, 2019
Member
Is this related to #23921? It seems the #23921 has a different approach from this. cc: @HyukjinKwon |
SparkQA
commented
Dec 15, 2019
Test build #115349 has finished for PR 26888 at commit
|
HyukjinKwon
commented
Dec 27, 2019
Member
Yeah, seems a duplicate. |
HyukjinKwon
commented
Dec 27, 2019
Member
@southernriver can you explain why/when the class loaders are changed? |
cloud-fan
commented
Dec 27, 2019
Contributor
should IMainTranslatingClassLoader fallback to spark context class loader? |
HeartSaVioR
commented
Dec 27, 2019
Contributor
dongjoon-hyun
commented
Jan 7, 2020
Member
According to the above discussion, I'll close this PR and SPARK-30260 . Thank you, @southernriver and all! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
When we start spark-shell and use the udf for the first statement ,it's ok. But for the other statements it failed to load jar to current classpath and would throw ClassNotFoundException.It seems like that the first ClassLoader is different from the other's. For Spark-shell, the maintained class loader is always IMainsTranslatingClassLoader ,and for addJar Operation, the current classLoader is NonClosableMutuableclassLoader. For the first statement, there jar was loaded to right classLoader,and for other statements, the jar has been registered to functionRegistry and would not reload to NonClosableMutuableclassLoader, we need to reset classloader to active sparkSession's.
Here, I will show difference between the first statement and the second.

First statement is NonClosableMutuableclassLoader:
Second statement is IMainsTranslatingClassLoader:

Why are the changes needed?
The problem can be reproduced as described in the below.
After fix:
we should resolve this bug!
Does this PR introduce any user-facing change?
No
How was this patch tested?
manual.