[SPARK-54558][SQL] Fix Internal Exception when Exception Handlers with no BEGIN/END are used#53271
Closed
miland-db wants to merge 2 commits intoapache:masterfrom
Closed
[SPARK-54558][SQL] Fix Internal Exception when Exception Handlers with no BEGIN/END are used#53271miland-db wants to merge 2 commits intoapache:masterfrom
miland-db wants to merge 2 commits intoapache:masterfrom
Conversation
Contributor
Author
|
Adding @cloud-fan, @davidm-db, @dejankrak-db, @MaxGekk |
dejankrak-db
reviewed
Dec 1, 2025
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
Outdated
Show resolved
Hide resolved
dejankrak-db
reviewed
Dec 1, 2025
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
Show resolved
Hide resolved
dejankrak-db
reviewed
Dec 1, 2025
sql/core/src/test/scala/org/apache/spark/sql/scripting/SqlScriptingExecutionSuite.scala
Show resolved
Hide resolved
dejankrak-db
approved these changes
Dec 1, 2025
cloud-fan
approved these changes
Dec 1, 2025
dongjoon-hyun
approved these changes
Dec 1, 2025
Contributor
Author
|
Hi @cloud-fan, failure in |
Contributor
|
thanks, merging to master/4.1! |
cloud-fan
pushed a commit
that referenced
this pull request
Dec 2, 2025
…h no BEGIN/END are used
### What changes were proposed in this pull request?
When Exception Handlers which don't have BEGIN-END body are triggered, internal exception `java.util.NoSuchElementException` was thrown instead of executing properly or propagating/raising the new error if it happens in handler.
```
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION
SELECT 1;
SELECT 1/0;
END
```
### Why are the changes needed?
Code was encountering a bug which throws internal error for what should be valid user code.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
New unit tests in `SqlScriptingExecutionSuite`.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #53271 from miland-db/milan-dankovic_data/fix-no-body-handlers.
Authored-by: Milan Dankovic <milan.dankovic@databricks.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
(cherry picked from commit 4435a3a)
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
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
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?
When Exception Handlers which don't have BEGIN-END body are triggered, internal exception
java.util.NoSuchElementExceptionwas thrown instead of executing properly or propagating/raising the new error if it happens in handler.Why are the changes needed?
Code was encountering a bug which throws internal error for what should be valid user code.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
New unit tests in
SqlScriptingExecutionSuite.Was this patch authored or co-authored using generative AI tooling?
No.