Skip to content

Properly handle table existence check for jdbc dialects #50835

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

milastdbx
Copy link
Contributor

@milastdbx milastdbx commented May 8, 2025

What changes were proposed in this pull request?

In this PR, I propose that we rethrow exception when we are doing table existence check in jdbc dialect, if exception is not related to table not being found. I propose this because currently all exceptions get swallowed and method returns false. From the perspective of the system its as if table doesn't exist, which is a wrong message (e.g, we can get table does not exist if network to jdbc database is down).

This issue is mostly exposed when TableCatalog API is used,

  override def loadTable(ident: Identifier): Table = {
    if (!tableExists(ident)) {
      throw QueryCompilationErrors.noSuchTableError(ident)
    }

How its implemented today, tableExist cannot throw anything, so every exception gets converted to noSuchTableError which is wrong.

Does this PR introduce any user-facing change?

Customers will get proper error messages.

How was this patch tested?

Tests

Was this patch authored or co-authored using generative AI tooling?

Generetad by: COPILOT

@github-actions github-actions bot added the SQL label May 8, 2025
@milastdbx milastdbx changed the title add handling for table not found Properly handle table existence check for jdbc dialects May 8, 2025
@milastdbx
Copy link
Contributor Author

I will create SPARK jira ticket shortly

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.

1 participant