Skip to content

Fix class loading issue for AWS Glue catalog in Iceberg extension#18016

Merged
a2l007 merged 2 commits intoapache:masterfrom
a2l007:glueclassload
May 21, 2025
Merged

Fix class loading issue for AWS Glue catalog in Iceberg extension#18016
a2l007 merged 2 commits intoapache:masterfrom
a2l007:glueclassload

Conversation

@a2l007
Copy link
Copy Markdown
Contributor

@a2l007 a2l007 commented May 19, 2025

Fixes #18015.

Description

Fixes an issue where attempting to load iceberg tables from an AWS Glue catalog fails with ClassNotFound exceptions.
AWS Glue catalog internally uses DynConstructors which uses reflection to locate certain Glue-related classes from the iceberg-aws dependency. This uses the current thread context classloader to locate it but these classes are only available on the application classloader.
This PR does a context classloader switch to fix the issue.

Release note

Fixes an issue where loading Iceberg tables from the AWS Glue Catalog could fail due to ClassNotFoundException exceptions.


This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

Copy link
Copy Markdown
Contributor

@abhishekrb19 abhishekrb19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for the fix! I had done a similar workaround for the Delta Lake extension as well, since the underlying library was loading the class only from the context class loader. After it was fixed upstream, we removed the workaround from the Delta extension with version upgrade. I wonder if there’s something similar we could do with the upstream Iceberg project?

Agreed on following up with ITs to catch these kinds of issues 👍 were you able to successfully connect to the AWS Glue catalog with this patch?

@abhishekrb19
Copy link
Copy Markdown
Contributor

@a2l007 I think pulling the latest changes from master into your branch should resolve the CodeQL CI errors

@a2l007
Copy link
Copy Markdown
Contributor Author

a2l007 commented May 20, 2025

I wonder if there’s something similar we could do with the upstream Iceberg project?

That sounds reasonable, I can follow up with the iceberg project and see if it can be resolved on their end.

were you able to successfully connect to the AWS Glue catalog with this patch?

Unfortunately, I don't have a glue catalog setup to test this end to end, but I was able to reproduce the error using the ingestion spec from #18015 and this patch resolves it. The follow up errors were access related which makes sense since I don't have access to the catalog.

@erodas-bch
Copy link
Copy Markdown

@a2l007 thanks a lot for providing a fix so quickly!

Would it be possible for you to share a compiled version of the patched extension (as a JAR)? I’d like to upload it into my Druid image and test it directly in my EKS environment before the official release.

Appreciate the support!

@a2l007
Copy link
Copy Markdown
Contributor Author

a2l007 commented May 20, 2025

Would it be possible for you to share a compiled version of the patched extension (as a JAR)?

@redson-bc Unfortunately, I run an internal version of JDK and cannot share jars generated from it. @abhishekrb19 Is this something you can help with?

@a2l007 a2l007 merged commit 2ed53ed into apache:master May 21, 2025
42 checks passed
@a2l007 a2l007 added the Bug label May 21, 2025
@abhishekrb19 abhishekrb19 added this to the 34.0.0 milestone Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot initialize GlueCatalog: ClassNotFoundException org.apache.iceberg.aws.glue.GlueCatalog when using iceberg inputSource

3 participants