From 1bd153027acc5a373d9ab7980315b86ea04a326c Mon Sep 17 00:00:00 2001 From: minghong Date: Fri, 12 Jan 2024 20:38:13 +0800 Subject: [PATCH] [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 --- .../apache/doris/analysis/DecimalLiteral.java | 2 +- .../apache/doris/analysis/FloatLiteral.java | 2 +- .../org/apache/doris/analysis/IntLiteral.java | 2 +- .../doris/analysis/LargeIntLiteral.java | 2 +- .../doris/analysis/NumericLiteralExpr.java | 31 +++++ .../nereids/stats/ExpressionEstimation.java | 64 ++++++---- .../expressions/literal/DecimalLiteral.java | 2 +- .../expressions/literal/DecimalV3Literal.java | 2 +- .../expressions/literal/DoubleLiteral.java | 2 +- .../expressions/literal/FloatLiteral.java | 2 +- .../literal/FractionalLiteral.java | 34 +++++ .../literal/IntegerLikeLiteral.java | 2 +- .../expressions/literal/NumericLiteral.java | 34 +++++ .../stats/ExpressionEstimationTest.java | 71 +++++++++++ .../nereids/stats/FilterEstimationTest.java | 4 +- .../shape/query4.out | 16 +-- .../shape/query58.out | 117 +++++++++--------- .../rf_prune/query4.out | 16 +-- .../rf_prune/query58.out | 12 +- .../shape/query4.out | 16 +-- .../shape/query58.out | 12 +- 21 files changed, 316 insertions(+), 129 deletions(-) create mode 100644 fe/fe-core/src/main/java/org/apache/doris/analysis/NumericLiteralExpr.java create mode 100644 fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/FractionalLiteral.java create mode 100644 fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/NumericLiteral.java 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 50749b46c2985d..19389a6f2ea021 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.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 b95b3860aa53c7..1fba4edfb90639 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.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 f122d1edc40960..e348c0be542822 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.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 c284b963d52a98..6e8cd3ed2e0fce 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.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/analysis/NumericLiteralExpr.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/NumericLiteralExpr.java new file mode 100644 index 00000000000000..31cde22078f753 --- /dev/null +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/NumericLiteralExpr.java @@ -0,0 +1,31 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// 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.analysis; + +public abstract class NumericLiteralExpr extends LiteralExpr { + public NumericLiteralExpr() { + super(); + } + + public NumericLiteralExpr(NumericLiteralExpr other) { + super(other); + } +} 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 f82f509ba02dc1..acf6bddfe5745f 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 ColumnStatistic visitCast(Cast cast, Statistics context) { } 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 03973fe6b03d69..84b8f07a94aee1 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 @@ /** * 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 2a10196e0569e9..33bf5773165b38 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 @@ /** * 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 34b8ca36fbc8a5..bc7b356c3762fe 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 @@ /** * 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 4fff7445efae4d..55d9c98e2da2da 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 @@ /** * 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/FractionalLiteral.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/FractionalLiteral.java new file mode 100644 index 00000000000000..ac63225dc3b582 --- /dev/null +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/FractionalLiteral.java @@ -0,0 +1,34 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.nereids.trees.expressions.literal; + +import org.apache.doris.nereids.types.DataType; + +/** + * float/double/decimal + */ +public abstract class FractionalLiteral extends NumericLiteral { + /** + * Constructor for FractionalLiteral. + * + * @param dataType logical data type in Nereids + */ + public FractionalLiteral(DataType dataType) { + super(dataType); + } +} 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 9f8a08a00f56f2..54456bd9493564 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 @@ 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/NumericLiteral.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/NumericLiteral.java new file mode 100644 index 00000000000000..93b03e4fafaf02 --- /dev/null +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/NumericLiteral.java @@ -0,0 +1,34 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.nereids.trees.expressions.literal; + +import org.apache.doris.nereids.types.DataType; + +/** + * numeric literal + */ +public abstract class NumericLiteral extends Literal { + /** + * Constructor for NumericLiteral. + * + * @param dataType logical data type in Nereids + */ + public NumericLiteral(DataType dataType) { + super(dataType); + } +} 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 b55b266faff644..7368735365cda4 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.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 @@ public void test8() { 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 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 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 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 b476cc563be32b..7bad73801a0606 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 @@ public void testBetweenCastFilter() { .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 @@ public void testBetweenCastFilter() { 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 e40a7c0ebe78b6..678e8bf71abac4 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 c18a9cf8681a64..6a846c34d213e6 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 DOUBLE) <= cast((1.1 * ss_item_rev) as DOUBLE)) and (cast(ws_item_rev as DOUBLE) >= cast((0.9 * cs_item_rev) as DOUBLE)) and (cast(ws_item_rev as DOUBLE) >= cast((0.9 * ss_item_rev) as DOUBLE))) build RFs:RF13 item_id->[i_item_id] +------------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 DOUBLE) >= cast((0.9 * cs_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 DOUBLE) >= cast((0.9 * cs_item_rev) as DOUBLE))) build RFs:RF13 item_id->[i_item_id] --------------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 133758d0144f47..a2d3494e5203e1 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 d49c4adfe96eaf..05c0d34df117de 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 e40a7c0ebe78b6..678e8bf71abac4 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 6404cfaf9da57f..7e91108980bec2 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]