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

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


The following commit(s) were added to refs/heads/master by this push:
     new 1e44a4b1456 [opt](nereids) convert or to inpredicate and optimize 
inpredicate partition prune (#28316)
1e44a4b1456 is described below

commit 1e44a4b145606eff7cb75fe7f1daeb95f04c8c9c
Author: starocean999 <[email protected]>
AuthorDate: Sun Dec 24 21:42:03 2023 +0800

    [opt](nereids) convert or to inpredicate and optimize inpredicate partition 
prune (#28316)
---
 .../rules/expression/rules/OneRangePartitionEvaluator.java    | 11 ++++++-----
 .../doris/nereids/rules/expression/rules/PartitionPruner.java |  1 +
 2 files changed, 7 insertions(+), 5 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 3e08404d0be..e6c2d92c8e2 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
@@ -396,11 +396,12 @@ public class OneRangePartitionEvaluator
         if (inPredicate.getCompareExpr() instanceof Slot
                 && 
inPredicate.getOptions().stream().allMatch(Literal.class::isInstance)) {
             Slot slot = (Slot) inPredicate.getCompareExpr();
-            ColumnRange unionLiteralRange = inPredicate.getOptions()
-                    .stream()
-                    .map(Literal.class::cast)
-                    .map(ColumnRange::singleton)
-                    .reduce(ColumnRange.empty(), ColumnRange::union);
+            ColumnRange unionLiteralRange = ColumnRange.empty();
+            ColumnRange slotRange = 
result.childrenResult.get(0).columnRanges.get(slot);
+            for (Expression expr : inPredicate.getOptions()) {
+                unionLiteralRange = unionLiteralRange.union(
+                        slotRange.intersect(ColumnRange.singleton((Literal) 
expr)));
+            }
             Map<Slot, ColumnRange> slotRanges = 
result.childrenResult.get(0).columnRanges;
             result = intersectSlotRange(result, slotRanges, slot, 
unionLiteralRange);
         }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/PartitionPruner.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/PartitionPruner.java
index cb4137ba5b6..6089cf31a61 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/PartitionPruner.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/PartitionPruner.java
@@ -113,6 +113,7 @@ public class PartitionPruner extends 
DefaultExpressionRewriter<Void> {
                         partitionTableType))
                 .collect(ImmutableList.toImmutableList());
 
+        partitionPredicate = OrToIn.INSTANCE.rewrite(partitionPredicate, null);
         PartitionPruner partitionPruner = new PartitionPruner(evaluators, 
partitionPredicate);
         //TODO: we keep default partition because it's too hard to prune it, 
we return false in canPrune().
         return partitionPruner.prune();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to