DonnyZone commented on a change in pull request #1540: [CALCITE-3433] EQUALS
operator between date/timestamp types returns false if the type is nullable
URL: https://github.com/apache/calcite/pull/1540#discussion_r339906319
##########
File path:
core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java
##########
@@ -2319,6 +2325,18 @@ public Expression implement(
return Expressions.call(SqlFunctions.class, backupMethodName,
expressions);
}
+ // When check (not) equals on two primitive boxing class (e.g., Long
x, Long y),
+ // if "x" or "y" is not a constant null expression, we should fall
back to
+ // call "SqlFunctions.eq(x, y)" and "SqlFunctions.ne(x, y)", rather
than "x == y"
+ final Primitive boxPrimitive0 = Primitive.ofBox(type0);
+ final Primitive boxPrimitive1 = Primitive.ofBox(type1);
+ if (EQUALS_OPERATORS.contains(op)
+ && boxPrimitive0 != null && boxPrimitive1 != null
+ && !isConstantNullExpression(expressions.get(0))
+ && !isConstantNullExpression(expressions.get(1))) {
Review comment:
In `RexImpTable`, when defining `BinaryImplementor`, there is a `harmonize`
function called to ensure that operands have identical type.
----------------------------------------------------------------
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]
With regards,
Apache Git Services