chern opened a new pull request, #4609:
URL: https://github.com/apache/datafusion-comet/pull/4609
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases. You can
link an issue to this PR using the GitHub syntax. For example `Closes #123`
indicates that this PR will close issue #123.
-->
Closes #3737.
## Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in
the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your
changes and offer better suggestions for fixes.
-->
Similar change to #3738.
Comet uses `Class.forName(className)` to reflectively load Iceberg classes.
The single-argument `Class.forName` uses 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](https://github.com/apache/spark/blob/master/core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala#L939-L950)
.
Since parent classloaders cannot see classes loaded by child classloaders,
`Class.forName` from Comet's code fails with `ClassNotFoundException`.
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is
sometimes worth providing a summary of the individual changes in this PR.
-->
- Replaces bare `Class.forName()` calls in `CometScanRule` with the
`IcebergReflection.loadClass()` helper method.
## How are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are
they covered by existing tests)?
-->
- Verified in a deployment where the Comet jar is in Spark's `jars/` folder
and Iceberg is bundled in the application's uber jar; ran a few SQL queries
that involved reading from Iceberg.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]