-
Notifications
You must be signed in to change notification settings - Fork 29.1k
[SPARK-28880][SQL] Support ANSI nested bracketed comments #27495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
464cd03
c782bac
0a21b5e
1b9d1da
3d03688
596d905
7760f91
efe98fa
a2241ae
519f47f
f2e7fb5
1b188d7
e1d3b3b
812b16d
f5a817f
99d9187
8e89a87
8118ab5
116e9b8
25d0863
f1806ef
a32cb54
93eb3c5
20452bc
0a42a59
660cd34
9c856b7
48814c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| -- Test comments. | ||
|
|
||
| -- the first case of bracketed comment | ||
| --QUERY-DELIMITER-START | ||
| /* This is the first example of bracketed comment. | ||
| SELECT 'ommented out content' AS first; | ||
| */ | ||
| SELECT 'selected content' AS first; | ||
| --QUERY-DELIMITER-END | ||
|
|
||
| -- the second case of bracketed comment | ||
| --QUERY-DELIMITER-START | ||
| /* This is the second example of bracketed comment. | ||
| SELECT '/', 'ommented out content' AS second; | ||
| */ | ||
| SELECT '/', 'selected content' AS second; | ||
| --QUERY-DELIMITER-END | ||
|
|
||
| -- the third case of bracketed comment | ||
| --QUERY-DELIMITER-START | ||
| /* This is the third example of bracketed comment. | ||
| *SELECT '*', 'ommented out content' AS third; | ||
| */ | ||
| SELECT '*', 'selected content' AS third; | ||
| --QUERY-DELIMITER-END | ||
|
|
||
| -- the first case of empty bracketed comment | ||
| --QUERY-DELIMITER-START | ||
| /**/ | ||
| SELECT 'selected content' AS fourth; | ||
| --QUERY-DELIMITER-END | ||
|
|
||
| -- the first case of nested bracketed comment | ||
| --QUERY-DELIMITER-START | ||
| /* This is the first example of nested bracketed comment. | ||
| /* I am a nested bracketed comment.*/ | ||
| */ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LOL even github can't highlight the nested bracketed comment correctly
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Haha |
||
| SELECT 'selected content' AS fifth; | ||
| --QUERY-DELIMITER-END | ||
|
|
||
| -- the second case of nested bracketed comment | ||
| --QUERY-DELIMITER-START | ||
| /* This is the second example of nested bracketed comment. | ||
| /* I am a nested bracketed comment. | ||
| */ | ||
| */ | ||
| SELECT 'selected content' AS sixth; | ||
| --QUERY-DELIMITER-END | ||
|
|
||
| -- the third case of nested bracketed comment | ||
| --QUERY-DELIMITER-START | ||
| /* | ||
| * This is the third example of nested bracketed comment. | ||
| /* | ||
| * I am a nested bracketed comment. | ||
| */ | ||
| */ | ||
| SELECT 'selected content' AS seventh; | ||
| --QUERY-DELIMITER-END | ||
|
|
||
| -- the fourth case of nested bracketed comment | ||
| --QUERY-DELIMITER-START | ||
| /* | ||
| * This is the fourth example of nested bracketed comment. | ||
| SELECT /* I am a nested bracketed comment.*/ * FROM testData; | ||
| */ | ||
| SELECT 'selected content' AS eighth; | ||
| --QUERY-DELIMITER-END | ||
|
|
||
| -- the fifth case of nested bracketed comment | ||
| --QUERY-DELIMITER-START | ||
| SELECT /* | ||
| * This is the fifth example of nested bracketed comment. | ||
| /* I am a second level of nested bracketed comment. | ||
| /* I am a third level of nested bracketed comment. | ||
| Other information of third level. | ||
| SELECT 'ommented out content' AS ninth; | ||
| */ | ||
| Other information of second level. | ||
| */ | ||
| Other information of first level. | ||
| */ | ||
| 'selected content' AS ninth; | ||
| --QUERY-DELIMITER-END | ||
|
|
||
| -- the first case of empty nested bracketed comment | ||
| --QUERY-DELIMITER-START | ||
| /*/**/*/ | ||
| SELECT 'selected content' AS tenth; | ||
| --QUERY-DELIMITER-END | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,14 +12,12 @@ SELECT /* both embedded and trailing single line */ 'both' AS third; -- trailing | |
|
|
||
| SELECT 'before multi-line' AS fourth; | ||
| --QUERY-DELIMITER-START | ||
| -- [SPARK-28880] ANSI SQL: Bracketed comments | ||
| /* This is an example of SQL which should not execute: | ||
| * select 'multi-line'; | ||
| */ | ||
| SELECT 'after multi-line' AS fifth; | ||
| --QUERY-DELIMITER-END | ||
|
|
||
| -- [SPARK-28880] ANSI SQL: Bracketed comments | ||
| -- | ||
| -- Nested comments | ||
| -- | ||
|
|
@@ -47,4 +45,5 @@ Now just one deep... | |
| */ | ||
| 'deeply nested example' AS sixth; | ||
| --QUERY-DELIMITER-END | ||
| /* and this is the end of the file */ | ||
| -- [SPARK-30824] Support submit sql content only contains comments. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this an ANSI-related issue? https://issues.apache.org/jira/browse/SPARK-30824
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. But postgreSQL test support it.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I see. If so, can you move the parent ticket to https://issues.apache.org/jira/browse/SPARK-30375 ? I think this feature is implementation-dependent.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. |
||
| -- /* and this is the end of the file */ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| -- Automatically generated by SQLQueryTestSuite | ||
| -- Number of queries: 10 | ||
|
|
||
|
|
||
| -- !query | ||
| /* This is the first example of bracketed comment. | ||
| SELECT 'ommented out content' AS first; | ||
| */ | ||
| SELECT 'selected content' AS first | ||
| -- !query schema | ||
| struct<first:string> | ||
| -- !query output | ||
| selected content | ||
|
|
||
|
|
||
| -- !query | ||
| /* This is the second example of bracketed comment. | ||
| SELECT '/', 'ommented out content' AS second; | ||
| */ | ||
| SELECT '/', 'selected content' AS second | ||
| -- !query schema | ||
| struct</:string,second:string> | ||
| -- !query output | ||
| / selected content | ||
|
|
||
|
|
||
| -- !query | ||
| /* This is the third example of bracketed comment. | ||
| *SELECT '*', 'ommented out content' AS third; | ||
| */ | ||
| SELECT '*', 'selected content' AS third | ||
| -- !query schema | ||
| struct<*:string,third:string> | ||
| -- !query output | ||
| * selected content | ||
|
|
||
|
|
||
| -- !query | ||
| /**/ | ||
| SELECT 'selected content' AS fourth | ||
| -- !query schema | ||
| struct<fourth:string> | ||
| -- !query output | ||
| selected content | ||
|
|
||
|
|
||
| -- !query | ||
| /* This is the first example of nested bracketed comment. | ||
| /* I am a nested bracketed comment.*/ | ||
| */ | ||
| SELECT 'selected content' AS fifth | ||
| -- !query schema | ||
| struct<fifth:string> | ||
| -- !query output | ||
| selected content | ||
|
|
||
|
|
||
| -- !query | ||
| /* This is the second example of nested bracketed comment. | ||
| /* I am a nested bracketed comment. | ||
| */ | ||
| */ | ||
| SELECT 'selected content' AS sixth | ||
| -- !query schema | ||
| struct<sixth:string> | ||
| -- !query output | ||
| selected content | ||
|
|
||
|
|
||
| -- !query | ||
| /* | ||
| * This is the third example of nested bracketed comment. | ||
| /* | ||
| * I am a nested bracketed comment. | ||
| */ | ||
| */ | ||
| SELECT 'selected content' AS seventh | ||
| -- !query schema | ||
| struct<seventh:string> | ||
| -- !query output | ||
| selected content | ||
|
|
||
|
|
||
| -- !query | ||
| /* | ||
| * This is the fourth example of nested bracketed comment. | ||
| SELECT /* I am a nested bracketed comment.*/ * FROM testData; | ||
| */ | ||
| SELECT 'selected content' AS eighth | ||
| -- !query schema | ||
| struct<eighth:string> | ||
| -- !query output | ||
| selected content | ||
|
|
||
|
|
||
| -- !query | ||
| SELECT /* | ||
| * This is the fifth example of nested bracketed comment. | ||
| /* I am a second level of nested bracketed comment. | ||
| /* I am a third level of nested bracketed comment. | ||
| Other information of third level. | ||
| SELECT 'ommented out content' AS ninth; | ||
| */ | ||
| Other information of second level. | ||
| */ | ||
| Other information of first level. | ||
| */ | ||
| 'selected content' AS ninth | ||
| -- !query schema | ||
| struct<ninth:string> | ||
| -- !query output | ||
| selected content | ||
|
|
||
|
|
||
| -- !query | ||
| /*/**/*/ | ||
| SELECT 'selected content' AS tenth | ||
| -- !query schema | ||
| struct<tenth:string> | ||
| -- !query output | ||
| selected content |
Uh oh!
There was an error while loading. Please reload this page.