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

[SPARK-39547][SQL] V2SessionCatalog should not throw NoSuchDatabaseException in loadNamspaceMetadata #36948

Closed

Conversation

singhpk234
Copy link

What changes were proposed in this pull request?

This change attempts to make V2SessionCatalog return NoSuchNameSpaceException rather than NoSuchDataseException

Why are the changes needed?

if a catalog doesn't overrides namespaceExists it by default uses loadNamespaceMetadata and in case a db not exists loadNamespaceMetadata throws a NoSuchDatabaseException which is not catched and we see failures even with if exists clause. One such use case we observed was in iceberg table a post test clean up was failing with NoSuchDatabaseException now. Also queries such as DROP TABLE IF EXISTS {} fails with no such db exception.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Modified the UT to match the proposed behviour

@github-actions github-actions bot added the SQL label Jun 21, 2022
@singhpk234
Copy link
Author

cc @cloud-fan @huaxingao

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

Copy link
Contributor

@cloud-fan cloud-fan left a comment

Choose a reason for hiding this comment

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

good catch!

@cloud-fan cloud-fan closed this in 9513393 Jun 23, 2022
cloud-fan pushed a commit that referenced this pull request Jun 23, 2022
…ception in loadNamspaceMetadata

### What changes were proposed in this pull request?

This change attempts to make V2SessionCatalog return NoSuchNameSpaceException rather than NoSuchDataseException

### Why are the changes needed?

if a catalog doesn't overrides `namespaceExists` it by default uses `loadNamespaceMetadata` and in case a `db` not exists loadNamespaceMetadata throws a `NoSuchDatabaseException` which is not catched and we see failures even with `if exists` clause. One such use case we observed was in iceberg table a post test clean up was failing with `NoSuchDatabaseException` now. Also queries such as `DROP TABLE IF EXISTS {}` fails with no such db exception.

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

Modified the UT to match the proposed behviour

Closes #36948 from singhpk234/fix/loadNamespaceMetadata.

Authored-by: Prashant Singh <psinghvk@amazon.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
(cherry picked from commit 9513393)
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
@cloud-fan
Copy link
Contributor

thanks, merging to master/3.3

@singhpk234 singhpk234 deleted the fix/loadNamespaceMetadata branch June 23, 2022 16:35
@singhpk234
Copy link
Author

Thanks for the review @cloud-fan , @huaxingao !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants