[SPARK-56764][SQL] Add spark.jars to SharedState.jarClassLoader for persistent UDF resolution#55869
Open
yadavay-amzn wants to merge 1 commit into
Open
Conversation
…ersistent UDF resolution
385aac5 to
2c6d8e4
Compare
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 free
to 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?
Add jars from
spark.jarstoSharedState.jarClassLoaderduring initialization.Why are the changes needed?
When a persistent UDF is created via
CREATE FUNCTION ... AS 'com.test.HelloUDF'(withoutUSING JAR), the function metadata is stored in the catalog with emptyresources. After ThriftServer restart,loadFunctionResourcesis a no-op andmakeFunctionBuilderfails withCANNOT_LOAD_FUNCTION_CLASSbecauseUtils.classIsLoadablereturns false.The jar is on the classpath via
spark.jars, butSharedState.jarClassLoaderis created empty and relies on parent classloader delegation to reach it. This delegation is not reliable in ThriftServer's thread pool threads.The fix explicitly adds
spark.jarstojarClassLoaderso UDF classes are loadable regardless of parent delegation.Does this PR introduce any user-facing change?
Yes. Persistent UDFs registered without
USING JARwill now resolve correctly after ThriftServer restart when the jar is specified viaspark.jars.How was this patch tested?
Added test in
SharedStateSuiteverifying thatspark.jarsappear injarClassLoader.getURLs.Was this patch authored or co-authored using generative AI tooling?
Yes