liyafan82 commented on a change in pull request #1873: [CALCITE-3872] Simplify 
expressions with unary minus
URL: https://github.com/apache/calcite/pull/1873#discussion_r402255980
 
 

 ##########
 File path: core/src/test/java/org/apache/calcite/rex/RexProgramTest.java
 ##########
 @@ -2265,12 +2265,35 @@ private void assertTypeAndToString(
     checkSimplify(coalesce(gt(nullInt, nullInt), trueLiteral),
         "true");
     checkSimplify(coalesce(unaryPlus(nullInt), unaryPlus(vInt())),
-        "+(?0.int0)");
-    checkSimplifyUnchanged(coalesce(unaryPlus(vInt(1)), unaryPlus(vInt())));
+        "?0.int0");
+    checkSimplifyUnchanged(coalesce(vInt(1), vInt()));
 
     checkSimplify(coalesce(nullInt, vInt()), "?0.int0");
     checkSimplify(coalesce(vInt(), nullInt, vInt(1)),
         "COALESCE(?0.int0, ?0.int1)");
+
+    checkSimplify(coalesce(vDecimalNotNull(), vDecimal()), // first arg not 
null
+        "?0.notNullDecimal0");
+    checkSimplifyUnchanged(coalesce(vDecimal(), vDecimalNotNull()));
+    checkSimplify(coalesce(vDecimal(), vDecimal()), // repeated arg
+        "?0.decimal0");
+    checkSimplify(coalesce(vDecimalNotNull(), vDecimalNotNull()), // repeated 
arg
+        "?0.notNullDecimal0");
 
 Review comment:
   Done. Thank you.

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

Reply via email to