mihaibudiu commented on code in PR #4543:
URL: https://github.com/apache/calcite/pull/4543#discussion_r2384267194
##########
core/src/main/java/org/apache/calcite/sql/fun/SqlStdOperatorTable.java:
##########
@@ -1312,6 +1315,23 @@ public class SqlStdOperatorTable extends
ReflectiveSqlOperatorTable {
InferTypes.FIRST_KNOWN,
OperandTypes.INTEGER_INTEGER.or(OperandTypes.BINARY_BINARY)
.or(OperandTypes.UNSIGNED_NUMERIC_UNSIGNED_NUMERIC));
+ // Both operands should support bitwise operations
+
+ /**
+ * <code>{@code &}</code> operator.
+ */
+ public static final SqlBinaryOperator BITAND_OPERATOR =
+ new SqlBinaryOperator(
+ "&",
+ SqlKind.BITAND,
+ 50, // Higher precedence than XOR but lower than
multiplication
+ true,
+ ReturnTypes.LARGEST_INT_BINARY_OR_LEAST_RESTRICTIVE,
+ InferTypes.FIRST_KNOWN,
+ OperandTypes.INTEGER_INTEGER.or(OperandTypes.BINARY_BINARY)
+ .or(OperandTypes.UNSIGNED_NUMERIC_UNSIGNED_NUMERIC)
+ .or(OperandTypes.family(SqlTypeFamily.UNSIGNED_NUMERIC,
SqlTypeFamily.INTEGER)
+ .or(OperandTypes.family(SqlTypeFamily.INTEGER,
SqlTypeFamily.UNSIGNED_NUMERIC))));
Review Comment:
Can you also please answer this question?
What do you think we should do about the fact that BITXOR_OPERATOR has a
different return type inference and a different operandTypeChecker?
One of the two must be wrong.
(I am not asking necessarily for a fix in this PR, I just want to understand
what you think should be the strategy to align them).
--
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]