-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-50491][SQL] Fix bug where empty BEGIN END blocks throw an error
This PR depends on #48989 ### What changes were proposed in this pull request? There is a bug in SQL scripting which causes empty compound statements to throw an error if their body consists solely of empty BEGIN END blocks. Examples: ``` WHILE 1 = 1 DO BEGIN END; END WHILE; ``` ``` BEGIN BEGIN BEGIN END; END; END; ``` This PR fixes this by introducing a NO-OP statement for SQL scripting, which empty BEGIN END blocks will return. ### Why are the changes needed? Currenty, compound bodies declare they have the next element even if their body is consisted only of empty blocks. This is because it only checks for existence of statements in the body, not whether there is at least one statement which is not an empty block. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Unit tests were added to existing suites. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #49064 from dusantism-db/scripting-noop-statement. Authored-by: Dušan Tišma <dusan.tisma@databricks.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
- Loading branch information
1 parent
559fda7
commit e70f8ab
Showing
3 changed files
with
272 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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