Skip to content

[SPARK-46727][SQL] Port classifyException() in JDBC dialects on error classes #44739

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

Closed
wants to merge 3 commits into from

Conversation

MaxGekk
Copy link
Member

@MaxGekk MaxGekk commented Jan 15, 2024

What changes were proposed in this pull request?

In the PR, I propose to port the existing classifyException() method which accepts a description to new one w/ an error class added by #44358. The modified JDBC dialects are: DB2, H2, Oracle, MS SQL Server, MySQL and PostgreSQL.

Why are the changes needed?

The old method classifyException() which accepts a description only has been deprecated already by ...

Does this PR introduce any user-facing change?

No.

How was this patch tested?

By existing integration tests, and the modified test suite:

$ build/sbt "test:testOnly *JDBCV2Suite"

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

No.

@github-actions github-actions bot added the SQL label Jan 15, 2024
@MaxGekk MaxGekk changed the title [WIP][SQL] Port classifyException() in JDBC dialects on error classes [SPARK-46727][SQL] Port classifyException() in JDBC dialects on error classes Jan 15, 2024
@MaxGekk MaxGekk marked this pull request as ready for review January 15, 2024 19:14
@MaxGekk MaxGekk requested review from beliefer and cloud-fan January 15, 2024 19:14
@MaxGekk
Copy link
Member Author

MaxGekk commented Jan 16, 2024

cc @milastdbx

Copy link
Contributor

@beliefer beliefer left a comment

Choose a reason for hiding this comment

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

LGTM except one comment.

val regex = "(?s)Failed to create index (.*) in (.*)".r
val indexName = regex.findFirstMatchIn(message).get.group(1)
val tableName = regex.findFirstMatchIn(message).get.group(2)
case 42111 if errorClass == "FAILED_JDBC.CREATE_INDEX" =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there only need error code?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is some kind of a guard for accessing messageParameters. Previous implementation implicitly assumes that the error happens on creating an index, see the regexp. Here I just made the assumption explicit.

Copy link
Contributor

Choose a reason for hiding this comment

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

SGTM.

@MaxGekk
Copy link
Member Author

MaxGekk commented Jan 16, 2024

Merging to master. Thank you, @beliefer and @cloud-fan for review.

@MaxGekk MaxGekk closed this in ebd2b78 Jan 16, 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.

3 participants