nielspardon commented on code in PR #5073:
URL: https://github.com/apache/calcite/pull/5073#discussion_r3536815851


##########
core/src/main/codegen/templates/Parser.jj:
##########
@@ -8470,6 +8470,12 @@ SqlBinaryOperator BinaryRowOperator() :
     // <IN> is handled as a special case
     <EQ> { return SqlStdOperatorTable.EQUALS; }
 |   <LEFTSHIFT> { return SqlStdOperatorTable.BIT_LEFT_SHIFT; }
+    // The right shift operator ">>" is matched as two adjacent ">" tokens 
rather
+    // than a single ">>" token. A greedy ">>" token would be produced by the 
lexer
+    // even when the two ">" characters close nested angle-bracket types (e.g.
+    // MAP<INT, MAP<INT, INT>>), breaking type parsing. Matching two ">" 
tokens here
+    // keeps right shift confined to expression context.
+|   LOOKAHEAD(2) <GT> <GT> { return SqlStdOperatorTable.BIT_RIGHT_SHIFT; }

Review Comment:
   You're right. I changed the parser config to more strictly only match two 
adjacent angle-brackets and added a test case verifying it does not match the 
space separated ones in `SqlParserTest`.



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

Reply via email to