Dwrite commented on code in PR #4339:
URL: https://github.com/apache/calcite/pull/4339#discussion_r2117583126
##########
core/src/main/java/org/apache/calcite/sql/fun/SqlStdOperatorTable.java:
##########
@@ -1299,6 +1299,33 @@ public class SqlStdOperatorTable extends
ReflectiveSqlOperatorTable {
ReturnTypes.LARGEST_INT_OR_FIRST_NON_NULL,
OperandTypes.INTEGER_INTEGER.or(OperandTypes.BINARY_BINARY));
+ /**
+ * <code>{@code ^}</code> operator.
+ */
+ public static final SqlBinaryOperator BITXOR_OPERATOR =
+ new SqlMonotonicBinaryOperator(
+ "^",
+ SqlKind.BITXOR,
+ 50, // Precedence between addition (40) and multiplication
(60)
+ true,
+ ReturnTypes.LARGEST_INT_OR_FIRST_NON_NULL, // Returns same type as
inputs when nullable
+ InferTypes.FIRST_KNOWN,
+ OperandTypes.INTEGER_INTEGER.or(OperandTypes.BINARY_BINARY));
+ // Both operands should support bitwise operations
+
+ /**
+ * <code>{@code <<}</code> operator.
+ */
+ public static final SqlBinaryOperator LEFTSHIFT_OPERATOR =
+ new SqlBinaryOperator("<<", // Operator name
+ SqlKind.OTHER_FUNCTION, // SqlKind
+ 32,
+ true,
+ ReturnTypes.LARGEST_INT_OR_FIRST_NON_NULL,
+ null,
+ OperandTypes.family(SqlTypeFamily.INTEGER, SqlTypeFamily.INTEGER));
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]