Commit e7d5344
[SPARK-33100][SQL][3.0] 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.
NOTE: This backport comes from #29982
### 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 #31033 from turboFei/SPARK-33100.
Authored-by: fwang12 <fwang12@ebay.com>
Signed-off-by: Takeshi Yamamuro <yamamuro@apache.org>1 parent c9c3d6f commit e7d5344
2 files changed
Lines changed: 65 additions & 8 deletions
File tree
- sql/hive-thriftserver/src
- main/scala/org/apache/spark/sql/hive/thriftserver
- test/scala/org/apache/spark/sql/hive/thriftserver
Lines changed: 42 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
518 | 518 | | |
519 | 519 | | |
520 | 520 | | |
| 521 | + | |
521 | 522 | | |
522 | 523 | | |
523 | 524 | | |
524 | | - | |
| 525 | + | |
| 526 | + | |
525 | 527 | | |
526 | 528 | | |
| 529 | + | |
| 530 | + | |
527 | 531 | | |
528 | 532 | | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
529 | 538 | | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
530 | 547 | | |
531 | 548 | | |
532 | 549 | | |
| |||
549 | 566 | | |
550 | 567 | | |
551 | 568 | | |
552 | | - | |
553 | | - | |
| 569 | + | |
| 570 | + | |
554 | 571 | | |
555 | 572 | | |
556 | 573 | | |
557 | 574 | | |
558 | 575 | | |
559 | | - | |
560 | | - | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
561 | 580 | | |
| 581 | + | |
562 | 582 | | |
563 | 583 | | |
564 | | - | |
| 584 | + | |
565 | 585 | | |
566 | | - | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
567 | 597 | | |
568 | 598 | | |
569 | 599 | | |
| |||
572 | 602 | | |
573 | 603 | | |
574 | 604 | | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
575 | 610 | | |
576 | | - | |
577 | 611 | | |
578 | 612 | | |
579 | 613 | | |
| |||
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
551 | 551 | | |
552 | 552 | | |
553 | 553 | | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
554 | 577 | | |
0 commit comments