yaooqinn commented on code in PR #55466:
URL: https://github.com/apache/spark/pull/55466#discussion_r3307983659


##########
sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala:
##########
@@ -693,6 +694,8 @@ private[hive] class SparkSQLCLIDriver extends CliDriver 
with Logging {
           leavingBracketedComment = true
         } else if (hasNext && line.charAt(index + 1) == '*') {
           bracketedCommentLevel += 1
+          hasPrecedingNonCommentString = beginIndex != index &&

Review Comment:
   This substring scan doesn't skip `--` line comments, so the `-` chars 
register as "preceding SQL". Verified at PR head:
   
   | Input | Pre-PR | Post-PR |
   |---|---|---|
   | `"-- foo\n/* bar */"` | `[]` | `["-- foo\n/* bar */"]` |
   | `"SELECT 1; -- foo\n /* bar */"` | `["SELECT 1"]` | `["SELECT 1", " -- 
foo\n /* bar */"]` |
   
   Both post-PR outputs end with a comment-only chunk that gets forwarded to 
the parser — the same class of exception this function was designed to avoid.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to