Skip to content
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

[SPARK-33100][SQL][FOLLOWUP] Find correct bound of bracketed comment in spark-sql #31054

Closed
wants to merge 10 commits into from

Conversation

turboFei
Copy link
Member

@turboFei turboFei commented Jan 6, 2021

What changes were proposed in this pull request?

This PR help find correct bound of bracketed comment in spark-sql.

Here is the log for UT of SPARK-33100 in CliSuite before:

2021-01-05 13:22:34.768 - stdout> spark-sql> /* SELECT 'test';*/ SELECT 'test';
2021-01-05 13:22:41.523 - stderr> Time taken: 6.716 seconds, Fetched 1 row(s)
2021-01-05 13:22:41.599 - stdout> test
2021-01-05 13:22:41.6 - stdout> spark-sql> ;;/* SELECT 'test';*/ SELECT 'test';
2021-01-05 13:22:41.709 - stdout> test
2021-01-05 13:22:41.709 - stdout> spark-sql> /* SELECT 'test';*/;; SELECT 'test';
2021-01-05 13:22:41.902 - stdout> spark-sql> SELECT 'test'; -- SELECT 'test';
2021-01-05 13:22:41.902 - stderr> Time taken: 0.129 seconds, Fetched 1 row(s)
2021-01-05 13:22:41.902 - stderr> Error in query: 
2021-01-05 13:22:41.902 - stderr> mismatched input '<EOF>' expecting {'(', 'ADD', 'ALTER', 'ANALYZE', 'CACHE', 'CLEAR', 'COMMENT', 'COMMIT', 'CREATE', 'DELETE', 'DESC', 'DESCRIBE', 'DFS', 'DROP', 'EXPLAIN', 'EXPORT', 'FROM', 'GRANT', 'IMPORT', 'INSERT', 'LIST', 'LOAD', 'LOCK', 'MAP', 'MERGE', 'MSCK', 'REDUCE', 'REFRESH', 'REPLACE', 'RESET', 'REVOKE', 'ROLLBACK', 'SELECT', 'SET', 'SHOW', 'START', 'TABLE', 'TRUNCATE', 'UNCACHE', 'UNLOCK', 'UPDATE', 'USE', 'VALUES', 'WITH'}(line 1, pos 19)
2021-01-05 13:22:42.006 - stderr> 
2021-01-05 13:22:42.006 - stderr> == SQL ==
2021-01-05 13:22:42.006 - stderr> /* SELECT 'test';*/
2021-01-05 13:22:42.006 - stderr> -------------------^^^
2021-01-05 13:22:42.006 - stderr> 
2021-01-05 13:22:42.006 - stderr> Time taken: 0.226 seconds, Fetched 1 row(s)
2021-01-05 13:22:42.006 - stdout> test

The root cause is that the insideBracketedComment is not accurate.

For /* comment */, the last character / is not insideBracketedComment and it would be treat as beginning of statements.

In this PR, this issue is fixed.

Why are the changes needed?

To fix the issue described above.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Existing UT

@turboFei turboFei changed the title [SPARK-33100][FOLLOWUP] Find right bound of bracketed comment in spark-sql [SPARK-33100][FOLLOWUP] Find correct bound of bracketed comment in spark-sql Jan 6, 2021
@turboFei
Copy link
Member Author

turboFei commented Jan 6, 2021

After this PR, the log in sql/hive-thriftserver/target/unit-tests.log

12:23:18.249 Thread-6 INFO CliSuite: 2021-01-05 20:23:18.249 - stdout> spark-sql> /* SELECT 'test';*/ SELECT 'test';
12:23:18.249 Thread-6 INFO CliSuite: stdout> found expected output line 0: 'spark-sql> /* SELECT 'test';*/ SELECT 'test';'
12:23:22.844 Thread-6 INFO CliSuite: 2021-01-05 20:23:22.844 - stdout> test
12:23:22.844 Thread-6 INFO CliSuite: stdout> found expected output line 1: 'test'
12:23:22.844 Thread-7 INFO CliSuite: 2021-01-05 20:23:22.844 - stderr> Time taken: 4.573 seconds, Fetched 1 row(s)
12:23:22.867 Thread-6 INFO CliSuite: 2021-01-05 20:23:22.867 - stdout> spark-sql> ;;/* SELECT 'test';*/ SELECT 'test';
12:23:22.868 Thread-6 INFO CliSuite: stdout> found expected output line 2: 'spark-sql> ;;/* SELECT 'test';*/ SELECT 'test';'
12:23:22.928 Thread-6 INFO CliSuite: 2021-01-05 20:23:22.927 - stdout> test
12:23:22.928 Thread-6 INFO CliSuite: stdout> found expected output line 3: 'test'
12:23:22.928 Thread-7 INFO CliSuite: 2021-01-05 20:23:22.928 - stderr> Time taken: 0.059 seconds, Fetched 1 row(s)
12:23:22.941 Thread-6 INFO CliSuite: 2021-01-05 20:23:22.941 - stdout> spark-sql> /* SELECT 'test';*/;; SELECT 'test';
12:23:22.941 Thread-6 INFO CliSuite: stdout> found expected output line 4: 'spark-sql> /* SELECT 'test';*/;; SELECT 'test';'
12:23:22.993 Thread-6 INFO CliSuite: 2021-01-05 20:23:22.993 - stdout> test
12:23:22.994 Thread-6 INFO CliSuite: stdout> found expected output line 5: 'test'
12:23:22.994 Thread-7 INFO CliSuite: 2021-01-05 20:23:22.994 - stderr> Time taken: 0.052 seconds, Fetched 1 row(s)
12:23:23.007 Thread-6 INFO CliSuite: 2021-01-05 20:23:23.007 - stdout> spark-sql> SELECT 'test'; -- SELECT 'test';
12:23:23.007 Thread-6 INFO CliSuite: stdout> found expected output line 6: 'spark-sql> SELECT 'test'; -- SELECT 'test';'
12:23:23.067 Thread-6 INFO CliSuite: 2021-01-05 20:23:23.067 - stdout> test
12:23:23.067 Thread-6 INFO CliSuite: stdout> found expected output line 7: ''
12:23:23.067 Thread-7 INFO CliSuite: 2021-01-05 20:23:23.067 - stderr> Time taken: 0.059 seconds, Fetched 1 row(s)
12:23:23.083 Thread-6 INFO CliSuite: 2021-01-05 20:23:23.083 - stdout> spark-sql> SELECT 'test'; /* SELECT 'test';*/;
12:23:23.083 Thread-6 INFO CliSuite: stdout> found expected output line 8: 'spark-sql> SELECT 'test'; /* SELECT 'test';*/;'
12:23:23.130 Thread-6 INFO CliSuite: 2021-01-05 20:23:23.13 - stdout> test
12:23:23.130 Thread-6 INFO CliSuite: stdout> found expected output line 9: ''
12:23:23.130 Thread-7 INFO CliSuite: 2021-01-05 20:23:23.13 - stderr> Time taken: 0.046 seconds, Fetched 1 row(s)
12:23:23.144 Thread-6 INFO CliSuite: 2021-01-05 20:23:23.144 - stdout> spark-sql> /*$meta chars{^\;}*/ SELECT 'test';
12:23:23.144 Thread-6 INFO CliSuite: stdout> found expected output line 10: 'spark-sql> /*$meta chars{^\;}*/ SELECT 'test';'
12:23:23.191 Thread-6 INFO CliSuite: 2021-01-05 20:23:23.191 - stdout> test
12:23:23.191 Thread-6 INFO CliSuite: stdout> found expected output line 11: 'test'
12:23:23.191 Thread-7 INFO CliSuite: 2021-01-05 20:23:23.191 - stderr> Time taken: 0.046 seconds, Fetched 1 row(s)
12:23:23.202 Thread-6 INFO CliSuite: 2021-01-05 20:23:23.202 - stdout> spark-sql> /*
12:23:23.202 Thread-6 INFO CliSuite: stdout> found expected output line 12: 'spark-sql> /*'
12:23:23.215 Thread-6 INFO CliSuite: 2021-01-05 20:23:23.215 - stdout>          > multi-line
12:23:23.215 Thread-6 INFO CliSuite: stdout> found expected output line 13: '         > multi-line'
12:23:23.228 Thread-6 INFO CliSuite: 2021-01-05 20:23:23.228 - stdout>          > */ SELECT 'test';
12:23:23.228 Thread-6 INFO CliSuite: stdout> found expected output line 14: '         > */ SELECT 'test';'
12:23:23.271 Thread-6 INFO CliSuite: 2021-01-05 20:23:23.271 - stdout> test
12:23:23.271 Thread-6 INFO CliSuite: stdout> found expected output line 15: 'test'
12:23:23.271 Thread-7 INFO CliSuite: 2021-01-05 20:23:23.271 - stderr> Time taken: 0.042 seconds, Fetched 1 row(s)
12:23:23.290 Thread-6 INFO CliSuite: 2021-01-05 20:23:23.29 - stdout> spark-sql> /*/* multi-level bracketed*/ SELECT 'test';
12:23:23.291 Thread-6 INFO CliSuite: stdout> found expected output line 16: 'spark-sql> /*/* multi-level bracketed*/ SELECT 'test';'
12:23:23.335 Thread-6 INFO CliSuite: 2021-01-05 20:23:23.335 - stdout> test
12:23:23.335 Thread-6 INFO CliSuite: stdout> found expected output line 17: 'test'

@turboFei
Copy link
Member Author

turboFei commented Jan 6, 2021

@github-actions github-actions bot added the SQL label Jan 6, 2021
@maropu maropu changed the title [SPARK-33100][FOLLOWUP] Find correct bound of bracketed comment in spark-sql [SPARK-33100][SQL][FOLLOWUP] Find correct bound of bracketed comment in spark-sql Jan 6, 2021
@maropu
Copy link
Member

maropu commented Jan 6, 2021

ok to test

@maropu
Copy link
Member

maropu commented Jan 6, 2021

also cc: @bogdanghit

@maropu
Copy link
Member

maropu commented Jan 6, 2021

For /* comment */, the last character / is not insideBracketedComment and it would be treat as beginning of statements.

This causes the flakiness? Why can the test pass sometimes?

@SparkQA
Copy link

SparkQA commented Jan 6, 2021

Test build #133738 has finished for PR 31054 at commit b42d28f.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jan 6, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/38326/

@turboFei
Copy link
Member Author

turboFei commented Jan 6, 2021

according to the log you attached(https://github.com/apache/spark/pull/31045/checks?check_run_id=1652972350),
we can see that there are two continuous query lines, it is abnormal.
image

Is it possible that, for the CliSuite, we launch a process for test and write all queries into the outputstream of this process,
might the process stuck(might caused by the issue fixed by this pr?) some moment, and two continuous lines inputed and then only one result returned at last.

val process = new ProcessBuilder(command: _*).start()
val stdinWriter = new OutputStreamWriter(process.getOutputStream, StandardCharsets.UTF_8)
stdinWriter.write(queriesString)
stdinWriter.flush()
stdinWriter.close()

So one result loss and can not be matched, so the UT failed at last.

def captureOutput(source: String)(line: String): Unit = lock.synchronized {

Is it better to change it to?

    val stdinWriter = new OutputStreamWriter(process.getOutputStream, StandardCharsets.UTF_8)
    queryLineList.foreach { queryLine =>
        stdinWriter.write(queryLine)
        stdinWriter.flush()
     }
    stdinWriter.close()

@SparkQA
Copy link

SparkQA commented Jan 6, 2021

Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/38326/

@SparkQA
Copy link

SparkQA commented Jan 6, 2021

Test build #133744 has finished for PR 31054 at commit a317344.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@maropu
Copy link
Member

maropu commented Jan 7, 2021

Is it better to change it to?

If we flushed it for each query, did we could notice this issue right away? If yes, I think it is worth doing so. The change could make the test running time of `CliSuite longer? Could you check it in a separate PR after this issue fixed?

@turboFei
Copy link
Member Author

turboFei commented Jan 7, 2021

If we flushed it for each query, did we could notice this issue right away? If yes, I think it is worth doing so. The change could make the test running time of `CliSuite longer? Could you check it in a separate PR after this issue fixed?

I think it would not cost much time, will try it later.

@turboFei
Copy link
Member Author

turboFei commented Jan 7, 2021

Here is a test case(query contains '\n') which can not be covered by runCliWithin:

    runCliWithin(1.minute)("select 'test1';\n select 'test2';" -> "test2")

log:

11:35:00.383 pool-1-thread-1-ScalaTest-running-CliSuite INFO CliSuite: Cli driver is booted. Waiting for expected answers.
11:35:01.104 Thread-6 INFO CliSuite: 2021-01-06 19:35:01.104 - stdout> spark-sql> select 'test1';
11:35:01.104 Thread-6 INFO CliSuite: stdout> found expected output line 0: 'spark-sql> select 'test1';'
11:35:10.120 Thread-6 INFO CliSuite: 2021-01-06 19:35:10.12 - stdout> test1
11:35:10.121 Thread-7 INFO CliSuite: 2021-01-06 19:35:10.121 - stderr> Time taken: 8.987 seconds, Fetched 1 row(s)
11:35:10.151 Thread-6 INFO CliSuite: 2021-01-06 19:35:10.151 - stdout> spark-sql>  select 'test2';
11:35:10.220 Thread-6 INFO CliSuite: 2021-01-06 19:35:10.22 - stdout> test2
11:35:10.220 Thread-7 INFO CliSuite: 2021-01-06 19:35:10.22 - stderr> Time taken: 0.068 seconds, Fetched 1 row(s)
11:35:10.443 Thread-6 INFO CliSuite: 2021-01-06 19:35:10.443 - stdout> spark-sql> 
11:36:00.390 pool-1-thread-1-ScalaTest-running-CliSuite ERROR CliSuite: 
=======================
CliSuite failure output
=======================
Spark SQL CLI command line: ../../bin/spark-sql --master local --driver-java-options -Dderby.system.durability=test --conf spark.ui.enabled=false --hiveconf javax.jdo.option.ConnectionURL=jdbc:derby:;databaseName=/Users/fwang12/ebay/apache-spark/target/tmp/spark-7c275c0c-fc8e-49c7-b643-18f20fe8ba51;create=true --hiveconf hive.exec.scratchdir=/Users/fwang12/ebay/apache-spark/target/tmp/spark-bb0fded2-1a25-45d2-9f78-16898f32aefc --hiveconf conf1=conftest --hiveconf conf2=1 --hiveconf hive.metastore.warehouse.dir=/Users/fwang12/ebay/apache-spark/target/tmp/spark-4901396f-9a7a-4299-b7fc-9cb3b24c46f4
Exception: java.util.concurrent.TimeoutException: Futures timed out after [1 minute]
Failed to capture next expected output "         >  select 'test2';" within 1 minute.

It seems that it is not better to transfer multiple queries one time, but there is some UT like this:

test("SPARK-31595 Should allow unescaped quote mark in quoted string") {
runCliWithin(1.minute)(
"SELECT '\"legal string a';select 1 + 234;".stripMargin -> "235"

@SparkQA
Copy link

SparkQA commented Jan 7, 2021

Test build #133766 has finished for PR 31054 at commit ada4d5c.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jan 7, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/38353/

Copy link
Member

@maropu maropu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine. To check if we can fix the flakiness, could you push empty commits for invoking GA tests three or four times?

@maropu
Copy link
Member

maropu commented Jan 7, 2021

Here is a test case(query contains '\n') which can not be covered by runCliWithin:

Thanks for investigating it , @turboFei . Could you file another jira and make a PR for it?

@SparkQA
Copy link

SparkQA commented Jan 7, 2021

Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/38353/

@turboFei
Copy link
Member Author

turboFei commented Jan 7, 2021

Could you file another jira and make a PR for it?

Sure.

@SparkQA
Copy link

SparkQA commented Jan 7, 2021

Test build #133777 has finished for PR 31054 at commit e1814a6.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jan 7, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/38366/

@maropu
Copy link
Member

maropu commented Jan 7, 2021

To check if we can fix the flakiness, could you push empty commits for invoking GA tests three or four times?

@turboFei Could you do this?

@SparkQA
Copy link

SparkQA commented Jan 7, 2021

Kubernetes integration test status success
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/38366/

@turboFei
Copy link
Member Author

turboFei commented Jan 7, 2021

To check if we can fix the flakiness, could you push empty commits for invoking GA tests three or four times?

ok, I will trigger GA test 3 times again.

@maropu
Copy link
Member

maropu commented Jan 7, 2021

@turboFei You need to push two more empty commits for invoking GA tests concurrently. It seems that only one test job is running now.

@maropu
Copy link
Member

maropu commented Jan 7, 2021

Thanks for it! Let's wait for the test results...

@SparkQA
Copy link

SparkQA commented Jan 7, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/38371/

@SparkQA
Copy link

SparkQA commented Jan 7, 2021

Test build #133783 has finished for PR 31054 at commit d348489.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jan 7, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/38371/

@turboFei
Copy link
Member Author

turboFei commented Jan 7, 2021

For the first time GA test:

[error] Failed tests:
[error] 	org.apache.spark.sql.execution.datasources.orc.OrcEncryptionSuite

@maropu
Copy link
Member

maropu commented Jan 7, 2021

For the first time GA test:

[error] Failed tests:
[error] org.apache.spark.sql.execution.datasources.orc.OrcEncryptionSuite

Yea, that's the known issue.

@turboFei
Copy link
Member Author

turboFei commented Jan 7, 2021

the second and third succeed.

@maropu
Copy link
Member

maropu commented Jan 7, 2021

okay, thanks for the quick fix! I'll merge this to fix the flakiness. FYI: @HyukjinKwon @dongjoon-hyun If you have any further comments, feel free to leave comments here.

@maropu maropu closed this in 7b06acc Jan 7, 2021
maropu pushed a commit that referenced this pull request Jan 7, 2021
…in spark-sql

### What changes were proposed in this pull request?

This PR help find correct bound of bracketed comment in spark-sql.

Here is the log for UT of SPARK-33100 in CliSuite before:
```
2021-01-05 13:22:34.768 - stdout> spark-sql> /* SELECT 'test';*/ SELECT 'test';
2021-01-05 13:22:41.523 - stderr> Time taken: 6.716 seconds, Fetched 1 row(s)
2021-01-05 13:22:41.599 - stdout> test
2021-01-05 13:22:41.6 - stdout> spark-sql> ;;/* SELECT 'test';*/ SELECT 'test';
2021-01-05 13:22:41.709 - stdout> test
2021-01-05 13:22:41.709 - stdout> spark-sql> /* SELECT 'test';*/;; SELECT 'test';
2021-01-05 13:22:41.902 - stdout> spark-sql> SELECT 'test'; -- SELECT 'test';
2021-01-05 13:22:41.902 - stderr> Time taken: 0.129 seconds, Fetched 1 row(s)
2021-01-05 13:22:41.902 - stderr> Error in query:
2021-01-05 13:22:41.902 - stderr> mismatched input '<EOF>' expecting {'(', 'ADD', 'ALTER', 'ANALYZE', 'CACHE', 'CLEAR', 'COMMENT', 'COMMIT', 'CREATE', 'DELETE', 'DESC', 'DESCRIBE', 'DFS', 'DROP', 'EXPLAIN', 'EXPORT', 'FROM', 'GRANT', 'IMPORT', 'INSERT', 'LIST', 'LOAD', 'LOCK', 'MAP', 'MERGE', 'MSCK', 'REDUCE', 'REFRESH', 'REPLACE', 'RESET', 'REVOKE', 'ROLLBACK', 'SELECT', 'SET', 'SHOW', 'START', 'TABLE', 'TRUNCATE', 'UNCACHE', 'UNLOCK', 'UPDATE', 'USE', 'VALUES', 'WITH'}(line 1, pos 19)
2021-01-05 13:22:42.006 - stderr>
2021-01-05 13:22:42.006 - stderr> == SQL ==
2021-01-05 13:22:42.006 - stderr> /* SELECT 'test';*/
2021-01-05 13:22:42.006 - stderr> -------------------^^^
2021-01-05 13:22:42.006 - stderr>
2021-01-05 13:22:42.006 - stderr> Time taken: 0.226 seconds, Fetched 1 row(s)
2021-01-05 13:22:42.006 - stdout> test
```
The root cause is that the insideBracketedComment is not accurate.

For `/* comment */`, the last character `/` is not insideBracketedComment and it would be treat as beginning of statements.

In this PR, this issue is fixed.

### Why are the changes needed?
To fix the issue described above.

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
Existing UT

Closes #31054 from turboFei/SPARK-33100-followup.

Authored-by: fwang12 <fwang12@ebay.com>
Signed-off-by: Takeshi Yamamuro <yamamuro@apache.org>
(cherry picked from commit 7b06acc)
Signed-off-by: Takeshi Yamamuro <yamamuro@apache.org>
@maropu
Copy link
Member

maropu commented Jan 7, 2021

Merged to master/branch-3.1.

turboFei added a commit to turboFei/spark that referenced this pull request Jan 7, 2021
…in spark-sql

### What changes were proposed in this pull request?

This PR help find correct bound of bracketed comment in spark-sql.

Here is the log for UT of SPARK-33100 in CliSuite before:
```
2021-01-05 13:22:34.768 - stdout> spark-sql> /* SELECT 'test';*/ SELECT 'test';
2021-01-05 13:22:41.523 - stderr> Time taken: 6.716 seconds, Fetched 1 row(s)
2021-01-05 13:22:41.599 - stdout> test
2021-01-05 13:22:41.6 - stdout> spark-sql> ;;/* SELECT 'test';*/ SELECT 'test';
2021-01-05 13:22:41.709 - stdout> test
2021-01-05 13:22:41.709 - stdout> spark-sql> /* SELECT 'test';*/;; SELECT 'test';
2021-01-05 13:22:41.902 - stdout> spark-sql> SELECT 'test'; -- SELECT 'test';
2021-01-05 13:22:41.902 - stderr> Time taken: 0.129 seconds, Fetched 1 row(s)
2021-01-05 13:22:41.902 - stderr> Error in query:
2021-01-05 13:22:41.902 - stderr> mismatched input '<EOF>' expecting {'(', 'ADD', 'ALTER', 'ANALYZE', 'CACHE', 'CLEAR', 'COMMENT', 'COMMIT', 'CREATE', 'DELETE', 'DESC', 'DESCRIBE', 'DFS', 'DROP', 'EXPLAIN', 'EXPORT', 'FROM', 'GRANT', 'IMPORT', 'INSERT', 'LIST', 'LOAD', 'LOCK', 'MAP', 'MERGE', 'MSCK', 'REDUCE', 'REFRESH', 'REPLACE', 'RESET', 'REVOKE', 'ROLLBACK', 'SELECT', 'SET', 'SHOW', 'START', 'TABLE', 'TRUNCATE', 'UNCACHE', 'UNLOCK', 'UPDATE', 'USE', 'VALUES', 'WITH'}(line 1, pos 19)
2021-01-05 13:22:42.006 - stderr>
2021-01-05 13:22:42.006 - stderr> == SQL ==
2021-01-05 13:22:42.006 - stderr> /* SELECT 'test';*/
2021-01-05 13:22:42.006 - stderr> -------------------^^^
2021-01-05 13:22:42.006 - stderr>
2021-01-05 13:22:42.006 - stderr> Time taken: 0.226 seconds, Fetched 1 row(s)
2021-01-05 13:22:42.006 - stdout> test
```
The root cause is that the insideBracketedComment is not accurate.

For `/* comment */`, the last character `/` is not insideBracketedComment and it would be treat as beginning of statements.

In this PR, this issue is fixed.

### Why are the changes needed?
To fix the issue described above.

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
Existing UT

Closes apache#31054 from turboFei/SPARK-33100-followup.

Authored-by: fwang12 <fwang12@ebay.com>
Signed-off-by: Takeshi Yamamuro <yamamuro@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants