zabetak commented on code in PR #5196:
URL: https://github.com/apache/hive/pull/5196#discussion_r1689403314


##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveCalciteUtil.java:
##########
@@ -683,6 +687,20 @@ public static ImmutableList<RexNode> 
getPredsNotPushedAlready(Set<String> predic
     predicatesToExclude.addAll(predicatesInSubtree);
     return newConjuncts.build();
   }
+  
+  private static RexNode simplify(RexSimplify simplifier, RexNode node) {
+    RexNode result = node;
+    int maxTries = 5;
+    for (int i = 0; i < maxTries; i++) {
+      RexNode simplified = simplifier.simplify(result);
+      if (simplified.equals(result)) {
+        break;
+      }
+      result = simplified;
+    }
+    
+    return result;

Review Comment:
   This part indicates that there is some part of flakiness/nondeterminism in 
the mix. Moreover, the simplifier is rather costly so calling it multiple times 
can have an impact on performance. Why do we need to do this? What is the 
expression that requires multiple rounds of simplification? This probably 
deserves logging a dedicated CALCITE ticket. Unfortunately this cannot be 
committed as such we need to work out a solution.



-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to