Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: FileIO Reflection Error Message is Misleading #9840

Merged
merged 3 commits into from
Feb 29, 2024

Conversation

RussellSpitzer
Copy link
Member

@RussellSpitzer RussellSpitzer commented Feb 29, 2024

The current error message always says FileIO "missing no-arg constructor: " whenever a NoSuchMethod is thrown but we've seen several instances of the underlying exception being completely unrelated to the existence of a no arg constructor and actually a NSM exception being thrown from a dependent class.

The biggest culprit of this is S3FileIO, for example if you have a bad AWS SDK you can see something like

#7396

Exception in thread "main" java.lang.IllegalArgumentException: Cannot initialize FileIO, missing no-arg constructor: org.apache.iceberg.aws.s3.S3FileIO
Caused by: java.lang.NoSuchMethodException: Cannot find constructor for interface org.apache.iceberg.io.FileIO
	Missing org.apache.iceberg.aws.s3.S3FileIO [java.lang.NoClassDefFoundError: software/amazon/awssdk/services/s3/model/S3Exception]
	Suppressed: java.lang.NoClassDefFoundError: software/amazon/awssdk/services/s3/model/S3Exception
	Caused by: java.lang.ClassNotFoundException: software.amazon.awssdk.services.s3.model.S3Exception

While our error message says it's missing a no-arg constructor the ACTUAL issue is that the AWS SDK is not on the classpath.

To fix this I've changed the error message to mirror the one for the LoadCatalog code which doesn't insert a statement about it missing a no-arg constructor. I think we have similar issues with the class cast error message but I haven't seen that been wrong in the wild yet.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Copy link
Contributor

@singhpk234 singhpk234 left a comment

Choose a reason for hiding this comment

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

LGTM, as well ! Thanks @RussellSpitzer.

@RussellSpitzer RussellSpitzer removed the request for review from nastra February 29, 2024 23:01
@RussellSpitzer RussellSpitzer merged commit 08e31ce into apache:main Feb 29, 2024
41 checks passed
@RussellSpitzer RussellSpitzer deleted the FileIOReflection branch February 29, 2024 23:02
@RussellSpitzer
Copy link
Member Author

Thanks @stevenzwu and @singhpk234 for reviewing!

bitsondatadev pushed a commit to bitsondatadev/iceberg that referenced this pull request Mar 3, 2024
devangjhabakh pushed a commit to cdouglas/iceberg that referenced this pull request Apr 22, 2024
zachdisc pushed a commit to zachdisc/iceberg that referenced this pull request Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants