-
Notifications
You must be signed in to change notification settings - Fork 28.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-50449][SQL] Fix SQL Scripting grammar allowing empty bodies fo…
…r loops, IF and CASE ### What changes were proposed in this pull request? Before this PR, SQL Scripting grammar allowed for loops, IF and CASE to have empty bodies. Example: `WHILE 1 = 1 DO END WHILE;` If they have an empty body, an internal error is thrown during execution. This PR changes the grammar so that loops, IF and CASE must have at least one statement in their bodies. Note that this does not completely fix the internal error issue. It is still possible to have something like ``` WHILE 1 = 1 DO BEGIN END; END WHILE; ``` where the same error is still thrown, except this construct is correct grammar wise. This issue will be fixed by a separate PR, as non-trivial interpreter logic changes are required. ### Why are the changes needed? The existing grammar was wrong. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Unit tests that make sure parsing loops, IF and CASE with empty bodies throws an error. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #48989 from dusantism-db/scripting-empty-bodies-fix. Authored-by: Dušan Tišma <dusan.tisma@databricks.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
- Loading branch information
1 parent
851f5f2
commit c149942
Showing
3 changed files
with
145 additions
and
11 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