Commit 9676b1c
### What changes were proposed in this pull request?
This PR proposes introduction of `LEAVE` and `ITERATE` statement types to SQL Scripting language:
- `LEAVE` statement can be used in loops, as well as in `BEGIN ... END` compound blocks.
- `ITERATE` statement can be used only in loops.
This PR introduces:
- Logical operators for both statement types.
- Execution nodes for both statement types.
- Interpreter changes required to build execution plans that support new statement types.
- New error if statements are not used properly.
- Minor changes required to support new keywords.
### Why are the changes needed?
Adding support for new statement types to SQL Scripting language.
### Does this PR introduce _any_ user-facing change?
This PR introduces new statement types that will be available to users. However, script execution logic hasn't been done yet, so the new changes are not accessible by users yet.
### How was this patch tested?
Tests are introduced to all test suites related to SQL scripting.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #47973 from davidm-db/sql_scripting_leave_iterate.
Authored-by: David Milicevic <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
1 parent 182353d commit 9676b1c
File tree
15 files changed
+664
-15
lines changed- common/utils/src/main/resources/error
- docs
- sql
- api/src/main/antlr4/org/apache/spark/sql/catalyst/parser
- catalyst/src
- main/scala/org/apache/spark/sql
- catalyst/parser
- errors
- test/scala/org/apache/spark/sql/catalyst/parser
- core/src
- main/scala/org/apache/spark/sql/scripting
- test
- resources/sql-tests/results
- ansi
- scala/org/apache/spark/sql/scripting
- hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver
15 files changed
+664
-15
lines changedLines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2495 | 2495 | | |
2496 | 2496 | | |
2497 | 2497 | | |
| 2498 | + | |
| 2499 | + | |
| 2500 | + | |
| 2501 | + | |
| 2502 | + | |
| 2503 | + | |
| 2504 | + | |
| 2505 | + | |
| 2506 | + | |
| 2507 | + | |
| 2508 | + | |
| 2509 | + | |
| 2510 | + | |
| 2511 | + | |
| 2512 | + | |
| 2513 | + | |
| 2514 | + | |
| 2515 | + | |
2498 | 2516 | | |
2499 | 2517 | | |
2500 | 2518 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
556 | 556 | | |
557 | 557 | | |
558 | 558 | | |
| 559 | + | |
559 | 560 | | |
560 | 561 | | |
561 | 562 | | |
562 | 563 | | |
563 | 564 | | |
564 | 565 | | |
565 | 566 | | |
| 567 | + | |
566 | 568 | | |
567 | 569 | | |
568 | 570 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| 279 | + | |
279 | 280 | | |
280 | 281 | | |
281 | 282 | | |
282 | 283 | | |
283 | 284 | | |
284 | 285 | | |
285 | 286 | | |
| 287 | + | |
286 | 288 | | |
287 | 289 | | |
288 | 290 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
86 | 96 | | |
87 | 97 | | |
88 | 98 | | |
| |||
1578 | 1588 | | |
1579 | 1589 | | |
1580 | 1590 | | |
| 1591 | + | |
1581 | 1592 | | |
1582 | 1593 | | |
1583 | 1594 | | |
1584 | 1595 | | |
| 1596 | + | |
1585 | 1597 | | |
1586 | 1598 | | |
1587 | 1599 | | |
| |||
1927 | 1939 | | |
1928 | 1940 | | |
1929 | 1941 | | |
| 1942 | + | |
1930 | 1943 | | |
1931 | 1944 | | |
1932 | 1945 | | |
1933 | 1946 | | |
1934 | 1947 | | |
| 1948 | + | |
1935 | 1949 | | |
1936 | 1950 | | |
1937 | 1951 | | |
| |||
Lines changed: 51 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
264 | 314 | | |
265 | 315 | | |
266 | 316 | | |
| |||
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
87 | 110 | | |
0 commit comments