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

englefly 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 138e6c2f01 [stats](nereids)keep min/max expr in colstats (#22064)
138e6c2f01 is described below

commit 138e6c2f0179d0df93c0e41607c290bc81c70dca
Author: minghong <[email protected]>
AuthorDate: Mon Jul 24 10:28:36 2023 +0800

    [stats](nereids)keep min/max expr in colstats (#22064)
    
    columnStatistics.minExpr and maxExpr is useful when we derive stats for 
cast function.
    This pr
    1. maintains the min/max expr during stats derive in filter condition: 
col<literal, col>literal and col=literal
    2. adjust column stats range for cast function (now only support cast from 
string to other types)
    
    ds9 is changed, but no performance issue: on tpcds_sf100_rf exe time is 
1.5~1.6sec, the same as master
---
 .../nereids/stats/ColumnStatsAdjustVisitor.java    | 35 +++++++++-
 .../doris/nereids/stats/ExpressionEstimation.java  |  4 ++
 .../doris/nereids/stats/FilterEstimation.java      | 58 ++++++++--------
 .../plans/physical/PhysicalNestedLoopJoin.java     |  6 +-
 .../doris/statistics/ColumnStatisticBuilder.java   |  4 +-
 .../apache/doris/statistics/StatisticRange.java    | 77 ++++++++++++++++++----
 .../nereids_tpcds_shape_sf100_p0/shape/query9.out  | 53 ++++++++-------
 7 files changed, 161 insertions(+), 76 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ColumnStatsAdjustVisitor.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ColumnStatsAdjustVisitor.java
index 1f789f7deb..f23cd61006 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ColumnStatsAdjustVisitor.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ColumnStatsAdjustVisitor.java
@@ -17,12 +17,20 @@
 
 package org.apache.doris.nereids.stats;
 
+import org.apache.doris.analysis.LiteralExpr;
+import org.apache.doris.catalog.Type;
 import org.apache.doris.nereids.trees.expressions.Cast;
 import org.apache.doris.nereids.trees.expressions.Expression;
+import org.apache.doris.nereids.trees.expressions.literal.Literal;
 import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
+import org.apache.doris.nereids.types.DataType;
+import org.apache.doris.nereids.types.coercion.CharacterType;
 import org.apache.doris.statistics.ColumnStatistic;
+import org.apache.doris.statistics.ColumnStatisticBuilder;
 import org.apache.doris.statistics.Statistics;
 
+import com.google.common.base.Preconditions;
+
 /**
  * table: T(A, B)
  * T.stats = (rows=10,
@@ -54,10 +62,35 @@ public class ColumnStatsAdjustVisitor extends 
ExpressionVisitor<ColumnStatistic,
         return null;
     }
 
+    @Override
     public ColumnStatistic visitCast(Cast cast, Statistics context) {
         ColumnStatistic colStats = context.findColumnStatistics(cast);
+
         if (colStats != null) {
-            context.addColumnStats(cast.child(), colStats);
+            try {
+                DataType childNereidsType = cast.child().getDataType();
+                if (childNereidsType instanceof CharacterType) {
+                    Type childCatalogType = 
childNereidsType.toCatalogDataType();
+                    LiteralExpr childMinExpr = 
LiteralExpr.create(colStats.minExpr.getStringValue(),
+                            childCatalogType);
+                    double childMinValue = 
Literal.of(childMinExpr.getStringValue()).getDouble();
+                    LiteralExpr childMaxExpr = 
LiteralExpr.create(colStats.maxExpr.getStringValue(),
+                            childCatalogType);
+                    double childMaxValue = 
Literal.of(childMaxExpr.getStringValue()).getDouble();
+                    ColumnStatisticBuilder builder = new 
ColumnStatisticBuilder(colStats);
+                    builder.setMaxExpr(childMaxExpr);
+                    builder.setMaxValue(childMaxValue);
+                    builder.setMinExpr(childMinExpr);
+                    builder.setMinValue(childMinValue);
+                    context.addColumnStats(cast.child(), builder.build());
+                } else {
+                    // TODO: handle other data types
+                    context.addColumnStats(cast.child(), colStats);
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+                Preconditions.checkArgument(false, "type conversion failed");
+            }
         }
         return null;
     }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ExpressionEstimation.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ExpressionEstimation.java
index 9a3c54f739..03e4be4d63 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ExpressionEstimation.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/ExpressionEstimation.java
@@ -163,11 +163,13 @@ public class ExpressionEstimation extends 
ExpressionVisitor<ColumnStatistic, Sta
                     DateLiteral dateMinLiteral = new DateLiteral(strMin);
                     long min = dateMinLiteral.getValue();
                     builder.setMinValue(min);
+                    builder.setMinExpr(dateMinLiteral.toLegacyLiteral());
 
                     String strMax = colStats.maxExpr.getStringValue();
                     DateLiteral dateMaxLiteral = new DateLiteral(strMax);
                     long max = dateMaxLiteral.getValue();
                     builder.setMaxValue(max);
+                    builder.setMaxExpr(dateMaxLiteral.toLegacyLiteral());
                 } catch (AnalysisException e) {
                     // ignore exception. do not convert min max
                 }
@@ -189,6 +191,8 @@ public class ExpressionEstimation extends 
ExpressionVisitor<ColumnStatistic, Sta
         columnStatBuilder.setNdv(1);
         columnStatBuilder.setNumNulls(1);
         columnStatBuilder.setAvgSizeByte(1);
+        columnStatBuilder.setMinExpr(literal.toLegacyLiteral());
+        columnStatBuilder.setMaxExpr(literal.toLegacyLiteral());
         return columnStatBuilder.build();
     }
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java
index 3ea7caaf08..6cb397437d 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java
@@ -20,7 +20,6 @@ package org.apache.doris.nereids.stats;
 import org.apache.doris.nereids.stats.FilterEstimation.EstimationContext;
 import org.apache.doris.nereids.trees.TreeNode;
 import org.apache.doris.nereids.trees.expressions.And;
-import org.apache.doris.nereids.trees.expressions.Cast;
 import org.apache.doris.nereids.trees.expressions.ComparisonPredicate;
 import org.apache.doris.nereids.trees.expressions.CompoundPredicate;
 import org.apache.doris.nereids.trees.expressions.EqualTo;
@@ -172,25 +171,27 @@ public class FilterEstimation extends 
ExpressionVisitor<Statistics, EstimationCo
     }
 
     private Statistics updateLessThanLiteral(Expression leftExpr, 
ColumnStatistic statsForLeft,
-            double val, EstimationContext context, boolean contains) {
+            ColumnStatistic statsForRight, EstimationContext context, boolean 
contains) {
         if (statsForLeft.hasHistogram()) {
-            return estimateLessThanLiteralWithHistogram(leftExpr, 
statsForLeft, val, context, contains);
+            return estimateLessThanLiteralWithHistogram(leftExpr, statsForLeft,
+                    statsForRight.maxValue, context, contains);
         }
-        //rightRange.distinctValues should not be used
-        StatisticRange rightRange = new StatisticRange(statsForLeft.minValue, 
val, statsForLeft.ndv,
-                leftExpr.getDataType());
+        StatisticRange rightRange = new StatisticRange(statsForLeft.minValue, 
statsForLeft.minExpr,
+                statsForRight.maxValue, statsForRight.maxExpr,
+                statsForLeft.ndv, leftExpr.getDataType());
         return estimateBinaryComparisonFilter(leftExpr,
                 statsForLeft,
                 rightRange, context);
     }
 
     private Statistics updateGreaterThanLiteral(Expression leftExpr, 
ColumnStatistic statsForLeft,
-            double val, EstimationContext context, boolean contains) {
+            ColumnStatistic statsForRight, EstimationContext context, boolean 
contains) {
         if (statsForLeft.hasHistogram()) {
-            return estimateGreaterThanLiteralWithHistogram(leftExpr, 
statsForLeft, val, context, contains);
+            return estimateGreaterThanLiteralWithHistogram(leftExpr, 
statsForLeft,
+                    statsForRight.minValue, context, contains);
         }
-        //rightRange.distinctValues should not be used
-        StatisticRange rightRange = new StatisticRange(val, 
statsForLeft.maxValue,
+        StatisticRange rightRange = new StatisticRange(statsForRight.minValue, 
statsForRight.minExpr,
+                statsForLeft.maxValue, statsForLeft.maxExpr,
                 statsForLeft.ndv, leftExpr.getDataType());
         return estimateBinaryComparisonFilter(leftExpr, statsForLeft, 
rightRange, context);
     }
@@ -204,12 +205,12 @@ public class FilterEstimation extends 
ExpressionVisitor<Statistics, EstimationCo
         if (cp instanceof EqualTo || cp instanceof NullSafeEqual) {
             return estimateEqualTo(cp, statsForLeft, statsForRight, context);
         } else {
-            double val = statsForRight.maxValue;
             if (cp instanceof LessThan || cp instanceof LessThanEqual) {
-                return updateLessThanLiteral(cp.left(), statsForLeft, val, 
context, cp instanceof LessThanEqual);
+                return updateLessThanLiteral(cp.left(), statsForLeft, 
statsForRight,
+                        context, cp instanceof LessThanEqual);
             } else if (cp instanceof GreaterThan || cp instanceof 
GreaterThanEqual) {
 
-                return updateGreaterThanLiteral(cp.left(), statsForLeft, val, 
context,
+                return updateGreaterThanLiteral(cp.left(), statsForLeft, 
statsForRight, context,
                         cp instanceof GreaterThanEqual);
             } else {
                 throw new RuntimeException(String.format("Unexpected 
expression : %s", cp.toSql()));
@@ -234,19 +235,9 @@ public class FilterEstimation extends 
ExpressionVisitor<Statistics, EstimationCo
 
         Statistics equalStats = context.statistics.withSel(selectivity);
         Expression left = cp.left();
-        if (left instanceof Cast) {
-            left = ((Cast) left).child();
-        }
-        if (left instanceof SlotReference) {
-            Slot leftSlot = (SlotReference) left;
-            //update min/max of cp.left
-            ColumnStatistic columnStats = 
equalStats.findColumnStatistics(leftSlot);
-            ColumnStatisticBuilder colStatsBuilder = new 
ColumnStatisticBuilder(columnStats);
-            colStatsBuilder.setMaxValue(val);
-            colStatsBuilder.setMinValue(val);
-            colStatsBuilder.setNdv(1);
-            colStatsBuilder.setNumNulls(0);
-            equalStats.addColumnStats(leftSlot, colStatsBuilder.build());
+        equalStats.addColumnStats(left, statsForRight);
+        if (!(left instanceof SlotReference)) {
+            left.accept(new ColumnStatsAdjustVisitor(), equalStats);
         }
         return equalStats;
     }
@@ -362,11 +353,14 @@ public class FilterEstimation extends 
ExpressionVisitor<Statistics, EstimationCo
     private Statistics estimateBinaryComparisonFilter(Expression leftExpr, 
ColumnStatistic leftStats,
             StatisticRange rightRange, EstimationContext context) {
         StatisticRange leftRange =
-                new StatisticRange(leftStats.minValue, leftStats.maxValue, 
leftStats.ndv, leftExpr.getDataType());
+                new StatisticRange(leftStats.minValue, leftStats.minExpr, 
leftStats.maxValue, leftStats.maxExpr,
+                        leftStats.ndv, leftExpr.getDataType());
         StatisticRange intersectRange = leftRange.cover(rightRange);
         ColumnStatisticBuilder leftColumnStatisticBuilder = new 
ColumnStatisticBuilder(leftStats)
                 .setMinValue(intersectRange.getLow())
+                .setMinExpr(intersectRange.getLowExpr())
                 .setMaxValue(intersectRange.getHigh())
+                .setMaxExpr(intersectRange.getHighExpr())
                 .setNdv(intersectRange.getDistinctValues());
         double sel = leftRange.overlapPercentWith(rightRange);
         Statistics updatedStatistics = context.statistics.withSel(sel);
@@ -416,8 +410,8 @@ public class FilterEstimation extends 
ExpressionVisitor<Statistics, EstimationCo
         if (leftOverlapPercent == 0) {
             return context.statistics.withRowCount(0.0);
         }
-        StatisticRange leftAlwaysLessThanRightRange = new 
StatisticRange(leftStats.minValue,
-                rightStats.minValue, Double.NaN, leftExpr.getDataType());
+        StatisticRange leftAlwaysLessThanRightRange = new 
StatisticRange(leftStats.minValue, leftStats.minExpr,
+                rightStats.minValue, rightStats.minExpr, Double.NaN, 
leftExpr.getDataType());
         double leftAlwaysLessThanRightPercent = 0;
         if (leftRange.getLow() < rightRange.getLow()) {
             leftAlwaysLessThanRightPercent = 
leftRange.overlapPercentWith(leftAlwaysLessThanRightRange);
@@ -431,8 +425,10 @@ public class FilterEstimation extends 
ExpressionVisitor<Statistics, EstimationCo
         double rightOverlappingRangeFraction = 
rightRange.overlapPercentWith(leftRange);
         double rightAlwaysGreaterRangeFraction = 0;
         if (leftRange.getHigh() < rightRange.getHigh()) {
-            rightAlwaysGreaterRangeFraction = 
rightRange.overlapPercentWith(new StatisticRange(leftRange.getHigh(),
-                    rightRange.getHigh(), Double.NaN, 
rightExpr.getDataType()));
+            rightAlwaysGreaterRangeFraction = 
rightRange.overlapPercentWith(new StatisticRange(
+                    leftRange.getHigh(), leftRange.getHighExpr(),
+                    rightRange.getHigh(), rightRange.getHighExpr(),
+                    Double.NaN, rightExpr.getDataType()));
         }
         ColumnStatistic rightColumnStatistic = new 
ColumnStatisticBuilder(rightStats)
                 .setMinValue(Math.max(leftRange.getLow(), rightRange.getLow()))
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalNestedLoopJoin.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalNestedLoopJoin.java
index 5ba9f60a86..dc420b1784 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalNestedLoopJoin.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/physical/PhysicalNestedLoopJoin.java
@@ -127,9 +127,13 @@ public class PhysicalNestedLoopJoin<
     @Override
     public PhysicalNestedLoopJoin<Plan, Plan> withChildren(List<Plan> 
children) {
         Preconditions.checkArgument(children.size() == 2);
-        return new PhysicalNestedLoopJoin<>(joinType,
+        PhysicalNestedLoopJoin newJoin = new PhysicalNestedLoopJoin<>(joinType,
                 hashJoinConjuncts, otherJoinConjuncts, markJoinSlotReference, 
Optional.empty(),
                 getLogicalProperties(), physicalProperties, statistics, 
children.get(0), children.get(1));
+        if (groupExpression.isPresent()) {
+            newJoin.setMutableState("group", 
groupExpression.get().getOwnerGroup().getGroupId().asInt());
+        }
+        return newJoin;
     }
 
     @Override
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatisticBuilder.java
 
b/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatisticBuilder.java
index 60e0bdab85..f69ab56815 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatisticBuilder.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatisticBuilder.java
@@ -171,9 +171,9 @@ public class ColumnStatisticBuilder {
 
     public ColumnStatistic build() {
         dataSize = Math.max((count - numNulls + 1) * avgSizeByte, 0);
-        if (original == null) {
+        if (original == null && !isUnknown) {
             original = new ColumnStatistic(count, ndv, null, avgSizeByte, 
numNulls,
-                    dataSize, minValue, maxValue, selectivity, minExpr, 
maxExpr, isUnknown, histogram);
+                    dataSize, minValue, maxValue, selectivity, minExpr, 
maxExpr, false, histogram);
         }
         return new ColumnStatistic(count, ndv, original, avgSizeByte, numNulls,
             dataSize, minValue, maxValue, selectivity, minExpr, maxExpr, 
isUnknown, histogram);
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticRange.java 
b/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticRange.java
index 74055e62f1..f784536443 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticRange.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticRange.java
@@ -17,6 +17,8 @@
 
 package org.apache.doris.statistics;
 
+import org.apache.doris.analysis.LiteralExpr;
+import org.apache.doris.common.Pair;
 import org.apache.doris.nereids.types.DataType;
 
 import java.util.Objects;
@@ -29,22 +31,41 @@ public class StatisticRange {
      * {@code NaN} represents empty range ({@code high} must be {@code NaN} 
too)
      */
     private final double low;
+
+    private final LiteralExpr lowExpr;
     /**
      * {@code NaN} represents empty range ({@code low} must be {@code NaN} too)
      */
     private final double high;
 
+    private final LiteralExpr highExpr;
+
     private final double distinctValues;
 
     private final DataType dataType;
 
-    public StatisticRange(double low, double high, double distinctValues, 
DataType dataType) {
+    public StatisticRange(double low, LiteralExpr lowExpr, double high, 
LiteralExpr highExpr,
+                          double distinctValues, DataType dataType) {
         this.low = low;
+        this.lowExpr = lowExpr;
         this.high = high;
+        this.highExpr = highExpr;
         this.distinctValues = distinctValues;
         this.dataType = dataType;
     }
 
+    public LiteralExpr getLowExpr() {
+        return lowExpr;
+    }
+
+    public LiteralExpr getHighExpr() {
+        return highExpr;
+    }
+
+    public DataType getDataType() {
+        return dataType;
+    }
+
     public double overlapPercentWith(StatisticRange other) {
         Objects.requireNonNull(other, "other is null");
         if (this.isEmpty() || other.isEmpty() || this.distinctValues == 0 || 
other.distinctValues == 0) {
@@ -79,7 +100,7 @@ public class StatisticRange {
     }
 
     public static StatisticRange empty(DataType dataType) {
-        return new StatisticRange(Double.NaN, Double.NaN, 0, dataType);
+        return new StatisticRange(Double.NaN, null, Double.NaN, null, 0, 
dataType);
     }
 
     public boolean isEmpty() {
@@ -90,8 +111,9 @@ public class StatisticRange {
         return Double.isInfinite(low) && Double.isInfinite(high);
     }
 
-    public static StatisticRange from(ColumnStatistic column, DataType 
dataType) {
-        return new StatisticRange(column.minValue, column.maxValue, 
column.ndv, dataType);
+    public static StatisticRange from(ColumnStatistic colStats, DataType 
dataType) {
+        return new StatisticRange(colStats.minValue, colStats.minExpr, 
colStats.maxValue, colStats.maxExpr,
+                colStats.ndv, dataType);
     }
 
     public double getLow() {
@@ -107,22 +129,49 @@ public class StatisticRange {
     }
 
     public StatisticRange intersect(StatisticRange other) {
-        double newLow = Math.max(low, other.low);
-        double newHigh = Math.min(high, other.high);
+        Pair<Double, LiteralExpr> biggerLow = maxPair(low, lowExpr, other.low, 
other.lowExpr);
+        double newLow = biggerLow.first;
+        LiteralExpr newLowExpr = biggerLow.second;
+
+        Pair<Double, LiteralExpr> smallerHigh = minPair(high, highExpr, 
other.high, other.highExpr);
+        double newHigh = smallerHigh.first;
+        LiteralExpr newHighExpr = smallerHigh.second;
         if (newLow <= newHigh) {
-            return new StatisticRange(newLow, newHigh, 
overlappingDistinctValues(other), dataType);
+            return new StatisticRange(newLow, newLowExpr, newHigh, newHighExpr,
+                    overlappingDistinctValues(other), dataType);
         }
         return empty(dataType);
     }
 
+    public Pair<Double, LiteralExpr> minPair(double r1, LiteralExpr e1, double 
r2, LiteralExpr e2) {
+        if (r1 < r2) {
+            return Pair.of(r1, e1);
+        }
+        return Pair.of(r2, e2);
+    }
+
+    public Pair<Double, LiteralExpr> maxPair(double r1, LiteralExpr e1, double 
r2, LiteralExpr e2) {
+        if (r1 > r2) {
+            return Pair.of(r1, e1);
+        }
+        return Pair.of(r2, e2);
+    }
+
     public StatisticRange cover(StatisticRange other) {
-        double newLow = Math.max(low, other.low);
-        double newHigh = Math.min(high, other.high);
+        // double newLow = Math.max(low, other.low);
+        // double newHigh = Math.min(high, other.high);
+        Pair<Double, LiteralExpr> biggerLow = maxPair(low, lowExpr, other.low, 
other.lowExpr);
+        double newLow = biggerLow.first;
+        LiteralExpr newLowExpr = biggerLow.second;
+        Pair<Double, LiteralExpr> smallerHigh = minPair(high, highExpr, 
other.high, other.highExpr);
+        double newHigh = smallerHigh.first;
+        LiteralExpr newHighExpr = smallerHigh.second;
+
         if (newLow <= newHigh) {
             double overlapPercentOfLeft = overlapPercentWith(other);
             double overlapDistinctValuesLeft = overlapPercentOfLeft * 
distinctValues;
             double coveredDistinctValues = minExcludeNaN(distinctValues, 
overlapDistinctValuesLeft);
-            return new StatisticRange(newLow, newHigh, coveredDistinctValues, 
dataType);
+            return new StatisticRange(newLow, newLowExpr, newHigh, 
newHighExpr, coveredDistinctValues, dataType);
         }
         return empty(dataType);
     }
@@ -135,7 +184,10 @@ public class StatisticRange {
         double maxOverlapNDV = Math.max(overlapNDVThis, overlapNDVOther);
         double newNDV = maxOverlapNDV + ((1 - overlapPercentThis) * 
distinctValues)
                 + ((1 - overlapPercentOther) * other.distinctValues);
-        return new StatisticRange(Math.min(low, other.low), Math.max(high, 
other.high), newNDV, dataType);
+        Pair<Double, LiteralExpr> smallerMin = minPair(low, lowExpr, 
other.low, other.lowExpr);
+        Pair<Double, LiteralExpr> biggerHigh = maxPair(high, highExpr, 
other.high, other.highExpr);
+        return new StatisticRange(smallerMin.first, smallerMin.second,
+                biggerHigh.first, biggerHigh.second, newNDV, dataType);
     }
 
     private double overlappingDistinctValues(StatisticRange other) {
@@ -173,7 +225,4 @@ public class StatisticRange {
         return distinctValues;
     }
 
-    public static StatisticRange fromColumnStatistics(ColumnStatistic 
columnStatistic, DataType dataType) {
-        return new StatisticRange(columnStatistic.minValue, 
columnStatistic.maxValue, columnStatistic.ndv, dataType);
-    }
 }
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query9.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query9.out
index ba03014643..551b4cb7cf 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query9.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query9.out
@@ -1,7 +1,7 @@
 -- This file is automatically generated. You should know what you did if you 
want to edit this
 -- !ds_shape_9 --
-PhysicalDistribute
---PhysicalProject
+PhysicalProject
+--NestedLoopJoin[CROSS_JOIN]
 ----NestedLoopJoin[CROSS_JOIN]
 ------NestedLoopJoin[CROSS_JOIN]
 --------NestedLoopJoin[CROSS_JOIN]
@@ -15,21 +15,8 @@ PhysicalDistribute
 ------------------------NestedLoopJoin[CROSS_JOIN]
 --------------------------NestedLoopJoin[CROSS_JOIN]
 ----------------------------NestedLoopJoin[CROSS_JOIN]
-------------------------------NestedLoopJoin[CROSS_JOIN]
---------------------------------PhysicalProject
-----------------------------------NestedLoopJoin[CROSS_JOIN]
-------------------------------------PhysicalProject
---------------------------------------filter((reason.r_reason_sk = 1))
-----------------------------------------PhysicalOlapScan[reason]
-------------------------------------PhysicalDistribute
---------------------------------------PhysicalAssertNumRows
-----------------------------------------hashAgg[GLOBAL]
-------------------------------------------PhysicalDistribute
---------------------------------------------hashAgg[LOCAL]
-----------------------------------------------PhysicalProject
-------------------------------------------------filter((store_sales.ss_quantity
 <= 20)(store_sales.ss_quantity >= 1))
---------------------------------------------------PhysicalOlapScan[store_sales]
---------------------------------PhysicalDistribute
+------------------------------PhysicalProject
+--------------------------------NestedLoopJoin[CROSS_JOIN]
 ----------------------------------PhysicalAssertNumRows
 ------------------------------------hashAgg[GLOBAL]
 --------------------------------------PhysicalDistribute
@@ -37,6 +24,10 @@ PhysicalDistribute
 ------------------------------------------PhysicalProject
 --------------------------------------------filter((store_sales.ss_quantity <= 
20)(store_sales.ss_quantity >= 1))
 ----------------------------------------------PhysicalOlapScan[store_sales]
+----------------------------------PhysicalDistribute
+------------------------------------PhysicalProject
+--------------------------------------filter((reason.r_reason_sk = 1))
+----------------------------------------PhysicalOlapScan[reason]
 ------------------------------PhysicalDistribute
 --------------------------------PhysicalAssertNumRows
 ----------------------------------hashAgg[GLOBAL]
@@ -51,7 +42,7 @@ PhysicalDistribute
 ----------------------------------PhysicalDistribute
 ------------------------------------hashAgg[LOCAL]
 --------------------------------------PhysicalProject
-----------------------------------------filter((store_sales.ss_quantity >= 
21)(store_sales.ss_quantity <= 40))
+----------------------------------------filter((store_sales.ss_quantity <= 
20)(store_sales.ss_quantity >= 1))
 ------------------------------------------PhysicalOlapScan[store_sales]
 --------------------------PhysicalDistribute
 ----------------------------PhysicalAssertNumRows
@@ -59,7 +50,7 @@ PhysicalDistribute
 --------------------------------PhysicalDistribute
 ----------------------------------hashAgg[LOCAL]
 ------------------------------------PhysicalProject
---------------------------------------filter((store_sales.ss_quantity <= 
40)(store_sales.ss_quantity >= 21))
+--------------------------------------filter((store_sales.ss_quantity >= 
21)(store_sales.ss_quantity <= 40))
 ----------------------------------------PhysicalOlapScan[store_sales]
 ------------------------PhysicalDistribute
 --------------------------PhysicalAssertNumRows
@@ -67,7 +58,7 @@ PhysicalDistribute
 ------------------------------PhysicalDistribute
 --------------------------------hashAgg[LOCAL]
 ----------------------------------PhysicalProject
-------------------------------------filter((store_sales.ss_quantity >= 
21)(store_sales.ss_quantity <= 40))
+------------------------------------filter((store_sales.ss_quantity <= 
40)(store_sales.ss_quantity >= 21))
 --------------------------------------PhysicalOlapScan[store_sales]
 ----------------------PhysicalDistribute
 ------------------------PhysicalAssertNumRows
@@ -75,7 +66,7 @@ PhysicalDistribute
 ----------------------------PhysicalDistribute
 ------------------------------hashAgg[LOCAL]
 --------------------------------PhysicalProject
-----------------------------------filter((store_sales.ss_quantity <= 
60)(store_sales.ss_quantity >= 41))
+----------------------------------filter((store_sales.ss_quantity >= 
21)(store_sales.ss_quantity <= 40))
 ------------------------------------PhysicalOlapScan[store_sales]
 --------------------PhysicalDistribute
 ----------------------PhysicalAssertNumRows
@@ -99,7 +90,7 @@ PhysicalDistribute
 ----------------------PhysicalDistribute
 ------------------------hashAgg[LOCAL]
 --------------------------PhysicalProject
-----------------------------filter((store_sales.ss_quantity <= 
80)(store_sales.ss_quantity >= 61))
+----------------------------filter((store_sales.ss_quantity <= 
60)(store_sales.ss_quantity >= 41))
 ------------------------------PhysicalOlapScan[store_sales]
 --------------PhysicalDistribute
 ----------------PhysicalAssertNumRows
@@ -107,7 +98,7 @@ PhysicalDistribute
 --------------------PhysicalDistribute
 ----------------------hashAgg[LOCAL]
 ------------------------PhysicalProject
---------------------------filter((store_sales.ss_quantity >= 
61)(store_sales.ss_quantity <= 80))
+--------------------------filter((store_sales.ss_quantity <= 
80)(store_sales.ss_quantity >= 61))
 ----------------------------PhysicalOlapScan[store_sales]
 ------------PhysicalDistribute
 --------------PhysicalAssertNumRows
@@ -115,7 +106,7 @@ PhysicalDistribute
 ------------------PhysicalDistribute
 --------------------hashAgg[LOCAL]
 ----------------------PhysicalProject
-------------------------filter((store_sales.ss_quantity <= 
80)(store_sales.ss_quantity >= 61))
+------------------------filter((store_sales.ss_quantity >= 
61)(store_sales.ss_quantity <= 80))
 --------------------------PhysicalOlapScan[store_sales]
 ----------PhysicalDistribute
 ------------PhysicalAssertNumRows
@@ -123,7 +114,7 @@ PhysicalDistribute
 ----------------PhysicalDistribute
 ------------------hashAgg[LOCAL]
 --------------------PhysicalProject
-----------------------filter((store_sales.ss_quantity >= 
81)(store_sales.ss_quantity <= 100))
+----------------------filter((store_sales.ss_quantity <= 
80)(store_sales.ss_quantity >= 61))
 ------------------------PhysicalOlapScan[store_sales]
 --------PhysicalDistribute
 ----------PhysicalAssertNumRows
@@ -131,7 +122,7 @@ PhysicalDistribute
 --------------PhysicalDistribute
 ----------------hashAgg[LOCAL]
 ------------------PhysicalProject
---------------------filter((store_sales.ss_quantity <= 
100)(store_sales.ss_quantity >= 81))
+--------------------filter((store_sales.ss_quantity >= 
81)(store_sales.ss_quantity <= 100))
 ----------------------PhysicalOlapScan[store_sales]
 ------PhysicalDistribute
 --------PhysicalAssertNumRows
@@ -139,6 +130,14 @@ PhysicalDistribute
 ------------PhysicalDistribute
 --------------hashAgg[LOCAL]
 ----------------PhysicalProject
-------------------filter((store_sales.ss_quantity >= 
81)(store_sales.ss_quantity <= 100))
+------------------filter((store_sales.ss_quantity <= 
100)(store_sales.ss_quantity >= 81))
 --------------------PhysicalOlapScan[store_sales]
+----PhysicalDistribute
+------PhysicalAssertNumRows
+--------hashAgg[GLOBAL]
+----------PhysicalDistribute
+------------hashAgg[LOCAL]
+--------------PhysicalProject
+----------------filter((store_sales.ss_quantity >= 81)(store_sales.ss_quantity 
<= 100))
+------------------PhysicalOlapScan[store_sales]
 


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

Reply via email to