FrankChen021 commented on code in PR #19719:
URL: https://github.com/apache/druid/pull/19719#discussion_r3630300827


##########
sql/src/main/java/org/apache/druid/sql/calcite/parser/DruidSqlParser.java:
##########
@@ -199,6 +204,24 @@ private static DruidException 
translateParseException(SqlParseException e)
       } else {
         final String theUnexpectedToken = 
getUnexpectedTokenString(parseException);
 
+        if 
(parserMetadata.isReservedWord(theUnexpectedToken.toUpperCase(Locale.ROOT))) {

Review Comment:
   [P2] Gate the reserved-word hint on identifier context
   
   This treats any parse failure whose current token happens to be reserved as 
an identifier error, even when the grammar expected a different keyword. For 
example, `SELECT * FROM foo GROUP ORDER BY x` is missing `BY`, but the new 
branch tells the user to quote `ORDER`, obscuring the actual syntax error. 
Please gate the specialized hint on parser expectations that permit an 
identifier at this position (and retain the normal expected-token diagnostic 
otherwise), with a regression test for a reserved keyword encountered in 
non-identifier context.



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