vlsi commented on a change in pull request #2282:
URL: https://github.com/apache/calcite/pull/2282#discussion_r659086697



##########
File path: core/src/test/java/org/apache/calcite/rex/RexProgramTest.java
##########
@@ -3224,4 +3224,25 @@ private SqlSpecialOperatorWithPolicy(String name, 
SqlKind kind, int prec, boolea
   @Test void testSimplifyVarbinary() {
     checkSimplifyUnchanged(cast(cast(vInt(), tVarchar(true, 100)), 
tVarbinary(true)));
   }
+
+  @Test void testSimplifySimpleArithmetic() {
+    RexNode a = vIntNotNull(1);
+    RexNode zero = literal(0);
+    RexNode one = literal(1);
+
+    RexNode b = vDecimalNotNull(2);
+    RexNode half = literal(new BigDecimal(0.5), b.getType());
+
+    checkSimplify(add(a, zero), "?0.notNullInt1");

Review comment:
       Could you please add a test like `add(zero, sub(vInt(0), vInt(0)))`?
   The expression should evaluate to null in case `vInt(0)` is null.




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