Skip to content

Commit

Permalink
branch-3.0: [opt](nereids) improve prune partition with lots of `in (…
Browse files Browse the repository at this point in the history
…xxx)` apache#46261 (apache#46285)

Cherry-picked from apache#46261

Co-authored-by: 924060929 <[email protected]>
  • Loading branch information
github-actions[bot] and 924060929 authored Jan 3, 2025
1 parent 359dfe9 commit 04b18d9
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Range;
import com.google.common.collect.RangeSet;
import com.google.common.collect.TreeRangeSet;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -362,13 +364,12 @@ public EvaluateRangeResult visitInPredicate(InPredicate inPredicate, EvaluateRan
if (exprRanges.containsKey(inPredicate.getCompareExpr())
&& inPredicate.getOptions().stream().allMatch(Literal.class::isInstance)) {
Expression compareExpr = inPredicate.getCompareExpr();
ColumnRange unionLiteralRange = ColumnRange.empty();
ColumnRange compareExprRange = result.childrenResult.get(0).columnRanges.get(compareExpr);
RangeSet<ColumnBound> union = TreeRangeSet.create();
for (Expression expr : inPredicate.getOptions()) {
unionLiteralRange = unionLiteralRange.union(
compareExprRange.intersect(ColumnRange.singleton((Literal) expr)));
union.addAll(compareExprRange.intersect(ColumnRange.singleton((Literal) expr)).asRanges());
}
result = intersectSlotRange(result, exprRanges, compareExpr, unionLiteralRange);
result = intersectSlotRange(result, exprRanges, compareExpr, new ColumnRange(union));
}
result = result.withRejectNot(false);
return result;
Expand Down

0 comments on commit 04b18d9

Please sign in to comment.