-
Notifications
You must be signed in to change notification settings - Fork 3k
Core,AWS: Fix NPE in ResolvingFileIO when HadoopConf is not set #10872
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,AWS: Fix NPE in ResolvingFileIO when HadoopConf is not set #10872
Conversation
|
@nastra FYI |
| impl, | ||
| key -> { | ||
| Configuration conf = hadoopConf.get(); | ||
| Configuration conf = Optional.ofNullable(hadoopConf).map(Supplier::get).orElse(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
given that ResolvingFileIO is implementing Configurable from Hadoop it actually requires the conf to be set via setConf but I agree that this is a bit problematic for FileIO instances that don't need this, like S3FileIO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do feel like it would be better to add this null handling to getConf() directly and then just call getConf() here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one minor comment to move the null handling code. @amogh-jahagirdar can you double-check the changes here as well please?
|
@nastra Thank you for the review, please let me know if I should moved the |
@munendrasn yes I think it makes sense to move the null handling code into |
This reverts commit fe256b4.
amogh-jahagirdar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with this change, I think it's the right behavior to just set a null conf instead of a strict failure if a HadoopConf is not set. The fact that ResolvingFileIO implements HadoopConfigurable does not mean a HadoopConf must be set, it just means that option is available and will be applied if it's specified.
|
THanks @munendrasn and thanks @nastra for the review. |
| impl, | ||
| key -> { | ||
| Configuration conf = hadoopConf.get(); | ||
| Configuration conf = getConf(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I double checked that the CatalogUtil.loadFileIO calls below are null protected as well, the s3fileIO test will exercise that API so that gives confidence too.
|
Thank you @nastra and @amogh-jahagirdar for the review |
When
ResolvingFileIois invoked without conf set (which can happen when catalog or fileIo is explicitly created), it throws NPE.The workaround is set to
Configurationalways.For example, while creating the RESTCatalog like below but the order need to be maintained
Exception HadoopFileIO, conf is not required or unused for other FileIo impl hence, handling with soft check, other option was to have strict check and fail if it is not set here