Skip to content

AWS: Fix issue that GlueTableOperations fails to initialize FileIO when GlueCatalog is not initialized with catalogProperties#5797

Closed
JonasJ-ap wants to merge 2 commits intoapache:masterfrom
JonasJ-ap:fix_glue_catalog_passing_null
Closed

AWS: Fix issue that GlueTableOperations fails to initialize FileIO when GlueCatalog is not initialized with catalogProperties#5797
JonasJ-ap wants to merge 2 commits intoapache:masterfrom
JonasJ-ap:fix_glue_catalog_passing_null

Conversation

@JonasJ-ap
Copy link
Contributor

@JonasJ-ap JonasJ-ap commented Sep 19, 2022

When the user initialize GlueCatalog without providing a catalogProperties, the corresponding GlueTableOperations will face a NullPointerException when initializing FileIO using initializeFileIO. This bug causes several tests in the AWS Integration test fail.

before this fix:

Screenshot from 2022-09-17 18-40-19

after this fix:

Screen Shot 2022-09-19 at 11 25 31

The remaining test errors are either due to the test itself or outdated environment settings. Since they are not related to GlueCatalog, they will be addressed in another PR: #5784

@github-actions github-actions bot added the AWS label Sep 19, 2022
@JonasJ-ap
Copy link
Contributor Author

@amogh-jahagirdar Would you mind reviewing this fix and giving some suggestions if needed? Thank you in advance for your help

Copy link
Contributor Author

@JonasJ-ap JonasJ-ap left a comment

Choose a reason for hiding this comment

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

The fix I made

lockManager,
catalogName,
awsProperties,
catalogProperties,
Copy link
Contributor Author

@JonasJ-ap JonasJ-ap Sep 19, 2022

Choose a reason for hiding this comment

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

The catalogProperties here is always null. Hence, I replaced it with a properties() to initialize an empty ImmutableMap to avoid any NullPointerException

Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @JonasJ-ap, I think this means that the GlueCatalog isn't being correctly initialized in the integration tests. The initialize() call should set the value correctly. I'm guessing some of the testing init methods aren't consistent with the implementation in from the catalog interface.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you so much for your review and suggestions. Now I see that there are some integration tests using the wrong initialize() call and thus skip initializing this particular field. I will update the changes to those tests in #5784.

Meanwhile, I am curious if the return statement here is worth a change. Given that this return statement always receives null for catalogProperties and methods in GlueTableOperations do not fully handle the null case, it seems not a good idea to initialize GlueTableOperations in this way. Maybe we could still call properties() here or delete this return statement since it is unreachable under the current code logic? I appreciate your time and help.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah the expectation is that for loading the catalog dynamically, all the fields (including catalogProperties) are set via initialize() as @danielcweeks suggested, so I think let's just fix the integration test catalog initialization.

As for simplifying the code, sure I think we can have a common return point through properties(); I would say let's correct the integration tests in #5784 and then we can come back here, and re-run the tests after the common return point change. If they succeed, then we should be good.

@JonasJ-ap JonasJ-ap marked this pull request as draft September 20, 2022 01:36
@JonasJ-ap
Copy link
Contributor Author

JonasJ-ap commented Sep 20, 2022

@danielcweeks, @danielcweeks. Thank you for your suggestions. In this case, I will close this PR and postpone the code simplification after the correction in #5784.

@JonasJ-ap JonasJ-ap closed this Sep 20, 2022
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.

3 participants