Commit f702a95
[SPARK-33100][SQL] Ignore a semicolon inside a bracketed comment in spark-sql
### What changes were proposed in this pull request?
Now the spark-sql does not support parse the sql statements with bracketed comments.
For the sql statements:
```
/* SELECT 'test'; */
SELECT 'test';
```
Would be split to two statements:
The first one: `/* SELECT 'test'`
The second one: `*/ SELECT 'test'`
Then it would throw an exception because the first one is illegal.
In this PR, we ignore the content in bracketed comments while splitting the sql statements.
Besides, we ignore the comment without any content.
### Why are the changes needed?
Spark-sql might split the statements inside bracketed comments and it is not correct.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Added UT.
Closes #29982 from turboFei/SPARK-33110.
Lead-authored-by: fwang12 <[email protected]>
Co-authored-by: turbofei <[email protected]>
Signed-off-by: Takeshi Yamamuro <[email protected]>
(cherry picked from commit a071826)
Signed-off-by: Takeshi Yamamuro <[email protected]>1 parent b3cd86d commit f702a95
File tree
2 files changed
+55
-8
lines changed- sql/hive-thriftserver/src
- main/scala/org/apache/spark/sql/hive/thriftserver
- test/scala/org/apache/spark/sql/hive/thriftserver
2 files changed
+55
-8
lines changedLines changed: 32 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
522 | 522 | | |
523 | 523 | | |
524 | 524 | | |
| 525 | + | |
525 | 526 | | |
526 | 527 | | |
527 | 528 | | |
528 | | - | |
| 529 | + | |
| 530 | + | |
529 | 531 | | |
530 | 532 | | |
| 533 | + | |
531 | 534 | | |
532 | 535 | | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
533 | 541 | | |
534 | 542 | | |
535 | 543 | | |
| |||
553 | 561 | | |
554 | 562 | | |
555 | 563 | | |
556 | | - | |
557 | | - | |
| 564 | + | |
| 565 | + | |
558 | 566 | | |
559 | 567 | | |
560 | 568 | | |
561 | 569 | | |
562 | 570 | | |
563 | | - | |
564 | | - | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
565 | 575 | | |
| 576 | + | |
566 | 577 | | |
567 | 578 | | |
568 | | - | |
| 579 | + | |
569 | 580 | | |
570 | | - | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
571 | 591 | | |
572 | 592 | | |
573 | 593 | | |
| |||
576 | 596 | | |
577 | 597 | | |
578 | 598 | | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
579 | 604 | | |
580 | | - | |
581 | 605 | | |
582 | 606 | | |
583 | 607 | | |
| |||
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
571 | 571 | | |
572 | 572 | | |
573 | 573 | | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
574 | 597 | | |
0 commit comments