soumyakanti3578 commented on code in PR #5196: URL: https://github.com/apache/hive/pull/5196#discussion_r1690073360
########## 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: Yes, this is rather crude, and I will remove it. I just wanted to test that if the RexNode is completely simplified at this point, then we won't run into the infinite for loop issue - this is explained by Krisztian [here](https://github.com/apache/hive/pull/5196#discussion_r1660939490). There is already a ticket in Calcite to fix this: [CALCITE-6453](https://issues.apache.org/jira/browse/CALCITE-6453). So the issue is really with certain CASTs not getting reduced, and we have to call simplify twice to reduce it. -- 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