deniskuzZ commented on code in PR #6082:
URL: https://github.com/apache/hive/pull/6082#discussion_r2360354039


##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HivePointLookupOptimizerRule.java:
##########
@@ -659,14 +658,17 @@ private static RexNode handleAND(RexBuilder rexBuilder, 
RexCall call) {
           } else {
             inLHSExprToRHSExprs.put(c.exprNode, new 
SimilarRexNodeElement(c.constNode));
           }
-          operands.remove(i);
-          --i;
+          ++eqExpressionCount;
+        } else {
+          newOperands.add(operand);
         }
       }
+      if (inExpressionCount + eqExpressionCount == 
inLHSExprToRHSExprs.keySet().size()) {
+        // No IN and Equality expressions can be merged, bail out
+        return call;
+      }
       // Create IN clauses
-      final List<RexNode> newOperands = createInClauses(rexBuilder,
-          visitedRefs, inLHSExprToRHSExprs, inLHSExprToRHSNullableExprs);
-      newOperands.addAll(operands);
+      newOperands.addAll(createInClauses(rexBuilder, visitedRefs, 
inLHSExprToRHSExprs, inLHSExprToRHSNullableExprs));

Review Comment:
   i would prefer local var and then `newOperands.addAll(operands)`. could we 
at least move `createInClauses` on a next line 
   ````
   newOperands.addAll(
     createInClauses(rexBuilder, visitedRefs, inLHSExprToRHSExprs, 
inLHSExprToRHSNullableExprs));
   ````



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