kasakrisz commented on code in PR #6082: URL: https://github.com/apache/hive/pull/6082#discussion_r2371673470
########## ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HivePointLookupOptimizerRule.java: ########## @@ -599,15 +599,15 @@ private static RexNode handleAND(RexBuilder rexBuilder, RexCall call) { // into a null value. final Multimap<RexNode,RexNode> inLHSExprToRHSNullableExprs = LinkedHashMultimap.create(); final List<RexNode> operands = new ArrayList<>(RexUtil.flattenAnd(call.getOperands())); - - for (int i = 0; i < operands.size(); i++) { - RexNode operand = operands.get(i); - if (operand instanceof RexCall && HiveIn.INSTANCE.equals(((RexCall) operand).op)) { - RexCall inCall = (RexCall) operand; - if (!HiveCalciteUtil.isDeterministic(inCall.getOperands().get(0))) { + final List<RexNode> newOperands = new ArrayList<>(operands.size()); + int inExpressionCount = 0; + int eqExpressionCount = 0; + for (RexNode operand : operands) { + if (operand instanceof RexCall inCall && HiveIn.INSTANCE.equals(inCall.op)) { + if (!HiveCalciteUtil.isDeterministic(inCall.getOperands().getFirst())) { continue; } - RexNode ref = inCall.getOperands().get(0); + RexNode ref = inCall.getOperands().getFirst(); Review Comment: I applied this change. Thanks. ########## ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HivePointLookupOptimizerRule.java: ########## @@ -734,26 +736,30 @@ private static boolean shareSameType( private static RexNode handleOR(RexBuilder rexBuilder, RexCall call) { // IN clauses need to be combined by keeping all elements final List<RexNode> operands = new ArrayList<>(RexUtil.flattenOr(call.getOperands())); + final List<RexNode> newOperands = new ArrayList<>(operands.size()); final Multimap<RexNode,SimilarRexNodeElement> inLHSExprToRHSExprs = LinkedHashMultimap.create(); - for (int i = 0; i < operands.size(); i++) { - RexNode operand = operands.get(i); - if (operand instanceof RexCall && HiveIn.INSTANCE.equals(((RexCall) operand).op)) { - RexCall inCall = (RexCall) operand; - if (!HiveCalciteUtil.isDeterministic(inCall.getOperands().get(0))) { + int inExpressionCount = 0; + for (RexNode operand : operands) { + if (operand instanceof RexCall inCall && HiveIn.INSTANCE.equals(inCall.op)) { + if (!HiveCalciteUtil.isDeterministic(inCall.getOperands().getFirst())) { continue; } - RexNode ref = inCall.getOperands().get(0); + RexNode ref = inCall.getOperands().getFirst(); Review Comment: Done -- 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