jcamachor commented on a change in pull request #1810:
URL: https://github.com/apache/hive/pull/1810#discussion_r548335382
##########
File path: parser/src/java/org/apache/hadoop/hive/ql/parse/HiveLexerParent.g
##########
@@ -373,6 +373,8 @@ KW_COST: 'COST';
KW_JOINCOST: 'JOINCOST';
KW_WITHIN: 'WITHIN';
KW_PKFK_JOIN: 'PKFK_JOIN';
+KW_LEADING: 'LEADING';
Review comment:
Since these two keywords are reserved, can you add a test to
`TestSQL11ReservedKeyWordsNegative.java`?
##########
File path: parser/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
##########
@@ -464,6 +473,7 @@ atomExpression
| whenExpression
| (subQueryExpression)=> (subQueryExpression)
-> ^(TOK_SUBQUERY_EXPR TOK_SUBQUERY_OP subQueryExpression)
+ | (functionName LPAREN (leading=KW_LEADING | trailing=KW_TRAILING |
KW_BOTH)? (trim_characters=selectExpression)? KW_FROM (str=selectExpression)
RPAREN) => trimFunction
Review comment:
I think this would match any function name, that then would be converted
to `trim` (or any other variant) by the rules in `trimFunction`?
I think one way of fixing this could be to declare `TRIM` as a keyword, and
match directly on `TRIM` (TRIM is a reserved keyword in SQL standard) rather
than `functionName`.
Could you also add a negative test, i.e., a test where the trim construct is
correct but the function name is different, and make sure it fails and it is
not transformed by the parser?
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]