amansinha100 commented on code in PR #4237:
URL: https://github.com/apache/hive/pull/4237#discussion_r1168016810
##########
ql/src/test/queries/clientpositive/pointlookup6.q:
##########
@@ -0,0 +1,17 @@
+create table r_table (
Review Comment:
Should these tests set the hive.optimize.point.lookup and
hive.optimize.point.lookup.min explicitly since the default values could
change.
##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HivePointLookupOptimizerRule.java:
##########
@@ -669,6 +670,22 @@ private static RexNode handleAND(RexBuilder rexBuilder,
RexCall call) {
return RexUtil.composeConjunction(rexBuilder, newOperands, false);
}
+ private static void retainAll(Collection<RexNode> elementsToRetain,
Collection<RexNode> collection) {
+ collection.removeIf(rexNode -> elementsToRetain.stream().noneMatch(
+ rexNodeToRetain -> equalsWithSimilarType(rexNode,
rexNodeToRetain)));
+ }
+
+ private static boolean equalsWithSimilarType(RexNode rexNode1, RexNode
rexNode2) {
+ if (!(rexNode1 instanceof RexLiteral) || !(rexNode2 instanceof
RexLiteral)) {
+ return rexNode1.equals(rexNode2);
+ }
+
+ RexLiteral rexLiteral1 = (RexLiteral) rexNode1;
+ RexLiteral rexLiteral2 = (RexLiteral) rexNode2;
+ return rexLiteral1.getValue().compareTo(rexLiteral2.getValue()) == 0 &&
+
rexLiteral1.getType().getSqlTypeName().equals(rexLiteral2.getType().getSqlTypeName());
Review Comment:
The SqlTypeName is being compared twice. Previously, it was compared by the
shareSameType() function on lines 623, 653.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]