Dwrite commented on code in PR #4339:
URL: https://github.com/apache/calcite/pull/4339#discussion_r2073540503
##########
core/src/main/codegen/templates/Parser.jj:
##########
@@ -7920,6 +7920,7 @@ SqlBinaryOperator BinaryRowOperator() :
{
// <IN> is handled as a special case
<EQ> { return SqlStdOperatorTable.EQUALS; }
+| <LEFTSHIFT> { return SqlStdOperatorTable.LEFTSHIFT_OPERATOR; }
Review Comment:
still can not fix this conflict. wii add RIGHTSHIFT function to support.
##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -16294,6 +16299,51 @@ private static void
checkLogicalOrFunc(SqlOperatorFixture f) {
f.checkAgg("logical_or(x)", values4, isNullValue());
}
+ @Test void testBitXorOperatorScalarFunc() throws SqlParseException {
+ String sql = "SELECT 5 ^ 3 ";
+ SqlNode sqlNode = SqlParser.create(sql,
SqlParser.Config.DEFAULT).parseStmt();
+
+ assertInstanceOf(SqlSelect.class, sqlNode);
+ SqlSelect select = (SqlSelect) sqlNode;
+
+ SqlNode selectItem = select.getSelectList().get(0);
+ assertInstanceOf(SqlBasicCall.class, selectItem);
+ SqlBasicCall call = (SqlBasicCall) selectItem;
+ assertEquals(SqlStdOperatorTable.BITXOR_OPERATOR, call.getOperator());
+ assertEquals(2, call.getOperandList().size());
+ }
+
+ @Test void testLeftShiftScalarFunc() {
+ final SqlOperatorFixture f = fixture();
+ f.setFor(SqlStdOperatorTable.LEFTSHIFT_OPERATOR, VmName.EXPAND);
+
+
+ // Basic test cases
+ f.checkScalar("2 << 2", "8", "INTEGER NOT NULL");
Review Comment:
Just add more test cases. Since Java provides a standard way to handle this
overloading, should we consider reusing that approach directly in this
implementation?
--
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]