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 1bd153027ac [fix](Nereids) adjust min/max stats for cast function if 
types are comparable (#28166)
1bd153027ac is described below

commit 1bd153027acc5a373d9ab7980315b86ea04a326c
Author: minghong <engle...@gmail.com>
AuthorDate: Fri Jan 12 20:38:13 2024 +0800

    [fix](Nereids) adjust min/max stats for cast function if types are 
comparable (#28166)
    
    estimate column stats for "cast(col, XXXType)"
    
    -----cast-est------
    query4 41169 40335 40267 40267
    query58 463 361 401 361
    Total cold run time: 41632 ms
    Total hot run time: 40628 ms
    
    ----master------
    query4 40624 40180 40299 40180
    query58 487 389 420 389
    Total cold run time: 41111 ms
    Total hot run time: 40569 ms
---
 .../org/apache/doris/analysis/DecimalLiteral.java  |   2 +-
 .../org/apache/doris/analysis/FloatLiteral.java    |   2 +-
 .../java/org/apache/doris/analysis/IntLiteral.java |   2 +-
 .../org/apache/doris/analysis/LargeIntLiteral.java |   2 +-
 .../NumericLiteralExpr.java}                       |  29 ++---
 .../doris/nereids/stats/ExpressionEstimation.java  |  64 ++++++-----
 .../trees/expressions/literal/DecimalLiteral.java  |   2 +-
 .../expressions/literal/DecimalV3Literal.java      |   2 +-
 .../trees/expressions/literal/DoubleLiteral.java   |   2 +-
 .../trees/expressions/literal/FloatLiteral.java    |   2 +-
 ...egerLikeLiteral.java => FractionalLiteral.java} |  20 ++--
 .../expressions/literal/IntegerLikeLiteral.java    |   2 +-
 ...IntegerLikeLiteral.java => NumericLiteral.java} |  20 ++--
 .../nereids/stats/ExpressionEstimationTest.java    |  71 +++++++++++++
 .../doris/nereids/stats/FilterEstimationTest.java  |   4 +-
 .../nereids_tpcds_shape_sf1000_p0/shape/query4.out |  16 +--
 .../shape/query58.out                              | 117 ++++++++++-----------
 .../rf_prune/query4.out                            |  16 +--
 .../rf_prune/query58.out                           |  12 +--
 .../nereids_tpcds_shape_sf100_p0/shape/query4.out  |  16 +--
 .../nereids_tpcds_shape_sf100_p0/shape/query58.out |  12 +--
 21 files changed, 238 insertions(+), 177 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/DecimalLiteral.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/DecimalLiteral.java
index 50749b46c29..19389a6f2ea 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DecimalLiteral.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DecimalLiteral.java
@@ -42,7 +42,7 @@ import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.util.Objects;
 
-public class DecimalLiteral extends LiteralExpr {
+public class DecimalLiteral extends NumericLiteralExpr {
     private static final Logger LOG = 
LogManager.getLogger(DecimalLiteral.class);
     private BigDecimal value;
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/FloatLiteral.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/FloatLiteral.java
index b95b3860aa5..1fba4edfb90 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/FloatLiteral.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/FloatLiteral.java
@@ -35,7 +35,7 @@ import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.text.NumberFormat;
 
-public class FloatLiteral extends LiteralExpr {
+public class FloatLiteral extends NumericLiteralExpr {
     private double value;
 
     public FloatLiteral() {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/IntLiteral.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/IntLiteral.java
index f122d1edc40..e348c0be542 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/IntLiteral.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/IntLiteral.java
@@ -37,7 +37,7 @@ import java.math.BigDecimal;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 
-public class IntLiteral extends LiteralExpr {
+public class IntLiteral extends NumericLiteralExpr {
     private static final Logger LOG = LogManager.getLogger(IntLiteral.class);
 
     public static final long TINY_INT_MIN = Byte.MIN_VALUE; // -2^7 ~ 2^7 - 1
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/LargeIntLiteral.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/LargeIntLiteral.java
index c284b963d52..6e8cd3ed2e0 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/LargeIntLiteral.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/LargeIntLiteral.java
@@ -38,7 +38,7 @@ import java.nio.ByteOrder;
 import java.util.Objects;
 
 // large int for the num that native types can not
-public class LargeIntLiteral extends LiteralExpr {
+public class LargeIntLiteral extends NumericLiteralExpr {
     private static final Logger LOG = 
LogManager.getLogger(LargeIntLiteral.class);
 
     // -2^127
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/IntegerLikeLiteral.java
 b/fe/fe-core/src/main/java/org/apache/doris/analysis/NumericLiteralExpr.java
similarity index 59%
copy from 
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/IntegerLikeLiteral.java
copy to 
fe/fe-core/src/main/java/org/apache/doris/analysis/NumericLiteralExpr.java
index 9f8a08a00f5..31cde22078f 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/IntegerLikeLiteral.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/NumericLiteralExpr.java
@@ -14,29 +14,18 @@
 // KIND, either express or implied.  See the License for the
 // specific language governing permissions and limitations
 // under the License.
+// This file is copied from
+// 
https://github.com/apache/impala/blob/branch-2.9.0/fe/src/main/java/org/apache/impala/LiteralExpr.java
+// and modified by Doris
 
-package org.apache.doris.nereids.trees.expressions.literal;
+package org.apache.doris.analysis;
 
-import org.apache.doris.nereids.types.DataType;
-
-/** IntegralLiteral */
-public abstract class IntegerLikeLiteral extends Literal {
-    /**
-     * Constructor for Literal.
-     *
-     * @param dataType logical data type in Nereids
-     */
-    public IntegerLikeLiteral(DataType dataType) {
-        super(dataType);
-    }
-
-    public int getIntValue() {
-        return getNumber().intValue();
+public abstract class NumericLiteralExpr extends LiteralExpr {
+    public NumericLiteralExpr() {
+        super();
     }
 
-    public long getLongValue() {
-        return getNumber().longValue();
+    public NumericLiteralExpr(NumericLiteralExpr other) {
+        super(other);
     }
-
-    public abstract Number getNumber();
 }
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 f82f509ba02..acf6bddfe57 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
@@ -18,6 +18,7 @@
 package org.apache.doris.nereids.stats;
 
 import org.apache.doris.analysis.ArithmeticExpr.Operator;
+import org.apache.doris.analysis.NumericLiteralExpr;
 import org.apache.doris.analysis.StringLiteral;
 import org.apache.doris.nereids.exceptions.AnalysisException;
 import org.apache.doris.nereids.trees.expressions.Add;
@@ -169,35 +170,50 @@ public class ExpressionEstimation extends 
ExpressionVisitor<ColumnStatistic, Sta
     }
 
     private ColumnStatistic castMinMax(ColumnStatistic colStats, DataType 
targetType) {
-        if (colStats.minExpr instanceof StringLiteral || colStats.maxExpr 
instanceof StringLiteral) {
-            if (targetType.isDateLikeType()) {
-                ColumnStatisticBuilder builder = new 
ColumnStatisticBuilder(colStats);
-                if (colStats.minExpr != null) {
-                    try {
-                        String strMin = colStats.minExpr.getStringValue();
-                        DateLiteral dateMinLiteral = new DateLiteral(strMin);
-                        long min = dateMinLiteral.getValue();
-                        builder.setMinValue(min);
-                        builder.setMinExpr(dateMinLiteral.toLegacyLiteral());
-                    } catch (AnalysisException e) {
-                        // ignore exception. do not convert min
-                    }
+        // cast str to date/datetime
+        if (colStats.minExpr instanceof StringLiteral
+                && colStats.maxExpr instanceof StringLiteral
+                && targetType.isDateLikeType()) {
+            boolean convertSuccess = true;
+            ColumnStatisticBuilder builder = new 
ColumnStatisticBuilder(colStats);
+            if (colStats.minExpr != null) {
+                try {
+                    String strMin = colStats.minExpr.getStringValue();
+                    DateLiteral dateMinLiteral = new DateLiteral(strMin);
+                    long min = dateMinLiteral.getValue();
+                    builder.setMinValue(min);
+                    builder.setMinExpr(dateMinLiteral.toLegacyLiteral());
+                } catch (AnalysisException e) {
+                    convertSuccess = false;
                 }
-                if (colStats.maxExpr != null) {
-                    try {
-                        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 max
-                    }
+            }
+            if (convertSuccess && colStats.maxExpr != null) {
+                try {
+                    String strMax = colStats.maxExpr.getStringValue();
+                    DateLiteral dateMaxLiteral = new DateLiteral(strMax);
+                    long max = dateMaxLiteral.getValue();
+                    builder.setMaxValue(max);
+                    builder.setMaxExpr(dateMaxLiteral.toLegacyLiteral());
+                } catch (AnalysisException e) {
+                    convertSuccess = false;
                 }
+            }
+            if (convertSuccess) {
                 return builder.build();
             }
         }
-        return colStats;
+        // cast numeric to numeric
+        if (colStats.minExpr instanceof NumericLiteralExpr && colStats.maxExpr 
instanceof NumericLiteralExpr) {
+            if (targetType.isNumericType()) {
+                return colStats;
+            }
+        }
+
+        // cast other date types, set min/max infinity
+        ColumnStatisticBuilder builder = new ColumnStatisticBuilder(colStats);
+        builder.setMinExpr(null).setMinValue(Double.NEGATIVE_INFINITY)
+                .setMaxExpr(null).setMaxValue(Double.POSITIVE_INFINITY);
+        return builder.build();
     }
 
     @Override
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DecimalLiteral.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DecimalLiteral.java
index 03973fe6b03..84b8f07a94a 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DecimalLiteral.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DecimalLiteral.java
@@ -31,7 +31,7 @@ import java.util.Objects;
 /**
  * decimal type literal
  */
-public class DecimalLiteral extends Literal {
+public class DecimalLiteral extends FractionalLiteral {
 
     private final BigDecimal value;
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DecimalV3Literal.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DecimalV3Literal.java
index 2a10196e056..33bf5773165 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DecimalV3Literal.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DecimalV3Literal.java
@@ -31,7 +31,7 @@ import java.util.Objects;
 /**
  * Literal for DecimalV3 Type
  */
-public class DecimalV3Literal extends Literal {
+public class DecimalV3Literal extends FractionalLiteral {
 
     private final BigDecimal value;
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DoubleLiteral.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DoubleLiteral.java
index 34b8ca36fbc..bc7b356c376 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DoubleLiteral.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DoubleLiteral.java
@@ -26,7 +26,7 @@ import org.apache.doris.nereids.types.DoubleType;
 /**
  * Double literal
  */
-public class DoubleLiteral extends Literal {
+public class DoubleLiteral extends FractionalLiteral {
 
     private final double value;
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/FloatLiteral.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/FloatLiteral.java
index 4fff7445efa..55d9c98e2da 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/FloatLiteral.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/FloatLiteral.java
@@ -25,7 +25,7 @@ import org.apache.doris.nereids.types.FloatType;
 /**
  * float type literal
  */
-public class FloatLiteral extends Literal {
+public class FloatLiteral extends FractionalLiteral {
 
     private final float value;
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/IntegerLikeLiteral.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/FractionalLiteral.java
similarity index 73%
copy from 
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/IntegerLikeLiteral.java
copy to 
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/FractionalLiteral.java
index 9f8a08a00f5..ac63225dc3b 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/IntegerLikeLiteral.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/FractionalLiteral.java
@@ -19,24 +19,16 @@ package org.apache.doris.nereids.trees.expressions.literal;
 
 import org.apache.doris.nereids.types.DataType;
 
-/** IntegralLiteral */
-public abstract class IntegerLikeLiteral extends Literal {
+/**
+ * float/double/decimal
+ */
+public abstract class FractionalLiteral extends NumericLiteral {
     /**
-     * Constructor for Literal.
+     * Constructor for FractionalLiteral.
      *
      * @param dataType logical data type in Nereids
      */
-    public IntegerLikeLiteral(DataType dataType) {
+    public FractionalLiteral(DataType dataType) {
         super(dataType);
     }
-
-    public int getIntValue() {
-        return getNumber().intValue();
-    }
-
-    public long getLongValue() {
-        return getNumber().longValue();
-    }
-
-    public abstract Number getNumber();
 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/IntegerLikeLiteral.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/IntegerLikeLiteral.java
index 9f8a08a00f5..54456bd9493 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/IntegerLikeLiteral.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/IntegerLikeLiteral.java
@@ -20,7 +20,7 @@ package org.apache.doris.nereids.trees.expressions.literal;
 import org.apache.doris.nereids.types.DataType;
 
 /** IntegralLiteral */
-public abstract class IntegerLikeLiteral extends Literal {
+public abstract class IntegerLikeLiteral extends NumericLiteral {
     /**
      * Constructor for Literal.
      *
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/IntegerLikeLiteral.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/NumericLiteral.java
similarity index 73%
copy from 
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/IntegerLikeLiteral.java
copy to 
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/NumericLiteral.java
index 9f8a08a00f5..93b03e4fafa 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/IntegerLikeLiteral.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/NumericLiteral.java
@@ -19,24 +19,16 @@ package org.apache.doris.nereids.trees.expressions.literal;
 
 import org.apache.doris.nereids.types.DataType;
 
-/** IntegralLiteral */
-public abstract class IntegerLikeLiteral extends Literal {
+/**
+ * numeric literal
+ */
+public abstract class NumericLiteral extends Literal {
     /**
-     * Constructor for Literal.
+     * Constructor for NumericLiteral.
      *
      * @param dataType logical data type in Nereids
      */
-    public IntegerLikeLiteral(DataType dataType) {
+    public NumericLiteral(DataType dataType) {
         super(dataType);
     }
-
-    public int getIntValue() {
-        return getNumber().intValue();
-    }
-
-    public long getLongValue() {
-        return getNumber().longValue();
-    }
-
-    public abstract Number getNumber();
 }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/stats/ExpressionEstimationTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/stats/ExpressionEstimationTest.java
index b55b266faff..7368735365c 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/stats/ExpressionEstimationTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/stats/ExpressionEstimationTest.java
@@ -17,7 +17,10 @@
 
 package org.apache.doris.nereids.stats;
 
+import org.apache.doris.analysis.DateLiteral;
+import org.apache.doris.analysis.StringLiteral;
 import org.apache.doris.nereids.trees.expressions.Add;
+import org.apache.doris.nereids.trees.expressions.Cast;
 import org.apache.doris.nereids.trees.expressions.Divide;
 import org.apache.doris.nereids.trees.expressions.Expression;
 import org.apache.doris.nereids.trees.expressions.Multiply;
@@ -25,7 +28,10 @@ import 
org.apache.doris.nereids.trees.expressions.SlotReference;
 import org.apache.doris.nereids.trees.expressions.Subtract;
 import org.apache.doris.nereids.trees.expressions.functions.agg.Max;
 import org.apache.doris.nereids.trees.expressions.functions.agg.Min;
+import org.apache.doris.nereids.types.DateType;
+import org.apache.doris.nereids.types.DoubleType;
 import org.apache.doris.nereids.types.IntegerType;
+import org.apache.doris.nereids.types.StringType;
 import org.apache.doris.statistics.ColumnStatistic;
 import org.apache.doris.statistics.ColumnStatisticBuilder;
 import org.apache.doris.statistics.Statistics;
@@ -250,4 +256,69 @@ class ExpressionEstimationTest {
         Assertions.assertTrue(Precision.equals(0.1, estimated.minValue, 
0.001));
         Assertions.assertEquals(2, estimated.maxValue);
     }
+
+    // cast(str to double) = double
+    @Test
+    public void testCastStrToDouble() {
+        SlotReference a = new SlotReference("a", StringType.INSTANCE);
+        Map<Expression, ColumnStatistic> slotToColumnStat = new HashMap<>();
+        ColumnStatisticBuilder builder = new ColumnStatisticBuilder()
+                .setNdv(100)
+                .setMinExpr(new StringLiteral("01"))
+                .setMinValue(13333333)
+                .setMaxExpr(new StringLiteral("A9"))
+                .setMaxValue(23333333);
+        slotToColumnStat.put(a, builder.build());
+        Statistics stats = new Statistics(1000, slotToColumnStat);
+        Cast cast = new Cast(a, DoubleType.INSTANCE);
+        ColumnStatistic est = ExpressionEstimation.estimate(cast, stats);
+        Assertions.assertTrue(Double.isInfinite(est.minValue));
+        Assertions.assertTrue(Double.isInfinite(est.maxValue));
+        Assertions.assertNull(est.minExpr);
+        Assertions.assertNull(est.maxExpr);
+    }
+
+    // cast(str to date) = date
+    // both min and max can be converted to date
+    @Test
+    public void testCastStrToDateSuccess() {
+        SlotReference a = new SlotReference("a", StringType.INSTANCE);
+        Map<Expression, ColumnStatistic> slotToColumnStat = new HashMap<>();
+        ColumnStatisticBuilder builder = new ColumnStatisticBuilder()
+                .setNdv(100)
+                .setMinExpr(new StringLiteral("2020-01-01"))
+                .setMinValue(20200101000000.0)
+                .setMaxExpr(new StringLiteral("2021-01-01"))
+                .setMaxValue(20210101000000.0);
+        slotToColumnStat.put(a, builder.build());
+        Statistics stats = new Statistics(1000, slotToColumnStat);
+        Cast cast = new Cast(a, DateType.INSTANCE);
+        ColumnStatistic est = ExpressionEstimation.estimate(cast, stats);
+        Assertions.assertTrue(est.minExpr instanceof DateLiteral);
+        Assertions.assertTrue(est.maxExpr instanceof DateLiteral);
+        Assertions.assertEquals(est.minValue, 20200101000000.0);
+        Assertions.assertEquals(est.maxValue, 20210101000000.0);
+    }
+
+    // cast(str to date) = date
+    // min or max cannot be converted to date
+    @Test
+    public void testCastStrToDateFail() {
+        SlotReference a = new SlotReference("a", StringType.INSTANCE);
+        Map<Expression, ColumnStatistic> slotToColumnStat = new HashMap<>();
+        ColumnStatisticBuilder builder = new ColumnStatisticBuilder()
+                .setNdv(100)
+                .setMinExpr(new StringLiteral("2020-01-01"))
+                .setMinValue(20200101000000.0)
+                .setMaxExpr(new StringLiteral("2021abcdefg"))
+                .setMaxValue(20210101000000.0);
+        slotToColumnStat.put(a, builder.build());
+        Statistics stats = new Statistics(1000, slotToColumnStat);
+        Cast cast = new Cast(a, DateType.INSTANCE);
+        ColumnStatistic est = ExpressionEstimation.estimate(cast, stats);
+        Assertions.assertTrue(Double.isInfinite(est.minValue));
+        Assertions.assertTrue(Double.isInfinite(est.maxValue));
+        Assertions.assertNull(est.minExpr);
+        Assertions.assertNull(est.maxExpr);
+    }
 }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/stats/FilterEstimationTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/stats/FilterEstimationTest.java
index b476cc563be..7bad73801a0 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/stats/FilterEstimationTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/stats/FilterEstimationTest.java
@@ -835,7 +835,9 @@ class FilterEstimationTest {
                 .setNdv(100)
                 .setAvgSizeByte(4)
                 .setNumNulls(0)
+                .setMaxExpr(new IntLiteral(100))
                 .setMaxValue(100)
+                .setMinExpr(new IntLiteral(0))
                 .setMinValue(0)
                 .setCount(100);
         DoubleLiteral begin = new DoubleLiteral(40.0);
@@ -847,7 +849,7 @@ class FilterEstimationTest {
         stats.addColumnStats(a, builder.build());
         FilterEstimation filterEstimation = new FilterEstimation();
         Statistics result = filterEstimation.estimate(and, stats);
-        Assertions.assertEquals(result.getRowCount(), 10, 0.01);
+        Assertions.assertEquals(10, result.getRowCount(), 0.01);
         ColumnStatistic colStats = result.findColumnStatistics(a);
         Assertions.assertTrue(colStats != null);
         Assertions.assertEquals(10, colStats.ndv, 0.1);
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query4.out 
b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query4.out
index e40a7c0ebe7..678e8bf71ab 100644
--- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query4.out
+++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query4.out
@@ -67,18 +67,18 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
 ----------------------PhysicalProject
 ------------------------filter((t_c_firstyear.dyear = 1999) and 
(t_c_firstyear.sale_type = 'c') and (t_c_firstyear.year_total > 0.000000))
 --------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
---------------------hashJoin[INNER_JOIN] 
hashCondition=((t_s_secyear.customer_id = t_s_firstyear.customer_id)) 
otherCondition=()
-----------------------PhysicalDistribute[DistributionSpecHash]
-------------------------PhysicalProject
---------------------------filter((t_s_secyear.dyear = 2000) and 
(t_s_secyear.sale_type = 's'))
-----------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
-----------------------hashJoin[INNER_JOIN] 
hashCondition=((t_s_firstyear.customer_id = t_c_secyear.customer_id)) 
otherCondition=()
+--------------------hashJoin[INNER_JOIN] 
hashCondition=((t_s_firstyear.customer_id = t_c_secyear.customer_id)) 
otherCondition=()
+----------------------hashJoin[INNER_JOIN] 
hashCondition=((t_s_secyear.customer_id = t_s_firstyear.customer_id)) 
otherCondition=()
 ------------------------PhysicalDistribute[DistributionSpecHash]
 --------------------------PhysicalProject
-----------------------------filter((t_c_secyear.dyear = 2000) and 
(t_c_secyear.sale_type = 'c'))
+----------------------------filter((t_s_firstyear.dyear = 1999) and 
(t_s_firstyear.sale_type = 's') and (t_s_firstyear.year_total > 0.000000))
 ------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
 ------------------------PhysicalDistribute[DistributionSpecHash]
 --------------------------PhysicalProject
-----------------------------filter((t_s_firstyear.dyear = 1999) and 
(t_s_firstyear.sale_type = 's') and (t_s_firstyear.year_total > 0.000000))
+----------------------------filter((t_s_secyear.dyear = 2000) and 
(t_s_secyear.sale_type = 's'))
 ------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+----------------------PhysicalDistribute[DistributionSpecHash]
+------------------------PhysicalProject
+--------------------------filter((t_c_secyear.dyear = 2000) and 
(t_c_secyear.sale_type = 'c'))
+----------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
 
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query58.out 
b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query58.out
index c18a9cf8681..6a846c34d21 100644
--- a/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query58.out
+++ b/regression-test/data/nereids_tpcds_shape_sf1000_p0/shape/query58.out
@@ -6,17 +6,17 @@ PhysicalResultSink
 ------PhysicalDistribute[DistributionSpecGather]
 --------PhysicalTopN[LOCAL_SORT]
 ----------PhysicalProject
-------------hashJoin[INNER_JOIN] hashCondition=((ss_items.item_id = 
ws_items.item_id)) otherCondition=((cast(cs_item_rev as DOUBLE) <= cast((1.1 * 
ws_item_rev) as DOUBLE)) and (cast(cs_item_rev as DOUBLE) >= cast((0.9 * 
ws_item_rev) as DOUBLE)) and (cast(ss_item_rev as DOUBLE) <= cast((1.1 * 
ws_item_rev) as DOUBLE)) and (cast(ss_item_rev as DOUBLE) >= cast((0.9 * 
ws_item_rev) as DOUBLE)) and (cast(ws_item_rev as DOUBLE) <= cast((1.1 * 
cs_item_rev) as DOUBLE)) and (cast(ws_item_rev as DOU [...]
+------------hashJoin[INNER_JOIN] hashCondition=((ss_items.item_id = 
cs_items.item_id)) otherCondition=((cast(cs_item_rev as DOUBLE) <= cast((1.1 * 
ss_item_rev) as DOUBLE)) and (cast(cs_item_rev as DOUBLE) <= cast((1.1 * 
ws_item_rev) as DOUBLE)) and (cast(cs_item_rev as DOUBLE) >= cast((0.9 * 
ss_item_rev) as DOUBLE)) and (cast(cs_item_rev as DOUBLE) >= cast((0.9 * 
ws_item_rev) as DOUBLE)) and (cast(ss_item_rev as DOUBLE) <= cast((1.1 * 
cs_item_rev) as DOUBLE)) and (cast(ss_item_rev as DOU [...]
 --------------PhysicalProject
 ----------------hashAgg[GLOBAL]
 ------------------PhysicalDistribute[DistributionSpecHash]
 --------------------hashAgg[LOCAL]
 ----------------------PhysicalProject
-------------------------hashJoin[INNER_JOIN] 
hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build 
RFs:RF12 i_item_sk->[ws_item_sk]
+------------------------hashJoin[INNER_JOIN] 
hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() 
build RFs:RF12 i_item_sk->[cs_item_sk]
 --------------------------PhysicalDistribute[DistributionSpecHash]
-----------------------------hashJoin[INNER_JOIN] 
hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF11 d_date_sk->[ws_sold_date_sk]
+----------------------------hashJoin[INNER_JOIN] 
hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF11 d_date_sk->[cs_sold_date_sk]
 ------------------------------PhysicalProject
---------------------------------PhysicalOlapScan[web_sales] apply RFs: RF11 
RF12
+--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: 
RF11 RF12
 ------------------------------PhysicalDistribute[DistributionSpecReplicated]
 --------------------------------PhysicalProject
 ----------------------------------hashJoin[LEFT_SEMI_JOIN] 
hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build 
RFs:RF10 d_date->[d_date]
@@ -36,64 +36,63 @@ PhysicalResultSink
 --------------------------PhysicalDistribute[DistributionSpecHash]
 ----------------------------PhysicalProject
 ------------------------------PhysicalOlapScan[item] apply RFs: RF13
---------------PhysicalProject
-----------------hashJoin[INNER_JOIN] hashCondition=((ss_items.item_id = 
cs_items.item_id)) otherCondition=((cast(cs_item_rev as DOUBLE) <= cast((1.1 * 
ss_item_rev) as DOUBLE)) and (cast(cs_item_rev as DOUBLE) >= cast((0.9 * 
ss_item_rev) as DOUBLE)) and (cast(ss_item_rev as DOUBLE) <= cast((1.1 * 
cs_item_rev) as DOUBLE)) and (cast(ss_item_rev as DOUBLE) >= cast((0.9 * 
cs_item_rev) as DOUBLE))) build RFs:RF8 item_id->[i_item_id]
-------------------PhysicalProject
---------------------hashAgg[GLOBAL]
-----------------------PhysicalDistribute[DistributionSpecHash]
-------------------------hashAgg[LOCAL]
---------------------------PhysicalProject
-----------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() 
build RFs:RF7 i_item_sk->[ss_item_sk]
-------------------------------PhysicalDistribute[DistributionSpecHash]
---------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF6 d_date_sk->[ss_sold_date_sk]
+--------------hashJoin[INNER_JOIN] hashCondition=((ss_items.item_id = 
ws_items.item_id)) otherCondition=((cast(ss_item_rev as DOUBLE) <= cast((1.1 * 
ws_item_rev) as DOUBLE)) and (cast(ss_item_rev as DOUBLE) >= cast((0.9 * 
ws_item_rev) as DOUBLE)) and (cast(ws_item_rev as DOUBLE) <= cast((1.1 * 
ss_item_rev) as DOUBLE)) and (cast(ws_item_rev as DOUBLE) >= cast((0.9 * 
ss_item_rev) as DOUBLE))) build RFs:RF8 item_id->[i_item_id]
+----------------PhysicalProject
+------------------hashAgg[GLOBAL]
+--------------------PhysicalDistribute[DistributionSpecHash]
+----------------------hashAgg[LOCAL]
+------------------------PhysicalProject
+--------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() 
build RFs:RF7 i_item_sk->[ss_item_sk]
+----------------------------PhysicalDistribute[DistributionSpecHash]
+------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF6 d_date_sk->[ss_sold_date_sk]
+--------------------------------PhysicalProject
+----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF6 
RF7
+--------------------------------PhysicalDistribute[DistributionSpecReplicated]
 ----------------------------------PhysicalProject
-------------------------------------PhysicalOlapScan[store_sales] apply RFs: 
RF6 RF7
-----------------------------------PhysicalDistribute[DistributionSpecReplicated]
-------------------------------------PhysicalProject
---------------------------------------hashJoin[LEFT_SEMI_JOIN] 
hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build 
RFs:RF5 d_date->[d_date]
+------------------------------------hashJoin[LEFT_SEMI_JOIN] 
hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build 
RFs:RF5 d_date->[d_date]
+--------------------------------------PhysicalProject
+----------------------------------------PhysicalOlapScan[date_dim] apply RFs: 
RF5
+--------------------------------------PhysicalDistribute[DistributionSpecReplicated]
 ----------------------------------------PhysicalProject
-------------------------------------------PhysicalOlapScan[date_dim] apply 
RFs: RF5
-----------------------------------------PhysicalDistribute[DistributionSpecReplicated]
-------------------------------------------PhysicalProject
---------------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((date_dim.d_week_seq = date_dim.d_week_seq)) otherCondition=() 
build RFs:RF4 d_week_seq->[d_week_seq]
-----------------------------------------------PhysicalProject
-------------------------------------------------PhysicalOlapScan[date_dim] 
apply RFs: RF4
-----------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
-------------------------------------------------PhysicalAssertNumRows
---------------------------------------------------PhysicalDistribute[DistributionSpecGather]
-----------------------------------------------------PhysicalProject
-------------------------------------------------------filter((date_dim.d_date 
= '2001-06-16'))
---------------------------------------------------------PhysicalOlapScan[date_dim]
-------------------------------PhysicalDistribute[DistributionSpecHash]
+------------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((date_dim.d_week_seq = date_dim.d_week_seq)) otherCondition=() 
build RFs:RF4 d_week_seq->[d_week_seq]
+--------------------------------------------PhysicalProject
+----------------------------------------------PhysicalOlapScan[date_dim] apply 
RFs: RF4
+--------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+----------------------------------------------PhysicalAssertNumRows
+------------------------------------------------PhysicalDistribute[DistributionSpecGather]
+--------------------------------------------------PhysicalProject
+----------------------------------------------------filter((date_dim.d_date = 
'2001-06-16'))
+------------------------------------------------------PhysicalOlapScan[date_dim]
+----------------------------PhysicalDistribute[DistributionSpecHash]
+------------------------------PhysicalProject
+--------------------------------PhysicalOlapScan[item] apply RFs: RF8
+----------------PhysicalProject
+------------------hashAgg[GLOBAL]
+--------------------PhysicalDistribute[DistributionSpecHash]
+----------------------hashAgg[LOCAL]
+------------------------PhysicalProject
+--------------------------hashJoin[INNER_JOIN] 
hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build 
RFs:RF3 i_item_sk->[ws_item_sk]
+----------------------------PhysicalDistribute[DistributionSpecHash]
+------------------------------hashJoin[INNER_JOIN] 
hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF2 d_date_sk->[ws_sold_date_sk]
 --------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[item] apply RFs: RF8
-------------------PhysicalProject
---------------------hashAgg[GLOBAL]
-----------------------PhysicalDistribute[DistributionSpecHash]
-------------------------hashAgg[LOCAL]
---------------------------PhysicalProject
-----------------------------hashJoin[INNER_JOIN] 
hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() 
build RFs:RF3 i_item_sk->[cs_item_sk]
-------------------------------PhysicalDistribute[DistributionSpecHash]
---------------------------------hashJoin[INNER_JOIN] 
hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF2 d_date_sk->[cs_sold_date_sk]
+----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 
RF3
+--------------------------------PhysicalDistribute[DistributionSpecReplicated]
 ----------------------------------PhysicalProject
-------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: 
RF2 RF3
-----------------------------------PhysicalDistribute[DistributionSpecReplicated]
-------------------------------------PhysicalProject
---------------------------------------hashJoin[LEFT_SEMI_JOIN] 
hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build 
RFs:RF1 d_date->[d_date]
+------------------------------------hashJoin[LEFT_SEMI_JOIN] 
hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build 
RFs:RF1 d_date->[d_date]
+--------------------------------------PhysicalProject
+----------------------------------------PhysicalOlapScan[date_dim] apply RFs: 
RF1
+--------------------------------------PhysicalDistribute[DistributionSpecReplicated]
 ----------------------------------------PhysicalProject
-------------------------------------------PhysicalOlapScan[date_dim] apply 
RFs: RF1
-----------------------------------------PhysicalDistribute[DistributionSpecReplicated]
-------------------------------------------PhysicalProject
---------------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((date_dim.d_week_seq = date_dim.d_week_seq)) otherCondition=() 
build RFs:RF0 d_week_seq->[d_week_seq]
-----------------------------------------------PhysicalProject
-------------------------------------------------PhysicalOlapScan[date_dim] 
apply RFs: RF0
-----------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
-------------------------------------------------PhysicalAssertNumRows
---------------------------------------------------PhysicalDistribute[DistributionSpecGather]
-----------------------------------------------------PhysicalProject
-------------------------------------------------------filter((date_dim.d_date 
= '2001-06-16'))
---------------------------------------------------------PhysicalOlapScan[date_dim]
-------------------------------PhysicalDistribute[DistributionSpecHash]
---------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[item]
+------------------------------------------hashJoin[INNER_JOIN] 
hashCondition=((date_dim.d_week_seq = date_dim.d_week_seq)) otherCondition=() 
build RFs:RF0 d_week_seq->[d_week_seq]
+--------------------------------------------PhysicalProject
+----------------------------------------------PhysicalOlapScan[date_dim] apply 
RFs: RF0
+--------------------------------------------PhysicalDistribute[DistributionSpecReplicated]
+----------------------------------------------PhysicalAssertNumRows
+------------------------------------------------PhysicalDistribute[DistributionSpecGather]
+--------------------------------------------------PhysicalProject
+----------------------------------------------------filter((date_dim.d_date = 
'2001-06-16'))
+------------------------------------------------------PhysicalOlapScan[date_dim]
+----------------------------PhysicalDistribute[DistributionSpecHash]
+------------------------------PhysicalProject
+--------------------------------PhysicalOlapScan[item]
 
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query4.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query4.out
index 133758d0144..a2d3494e520 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query4.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query4.out
@@ -67,18 +67,18 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
 ----------------------PhysicalProject
 ------------------------filter((t_c_firstyear.dyear = 1999) and 
(t_c_firstyear.sale_type = 'c') and (t_c_firstyear.year_total > 0.000000))
 --------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
---------------------hashJoin[INNER_JOIN] 
hashCondition=((t_s_secyear.customer_id = t_s_firstyear.customer_id)) 
otherCondition=()
-----------------------PhysicalDistribute[DistributionSpecHash]
-------------------------PhysicalProject
---------------------------filter((t_s_secyear.dyear = 2000) and 
(t_s_secyear.sale_type = 's'))
-----------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
-----------------------hashJoin[INNER_JOIN] 
hashCondition=((t_s_firstyear.customer_id = t_c_secyear.customer_id)) 
otherCondition=()
+--------------------hashJoin[INNER_JOIN] 
hashCondition=((t_s_firstyear.customer_id = t_c_secyear.customer_id)) 
otherCondition=()
+----------------------hashJoin[INNER_JOIN] 
hashCondition=((t_s_secyear.customer_id = t_s_firstyear.customer_id)) 
otherCondition=()
 ------------------------PhysicalDistribute[DistributionSpecHash]
 --------------------------PhysicalProject
-----------------------------filter((t_c_secyear.dyear = 2000) and 
(t_c_secyear.sale_type = 'c'))
+----------------------------filter((t_s_firstyear.dyear = 1999) and 
(t_s_firstyear.sale_type = 's') and (t_s_firstyear.year_total > 0.000000))
 ------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
 ------------------------PhysicalDistribute[DistributionSpecHash]
 --------------------------PhysicalProject
-----------------------------filter((t_s_firstyear.dyear = 1999) and 
(t_s_firstyear.sale_type = 's') and (t_s_firstyear.year_total > 0.000000))
+----------------------------filter((t_s_secyear.dyear = 2000) and 
(t_s_secyear.sale_type = 's'))
 ------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+----------------------PhysicalDistribute[DistributionSpecHash]
+------------------------PhysicalProject
+--------------------------filter((t_c_secyear.dyear = 2000) and 
(t_c_secyear.sale_type = 'c'))
+----------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
 
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query58.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query58.out
index d49c4adfe96..05c0d34df11 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query58.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/rf_prune/query58.out
@@ -42,11 +42,11 @@ PhysicalResultSink
 --------------------PhysicalDistribute[DistributionSpecHash]
 ----------------------hashAgg[LOCAL]
 ------------------------PhysicalProject
---------------------------hashJoin[INNER_JOIN] 
hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build 
RFs:RF7 i_item_sk->[ws_item_sk]
+--------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() 
build RFs:RF7 i_item_sk->[ss_item_sk]
 ----------------------------PhysicalDistribute[DistributionSpecHash]
-------------------------------hashJoin[INNER_JOIN] 
hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF6 d_date_sk->[ws_sold_date_sk]
+------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF6 d_date_sk->[ss_sold_date_sk]
 --------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF6 
RF7
+----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF6 
RF7
 --------------------------------PhysicalDistribute[DistributionSpecReplicated]
 ----------------------------------PhysicalProject
 ------------------------------------hashJoin[LEFT_SEMI_JOIN] 
hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build 
RFs:RF5 d_date->[d_date]
@@ -71,11 +71,11 @@ PhysicalResultSink
 --------------------PhysicalDistribute[DistributionSpecHash]
 ----------------------hashAgg[LOCAL]
 ------------------------PhysicalProject
---------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=()
+--------------------------hashJoin[INNER_JOIN] 
hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=()
 ----------------------------PhysicalDistribute[DistributionSpecHash]
-------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk]
+------------------------------hashJoin[INNER_JOIN] 
hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF2 d_date_sk->[ws_sold_date_sk]
 --------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2
+----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2
 --------------------------------PhysicalDistribute[DistributionSpecReplicated]
 ----------------------------------PhysicalProject
 ------------------------------------hashJoin[LEFT_SEMI_JOIN] 
hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build 
RFs:RF1 d_date->[d_date]
diff --git a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query4.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query4.out
index e40a7c0ebe7..678e8bf71ab 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query4.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query4.out
@@ -67,18 +67,18 @@ PhysicalCteAnchor ( cteId=CTEId#0 )
 ----------------------PhysicalProject
 ------------------------filter((t_c_firstyear.dyear = 1999) and 
(t_c_firstyear.sale_type = 'c') and (t_c_firstyear.year_total > 0.000000))
 --------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
---------------------hashJoin[INNER_JOIN] 
hashCondition=((t_s_secyear.customer_id = t_s_firstyear.customer_id)) 
otherCondition=()
-----------------------PhysicalDistribute[DistributionSpecHash]
-------------------------PhysicalProject
---------------------------filter((t_s_secyear.dyear = 2000) and 
(t_s_secyear.sale_type = 's'))
-----------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
-----------------------hashJoin[INNER_JOIN] 
hashCondition=((t_s_firstyear.customer_id = t_c_secyear.customer_id)) 
otherCondition=()
+--------------------hashJoin[INNER_JOIN] 
hashCondition=((t_s_firstyear.customer_id = t_c_secyear.customer_id)) 
otherCondition=()
+----------------------hashJoin[INNER_JOIN] 
hashCondition=((t_s_secyear.customer_id = t_s_firstyear.customer_id)) 
otherCondition=()
 ------------------------PhysicalDistribute[DistributionSpecHash]
 --------------------------PhysicalProject
-----------------------------filter((t_c_secyear.dyear = 2000) and 
(t_c_secyear.sale_type = 'c'))
+----------------------------filter((t_s_firstyear.dyear = 1999) and 
(t_s_firstyear.sale_type = 's') and (t_s_firstyear.year_total > 0.000000))
 ------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
 ------------------------PhysicalDistribute[DistributionSpecHash]
 --------------------------PhysicalProject
-----------------------------filter((t_s_firstyear.dyear = 1999) and 
(t_s_firstyear.sale_type = 's') and (t_s_firstyear.year_total > 0.000000))
+----------------------------filter((t_s_secyear.dyear = 2000) and 
(t_s_secyear.sale_type = 's'))
 ------------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
+----------------------PhysicalDistribute[DistributionSpecHash]
+------------------------PhysicalProject
+--------------------------filter((t_c_secyear.dyear = 2000) and 
(t_c_secyear.sale_type = 'c'))
+----------------------------PhysicalCteConsumer ( cteId=CTEId#0 )
 
diff --git 
a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query58.out 
b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query58.out
index 6404cfaf9da..7e91108980b 100644
--- a/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query58.out
+++ b/regression-test/data/nereids_tpcds_shape_sf100_p0/shape/query58.out
@@ -42,11 +42,11 @@ PhysicalResultSink
 --------------------PhysicalDistribute[DistributionSpecHash]
 ----------------------hashAgg[LOCAL]
 ------------------------PhysicalProject
---------------------------hashJoin[INNER_JOIN] 
hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build 
RFs:RF7 i_item_sk->[ws_item_sk]
+--------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() 
build RFs:RF7 i_item_sk->[ss_item_sk]
 ----------------------------PhysicalDistribute[DistributionSpecHash]
-------------------------------hashJoin[INNER_JOIN] 
hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF6 d_date_sk->[ws_sold_date_sk]
+------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF6 d_date_sk->[ss_sold_date_sk]
 --------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF6 
RF7
+----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF6 
RF7
 --------------------------------PhysicalDistribute[DistributionSpecReplicated]
 ----------------------------------PhysicalProject
 ------------------------------------hashJoin[LEFT_SEMI_JOIN] 
hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build 
RFs:RF5 d_date->[d_date]
@@ -71,11 +71,11 @@ PhysicalResultSink
 --------------------PhysicalDistribute[DistributionSpecHash]
 ----------------------hashAgg[LOCAL]
 ------------------------PhysicalProject
---------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() 
build RFs:RF3 i_item_sk->[ss_item_sk]
+--------------------------hashJoin[INNER_JOIN] 
hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build 
RFs:RF3 i_item_sk->[ws_item_sk]
 ----------------------------PhysicalDistribute[DistributionSpecHash]
-------------------------------hashJoin[INNER_JOIN] 
hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk]
+------------------------------hashJoin[INNER_JOIN] 
hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) 
otherCondition=() build RFs:RF2 d_date_sk->[ws_sold_date_sk]
 --------------------------------PhysicalProject
-----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 
RF3
+----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 
RF3
 --------------------------------PhysicalDistribute[DistributionSpecReplicated]
 ----------------------------------PhysicalProject
 ------------------------------------hashJoin[LEFT_SEMI_JOIN] 
hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build 
RFs:RF1 d_date->[d_date]


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to