-
Notifications
You must be signed in to change notification settings - Fork 28.5k
[SPARK-52184][SQL] Wrap external engine JDBC syntax errors with a unified exception #50918
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
alekjarmov
wants to merge
8
commits into
apache:master
Choose a base branch
from
alekjarmov:wrap-external-engine-errors
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+166
−13
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cloud-fan
reviewed
May 16, 2025
cloud-fan
approved these changes
May 16, 2025
MaxGekk
reviewed
May 16, 2025
@@ -3873,6 +3873,12 @@ | |||
}, | |||
"sqlState" : "42000" | |||
}, | |||
"JDBC_EXTERNAL_ENGINE_SYNTAX_ERROR" : { | |||
"message" : [ | |||
"JDBC external engine syntax error in <source>." |
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.
As I can see the source is limited set of strings:
- "output schema resolution"
- "query execution"
How about to make 2 sub-conditions of "JDBC_EXTERNAL_ENGINE_SYNTAX_ERROR" instead of the parameter? In this way, we could:
- avoid error text in source code. So, tech editors could modify the
error-conditions.json
w/o modifying/recompiling spark - in the future we might have errors in different languages.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR introduces a unified mechanism for handling SQL syntax errors thrown by external JDBC engines. It does so by:
JDBC_EXTERNAL_ENGINE_SYNTAX_ERROR
.JdbcUtils
to catch and rethrowSQLException
with a more informativeSparkException
if the dialect recognizes it as a syntax error.isSyntaxErrorBestEffort
.Why are the changes needed?
Current behavior rethrows the error if it's a syntax error on the external engine. Having it wrapped in a Spark exception enables for easier data scince.
Does this PR introduce any user-facing change?
The users would get a better error message.
How was this patch tested?
Adding new integration tests.
Was this patch authored or co-authored using generative AI tooling?
Coauthored with GitHub Copilot.