xiedeyantu commented on code in PR #4488:
URL: https://github.com/apache/calcite/pull/4488#discussion_r2249977446


##########
core/src/main/java/org/apache/calcite/rex/RexSimplify.java:
##########
@@ -397,6 +403,22 @@ RexNode isFalse(RexNode e) {
         : rexBuilder.makeCall(SqlStdOperatorTable.IS_FALSE, e);
   }
 
+  /**
+   * Runs simplification unary function by eliminating idempotent.
+   */
+  private RexCall simplifUnaryFunction(RexCall rexCall) {

Review Comment:
   Maybe we can simplify `lower(upper(lower(x)))` to `upper(lower(x))` or 
`lower(upper(x))`?



##########
core/src/main/java/org/apache/calcite/rex/RexSimplify.java:
##########
@@ -333,7 +337,9 @@ RexNode simplify(RexNode e, RexUnknownAs unknownAs) {
       return simplifyM2v((RexCall) e);
     default:
       if (e.getClass() == RexCall.class) {
-        return simplifyGenericNode((RexCall) e);
+        RexCall rexCall = (RexCall) e;
+        rexCall = simplifUnaryFunction(rexCall);

Review Comment:
   Maybe you should keep the same format as before, using case upper/lower/abs.



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