soumyakanti3578 commented on code in PR #5196:
URL: https://github.com/apache/hive/pull/5196#discussion_r1941952583
##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTConverter.java:
##########
@@ -1078,6 +1098,36 @@ public ASTNode visitCall(RexCall call) {
// proceed correctly if we just ignore the <time_unit>
astNodeLst.add(call.operands.get(1).accept(this));
break;
+ case SEARCH:
+ ASTNode astNode = call.getOperands().get(0).accept(this);
+ astNodeLst.add(astNode);
+ RexLiteral literal = (RexLiteral) call.operands.get(1);
+ Sarg<?> sarg = Objects.requireNonNull(literal.getValueAs(Sarg.class),
"Sarg");
+ int minOrClauses =
SessionState.getSessionConf().getIntVar(HiveConf.ConfVars.HIVE_POINT_LOOKUP_OPTIMIZER_MIN);
+
+ // convert Sarg to IN when they are points.
+ if (sarg.isPoints()) {
+ // just expand SEARCH to ORs when point count is less than
HIVE_POINT_LOOKUP_OPTIMIZER_MIN
+ if (sarg.pointCount < minOrClauses) {
+ return visitCall((RexCall)
call.accept(RexUtil.searchShuttle(rexBuilder, null, -1)));
+ }
+
+ // else convert to IN
+ for (Range<?> range : sarg.rangeSet.asRanges()) {
+ astNodeLst.add(visitLiteral((RexLiteral) rexBuilder.makeLiteral(
+ range.lowerEndpoint(), literal.getType(), true, true)));
Review Comment:
I will update these 👍🏼
--
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]