zabetak commented on code in PR #4591:
URL: https://github.com/apache/calcite/pull/4591#discussion_r2447793369


##########
core/src/main/java/org/apache/calcite/rex/RexSimplify.java:
##########
@@ -3206,29 +3206,11 @@ private boolean accept_(RexNode e, List<RexNode> 
newTerms) {
 
     private boolean accept2(RexNode left, RexNode right, SqlKind kind,
         List<RexNode> newTerms) {
-      switch (left.getKind()) {
-      case INPUT_REF:
-      case FIELD_ACCESS:
-      case CAST:
-        switch (right.getKind()) {
-        case LITERAL:
-          return accept2b(left, kind, (RexLiteral) right, newTerms);
-        default:
-          break;
-        }
-        return false;
-      case LITERAL:
-        switch (right.getKind()) {
-        case INPUT_REF:
-        case FIELD_ACCESS:
-        case CAST:
-          return accept2b(right, kind.reverse(), (RexLiteral) left, newTerms);
-        default:
-          break;
-        }
-        return false;
-      default:
-        break;
+      if (right.isA(SqlKind.LITERAL) && RexUtil.isDeterministic(left)) {

Review Comment:
   Yes, it is a generalization that I believe makes sense. The motivation for 
this change comes from use-cases encountered in Apache Hive & Apache Impala. I 
linked the HIVE jira ticket and I will also try to find the respective IMPALA 
ticket.
   
   In terms of documentation, I will try to see what can I do. Even if there is 
a a spec in place sometimes it needs to evolve as it happens here.



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