This is an automated email from the ASF dual-hosted git repository.
huajianlan pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new c385293ee9e branch-2.1: [opt](nereids) improve prune partition with
lots of `in (xxx)` #46261 (#46286)
c385293ee9e is described below
commit c385293ee9e861d027599b280148f1245a84c1b3
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Jan 2 18:52:31 2025 +0800
branch-2.1: [opt](nereids) improve prune partition with lots of `in (xxx)`
#46261 (#46286)
improve prune partition with lots of `in (xxx)`
this can reduce from 35s to 300ms when there have 4000 options
---
.../rules/expression/rules/OneRangePartitionEvaluator.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/OneRangePartitionEvaluator.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/OneRangePartitionEvaluator.java
index 1fb8954ab16..c6fa17ac11c 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/OneRangePartitionEvaluator.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/OneRangePartitionEvaluator.java
@@ -63,6 +63,8 @@ import com.google.common.collect.ImmutableSet;
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;
@@ -362,13 +364,12 @@ public class OneRangePartitionEvaluator<K>
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;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]