fix: Use thread context classloader for Iceberg class loading in CometScanRule#4609
Open
chern wants to merge 1 commit into
Open
fix: Use thread context classloader for Iceberg class loading in CometScanRule#4609chern wants to merge 1 commit into
chern wants to merge 1 commit into
Conversation
karuppayya
approved these changes
Jun 8, 2026
Contributor
|
@mbutrovich Do we need a sperate issue tracking this or reuse old? |
Contributor
No preference. |
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.
Which issue does this PR close?
Closes #3737.
Rationale for this change
Similar change to #3738.
Comet uses
Class.forName(className)to reflectively load Iceberg classes.The single-argument
Class.forNameuses the classloader of the calling class, not the thread context classloader.When the Comet JAR is placed in Spark's
jars/folder, it is loaded by the system classloader.However, Iceberg classes may be bundled inside the user's application jar (as uber jar), which is loaded by Spark's application classloader .
Since parent classloaders cannot see classes loaded by child classloaders,
Class.forNamefrom Comet's code fails withClassNotFoundException.What changes are included in this PR?
Class.forName()calls inCometScanRulewith theIcebergReflection.loadClass()helper method.How are these changes tested?
jars/folder and Iceberg is bundled in the application's uber jar; ran a few SQL queries that involved reading from Iceberg.