dongjoon-hyun commented on a change in pull request #25357: 
[SPARK-28617][SQL][TEST] Fix misplacement when comment is at the end of the 
query
URL: https://github.com/apache/spark/pull/25357#discussion_r311390341
 
 

 ##########
 File path: sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala
 ##########
 @@ -229,6 +229,7 @@ class SQLQueryTestSuite extends QueryTest with 
SharedSQLContext {
     // List of SQL queries to run
     // note: this is not a robust way to split queries using semicolon, but 
works for now.
     val queries = 
code.mkString("\n").split("(?<=[^\\\\]);").map(_.trim).filter(_ != "").toSeq
+      
.map(_.split("\n").filterNot(_.startsWith("--")).mkString("\n")).map(_.trim).filter(_
 != "")
 
 Review comment:
   The description is a little misleading.
   `The comment at the end of the query` looks like `SELECT 1; -- okay`.
   Technically, it's split by line 231 (not line 233).
   
   Given that, the following is a simpler solution, isn't it?
   ```scala
   - val queries = 
code.mkString("\n").split("(?<=[^\\\\]);").map(_.trim).filter(_ != "").toSeq
   + val queries = 
code.mkString("\n").split("(?<=[^\\\\]);").map(_.trim).filter(_ != 
"").filterNot(_.startsWith("--")).toSeq
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to