This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 04b18d9dcb6 branch-3.0: [opt](nereids) improve prune partition with 
lots of `in (xxx)` #46261 (#46285)
04b18d9dcb6 is described below

commit 04b18d9dcb69bbc0a6a5692667cfe57f0444cd54
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Jan 3 19:38:11 2025 +0800

    branch-3.0: [opt](nereids) improve prune partition with lots of `in (xxx)` 
#46261 (#46285)
    
    Cherry-picked from #46261
    
    Co-authored-by: 924060929 <lanhuaj...@selectdb.com>
---
 .../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 7e91d5502f7..0a9d0bbed01 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
@@ -62,6 +62,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: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to