From 5da26a548fa1028212685399bc06d86fce365470 Mon Sep 17 00:00:00 2001 From: Mryange <59914473+Mryange@users.noreply.github.com> Date: Mon, 30 Sep 2024 15:10:59 +0800 Subject: [PATCH 01/12] [fix](ubsan) fix ubsan : runtime error: applying non-zero offset 16 to null pointer (#41486) ## Proposed changes ``` /root/doris/be/src/vec/common/pod_array.h:406:13: runtime error: applying non-zero offset 16 to null pointer #0 0x55827f4bbf0c in void doris::vectorized::PODArray<__int128, 4096ul, Allocator, 0ul, 0ul>::push_back<__int128&>(__int128&) /root/doris/be/src/vec/common/pod_array.h:406:13 #1 0x55827f4baa40 in doris::Counts<__int128>::increment(__int128) /root/doris/be/src/util/counts.h:160:36 #2 0x55827f4baa40 in doris::vectorized::PercentileState<__int128>::add(__int128, doris::vectorized::PODArray, 16ul, 15ul> const&, int) /root/doris/be/src/vec/aggregate_functions/aggregate_function_percentile.h:634:27 #3 0x55827f6ca40f in doris::vectorized::AggregateFunctionNullVariadicInline, false>::add(char*, doris::vectorized::IColumn const**, long, doris::vectorized::Arena*) const /root/doris/be/src/vec/aggregate_functions/aggregate_function_null.h:324:32 #4 0x55827f6cef0e in doris::vectorized::IAggregateFunctionHelper, false> >::add_batch(unsigned long, char**, unsigned long, doris::vectorized::IColumn const**, doris::vectorized::Arena*, bool) const /root/doris/be/src/vec/aggregate_functions/aggregate_function.h:273:22 #5 0x5582a0c41059 in doris::vectorized::AggFnEvaluator::execute_batch_add(doris::vectorized::Block*, unsigned long, char**, doris::vectorized::Arena*, bool) /root/doris/be/src/vec/exprs/vectorized_agg_fn.cpp:241:16 #6 0x5582a0c39037 in doris::Status doris::pipeline::AggSinkLocalState::_execute_with_serialized_key_helper(doris::vectorized::Block*)::'lambda'()::operator()() const /root/doris/be/src/pipeline/exec/aggregation_sink_operator.cpp:481:17 #7 0x5582a0b51e1e in doris::Status doris::pipeline::AggSinkLocalState::_execute_with_serialized_key_helper(doris::vectorized::Block*) /root/doris/be/src/pipeline/exec/aggregation_sink_operator.cpp:497:13 #8 0x5582a0a014e1 in doris::pipeline::AggSinkLocalState::_execute_with_serialized_key(doris::vectorized::Block*) /root/doris/be/src/pipeline/exec/aggregation_sink_operator.cpp:437:16 #9 0x5582a0c37811 in doris::pipeline::AggSinkLocalState::Executor::execute(doris::pipeline::AggSinkLocalState*, doris::vectorized::Block*) /root/doris/be/src/pipeline/exec/aggregation_sink_operator.h:61:41 ``` --- be/src/vec/common/pod_array.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/be/src/vec/common/pod_array.h b/be/src/vec/common/pod_array.h index d4324c91f75e4f..9e09afd714414c 100644 --- a/be/src/vec/common/pod_array.h +++ b/be/src/vec/common/pod_array.h @@ -403,7 +403,7 @@ class PODArray : public PODArrayBase void push_back(U&& x, TAllocatorParams&&... allocator_params) { - if (UNLIKELY(this->c_end + sizeof(T) > this->c_end_of_storage)) { + if (UNLIKELY(this->c_end == nullptr || this->c_end + sizeof(T) > this->c_end_of_storage)) { this->reserve_for_next_size(std::forward(allocator_params)...); } From 26bbfa13827125e2583b1bad66f480a1707df633 Mon Sep 17 00:00:00 2001 From: starocean999 <40539150+starocean999@users.noreply.github.com> Date: Mon, 30 Sep 2024 15:34:11 +0800 Subject: [PATCH 02/12] [fix](test)resolve table name conflict between test cases (#41492) ## Proposed changes Issue Number: close #xxx --- .../schema_change_p0/test_dup_schema_key_change_modify.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/regression-test/suites/schema_change_p0/test_dup_schema_key_change_modify.groovy b/regression-test/suites/schema_change_p0/test_dup_schema_key_change_modify.groovy index d3d5d790a8d466..1b1c051eba5fdd 100644 --- a/regression-test/suites/schema_change_p0/test_dup_schema_key_change_modify.groovy +++ b/regression-test/suites/schema_change_p0/test_dup_schema_key_change_modify.groovy @@ -16,8 +16,8 @@ // under the License. suite("test_dup_schema_key_change_modify","p0") { - def tbName1 = "test_dup_schema_key_change_modify1" - def tbName2 = "test_dup_schema_key_change_modify_1" + def tbName1 = "test_dup_schema_key_change_modify1_v2" + def tbName2 = "test_dup_schema_key_change_modify_1_v2" def initTable1 = "" def initTableData1 = "" From bfccd0ebafc54f34f3ec37639f2aeb51e1ee869a Mon Sep 17 00:00:00 2001 From: zhangdong <493738387@qq.com> Date: Mon, 30 Sep 2024 15:48:57 +0800 Subject: [PATCH 03/12] [fix](mtmv)Fix show mtmv time should wrapped in double quotation marks (#41419) Fix show mtmv time should wrapped in double quotation marks --- .../doris/mtmv/MTMVRefreshSchedule.java | 3 ++- .../java/org/apache/doris/mtmv/MTMVTest.java | 2 +- .../mtmv_p0/test_show_create_mtmv.groovy | 23 +++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRefreshSchedule.java b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRefreshSchedule.java index 17123a3235ec48..da873ea968c486 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRefreshSchedule.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRefreshSchedule.java @@ -93,8 +93,9 @@ public String toString() { builder.append(" "); builder.append(timeUnit); if (!StringUtils.isEmpty(startTime)) { - builder.append(" STARTS "); + builder.append(" STARTS \""); builder.append(startTime); + builder.append("\""); } return builder.toString(); } diff --git a/fe/fe-core/src/test/java/org/apache/doris/mtmv/MTMVTest.java b/fe/fe-core/src/test/java/org/apache/doris/mtmv/MTMVTest.java index ca226218cfc4e3..de52b721287f61 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/mtmv/MTMVTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/mtmv/MTMVTest.java @@ -49,7 +49,7 @@ public class MTMVTest { @Test public void testToInfoString() { String expect - = "MTMV{refreshInfo=BUILD IMMEDIATE REFRESH COMPLETE ON SCHEDULE EVERY 2 SECOND STARTS ss, " + = "MTMV{refreshInfo=BUILD IMMEDIATE REFRESH COMPLETE ON SCHEDULE EVERY 2 SECOND STARTS \"ss\", " + "querySql='select * from xxx;', " + "status=MTMVStatus{state=INIT, schemaChangeDetail='null', refreshState=INIT}, " + "jobInfo=MTMVJobInfo{jobName='job1', " diff --git a/regression-test/suites/mtmv_p0/test_show_create_mtmv.groovy b/regression-test/suites/mtmv_p0/test_show_create_mtmv.groovy index 88f9de70865189..41f249e5fe382d 100644 --- a/regression-test/suites/mtmv_p0/test_show_create_mtmv.groovy +++ b/regression-test/suites/mtmv_p0/test_show_create_mtmv.groovy @@ -99,6 +99,29 @@ suite("test_show_create_mtmv","mtmv") { assertTrue(showCreateMTMVResult.toString().contains("BUILD IMMEDIATE REFRESH COMPLETE ON COMMIT")) assertTrue(showCreateMTMVResult.toString().contains("DISTRIBUTED BY RANDOM BUCKETS AUTO")) + + sql """drop materialized view if exists ${mvName};""" + sql """ + CREATE MATERIALIZED VIEW ${mvName} + BUILD DEFERRED REFRESH AUTO ON SCHEDULE EVERY 10 DAY starts "9999-01-01 10:10:10" + partition by (`k2`) + DISTRIBUTED BY hash(k1) BUCKETS 2 + PROPERTIES ( + 'replication_num' = '1' + ) + AS + SELECT * FROM ${tableName}; + """ + showCreateMTMVResult = sql """show CREATE MATERIALIZED VIEW ${mvName}""" + logger.info("showCreateMTMVResult: " + showCreateMTMVResult.toString()) + sql """drop materialized view if exists ${mvName};""" + sql """ + ${showCreateMTMVResult[0][1]} + """ + def showCreateMTMVResultAgain = sql """show CREATE MATERIALIZED VIEW ${mvName}""" + logger.info("showCreateMTMVAgainResult: " + showCreateMTMVResultAgain.toString()) + assertEquals(showCreateMTMVResult.toString(), showCreateMTMVResultAgain.toString()) + sql """drop table if exists `${tableName}`""" sql """drop materialized view if exists ${mvName};""" } From e8fb88f916753a24d56cf152f3ff17286a44ecf8 Mon Sep 17 00:00:00 2001 From: morrySnow <101034200+morrySnow@users.noreply.github.com> Date: Mon, 30 Sep 2024 16:06:31 +0800 Subject: [PATCH 04/12] [opt](compile) ensure fe-core compile with language level 8 (#41417) not change all module to level 8 because java-common use sun.misc.unsafe that cannot compile with level 8 --- fe/fe-core/pom.xml | 3 +++ .../java/org/apache/doris/cloud/rpc/MetaServiceClient.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/pom.xml b/fe/fe-core/pom.xml index 9a4e7630874246..70678c4262de33 100644 --- a/fe/fe-core/pom.xml +++ b/fe/fe-core/pom.xml @@ -1141,6 +1141,9 @@ under the License. org.apache.maven.plugins maven-compiler-plugin + + 8 + diff --git a/fe/fe-core/src/main/java/org/apache/doris/cloud/rpc/MetaServiceClient.java b/fe/fe-core/src/main/java/org/apache/doris/cloud/rpc/MetaServiceClient.java index 323b880a3a7a79..c4d28fb3bc256c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/cloud/rpc/MetaServiceClient.java +++ b/fe/fe-core/src/main/java/org/apache/doris/cloud/rpc/MetaServiceClient.java @@ -79,7 +79,7 @@ private long connectionAgeExpiredAt() { if (!isMetaServiceEndpointList && connectionAgeBase > 1) { long base = TimeUnit.MINUTES.toMillis(connectionAgeBase); long now = System.currentTimeMillis(); - long rand = random.nextLong(base); + long rand = random.nextLong() % base; return now + base + rand; } return Long.MAX_VALUE; From ce982a959e02f49f9cfe90d15bdba6890a603c77 Mon Sep 17 00:00:00 2001 From: Pxl Date: Mon, 30 Sep 2024 17:11:37 +0800 Subject: [PATCH 05/12] [Chore](materialized-view) mow table's mv need have all key column (#41496) ## Proposed changes mow table's mv need have all key column --- .../java/org/apache/doris/alter/MaterializedViewHandler.java | 3 +-- regression-test/data/mv_p0/test_mv_mow/test_mv_mow.out | 4 ++-- regression-test/suites/mv_p0/test_mv_mow/test_mv_mow.groovy | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java b/fe/fe-core/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java index 46b750375241b5..54e82c7cc092c0 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java +++ b/fe/fe-core/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java @@ -587,8 +587,7 @@ private List checkAndPrepareMaterializedView(CreateMaterializedViewStmt } // check b.3 - if (olapTable.getKeysType() == KeysType.UNIQUE_KEYS && !olapTable.getEnableUniqueKeyMergeOnWrite() - && !addMVClause.isReplay()) { + if (olapTable.getKeysType() == KeysType.UNIQUE_KEYS && !addMVClause.isReplay()) { Set originColumns = new TreeSet(String.CASE_INSENSITIVE_ORDER); for (Column column : newMVColumns) { originColumns.add(CreateMaterializedViewStmt.mvColumnBreaker(column.getName())); diff --git a/regression-test/data/mv_p0/test_mv_mow/test_mv_mow.out b/regression-test/data/mv_p0/test_mv_mow/test_mv_mow.out index fbf59000daf051..43f8446eeaa233 100644 --- a/regression-test/data/mv_p0/test_mv_mow/test_mv_mow.out +++ b/regression-test/data/mv_p0/test_mv_mow/test_mv_mow.out @@ -4,8 +4,8 @@ 1 3 -- !select_mv -- -1 2 -1 3 +1 1 1 2 +1 2 1 3 -- !select_mv -- 1 diff --git a/regression-test/suites/mv_p0/test_mv_mow/test_mv_mow.groovy b/regression-test/suites/mv_p0/test_mv_mow/test_mv_mow.groovy index bb32b5133ecc96..a11efd874a8610 100644 --- a/regression-test/suites/mv_p0/test_mv_mow/test_mv_mow.groovy +++ b/regression-test/suites/mv_p0/test_mv_mow/test_mv_mow.groovy @@ -35,7 +35,7 @@ suite ("test_mv_mow") { sql """analyze table u_table with sync;""" sql "insert into u_table select 1,1,1,1;" sql "insert into u_table select 1,2,1,1;" - createMV("create materialized view k123p as select k1,k2+k3 from u_table;") + createMV("create materialized view k123p as select k1,k2,k3,k2+k3 from u_table;") sql "insert into u_table select 1,1,1,2;" sql "insert into u_table select 1,2,1,2;" From b41927833f00a974a6eddd6300ab2e4c1e209cc9 Mon Sep 17 00:00:00 2001 From: morrySnow <101034200+morrySnow@users.noreply.github.com> Date: Mon, 30 Sep 2024 17:26:41 +0800 Subject: [PATCH 06/12] [fix](Nereids) could not parse date/datetime with blank + zone (#41394) for example: 2008-08-08 20:08:08 +08:00 parse failed because the blank before +08:00 --- .../expressions/literal/DateLiteral.java | 12 ++++++--- .../expressions/literal/DateLiteralTest.java | 6 +++++ .../util/DateTimeFormatterUtilsTest.java | 26 +++++++++++++++++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateLiteral.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateLiteral.java index f1946463aa71eb..efef246d4e8171 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateLiteral.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateLiteral.java @@ -220,7 +220,11 @@ static String normalize(String s) { while (i < s.length() && (isPunctuation(s.charAt(i)) || s.charAt(i) == ' ' || s.charAt(i) == 'T')) { i += 1; } - sb.append(' '); + // avoid add blank before zone-id, for example 2008-08-08 +08:00 + // should be normalized to 2008-08-08+08:00 + if (i >= s.length() || Character.isDigit(s.charAt(i))) { + sb.append(' '); + } } else if (partNumber > 3 && isPunctuation(c)) { sb.append(':'); } else { @@ -240,18 +244,20 @@ static String normalize(String s) { // parse MicroSecond // Keep up to 7 digits at most, 7th digit is use for overflow. + int j = i; if (partNumber == 6 && i < s.length() && s.charAt(i) == '.') { sb.append(s.charAt(i)); i += 1; while (i < s.length() && Character.isDigit(s.charAt(i))) { - if (i - 19 <= 7) { + if (i - j <= 7) { sb.append(s.charAt(i)); } i += 1; } } - sb.append(s.substring(i)); + // trim use to remove any blank before zone id or zone offset + sb.append(s.substring(i).trim()); return sb.toString(); } diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/DateLiteralTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/DateLiteralTest.java index 3430676b14d5ba..7c8ad5ed0e69a4 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/DateLiteralTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/DateLiteralTest.java @@ -47,6 +47,12 @@ void testNormalize() { Assertions.assertEquals("2021-05-01 00:00:00", s); s = DateLiteral.normalize("2021-5-01 0:0:0.001"); Assertions.assertEquals("2021-05-01 00:00:00.001", s); + s = DateLiteral.normalize("2021-5-01 0:0:0.12345678"); + Assertions.assertEquals("2021-05-01 00:00:00.1234567", s); + s = DateLiteral.normalize("2021-5-1 Asia/Shanghai"); + Assertions.assertEquals("2021-05-01Asia/Shanghai", s); + s = DateLiteral.normalize("2021-5-1 0:0:0.12345678 Asia/Shanghai"); + Assertions.assertEquals("2021-05-01 00:00:00.1234567Asia/Shanghai", s); } @Test diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/util/DateTimeFormatterUtilsTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/util/DateTimeFormatterUtilsTest.java index 8437fdb0092025..541ad9c28c7111 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/util/DateTimeFormatterUtilsTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/util/DateTimeFormatterUtilsTest.java @@ -111,4 +111,30 @@ void testTimeFormatter() { Assertions.assertThrows(DateTimeParseException.class, () -> timeFormatter.parse("01:01")); Assertions.assertThrows(DateTimeParseException.class, () -> timeFormatter.parse("01")); } + + @Test + void testZoneDateFormatter() { + DateTimeFormatter formatter = DateTimeFormatterUtils.ZONE_DATE_FORMATTER; + TemporalAccessor date = formatter.parse("2020-02-19Asia/Shanghai"); + assertDatePart(date); + date = formatter.parse("2020-02-19UTC+08:00"); + assertDatePart(date); + date = formatter.parse("2020-02-19+08:00"); + assertDatePart(date); + Assertions.assertThrows(DateTimeParseException.class, () -> formatter.parse("2020-02-19 Asia/Shanghai")); + Assertions.assertThrows(DateTimeParseException.class, () -> formatter.parse("2020-02-19++08:00")); + } + + @Test + void testZoneDateTimeFormatter() { + DateTimeFormatter formatter = DateTimeFormatterUtils.ZONE_DATE_TIME_FORMATTER; + TemporalAccessor dateTime = formatter.parse("2020-02-19 00:00:00Asia/Shanghai"); + assertDatePart(dateTime); + dateTime = formatter.parse("2020-02-19 00:00:00UTC+08:00"); + assertDatePart(dateTime); + dateTime = formatter.parse("2020-02-19 00:00:00+08:00"); + assertDatePart(dateTime); + Assertions.assertThrows(DateTimeParseException.class, () -> formatter.parse("2020-02-19 00:00:00 Asia/Shanghai")); + Assertions.assertThrows(DateTimeParseException.class, () -> formatter.parse("2020-02-19 00:00:00++08:00")); + } } From 2926cdb07f65bbc763273f9559ee7478eab28fce Mon Sep 17 00:00:00 2001 From: LiBinfeng <46676950+LiBinfeng-01@users.noreply.github.com> Date: Mon, 30 Sep 2024 21:06:53 +0800 Subject: [PATCH 07/12] [Feat](Nereids) add numeric functions (#40744) add fold constant on fe of numeric functions: Coalesce, Round, Ceil, Floor, Exp, Ln, Log, Log10, Log2, Sqrt, Power, Sin, Cos, Tan, Acos, Asin, Atan, Atan2, Sign, Bin, BitCount, BitLength, Cbrt, Cosh, Tanh, Dexp, Dlog10, Dlog1, Dpow, Dsqrt, Fmod, Fpow, Radians, Degrees, Xor, Pi, E, Conv, Truncate, CountEqual, Pmod. --------- Co-authored-by: libinfeng --- .../apache/doris/analysis/FloatLiteral.java | 3 + .../expressions/ExpressionEvaluator.java | 17 +- .../executable/ExecutableFunctions.java | 115 ---- .../executable/NumericArithmetic.java | 566 +++++++++++++++++- .../expressions/literal/DecimalV3Literal.java | 28 + .../rules/expression/FoldConstantTest.java | 162 +++++ .../functions/ExecutableFunctionsTest.java | 64 -- .../datatype_p0/double/test_double_nan.out | 4 - .../data/datatype_p0/float/test_float_nan.out | 4 - .../datatype_p0/double/test_double_nan.groovy | 13 +- .../datatype_p0/float/test_float_nan.groovy | 12 +- .../scalar_function/A.groovy | 5 +- .../fold_constant_numeric_arithmatic.groovy | 412 +++++++++++++ .../test_multi_range_partition.groovy | 2 +- 14 files changed, 1201 insertions(+), 206 deletions(-) delete mode 100644 fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/ExecutableFunctions.java delete mode 100644 fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/functions/ExecutableFunctionsTest.java create mode 100644 regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_numeric_arithmatic.groovy 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 c6cf403f949e71..8d4a9ef576523e 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 @@ -159,6 +159,9 @@ public String getStringValueInFe(FormatOptions options) { String timeStr = getStringValue(); return timeStr.substring(1, timeStr.length() - 1); } else { + if (Double.isInfinite(getValue())) { + return Double.toString(getValue()); + } return BigDecimal.valueOf(getValue()).toPlainString(); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java index 0c612e42ddaf11..0233b9882663da 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/ExpressionEvaluator.java @@ -18,12 +18,12 @@ package org.apache.doris.nereids.trees.expressions; import org.apache.doris.catalog.Env; +import org.apache.doris.nereids.exceptions.NotSupportedException; import org.apache.doris.nereids.trees.expressions.functions.BoundFunction; import org.apache.doris.nereids.trees.expressions.functions.agg.AggregateFunction; import org.apache.doris.nereids.trees.expressions.functions.executable.DateTimeAcquire; import org.apache.doris.nereids.trees.expressions.functions.executable.DateTimeArithmetic; import org.apache.doris.nereids.trees.expressions.functions.executable.DateTimeExtractAndTransform; -import org.apache.doris.nereids.trees.expressions.functions.executable.ExecutableFunctions; import org.apache.doris.nereids.trees.expressions.functions.executable.NumericArithmetic; import org.apache.doris.nereids.trees.expressions.functions.executable.StringArithmetic; import org.apache.doris.nereids.trees.expressions.functions.executable.TimeRoundSeries; @@ -105,9 +105,7 @@ private Expression invoke(Expression expression, String fnName) { Class componentType = parameterType.getComponentType(); Object varArgs = Array.newInstance(componentType, inputSize - fixedArgsSize); for (int i = fixedArgsSize; i < inputSize; i++) { - if (!(expression.children().get(i) instanceof NullLiteral)) { - Array.set(varArgs, i - fixedArgsSize, expression.children().get(i)); - } + Array.set(varArgs, i - fixedArgsSize, expression.children().get(i)); } Object[] objects = new Object[fixedArgsSize + 1]; for (int i = 0; i < fixedArgsSize; i++) { @@ -115,10 +113,16 @@ private Expression invoke(Expression expression, String fnName) { } objects[fixedArgsSize] = varArgs; - return (Literal) method.invoke(null, varArgs); + return (Literal) method.invoke(null, objects); } return (Literal) method.invoke(null, expression.children().toArray()); - } catch (InvocationTargetException | IllegalAccessException | IllegalArgumentException e) { + } catch (InvocationTargetException e) { + if (e.getTargetException() instanceof NotSupportedException) { + throw new NotSupportedException(e.getTargetException().getMessage()); + } else { + return expression; + } + } catch (IllegalAccessException | IllegalArgumentException e) { return expression; } } @@ -192,7 +196,6 @@ private void registerFunctions() { List> classes = ImmutableList.of( DateTimeAcquire.class, DateTimeExtractAndTransform.class, - ExecutableFunctions.class, DateLiteral.class, DateTimeArithmetic.class, NumericArithmetic.class, diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/ExecutableFunctions.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/ExecutableFunctions.java deleted file mode 100644 index e3082b57c2f977..00000000000000 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/ExecutableFunctions.java +++ /dev/null @@ -1,115 +0,0 @@ -// 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.functions.executable; - -import org.apache.doris.nereids.trees.expressions.ExecFunction; -import org.apache.doris.nereids.trees.expressions.Expression; -import org.apache.doris.nereids.trees.expressions.literal.BigIntLiteral; -import org.apache.doris.nereids.trees.expressions.literal.DecimalLiteral; -import org.apache.doris.nereids.trees.expressions.literal.DecimalV3Literal; -import org.apache.doris.nereids.trees.expressions.literal.DoubleLiteral; -import org.apache.doris.nereids.trees.expressions.literal.FloatLiteral; -import org.apache.doris.nereids.trees.expressions.literal.IntegerLiteral; -import org.apache.doris.nereids.trees.expressions.literal.LargeIntLiteral; -import org.apache.doris.nereids.trees.expressions.literal.NullLiteral; -import org.apache.doris.nereids.trees.expressions.literal.SmallIntLiteral; -import org.apache.doris.nereids.trees.expressions.literal.TinyIntLiteral; -import org.apache.doris.nereids.types.DoubleType; - -import java.math.BigInteger; -import java.security.SecureRandom; -import java.util.Random; - -/** - * functions that can be executed in FE. - */ -public class ExecutableFunctions { - public static final ExecutableFunctions INSTANCE = new ExecutableFunctions(); - private static final Random RANDOM = new SecureRandom(); - - /** - * other scalar function - */ - @ExecFunction(name = "abs") - public static Expression abs(TinyIntLiteral literal) { - return new SmallIntLiteral((short) Math.abs(literal.getValue())); - } - - @ExecFunction(name = "abs") - public static Expression abs(SmallIntLiteral literal) { - return new IntegerLiteral(Math.abs(literal.getValue())); - } - - @ExecFunction(name = "abs") - public static Expression abs(IntegerLiteral literal) { - return new BigIntLiteral(Math.abs((long) literal.getValue())); - } - - @ExecFunction(name = "abs") - public static Expression abs(BigIntLiteral literal) { - return new LargeIntLiteral(BigInteger.valueOf(literal.getValue()).abs()); - } - - @ExecFunction(name = "abs") - public static Expression abs(LargeIntLiteral literal) { - return new LargeIntLiteral(literal.getValue().abs()); - } - - @ExecFunction(name = "abs") - public static Expression abs(FloatLiteral literal) { - return new FloatLiteral(Math.abs(literal.getValue())); - } - - @ExecFunction(name = "abs") - public static Expression abs(DoubleLiteral literal) { - return new DoubleLiteral(Math.abs(literal.getValue())); - } - - @ExecFunction(name = "abs") - public static Expression abs(DecimalLiteral literal) { - return new DecimalLiteral(literal.getValue().abs()); - } - - @ExecFunction(name = "abs") - public static Expression abs(DecimalV3Literal literal) { - return new DecimalV3Literal(literal.getValue().abs()); - } - - /** - * acos scalar function - */ - @ExecFunction(name = "acos") - public static Expression acos(DoubleLiteral literal) { - double result = Math.acos(literal.getValue()); - if (Double.isNaN(result)) { - return new NullLiteral(DoubleType.INSTANCE); - } else { - return new DoubleLiteral(result); - } - } - - @ExecFunction(name = "e") - public static Expression e() { // CHECKSTYLE IGNORE THIS LINE - return new DoubleLiteral(Math.E); - } - - @ExecFunction(name = "pi") - public static Expression pi() { - return new DoubleLiteral(Math.PI); - } -} diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java index ba0b75e75dd77e..325e676fc046a0 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/executable/NumericArithmetic.java @@ -17,27 +17,82 @@ package org.apache.doris.nereids.trees.expressions.functions.executable; +import org.apache.doris.nereids.exceptions.NotSupportedException; import org.apache.doris.nereids.trees.expressions.ExecFunction; import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.expressions.literal.BigIntLiteral; +import org.apache.doris.nereids.trees.expressions.literal.BooleanLiteral; import org.apache.doris.nereids.trees.expressions.literal.DecimalLiteral; import org.apache.doris.nereids.trees.expressions.literal.DecimalV3Literal; import org.apache.doris.nereids.trees.expressions.literal.DoubleLiteral; +import org.apache.doris.nereids.trees.expressions.literal.FloatLiteral; import org.apache.doris.nereids.trees.expressions.literal.IntegerLiteral; import org.apache.doris.nereids.trees.expressions.literal.LargeIntLiteral; +import org.apache.doris.nereids.trees.expressions.literal.Literal; import org.apache.doris.nereids.trees.expressions.literal.NullLiteral; import org.apache.doris.nereids.trees.expressions.literal.SmallIntLiteral; +import org.apache.doris.nereids.trees.expressions.literal.StringLiteral; import org.apache.doris.nereids.trees.expressions.literal.TinyIntLiteral; +import org.apache.doris.nereids.trees.expressions.literal.VarcharLiteral; import org.apache.doris.nereids.types.DecimalV3Type; import java.math.BigDecimal; import java.math.BigInteger; +import java.nio.charset.StandardCharsets; /** * executable functions: * add, subtract, multiply, divide */ public class NumericArithmetic { + /** + * other scalar function + */ + @ExecFunction(name = "abs") + public static Expression abs(TinyIntLiteral literal) { + return new SmallIntLiteral((short) Math.abs(literal.getValue())); + } + + @ExecFunction(name = "abs") + public static Expression abs(SmallIntLiteral literal) { + return new IntegerLiteral(Math.abs(literal.getValue())); + } + + @ExecFunction(name = "abs") + public static Expression abs(IntegerLiteral literal) { + return new BigIntLiteral(Math.abs((long) literal.getValue())); + } + + @ExecFunction(name = "abs") + public static Expression abs(BigIntLiteral literal) { + return new LargeIntLiteral(BigInteger.valueOf(literal.getValue()).abs()); + } + + @ExecFunction(name = "abs") + public static Expression abs(LargeIntLiteral literal) { + return new LargeIntLiteral(literal.getValue().abs()); + } + + @ExecFunction(name = "abs") + public static Expression abs(FloatLiteral literal) { + return new FloatLiteral(Math.abs(literal.getValue())); + } + + @ExecFunction(name = "abs") + public static Expression abs(DoubleLiteral literal) { + return new DoubleLiteral(Math.abs(literal.getValue())); + } + + @ExecFunction(name = "abs") + public static Expression abs(DecimalLiteral literal) { + return new DecimalLiteral(literal.getValue().abs()); + } + + @ExecFunction(name = "abs") + public static Expression abs(DecimalV3Literal literal) { + return new DecimalV3Literal(literal.getValue().abs()); + } + /** * Executable arithmetic functions add */ @@ -194,7 +249,7 @@ public static Expression addLargeIntLargeInt(LargeIntLiteral first, LargeIntLite @ExecFunction(name = "add") public static Expression addDoubleDouble(DoubleLiteral first, DoubleLiteral second) { double result = first.getValue() + second.getValue(); - return new DoubleLiteral(result); + return checkOutputBoundary(new DoubleLiteral(result)); } @ExecFunction(name = "add") @@ -365,7 +420,7 @@ public static Expression subtractLargeIntLargeInt(LargeIntLiteral first, LargeIn @ExecFunction(name = "subtract") public static Expression subtractDoubleDouble(DoubleLiteral first, DoubleLiteral second) { double result = first.getValue() - second.getValue(); - return new DoubleLiteral(result); + return checkOutputBoundary(new DoubleLiteral(result)); } @ExecFunction(name = "subtract") @@ -536,7 +591,7 @@ public static Expression multiplyLargeIntLargeInt(LargeIntLiteral first, LargeIn @ExecFunction(name = "multiply") public static Expression multiplyDoubleDouble(DoubleLiteral first, DoubleLiteral second) { double result = first.getValue() * second.getValue(); - return new DoubleLiteral(result); + return checkOutputBoundary(new DoubleLiteral(result)); } @ExecFunction(name = "multiply") @@ -567,7 +622,7 @@ public static Expression divideDouble(DoubleLiteral first, DoubleLiteral second) return new NullLiteral(first.getDataType()); } double result = first.getValue() / second.getValue(); - return new DoubleLiteral(result); + return checkOutputBoundary(new DoubleLiteral(result)); } /** @@ -596,4 +651,507 @@ public static Expression divideDecimalV3(DecimalV3Literal first, DecimalV3Litera return new DecimalV3Literal(DecimalV3Type.createDecimalV3TypeLooseCheck( t1.getPrecision(), t1.getScale() - t2.getScale()), result); } + + /** + * coalesce + */ + @ExecFunction(name = "coalesce") + public static Expression coalesce(Literal first, Literal... second) { + if (!(first instanceof NullLiteral)) { + return first; + } + for (Literal secondLiteral : second) { + if (!(secondLiteral instanceof NullLiteral)) { + return secondLiteral; + } + } + return first; + } + + /** + * Method to check boundary with options for inclusive or exclusive boundaries + */ + public static void checkInputBoundary(Literal input, double lowerBound, double upperBound, + boolean isLowerInclusive, boolean isUpperInclusive) { + if (input instanceof DoubleLiteral) { + double inputValue = ((DoubleLiteral) input).getValue(); + boolean lowerCheck = isLowerInclusive ? (inputValue >= lowerBound) : (inputValue > lowerBound); + // Check upper bound + boolean upperCheck = isUpperInclusive ? (inputValue <= upperBound) : (inputValue < upperBound); + // Return true if both checks are satisfied + if (!lowerCheck || !upperCheck) { + throw new NotSupportedException("input " + input.toSql() + " is out of boundary"); + } + } + } + + private static Expression checkOutputBoundary(Literal input) { + if (input instanceof DoubleLiteral) { + if (((DoubleLiteral) input).getValue().isNaN() || ((DoubleLiteral) input).getValue().isInfinite()) { + throw new NotSupportedException(input.toSql() + " result is invalid"); + } + } + return input; + } + + /** + * round + */ + @ExecFunction(name = "round") + public static Expression round(DecimalV3Literal first) { + return first.round(0); + } + + /** + * round + */ + @ExecFunction(name = "round") + public static Expression round(DecimalV3Literal first, IntegerLiteral second) { + return first.round(second.getValue()); + } + + /** + * round + */ + @ExecFunction(name = "round") + public static Expression round(DoubleLiteral first) { + DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue()))); + return new DoubleLiteral(middleResult.round(0).getDouble()); + } + + /** + * round + */ + @ExecFunction(name = "round") + public static Expression round(DoubleLiteral first, IntegerLiteral second) { + DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue()))); + return new DoubleLiteral(middleResult.round(second.getValue()).getDouble()); + } + + /** + * ceil + */ + @ExecFunction(name = "ceil") + public static Expression ceil(DecimalV3Literal first) { + return first.roundCeiling(0); + } + + /** + * ceil + */ + @ExecFunction(name = "ceil") + public static Expression ceil(DecimalV3Literal first, IntegerLiteral second) { + return first.roundCeiling(second.getValue()); + } + + /** + * ceil + */ + @ExecFunction(name = "ceil") + public static Expression ceil(DoubleLiteral first) { + DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue()))); + return new DoubleLiteral(middleResult.roundCeiling(0).getDouble()); + } + + /** + * ceil + */ + @ExecFunction(name = "ceil") + public static Expression ceil(DoubleLiteral first, IntegerLiteral second) { + DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue()))); + return new DoubleLiteral(middleResult.roundCeiling(second.getValue()).getDouble()); + } + + /** + * floor + */ + @ExecFunction(name = "floor") + public static Expression floor(DecimalV3Literal first) { + return first.roundFloor(0); + } + + /** + * floor + */ + @ExecFunction(name = "floor") + public static Expression floor(DecimalV3Literal first, IntegerLiteral second) { + return first.roundFloor(second.getValue()); + } + + /** + * floor + */ + @ExecFunction(name = "floor") + public static Expression floor(DoubleLiteral first) { + DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue()))); + return new DoubleLiteral(middleResult.roundFloor(0).getDouble()); + } + + /** + * floor + */ + @ExecFunction(name = "floor") + public static Expression floor(DoubleLiteral first, IntegerLiteral second) { + DecimalV3Literal middleResult = new DecimalV3Literal(new BigDecimal(Double.toString(first.getValue()))); + return new DoubleLiteral(middleResult.roundFloor(second.getValue()).getDouble()); + } + + /** + * exp + */ + @ExecFunction(name = "exp") + public static Expression exp(DoubleLiteral first) { + return checkOutputBoundary(new DoubleLiteral(Math.exp(first.getValue()))); + } + + /** + * ln + */ + @ExecFunction(name = "ln") + public static Expression ln(DoubleLiteral first) { + checkInputBoundary(first, 0.0d, Double.MAX_VALUE, false, true); + return checkOutputBoundary(new DoubleLiteral(Math.log(first.getValue()))); + } + + /** + * log + */ + @ExecFunction(name = "log") + public static Expression log(DoubleLiteral first, DoubleLiteral second) { + checkInputBoundary(first, 0.0d, Double.MAX_VALUE, false, true); + return checkOutputBoundary(new DoubleLiteral(Math.log(first.getValue()) / Math.log(second.getValue()))); + } + + /** + * log2 + */ + @ExecFunction(name = "log2") + public static Expression log2(DoubleLiteral first) { + checkInputBoundary(first, 0.0d, Double.MAX_VALUE, false, true); + return checkOutputBoundary(new DoubleLiteral(Math.log(first.getValue()) / Math.log(2.0))); + } + + /** + * log10 + */ + @ExecFunction(name = "log10") + public static Expression log10(DoubleLiteral first) { + checkInputBoundary(first, 0.0d, Double.MAX_VALUE, false, true); + return checkOutputBoundary(new DoubleLiteral(Math.log10(first.getValue()))); + } + + /** + * sqrt + */ + @ExecFunction(name = "sqrt") + public static Expression sqrt(DoubleLiteral first) { + checkInputBoundary(first, 0.0d, Double.MAX_VALUE, true, true); + return checkOutputBoundary(new DoubleLiteral(Math.sqrt(first.getValue()))); + } + + /** + * power + */ + @ExecFunction(name = "power") + public static Expression power(DoubleLiteral first, DoubleLiteral second) { + checkInputBoundary(second, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, false, false); + return checkOutputBoundary(new DoubleLiteral(Math.pow(first.getValue(), second.getValue()))); + } + + /** + * sin + */ + @ExecFunction(name = "sin") + public static Expression sin(DoubleLiteral first) { + checkInputBoundary(first, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, false, false); + return checkOutputBoundary(new DoubleLiteral(Math.sin(first.getValue()))); + } + + /** + * cos + */ + @ExecFunction(name = "cos") + public static Expression cos(DoubleLiteral first) { + checkInputBoundary(first, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, false, false); + return checkOutputBoundary(new DoubleLiteral(Math.cos(first.getValue()))); + } + + /** + * tan + */ + @ExecFunction(name = "tan") + public static Expression tan(DoubleLiteral first) { + checkInputBoundary(first, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, false, false); + return checkOutputBoundary(new DoubleLiteral(Math.tan(first.getValue()))); + } + + /** + * asin + */ + @ExecFunction(name = "asin") + public static Expression asin(DoubleLiteral first) { + checkInputBoundary(first, -1.0, 1.0, true, true); + return checkOutputBoundary(new DoubleLiteral(Math.asin(first.getValue()))); + } + + /** + * acos + */ + @ExecFunction(name = "acos") + public static Expression acos(DoubleLiteral first) { + checkInputBoundary(first, -1.0, 1.0, true, true); + return checkOutputBoundary(new DoubleLiteral(Math.acos(first.getValue()))); + } + + /** + * atan + */ + @ExecFunction(name = "atan") + public static Expression atan(DoubleLiteral first) { + return checkOutputBoundary(new DoubleLiteral(Math.atan(first.getValue()))); + } + + /** + * atan2 + */ + @ExecFunction(name = "atan2") + public static Expression atan2(DoubleLiteral first, DoubleLiteral second) { + return checkOutputBoundary(new DoubleLiteral(Math.atan2(first.getValue(), second.getValue()))); + } + + /** + * sign + */ + @ExecFunction(name = "sign") + public static Expression sign(DoubleLiteral first) { + if (first.getValue() < 0) { + return new TinyIntLiteral((byte) -1); + } else if (first.getValue() == 0) { + return new TinyIntLiteral((byte) 0); + } else { + return new TinyIntLiteral((byte) 1); + } + } + + /** + * bit_count + */ + @ExecFunction(name = "bit_count") + public static Expression bitCount(TinyIntLiteral first) { + return new TinyIntLiteral((byte) Integer.bitCount(first.getValue() & 0xFF)); + } + + /** + * bit_count + */ + @ExecFunction(name = "bit_count") + public static Expression bitCount(SmallIntLiteral first) { + return new TinyIntLiteral((byte) Integer.bitCount(first.getValue() & 0xFFFF)); + } + + /** + * bit_count + */ + @ExecFunction(name = "bit_count") + public static Expression bitCount(IntegerLiteral first) { + return new TinyIntLiteral((byte) Integer.bitCount(first.getValue())); + } + + /** + * bit_count + */ + @ExecFunction(name = "bit_count") + public static Expression bitCount(BigIntLiteral first) { + return new TinyIntLiteral((byte) Long.bitCount(first.getValue())); + } + + /** + * bit_count + */ + @ExecFunction(name = "bit_count") + public static Expression bitCount(LargeIntLiteral first) { + if (first.getValue().compareTo(BigInteger.ZERO) < 0) { + return new SmallIntLiteral((short) (128 - first.getValue().bitCount())); + } else { + return new SmallIntLiteral((short) first.getValue().bitCount()); + } + } + + /** + * bit_length + */ + @ExecFunction(name = "bit_length") + public static Expression bitLength(VarcharLiteral first) { + byte[] byteArray = first.getValue().getBytes(StandardCharsets.UTF_8); // Convert to bytes in UTF-8 + int byteLength = byteArray.length; + return new IntegerLiteral(byteLength * Byte.SIZE); + } + + /** + * bit_length + */ + @ExecFunction(name = "bit_length") + public static Expression bitLength(StringLiteral first) { + byte[] byteArray = first.getValue().getBytes(StandardCharsets.UTF_8); // Convert to bytes in UTF-8 + int byteLength = byteArray.length; + return new IntegerLiteral(byteLength * Byte.SIZE); + } + + /** + * cbrt + */ + @ExecFunction(name = "cbrt") + public static Expression cbrt(DoubleLiteral first) { + return checkOutputBoundary(new DoubleLiteral(Math.cbrt(first.getValue()))); + } + + /** + * cosh + */ + @ExecFunction(name = "cosh") + public static Expression cosh(DoubleLiteral first) { + return checkOutputBoundary(new DoubleLiteral(Math.cosh(first.getValue()))); + } + + /** + * tanh + */ + @ExecFunction(name = "cosh") + public static Expression tanh(DoubleLiteral first) { + return checkOutputBoundary(new DoubleLiteral(Math.tanh(first.getValue()))); + } + + /** + * dexp + */ + @ExecFunction(name = "dexp") + public static Expression dexp(DoubleLiteral first) { + double exp = Math.exp(first.getValue()); + return checkOutputBoundary(new DoubleLiteral(exp)); + } + + /** + * dlog1 + */ + @ExecFunction(name = "dlog1") + public static Expression dlog1(DoubleLiteral first) { + checkInputBoundary(first, 0.0d, Double.MAX_VALUE, false, true); + return checkOutputBoundary(new DoubleLiteral(Math.log1p(first.getValue()))); + } + + /** + * dlog10 + */ + @ExecFunction(name = "dlog10") + public static Expression dlog10(DoubleLiteral first) { + checkInputBoundary(first, 0.0d, Double.MAX_VALUE, false, true); + return checkOutputBoundary(new DoubleLiteral(Math.log10(first.getValue()))); + } + + /** + * dsqrt + */ + @ExecFunction(name = "dsqrt") + public static Expression dsqrt(DoubleLiteral first) { + checkInputBoundary(first, 0.0d, Double.MAX_VALUE, false, true); + return checkOutputBoundary(new DoubleLiteral(Math.sqrt(first.getValue()))); + } + + /** + * dpower + */ + @ExecFunction(name = "dpow") + public static Expression dpow(DoubleLiteral first, DoubleLiteral second) { + return checkOutputBoundary(new DoubleLiteral(Math.pow(first.getValue(), second.getValue()))); + } + + /** + * fmod + */ + @ExecFunction(name = "fmod") + public static Expression fmod(DoubleLiteral first, DoubleLiteral second) { + return checkOutputBoundary(new DoubleLiteral(first.getValue() / second.getValue())); + } + + /** + * fmod + */ + @ExecFunction(name = "fmod") + public static Expression fmod(FloatLiteral first, FloatLiteral second) { + return new FloatLiteral(first.getValue() / second.getValue()); + } + + /** + * fpow + */ + @ExecFunction(name = "fpow") + public static Expression fpow(DoubleLiteral first, DoubleLiteral second) { + return checkOutputBoundary(new DoubleLiteral(Math.pow(first.getValue(), second.getValue()))); + } + + /** + * radians + */ + @ExecFunction(name = "radians") + public static Expression radians(DoubleLiteral first) { + return checkOutputBoundary(new DoubleLiteral(Math.toRadians(first.getValue()))); + } + + /** + * degrees + */ + @ExecFunction(name = "degrees") + public static Expression degrees(DoubleLiteral first) { + return checkOutputBoundary(new DoubleLiteral(Math.toDegrees(first.getValue()))); + } + + /** + * xor + */ + @ExecFunction(name = "xor") + public static Expression xor(BooleanLiteral first, BooleanLiteral second) { + return BooleanLiteral.of(Boolean.logicalXor(first.getValue(), second.getValue())); + } + + /** + * pi + */ + @ExecFunction(name = "pi") + public static Expression pi() { + return DoubleLiteral.of(Math.PI); + } + + /** + * E + */ + @ExecFunction(name = "e") + public static Expression mathE() { + return DoubleLiteral.of(Math.E); + } + + /** + * truncate + */ + @ExecFunction(name = "truncate") + public static Expression truncate(DecimalV3Literal first, IntegerLiteral second) { + if (first.getValue().compareTo(BigDecimal.ZERO) == 0) { + return first; + } else { + if (first.getValue().scale() < second.getValue()) { + return first; + } + if (second.getValue() < 0) { + double factor = Math.pow(10, Math.abs(second.getValue())); + return new DecimalV3Literal( + DecimalV3Type.createDecimalV3Type(first.getValue().precision(), 0), + BigDecimal.valueOf(Math.floor(first.getDouble() / factor) * factor)); + } + if (first.getValue().compareTo(BigDecimal.ZERO) == -1) { + return first.roundCeiling(second.getValue()); + } else { + return first.roundFloor(second.getValue()); + } + } + } + } 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 a16c57fa74ae88..9d311fe06646a5 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 @@ -72,14 +72,42 @@ public double getDouble() { return value.doubleValue(); } + /** + * get ceiling of a decimal v3 literal + * @param newScale scale we want to cast to + * @return new decimal v3 literal with new scalar + */ public DecimalV3Literal roundCeiling(int newScale) { + if (newScale >= this.getValue().scale()) { + return this; + } return new DecimalV3Literal(value.setScale(newScale, RoundingMode.CEILING)); } + /** + * get floor of a decimal v3 literal + * @param newScale scale we want to cast to + * @return new decimal v3 literal with new scalar + */ public DecimalV3Literal roundFloor(int newScale) { + if (newScale >= this.getValue().scale()) { + return this; + } return new DecimalV3Literal(value.setScale(newScale, RoundingMode.FLOOR)); } + /** + * get round of a decimal v3 literal + * @param newScale scale we want to cast to + * @return new decimal v3 literal with new scalar + */ + public DecimalV3Literal round(int newScale) { + if (newScale >= this.getValue().scale()) { + return this; + } + return new DecimalV3Literal(value.setScale(newScale, RoundingMode.HALF_UP)); + } + /** * check precision and scale is enough for value. */ diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/FoldConstantTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/FoldConstantTest.java index 9009bc13e8ab77..0601b3b558d882 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/FoldConstantTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/FoldConstantTest.java @@ -21,6 +21,7 @@ import org.apache.doris.common.Config; import org.apache.doris.nereids.analyzer.UnboundRelation; import org.apache.doris.nereids.exceptions.AnalysisException; +import org.apache.doris.nereids.exceptions.NotSupportedException; import org.apache.doris.nereids.parser.NereidsParser; import org.apache.doris.nereids.rules.analysis.ExpressionAnalyzer; import org.apache.doris.nereids.rules.expression.rules.FoldConstantRule; @@ -34,15 +35,31 @@ import org.apache.doris.nereids.trees.expressions.functions.executable.DateTimeArithmetic; import org.apache.doris.nereids.trees.expressions.functions.executable.DateTimeExtractAndTransform; import org.apache.doris.nereids.trees.expressions.functions.executable.TimeRoundSeries; +import org.apache.doris.nereids.trees.expressions.functions.scalar.Acos; import org.apache.doris.nereids.trees.expressions.functions.scalar.AppendTrailingCharIfAbsent; +import org.apache.doris.nereids.trees.expressions.functions.scalar.Asin; +import org.apache.doris.nereids.trees.expressions.functions.scalar.Bin; +import org.apache.doris.nereids.trees.expressions.functions.scalar.BitCount; +import org.apache.doris.nereids.trees.expressions.functions.scalar.Ceil; +import org.apache.doris.nereids.trees.expressions.functions.scalar.Coalesce; import org.apache.doris.nereids.trees.expressions.functions.scalar.ConvertTz; +import org.apache.doris.nereids.trees.expressions.functions.scalar.Cos; import org.apache.doris.nereids.trees.expressions.functions.scalar.DateFormat; import org.apache.doris.nereids.trees.expressions.functions.scalar.DateTrunc; +import org.apache.doris.nereids.trees.expressions.functions.scalar.Exp; +import org.apache.doris.nereids.trees.expressions.functions.scalar.Floor; import org.apache.doris.nereids.trees.expressions.functions.scalar.FromUnixtime; import org.apache.doris.nereids.trees.expressions.functions.scalar.HoursAdd; +import org.apache.doris.nereids.trees.expressions.functions.scalar.Ln; import org.apache.doris.nereids.trees.expressions.functions.scalar.MinutesAdd; +import org.apache.doris.nereids.trees.expressions.functions.scalar.Power; +import org.apache.doris.nereids.trees.expressions.functions.scalar.Round; import org.apache.doris.nereids.trees.expressions.functions.scalar.SecondsAdd; +import org.apache.doris.nereids.trees.expressions.functions.scalar.Sign; +import org.apache.doris.nereids.trees.expressions.functions.scalar.Sin; +import org.apache.doris.nereids.trees.expressions.functions.scalar.Sqrt; import org.apache.doris.nereids.trees.expressions.functions.scalar.StrToDate; +import org.apache.doris.nereids.trees.expressions.functions.scalar.Tan; import org.apache.doris.nereids.trees.expressions.functions.scalar.ToDays; import org.apache.doris.nereids.trees.expressions.functions.scalar.UnixTimestamp; import org.apache.doris.nereids.trees.expressions.literal.BigIntLiteral; @@ -51,11 +68,13 @@ import org.apache.doris.nereids.trees.expressions.literal.DateTimeV2Literal; import org.apache.doris.nereids.trees.expressions.literal.DateV2Literal; import org.apache.doris.nereids.trees.expressions.literal.DecimalV3Literal; +import org.apache.doris.nereids.trees.expressions.literal.DoubleLiteral; import org.apache.doris.nereids.trees.expressions.literal.IntegerLiteral; import org.apache.doris.nereids.trees.expressions.literal.Interval.TimeUnit; import org.apache.doris.nereids.trees.expressions.literal.Literal; import org.apache.doris.nereids.trees.expressions.literal.NullLiteral; import org.apache.doris.nereids.trees.expressions.literal.StringLiteral; +import org.apache.doris.nereids.trees.expressions.literal.TinyIntLiteral; import org.apache.doris.nereids.trees.expressions.literal.VarcharLiteral; import org.apache.doris.nereids.trees.plans.RelationId; import org.apache.doris.nereids.types.DateTimeV2Type; @@ -317,6 +336,149 @@ void testFoldString() { Assertions.assertEquals(new StringLiteral("13"), rewritten); } + @Test + void testleFoldNumeric() { + executor = new ExpressionRuleExecutor(ImmutableList.of( + bottomUp(FoldConstantRuleOnFE.VISITOR_INSTANCE) + )); + Coalesce c = new Coalesce(new NullLiteral(), new NullLiteral()); + Expression rewritten = executor.rewrite(c, context); + Assertions.assertEquals(new NullLiteral(), rewritten); + c = new Coalesce(new NullLiteral(), new IntegerLiteral(1)); + rewritten = executor.rewrite(c, context); + Assertions.assertEquals(new IntegerLiteral(1), rewritten); + c = new Coalesce(new IntegerLiteral(3), new IntegerLiteral(5)); + rewritten = executor.rewrite(c, context); + Assertions.assertEquals(new IntegerLiteral(3), rewritten); + + Round round = new Round(new DoubleLiteral(3.4d)); + rewritten = executor.rewrite(round, context); + Assertions.assertEquals(new DoubleLiteral(3d), rewritten); + round = new Round(new DoubleLiteral(3.4d), new IntegerLiteral(5)); + rewritten = executor.rewrite(round, context); + Assertions.assertEquals(new DoubleLiteral(3.4d), rewritten); + round = new Round(new DoubleLiteral(3.5d)); + rewritten = executor.rewrite(round, context); + Assertions.assertEquals(new DoubleLiteral(4d), rewritten); + + Ceil ceil = new Ceil(new DoubleLiteral(3.4d)); + rewritten = executor.rewrite(ceil, context); + Assertions.assertEquals(new DoubleLiteral(4d), rewritten); + ceil = new Ceil(new DoubleLiteral(3.4d), new IntegerLiteral(5)); + rewritten = executor.rewrite(ceil, context); + Assertions.assertEquals(new DoubleLiteral(3.4d), rewritten); + + Floor floor = new Floor(new DoubleLiteral(3.4d)); + rewritten = executor.rewrite(floor, context); + Assertions.assertEquals(new DoubleLiteral(3d), rewritten); + floor = new Floor(new DoubleLiteral(3.4d), new IntegerLiteral(5)); + rewritten = executor.rewrite(floor, context); + Assertions.assertEquals(new DoubleLiteral(3.4d), rewritten); + + Exp exp = new Exp(new DoubleLiteral(0d)); + rewritten = executor.rewrite(exp, context); + Assertions.assertEquals(new DoubleLiteral(1.0), rewritten); + Assertions.assertThrows(NotSupportedException.class, () -> { + Exp exExp = new Exp(new DoubleLiteral(1000d)); + executor.rewrite(exExp, context); + }, "infinite result is invalid"); + + Ln ln = new Ln(new DoubleLiteral(1d)); + rewritten = executor.rewrite(ln, context); + Assertions.assertEquals(new DoubleLiteral(0.0), rewritten); + Assertions.assertThrows(NotSupportedException.class, () -> { + Ln exExp = new Ln(new DoubleLiteral(0.0d)); + executor.rewrite(exExp, context); + }, "input 0.0 is out of boundary"); + Assertions.assertThrows(NotSupportedException.class, () -> { + Ln exExp = new Ln(new DoubleLiteral(-1d)); + executor.rewrite(exExp, context); + }, "input -1 is out of boundary"); + + Sqrt sqrt = new Sqrt(new DoubleLiteral(16d)); + rewritten = executor.rewrite(sqrt, context); + Assertions.assertEquals(new DoubleLiteral(4d), rewritten); + sqrt = new Sqrt(new DoubleLiteral(0d)); + rewritten = executor.rewrite(sqrt, context); + Assertions.assertEquals(new DoubleLiteral(0d), rewritten); + Assertions.assertThrows(NotSupportedException.class, () -> { + Sqrt exExp = new Sqrt(new DoubleLiteral(-1d)); + executor.rewrite(exExp, context); + }, "input -1 is out of boundary"); + + Power power = new Power(new DoubleLiteral(2d), new DoubleLiteral(3)); + rewritten = executor.rewrite(power, context); + Assertions.assertEquals(new DoubleLiteral(8d), rewritten); + Assertions.assertThrows(NotSupportedException.class, () -> { + Power exExp = new Power(new DoubleLiteral(2d), new DoubleLiteral(10000d)); + executor.rewrite(exExp, context); + }, "infinite result is invalid"); + + Sin sin = new Sin(new DoubleLiteral(Math.PI / 2)); + rewritten = executor.rewrite(sin, context); + Assertions.assertEquals(new DoubleLiteral(1d), rewritten); + sin = new Sin(new DoubleLiteral(0d)); + rewritten = executor.rewrite(sin, context); + Assertions.assertEquals(new DoubleLiteral(0d), rewritten); + Assertions.assertThrows(NotSupportedException.class, () -> { + Sin exExp = new Sin(new DoubleLiteral(Double.POSITIVE_INFINITY)); + executor.rewrite(exExp, context); + }, "input infinity is out of boundary"); + + Cos cos = new Cos(new DoubleLiteral(0d)); + rewritten = executor.rewrite(cos, context); + Assertions.assertEquals(new DoubleLiteral(1d), rewritten); + Assertions.assertThrows(NotSupportedException.class, () -> { + Cos exExp = new Cos(new DoubleLiteral(Double.POSITIVE_INFINITY)); + executor.rewrite(exExp, context); + }, "input infinity is out of boundary"); + + Tan tan = new Tan(new DoubleLiteral(0d)); + rewritten = executor.rewrite(tan, context); + Assertions.assertEquals(new DoubleLiteral(0d), rewritten); + Assertions.assertThrows(NotSupportedException.class, () -> { + Tan exExp = new Tan(new DoubleLiteral(Double.POSITIVE_INFINITY)); + executor.rewrite(exExp, context); + }, "input infinity is out of boundary"); + + Asin asin = new Asin(new DoubleLiteral(1d)); + rewritten = executor.rewrite(asin, context); + Assertions.assertEquals(new DoubleLiteral(Math.PI / 2), rewritten); + Assertions.assertThrows(NotSupportedException.class, () -> { + Asin exExp = new Asin(new DoubleLiteral(2d)); + executor.rewrite(exExp, context); + }, "input 2.0 is out of boundary"); + + Acos acos = new Acos(new DoubleLiteral(1d)); + rewritten = executor.rewrite(acos, context); + Assertions.assertEquals(new DoubleLiteral(0), rewritten); + Assertions.assertThrows(NotSupportedException.class, () -> { + Acos exExp = new Acos(new DoubleLiteral(2d)); + executor.rewrite(exExp, context); + }, "input 2.0 is out of boundary"); + + Sign sign = new Sign(new DoubleLiteral(1d)); + rewritten = executor.rewrite(sign, context); + Assertions.assertEquals(new TinyIntLiteral((byte) 1), rewritten); + sign = new Sign(new DoubleLiteral(-1d)); + rewritten = executor.rewrite(sign, context); + Assertions.assertEquals(new TinyIntLiteral((byte) -1), rewritten); + sign = new Sign(new DoubleLiteral(0d)); + rewritten = executor.rewrite(sign, context); + Assertions.assertEquals(new TinyIntLiteral((byte) 0), rewritten); + + Bin bin = new Bin(new BigIntLiteral(5)); + rewritten = executor.rewrite(bin, context); + Assertions.assertEquals(new VarcharLiteral("101"), rewritten); + + BitCount bitCount = new BitCount(new BigIntLiteral(16)); + rewritten = executor.rewrite(bitCount, context); + Assertions.assertEquals(new TinyIntLiteral((byte) 1), rewritten); + bitCount = new BitCount(new BigIntLiteral(-1)); + rewritten = executor.rewrite(bitCount, context); + Assertions.assertEquals(new TinyIntLiteral((byte) 64), rewritten); + } + @Test void testCompareFold() { executor = new ExpressionRuleExecutor(ImmutableList.of( diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/functions/ExecutableFunctionsTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/functions/ExecutableFunctionsTest.java deleted file mode 100644 index 6c2e9f144be883..00000000000000 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/functions/ExecutableFunctionsTest.java +++ /dev/null @@ -1,64 +0,0 @@ -// 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.functions; - -import org.apache.doris.nereids.trees.expressions.functions.executable.ExecutableFunctions; -import org.apache.doris.nereids.trees.expressions.literal.BigIntLiteral; -import org.apache.doris.nereids.trees.expressions.literal.IntegerLiteral; -import org.apache.doris.nereids.trees.expressions.literal.LargeIntLiteral; -import org.apache.doris.nereids.trees.expressions.literal.SmallIntLiteral; -import org.apache.doris.nereids.trees.expressions.literal.TinyIntLiteral; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import java.math.BigInteger; - -public class ExecutableFunctionsTest { - @Test - void testAbsFunctions() { - TinyIntLiteral tinyInt1 = new TinyIntLiteral((byte) -128); - Assertions.assertEquals(new SmallIntLiteral((short) 128), ExecutableFunctions.abs(tinyInt1)); - TinyIntLiteral tinyInt2 = new TinyIntLiteral((byte) 127); - Assertions.assertEquals(new SmallIntLiteral((short) 127), ExecutableFunctions.abs(tinyInt2)); - - SmallIntLiteral smallInt1 = new SmallIntLiteral((short) -32768); - Assertions.assertEquals(new IntegerLiteral(32768), ExecutableFunctions.abs(smallInt1)); - SmallIntLiteral smallInt2 = new SmallIntLiteral((short) 32767); - Assertions.assertEquals(new IntegerLiteral(32767), ExecutableFunctions.abs(smallInt2)); - - IntegerLiteral int1 = new IntegerLiteral(-2147483648); - Assertions.assertEquals(new BigIntLiteral(2147483648L), ExecutableFunctions.abs(int1)); - IntegerLiteral int2 = new IntegerLiteral(2147483647); - Assertions.assertEquals(new BigIntLiteral(2147483647L), ExecutableFunctions.abs(int2)); - - BigIntLiteral bigInt1 = new BigIntLiteral(-9223372036854775808L); - Assertions.assertEquals(new LargeIntLiteral(new BigInteger("9223372036854775808")), - ExecutableFunctions.abs(bigInt1)); - BigIntLiteral bigInt2 = new BigIntLiteral(9223372036854775807L); - Assertions.assertEquals(new LargeIntLiteral(new BigInteger("9223372036854775807")), - ExecutableFunctions.abs(bigInt2)); - - LargeIntLiteral largeInt1 = new LargeIntLiteral(new BigInteger("-170141183460469231731687303715884105728")); - Assertions.assertEquals(new LargeIntLiteral(new BigInteger("170141183460469231731687303715884105728")), - ExecutableFunctions.abs(largeInt1)); - LargeIntLiteral largeInt2 = new LargeIntLiteral(new BigInteger("170141183460469231731687303715884105727")); - Assertions.assertEquals(new LargeIntLiteral(new BigInteger("170141183460469231731687303715884105727")), - ExecutableFunctions.abs(largeInt2)); - } -} diff --git a/regression-test/data/datatype_p0/double/test_double_nan.out b/regression-test/data/datatype_p0/double/test_double_nan.out index 327a147e2db2e8..f958424e65c626 100644 --- a/regression-test/data/datatype_p0/double/test_double_nan.out +++ b/regression-test/data/datatype_p0/double/test_double_nan.out @@ -1,7 +1,3 @@ -- This file is automatically generated. You should know what you did if you want to edit this -- !select -- -1 \N - --- !select -- -\N diff --git a/regression-test/data/datatype_p0/float/test_float_nan.out b/regression-test/data/datatype_p0/float/test_float_nan.out index 327a147e2db2e8..f958424e65c626 100644 --- a/regression-test/data/datatype_p0/float/test_float_nan.out +++ b/regression-test/data/datatype_p0/float/test_float_nan.out @@ -1,7 +1,3 @@ -- This file is automatically generated. You should know what you did if you want to edit this -- !select -- -1 \N - --- !select -- -\N diff --git a/regression-test/suites/datatype_p0/double/test_double_nan.groovy b/regression-test/suites/datatype_p0/double/test_double_nan.groovy index b193b0132dbcfb..3d57fee2990d8c 100644 --- a/regression-test/suites/datatype_p0/double/test_double_nan.groovy +++ b/regression-test/suites/datatype_p0/double/test_double_nan.groovy @@ -19,10 +19,17 @@ suite("test_double_nan", "datatype_p0") { def tableName = "tbl_test_double_nan" sql "DROP TABLE IF EXISTS ${tableName}" sql "CREATE TABLE if NOT EXISTS ${tableName} (k int, value double) DUPLICATE KEY(k) DISTRIBUTED BY HASH (k) BUCKETS 1 PROPERTIES ('replication_num' = '1');" - sql """insert into ${tableName} select 1, sqrt(-1);""" + + test { + sql """insert into ${tableName} select 1, sqrt(-1);""" + exception "errCode" + } qt_select "select * from ${tableName} order by 1;" - qt_select "select sqrt(-1);" + test { + sql "select sqrt(-1);" + exception "errCode" + } sql "DROP TABLE IF EXISTS ${tableName}" -} \ No newline at end of file +} diff --git a/regression-test/suites/datatype_p0/float/test_float_nan.groovy b/regression-test/suites/datatype_p0/float/test_float_nan.groovy index 18958b27cf26a2..cf07006abad4b7 100644 --- a/regression-test/suites/datatype_p0/float/test_float_nan.groovy +++ b/regression-test/suites/datatype_p0/float/test_float_nan.groovy @@ -19,10 +19,16 @@ suite("test_float_nan", "datatype_p0") { def tableName = "tbl_test_float_nan" sql "DROP TABLE IF EXISTS ${tableName}" sql "CREATE TABLE if NOT EXISTS ${tableName} (k int, value float) DUPLICATE KEY(k) DISTRIBUTED BY HASH (k) BUCKETS 1 PROPERTIES ('replication_num' = '1');" - sql """insert into ${tableName} select 1, sqrt(-1);""" + test { + sql """insert into ${tableName} select 1, sqrt(-1);""" + exception "errCode" + } qt_select "select * from ${tableName} order by 1;" - qt_select "select sqrt(-1);" + test { + sql "select sqrt(-1);" + exception "errCode" + } sql "DROP TABLE IF EXISTS ${tableName}" -} \ No newline at end of file +} diff --git a/regression-test/suites/nereids_function_p0/scalar_function/A.groovy b/regression-test/suites/nereids_function_p0/scalar_function/A.groovy index bc8ffbe71b443d..b4df5d9e9c42fc 100644 --- a/regression-test/suites/nereids_function_p0/scalar_function/A.groovy +++ b/regression-test/suites/nereids_function_p0/scalar_function/A.groovy @@ -37,7 +37,10 @@ suite("nereids_scalar_fn_A") { qt_sql_abs_DecimalV2_notnull "select abs(kdcmls1) from fn_test_not_nullable order by kdcmls1" qt_sql_acos_Double "select acos(kdbl) from fn_test order by kdbl" qt_sql_acos_Double_notnull "select acos(kdbl) from fn_test_not_nullable order by kdbl" - qt_sql_acos_Double_NAN "select acos(cast(1.1 as double))" + test { + sql "select acos(cast(1.1 as double))" + exception "errCode" + } qt_sql_acos_Double_NULL "select acos(null)" sql "select aes_decrypt(kvchrs1, kvchrs1) from fn_test order by kvchrs1, kvchrs1" sql "select aes_decrypt(kvchrs1, kvchrs1) from fn_test_not_nullable order by kvchrs1, kvchrs1" diff --git a/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_numeric_arithmatic.groovy b/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_numeric_arithmatic.groovy new file mode 100644 index 00000000000000..5f728651267e82 --- /dev/null +++ b/regression-test/suites/nereids_p0/expression/fold_constant/fold_constant_numeric_arithmatic.groovy @@ -0,0 +1,412 @@ +// 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. + +suite("fold_constant_numeric_arithmatic") { + def db = "fold_constant_string_arithmatic" + sql "create database if not exists ${db}" + + sql "set enable_nereids_planner=true" + sql "set enable_fallback_to_original_planner=false" + sql "set enable_fold_constant_by_be=false" + + testFoldConst("SELECT truncate(123.456, -1)") +// testFoldConst("select pmod(-9223372036854775808,-1)") + //Coalesce function cases + testFoldConst("SELECT COALESCE(NULL, 5) AS coalesce_case_1") + testFoldConst("SELECT COALESCE(NULL, NULL, 7) AS coalesce_case_2") + testFoldConst("SELECT COALESCE(3, 5) AS coalesce_case_3") + testFoldConst("SELECT COALESCE(NULL, NULL) AS coalesce_case_4") + +//Round function cases + testFoldConst("SELECT ROUND(3.4) AS round_case_1") + testFoldConst("SELECT ROUND(3.5) AS round_case_2") + testFoldConst("SELECT ROUND(-3.4) AS round_case_3") + testFoldConst("SELECT ROUND(123.456, 2) AS round_case_4") //Rounding to 2 decimal places + +//Ceil function cases + testFoldConst("SELECT CEIL(3.4) AS ceil_case_1") + testFoldConst("SELECT CEIL(-3.4) AS ceil_case_2") + testFoldConst("SELECT CEIL(5.0) AS ceil_case_3") + +//Floor function cases + testFoldConst("SELECT FLOOR(3.7) AS floor_case_1") + testFoldConst("SELECT FLOOR(-3.7) AS floor_case_2") + testFoldConst("SELECT FLOOR(5.0) AS floor_case_3") + +//Exp function cases + testFoldConst("SELECT EXP(1) AS exp_case_1") //e^1 + testFoldConst("SELECT EXP(0) AS exp_case_2") //e^0 + testFoldConst("SELECT EXP(-1) AS exp_case_3") //e^-1 + +//Ln (natural logarithm) function cases + testFoldConst("SELECT LN(1) AS ln_case_1") //ln(1) = 0 + testFoldConst("SELECT LN(EXP(1)) AS ln_case_2") //ln(e) = 1 + testFoldConst("SELECT LN(0.5) AS ln_case_3") //ln(0.5) + +//Log10 function cases + testFoldConst("SELECT LOG10(100) AS log10_case_1") //log10(100) = 2 + testFoldConst("SELECT LOG10(1) AS log10_case_2") //log10(1) = 0 + testFoldConst("SELECT LOG10(1000) AS log10_case_3") //log10(1000) = 3 + +//Log2 function cases + testFoldConst("SELECT LOG2(2) AS log2_case_1") //log2(2) = 1 + testFoldConst("SELECT LOG2(8) AS log2_case_2") //log2(8) = 3 + testFoldConst("SELECT LOG2(1) AS log2_case_3") //log2(1) = 0 + +//Sqrt function cases + testFoldConst("SELECT SQRT(16) AS sqrt_case_1") //sqrt(16) = 4 + testFoldConst("SELECT SQRT(0) AS sqrt_case_2") //sqrt(0) = 0 + testFoldConst("SELECT SQRT(2) AS sqrt_case_3") //sqrt(2) + +//Power function cases + testFoldConst("SELECT POWER(2, 3) AS power_case_1") //2^3 = 8 + testFoldConst("SELECT POWER(10, 0) AS power_case_2") //10^0 = 1 + testFoldConst("SELECT POWER(5, -1) AS power_case_3") //5^-1 = 0.2 + +//Sin function cases + testFoldConst("SELECT SIN(PI() / 2) AS sin_case_1") //sin(π/2) = 1 + testFoldConst("SELECT SIN(0) AS sin_case_2") //sin(0) = 0 + testFoldConst("SELECT SIN(PI()) AS sin_case_3") //sin(π) + +//Cos function cases + testFoldConst("SELECT COS(PI()) AS cos_case_1") //cos(π) = -1 + testFoldConst("SELECT COS(0) AS cos_case_2") //cos(0) = 1 + testFoldConst("SELECT COS(PI() / 2) AS cos_case_3") //cos(π/2) + +//Tan function cases + testFoldConst("SELECT TAN(PI() / 4) AS tan_case_1") //tan(π/4) = 1 + testFoldConst("SELECT TAN(0) AS tan_case_2") //tan(0) = 0 + testFoldConst("SELECT TAN(PI()) AS tan_case_3") //tan(π) + +//Acos function cases + testFoldConst("SELECT ACOS(1) AS acos_case_1") //acos(1) = 0 + testFoldConst("SELECT ACOS(0) AS acos_case_2") //acos(0) = π/2 + testFoldConst("SELECT ACOS(-1) AS acos_case_3") //acos(-1) = π + +//Asin function cases + testFoldConst("SELECT ASIN(1) AS asin_case_1") //asin(1) = π/2 + testFoldConst("SELECT ASIN(0) AS asin_case_2") //asin(0) = 0 + testFoldConst("SELECT ASIN(-1) AS asin_case_3") //asin(-1) = -π/2 + +//Atan function cases + testFoldConst("SELECT ATAN(1) AS atan_case_1") //atan(1) = π/4 + testFoldConst("SELECT ATAN(0) AS atan_case_2") //atan(0) = 0 + testFoldConst("SELECT ATAN(-1) AS atan_case_3") //atan(-1) + +//Atan2 function cases + testFoldConst("SELECT ATAN2(1, 1) AS atan2_case_1") //atan2(1, 1) = π/4 + testFoldConst("SELECT ATAN2(0, 1) AS atan2_case_2") //atan2(0, 1) = 0 + testFoldConst("SELECT ATAN2(1, 0) AS atan2_case_3") //atan2(1, 0) = π/2 + +//Sign function cases + testFoldConst("SELECT SIGN(5) AS sign_case_1") //sign(5) = 1 + testFoldConst("SELECT SIGN(-5) AS sign_case_2") //sign(-5) = -1 + testFoldConst("SELECT SIGN(0) AS sign_case_3") //sign(0) = 0 + +//Bin function cases (binary conversion) + testFoldConst("SELECT BIN(5) AS bin_case_1") //bin(5) = 101 + testFoldConst("SELECT BIN(16) AS bin_case_2") //bin(16) = 10000 + testFoldConst("SELECT BIN(255) AS bin_case_3") //bin(255) + +//BitCount function cases (count bits set to 1) + testFoldConst("SELECT BIT_COUNT(5) AS bitcount_case_1") //bitcount(5) = 2 (101 has two 1s) + testFoldConst("SELECT BIT_COUNT(16) AS bitcount_case_2") //bitcount(16) = 1 + testFoldConst("SELECT BIT_COUNT(255) AS bitcount_case_3") //bitcount(255) + +//BitLength function cases + testFoldConst("SELECT BIT_LENGTH('5') AS bitlength_case_1") //bitlength(101) = 3 + testFoldConst("SELECT BIT_LENGTH('16') AS bitlength_case_2") //bitlength(10000) = 5 + testFoldConst("SELECT BIT_LENGTH('11111111') AS bitlength_case_3") //bitlength(11111111) + +//Cbrt (cube root) function cases + testFoldConst("SELECT CBRT(8) AS cbrt_case_1") //cbrt(8) = 2 + testFoldConst("SELECT CBRT(-8) AS cbrt_case_2") //cbrt(-8) = -2 +// testFoldConst("SELECT CBRT(27) AS cbrt_case_3") //cbrt(27) + +//Cosh function cases (hyperbolic cosine) + testFoldConst("SELECT COSH(0) AS cosh_case_1") //cosh(0) = 1 +// testFoldConst("SELECT COSH(1) AS cosh_case_2") //cosh(1) +// testFoldConst("SELECT COSH(-1) AS cosh_case_3") //cosh(-1) + +//Tanh function cases (hyperbolic tangent) + testFoldConst("SELECT TANH(0) AS tanh_case_1") //tanh(0) = 0 + testFoldConst("SELECT TANH(1) AS tanh_case_2") //tanh(1) + testFoldConst("SELECT TANH(-1) AS tanh_case_3") //tanh(-1) + +//Dexp function cases (double exp) + testFoldConst("SELECT EXP(2.0) AS dexp_case_1") //dexp(2.0) + testFoldConst("SELECT EXP(0.5) AS dexp_case_2") //dexp(0.5) + testFoldConst("SELECT EXP(-2.0) AS dexp_case_3") //dexp(-2.0) + +//Dlog10 function cases (double log base 10) + testFoldConst("SELECT LOG10(100.0) AS dlog10_case_1") //dlog10(100.0) = 2 + testFoldConst("SELECT LOG10(1.0) AS dlog10_case_2") //dlog10(1.0) = 0 + testFoldConst("SELECT LOG10(1000.0) AS dlog10_case_3") //dlog10(1000.0) + +//Dlog1 function cases (log base 1 is not commonly defined) + +//Dpow function cases (double power) + testFoldConst("SELECT POWER(2.0, 3.0) AS dpow_case_1") //dpow(2.0^3.0) = 8.0 + testFoldConst("SELECT POWER(10.0, 0.0) AS dpow_case_2") //dpow(10.0^0.0) = 1.0 + testFoldConst("SELECT POWER(5.0, -1.0) AS dpow_case_3") +//Coalesce function cases + testFoldConst("SELECT COALESCE(NULL, 5) AS coalesce_case_1") + testFoldConst("SELECT COALESCE(NULL, NULL, 7) AS coalesce_case_2") + testFoldConst("SELECT COALESCE(3, 5) AS coalesce_case_3") + testFoldConst("SELECT COALESCE(NULL, NULL) AS coalesce_case_4") + +//Round function cases + testFoldConst("SELECT ROUND(3.4) AS round_case_1") + testFoldConst("SELECT ROUND(3.5) AS round_case_2") + testFoldConst("SELECT ROUND(-3.4) AS round_case_3") + testFoldConst("SELECT ROUND(123.456, 2) AS round_case_4") //rounding to 2 decimal places +//Exception: Round overflow (not common but tested with extremely large values) + testFoldConst("SELECT ROUND(1E308) AS round_case_overflow") //very large number + +//Ceil function cases + testFoldConst("SELECT CEIL(3.4) AS ceil_case_1") + testFoldConst("SELECT CEIL(-3.4) AS ceil_case_2") + testFoldConst("SELECT CEIL(5.0) AS ceil_case_3") +//Exception: Ceil of extremely large number + testFoldConst("SELECT CEIL(1E308) AS ceil_case_overflow") + +//Floor function cases + testFoldConst("SELECT FLOOR(3.7) AS floor_case_1") + testFoldConst("SELECT FLOOR(-3.7) AS floor_case_2") + testFoldConst("SELECT FLOOR(5.0) AS floor_case_3") +//Exception: Floor of extremely large number + testFoldConst("SELECT FLOOR(1E308) AS floor_case_overflow") + +//Exp function cases + testFoldConst("SELECT EXP(1) AS exp_case_1") //e^1 + testFoldConst("SELECT EXP(0) AS exp_case_2") //e^0 + testFoldConst("SELECT EXP(-1) AS exp_case_3") //e^-1 + +//Ln (natural logarithm) function cases + testFoldConst("SELECT LN(1) AS ln_case_1") //ln(1) = 0 + testFoldConst("SELECT LN(EXP(1)) AS ln_case_2") //ln(e) = 1 + testFoldConst("SELECT LN(0.5) AS ln_case_3") //ln(0.5) + +//Log10 function cases + testFoldConst("SELECT LOG10(100) AS log10_case_1") //log10(100) = 2 + testFoldConst("SELECT LOG10(1) AS log10_case_2") //log10(1) = 0 + testFoldConst("SELECT LOG10(1000) AS log10_case_3") //log10(1000) = 3 + +//Sqrt function cases + testFoldConst("SELECT SQRT(16) AS sqrt_case_1") //sqrt(16) = 4 + testFoldConst("SELECT SQRT(0) AS sqrt_case_2") //sqrt(0) = 0 + testFoldConst("SELECT SQRT(2) AS sqrt_case_3") //sqrt(2) + +//Power function cases + testFoldConst("SELECT POWER(2, 3) AS power_case_1") //2^3 = 8 + testFoldConst("SELECT POWER(10, 0) AS power_case_2") //10^0 = 1 + testFoldConst("SELECT POWER(5, -1) AS power_case_3") //5^-1 = 0.2 + +//Sin function cases + testFoldConst("SELECT SIN(PI() / 2) AS sin_case_1") //sin(π/2) = 1 + testFoldConst("SELECT SIN(0) AS sin_case_2") //sin(0) = 0 + testFoldConst("SELECT SIN(PI()) AS sin_case_3") //sin(π) +//Exception: Sin of extremely large number + testFoldConst("SELECT SIN(1E308) AS sin_case_overflow") + +//Cos function cases + testFoldConst("SELECT COS(PI()) AS cos_case_1") //cos(π) = -1 + testFoldConst("SELECT COS(0) AS cos_case_2") //cos(0) = 1 + testFoldConst("SELECT COS(PI() / 2) AS cos_case_3") //cos(π/2) +//Exception: Cos of extremely large number + testFoldConst("SELECT COS(1E308) AS cos_case_overflow") + +//Tan function cases + testFoldConst("SELECT TAN(PI() / 4) AS tan_case_1") //tan(π/4) = 1 + testFoldConst("SELECT TAN(0) AS tan_case_2") //tan(0) = 0 + testFoldConst("SELECT TAN(PI()) AS tan_case_3") //tan(π) +//Exception: Tan of extremely large number (undefined for multiples of π/2) + testFoldConst("SELECT TAN(PI() / 2) AS tan_case_exception") //undefined (returns NULL or error) + +//Acos function cases + testFoldConst("SELECT ACOS(1) AS acos_case_1") //acos(1) = 0 + testFoldConst("SELECT ACOS(0) AS acos_case_2") //acos(0) = π/2 + testFoldConst("SELECT ACOS(-1) AS acos_case_3") //acos(-1) = π + +//Asin function cases + testFoldConst("SELECT ASIN(1) AS asin_case_1") //asin(1) = π/2 + testFoldConst("SELECT ASIN(0) AS asin_case_2") //asin(0) = 0 + testFoldConst("SELECT ASIN(-1) AS asin_case_3") //asin(-1) = -π/2 + +//Atan function cases + testFoldConst("SELECT ATAN(1) AS atan_case_1") //atan(1) = π/4 + testFoldConst("SELECT ATAN(0) AS atan_case_2") //atan(0) = 0 + testFoldConst("SELECT ATAN(-1) AS atan_case_3") //atan(-1) +//No exceptions for Atan, defined for all real numbers + +//Atan2 function cases + testFoldConst("SELECT ATAN2(1, 1) AS atan2_case_1") //atan2(1, 1) = π/4 + testFoldConst("SELECT ATAN2(0, 1) AS atan2_case_2") //atan2(0, 1) = 0 + testFoldConst("SELECT ATAN2(1, 0) AS atan2_case_3") //atan2(1, 0) = π/2 +//Exception: Atan2(0, 0) is undefined + testFoldConst("SELECT ATAN2(0, 0) AS atan2_case_exception") //undefined (returns NULL or error) + +//Sign function cases + testFoldConst("SELECT SIGN(5) AS sign_case_1") //sign(5) = 1 + testFoldConst("SELECT SIGN(-5) AS sign_case_2") //sign(-5) = -1 + testFoldConst("SELECT SIGN(0) AS sign_case_3") //sign(0) = 0 +//No exceptions for Sign + +//Bin function cases + testFoldConst("SELECT BIN(5) AS bin_case_1") //bin(5) = 101 + testFoldConst("SELECT BIN(16) AS bin_case_2") //bin(16) = 10000 + testFoldConst("SELECT BIN(255) AS bin_case_3") //bin(255) +//Exception: Bin of negative values (may not be defined in all DBs) + testFoldConst("SELECT BIN(-1) AS bin_case_exception") //returns NULL or error in some databases + +//BitCount function cases (count bits set to 1) + testFoldConst("SELECT BIT_COUNT(5) AS bitcount_case_1") //bitcount(5) = 2 (101 has two 1s) + testFoldConst("SELECT BIT_COUNT(16) AS bitcount_case_2") +//BitCount function cases (count bits set to 1) + testFoldConst("SELECT BIT_COUNT(5) AS bitcount_case_1") //bitcount(5) = 2 (101 has two 1s) + testFoldConst("SELECT BIT_COUNT(16) AS bitcount_case_2") //bitcount(16) = 1 + testFoldConst("SELECT BIT_COUNT(255) AS bitcount_case_3") //bitcount(255) = 8 +//Exception: BitCount of negative values + testFoldConst("SELECT BIT_COUNT(-1) AS bitcount_case_exception") //result depends on system's interpretation of negative values + +//Cbrt (cube root) function cases + testFoldConst("SELECT CBRT(8) AS cbrt_case_1") //cbrt(8) = 2 + testFoldConst("SELECT CBRT(-8) AS cbrt_case_2") //cbrt(-8) = -2 + +//Cosh function cases (hyperbolic cosine) + testFoldConst("SELECT COSH(0) AS cosh_case_1") //cosh(0) = 1 +// testFoldConst("SELECT COSH(1) AS cosh_case_2") //cosh(1) +// testFoldConst("SELECT COSH(-1) AS cosh_case_3") //cosh(-1) +//Exception: Overflow on large input +// testFoldConst("SELECT COSH(1E308) AS cosh_case_overflow") + +//Tanh function cases (hyperbolic tangent) + testFoldConst("SELECT TANH(0) AS tanh_case_1") //tanh(0) = 0 + testFoldConst("SELECT TANH(1) AS tanh_case_2") //tanh(1) + testFoldConst("SELECT TANH(-1) AS tanh_case_3") //tanh(-1) +//No exception cases for Tanh as it's defined for all real numbers + +//Dexp function cases (double exp) + testFoldConst("SELECT EXP(2.0) AS dexp_case_1") //dexp(2.0) + testFoldConst("SELECT EXP(0.5) AS dexp_case_2") //dexp(0.5) + testFoldConst("SELECT EXP(-2.0) AS dexp_case_3") //dexp(-2.0) + +//Dlog10 function cases (double log base 10) + testFoldConst("SELECT LOG10(100.0) AS dlog10_case_1") //dlog10(100.0) = 2 + testFoldConst("SELECT LOG10(1.0) AS dlog10_case_2") //dlog10(1.0) = 0 + testFoldConst("SELECT LOG10(1000.0) AS dlog10_case_3") //dlog10(1000.0) + +//Dpow function cases (double power) + testFoldConst("SELECT POWER(2.0, 3.0) AS dpow_case_1") //dpow(2.0^3.0) = 8.0 + testFoldConst("SELECT POWER(10.0, 0.0) AS dpow_case_2") //dpow(10.0^0.0) = 1.0 + testFoldConst("SELECT POWER(5.0, -1.0) AS dpow_case_3") //dpow(5.0^-1.0) = 0.2 + +//Dsqrt function cases (double sqrt) + testFoldConst("SELECT SQRT(16.0) AS dsqrt_case_1") //sqrt(16.0) = 4 + testFoldConst("SELECT SQRT(0.0) AS dsqrt_case_2") //sqrt(0.0) = 0 + testFoldConst("SELECT SQRT(2.0) AS dsqrt_case_3") //sqrt(2.0) + +//Fmod function cases (floating-point modulus) + testFoldConst("SELECT MOD(10.5, 3.2) AS fmod_case_1") //fmod(10.5 % 3.2) + testFoldConst("SELECT MOD(-10.5, 3.2) AS fmod_case_2") //fmod(-10.5 % 3.2) + testFoldConst("SELECT MOD(10.5, -3.2) AS fmod_case_3") //fmod(10.5 % -3.2) +//Exception: Division by zero in modulus + testFoldConst("SELECT MOD(10.5, 0) AS fmod_case_exception") //undefined (returns NULL or error) + +//Fpow function cases (floating-point power) + testFoldConst("SELECT POWER(2.5, 3.2) AS fpow_case_1") //fpow(2.5^3.2) + testFoldConst("SELECT POWER(10.0, 0.0) AS fpow_case_2") //fpow(10.0^0.0) = 1.0 + testFoldConst("SELECT POWER(5.5, -1.2) AS fpow_case_3") //fpow(5.5^-1.2) + +//Radians function cases (degrees to radians) + testFoldConst("SELECT RADIANS(180) AS radians_case_1") //radians(180) = π + testFoldConst("SELECT RADIANS(90) AS radians_case_2") //radians(90) = π/2 + testFoldConst("SELECT RADIANS(45) AS radians_case_3") //radians(45) +//No exception cases for Radians + +//Degrees function cases (radians to degrees) + testFoldConst("SELECT DEGREES(PI()) AS degrees_case_1") //degrees(π) = 180 + testFoldConst("SELECT DEGREES(PI()/2) AS degrees_case_2") //degrees(π/2) = 90 + testFoldConst("SELECT DEGREES(PI()/4) AS degrees_case_3") //degrees(π/4) +//No exception cases for Degrees + +//Xor function cases (bitwise XOR) + testFoldConst("SELECT 5 ^ 3 AS xor_case_1") //5 XOR 3 = 6 + testFoldConst("SELECT 0 ^ 1 AS xor_case_2") //0 XOR 1 = 1 + testFoldConst("SELECT 255 ^ 128 AS xor_case_3") //255 XOR 128 +//Exception: XOR on non-integer types (if applicable) +test { + sql "SELECT 'a' ^ 1 AS xor_case_exception" + exception("string literal 'a' cannot be cast to double") +} + +//Pi function cases + testFoldConst("SELECT PI() AS pi_case_1") //π = 3.141592653589793 +//No exception cases for Pi + +//E function cases + testFoldConst("SELECT EXP(1) AS e_case_1") //e = 2.718281828459045 +//No exception cases for E + +//Conv function cases (convert from one base to another) + testFoldConst("SELECT CONV(15, 10, 2) AS conv_case_1") //conv(15 from base 10 to base 2) = 1111 + testFoldConst("SELECT CONV(1111, 2, 10) AS conv_case_2") //conv(1111 from base 2 to base 10) = 15 + testFoldConst("SELECT CONV(255, 10, 16) AS conv_case_3") //conv(255 from base 10 to base 16) = FF +//Exception: Conv with invalid bases or negative values + testFoldConst("SELECT CONV(-10, 10, 2) AS conv_case_exception") //undefined or error + +//Truncate function cases + testFoldConst("SELECT TRUNCATE(123.456, 2) AS truncate_case_1") //truncate(123.456, 2) = 123.45 + testFoldConst("SELECT TRUNCATE(-123.456, 1) AS truncate_case_2") //truncate(-123.456, 1) = -123.4 + testFoldConst("SELECT TRUNCATE(123.456, 0) AS truncate_case_3") //truncate(123.456, 0) = 123 +//Exception: Truncate with negative decimal places + testFoldConst("SELECT TRUNCATE(123.456, -1) AS truncate_case_exception") //undefined or error + +//CountEqual function cases + testFoldConst("SELECT COUNT(CASE WHEN 5 = 5 THEN 1 END) AS countequal_case_1") //1 (true) + testFoldConst("SELECT COUNT(CASE WHEN 5 = 3 THEN 1 END) AS countequal_case_2") //0 (false) +//Exception: Undefined operation + testFoldConst("SELECT COUNT(CASE WHEN 'a' = 1 THEN 1 END) AS countequal_case_exception") //undefined or error + +//Pmod function cases (positive +//Pmod function cases (positive modulus) + testFoldConst("SELECT MOD(10, 3) AS pmod_case_1") //pmod(10 % 3) = 1 + testFoldConst("SELECT MOD(-10, 3) AS pmod_case_2") //pmod(-10 % 3) = 2 (makes result positive) + testFoldConst("SELECT MOD(10, -3) AS pmod_case_3") //pmod(10 % -3) = -2 (ensures result is positive) +//Exception: Division by zero in modulus + testFoldConst("SELECT MOD(10, 0) AS pmod_case_exception") //undefined (returns NULL or error) + +//Summary of Edge Cases and Overflows +//Round, Ceil, Floor with extremely large values + testFoldConst("SELECT ROUND(1E308) AS round_large_value") + testFoldConst("SELECT CEIL(1E308) AS ceil_large_value") + testFoldConst("SELECT FLOOR(1E308) AS floor_large_value") + +//Trigonometric functions with large inputs or boundary conditions + testFoldConst("SELECT SIN(1E308) AS sin_large_value") //Sin overflow + testFoldConst("SELECT COS(1E308) AS cos_large_value") //Cos overflow + testFoldConst("SELECT TAN(PI() / 2) AS tan_undefined") //Undefined for tan(π/2) + +//Miscellaneous operations like bit manipulations and modulo on edge cases + testFoldConst("SELECT BIN(-1) AS bin_negative_value") //Bin of negative number (may be undefined) + testFoldConst("SELECT BIT_COUNT(-1) AS bitcount_negative_value") //BitCount of negative number + testFoldConst("SELECT MOD(10.5, 0) AS fmod_divide_by_zero") //Modulo by zero (undefined) + testFoldConst("SELECT TRUNCATE(123.456, -1) AS truncate_negative_decimals") //Truncate with negative decimals + +//Additional cases for Xor, Conv, and other mathematical functions + testFoldConst("SELECT CONV(-10, 10, 2) AS conv_invalid_base") //Conv with negative input (may be undefined) +} diff --git a/regression-test/suites/nereids_rules_p0/partition_prune/test_multi_range_partition.groovy b/regression-test/suites/nereids_rules_p0/partition_prune/test_multi_range_partition.groovy index 23fad332f4c43d..319d6fb8141bd4 100644 --- a/regression-test/suites/nereids_rules_p0/partition_prune/test_multi_range_partition.groovy +++ b/regression-test/suites/nereids_rules_p0/partition_prune/test_multi_range_partition.groovy @@ -73,7 +73,7 @@ suite("test_multi_range_partition") { } explain{ sql "select * from pt where sin(k1)=0" - contains "artitions=3/3 (p1,p2,p3)" + contains "partitions=1/3 (p1)" } // fix BUG: p1 missed From f9bd4efb9e57f5c64ed4d3610b6dff9dedca8878 Mon Sep 17 00:00:00 2001 From: zy-kkk Date: Mon, 30 Sep 2024 22:32:35 +0800 Subject: [PATCH 08/12] [fix](oracle scan) Fix performance issues caused by version judgment (#41407) --- .../main/java/org/apache/doris/jdbc/OracleJdbcExecutor.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/OracleJdbcExecutor.java b/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/OracleJdbcExecutor.java index 6f38895335b986..344e88b96c2095 100644 --- a/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/OracleJdbcExecutor.java +++ b/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/OracleJdbcExecutor.java @@ -39,9 +39,11 @@ public class OracleJdbcExecutor extends BaseJdbcExecutor { private static final Logger LOG = Logger.getLogger(OracleJdbcExecutor.class); private final CharsetDecoder utf8Decoder = StandardCharsets.UTF_8.newDecoder(); + private final boolean isNewJdbcVersion; public OracleJdbcExecutor(byte[] thriftParams) throws Exception { super(thriftParams); + isNewJdbcVersion = isJdbcVersionGreaterThanOrEqualTo("12.2.0"); } @Override @@ -65,7 +67,7 @@ protected void initializeBlock(int columnCount, String[] replaceStringList, int @Override protected Object getColumnValue(int columnIndex, ColumnType type, String[] replaceStringList) throws SQLException { - if (isJdbcVersionGreaterThanOrEqualTo("12.2.0")) { + if (isNewJdbcVersion) { return newGetColumnValue(columnIndex, type, replaceStringList); } else { return oldGetColumnValue(columnIndex, type, replaceStringList); From 637da180ad757d6e0de85ca7b73e092924344c8c Mon Sep 17 00:00:00 2001 From: minghong Date: Tue, 1 Oct 2024 23:49:55 +0800 Subject: [PATCH 09/12] [regressioncase](nereids)tpcds 10t plan shape for external table (#41340) ## Proposed changes tracking tpcds 10t shape for exteranl table simulating exteranl table by olaptable, 1. inject row count 2. tables are distributed by random Issue Number: close #xxx --- .../shape/query1.out | 37 + .../shape/query10.out | 47 ++ .../shape/query11.out | 57 ++ .../shape/query12.out | 26 + .../shape/query13.out | 34 + .../shape/query14.out | 162 +++++ .../shape/query15.out | 25 + .../shape/query16.out | 34 + .../shape/query17.out | 44 ++ .../shape/query18.out | 42 ++ .../shape/query19.out | 35 + .../shape/query2.out | 39 ++ .../shape/query20.out | 26 + .../shape/query21.out | 26 + .../shape/query22.out | 23 + .../shape/query23.out | 82 +++ .../shape/query24.out | 52 ++ .../shape/query25.out | 43 ++ .../shape/query26.out | 31 + .../shape/query27.out | 33 + .../shape/query28.out | 57 ++ .../shape/query29.out | 43 ++ .../shape/query3.out | 23 + .../shape/query30.out | 41 ++ .../shape/query31.out | 65 ++ .../shape/query32.out | 25 + .../shape/query33.out | 83 +++ .../shape/query34.out | 32 + .../shape/query35.out | 47 ++ .../shape/query36.out | 33 + .../shape/query37.out | 27 + .../shape/query38.out | 52 ++ .../shape/query39.out | 33 + .../shape/query4.out | 82 +++ .../shape/query40.out | 30 + .../shape/query41.out | 23 + .../shape/query42.out | 22 + .../shape/query43.out | 22 + .../shape/query44.out | 69 ++ .../shape/query45.out | 35 + .../shape/query46.out | 38 + .../shape/query47.out | 45 ++ .../shape/query48.out | 29 + .../shape/query49.out | 107 +++ .../shape/query5.out | 77 ++ .../shape/query50.out | 29 + .../shape/query51.out | 43 ++ .../shape/query52.out | 23 + .../shape/query53.out | 32 + .../shape/query54.out | 74 ++ .../shape/query55.out | 23 + .../shape/query56.out | 83 +++ .../shape/query57.out | 45 ++ .../shape/query58.out | 86 +++ .../shape/query59.out | 42 ++ .../shape/query6.out | 47 ++ .../shape/query60.out | 83 +++ .../shape/query61.out | 70 ++ .../shape/query62.out | 29 + .../shape/query63.out | 32 + .../shape/query64.out | 102 +++ .../shape/query65.out | 41 ++ .../shape/query66.out | 62 ++ .../shape/query67.out | 32 + .../shape/query68.out | 38 + .../shape/query69.out | 47 ++ .../shape/query7.out | 31 + .../shape/query70.out | 44 ++ .../shape/query71.out | 46 ++ .../shape/query72.out | 54 ++ .../shape/query73.out | 32 + .../shape/query74.out | 57 ++ .../shape/query75.out | 78 +++ .../shape/query76.out | 47 ++ .../shape/query77.out | 101 +++ .../shape/query78.out | 57 ++ .../shape/query79.out | 32 + .../shape/query8.out | 43 ++ .../shape/query80.out | 100 +++ .../shape/query81.out | 41 ++ .../shape/query82.out | 27 + .../shape/query83.out | 80 +++ .../shape/query84.out | 31 + .../shape/query85.out | 46 ++ .../shape/query86.out | 28 + .../shape/query87.out | 51 ++ .../shape/query88.out | 171 +++++ .../shape/query89.out | 33 + .../shape/query9.out | 114 +++ .../shape/query90.out | 47 ++ .../shape/query91.out | 41 ++ .../shape/query92.out | 25 + .../shape/query93.out | 21 + .../shape/query94.out | 34 + .../shape/query95.out | 43 ++ .../shape/query96.out | 25 + .../shape/query97.out | 32 + .../shape/query98.out | 26 + .../shape/query99.out | 29 + .../ddl/gen_shape.py | 26 + .../ddl/shape.tmpl | 49 ++ .../nereids_tpcds_shape_sf10t_orc/load.groovy | 662 ++++++++++++++++++ .../shape/query1.groovy | 70 ++ .../shape/query10.groovy | 104 +++ .../shape/query11.groovy | 126 ++++ .../shape/query12.groovy | 79 +++ .../shape/query13.groovy | 97 +++ .../shape/query14.groovy | 149 ++++ .../shape/query15.groovy | 65 ++ .../shape/query16.groovy | 76 ++ .../shape/query17.groovy | 90 +++ .../shape/query18.groovy | 79 +++ .../shape/query19.groovy | 70 ++ .../shape/query2.groovy | 105 +++ .../shape/query20.groovy | 75 ++ .../shape/query21.groovy | 75 ++ .../shape/query22.groovy | 65 ++ .../shape/query23.groovy | 97 +++ .../shape/query24.groovy | 100 +++ .../shape/query25.groovy | 93 +++ .../shape/query26.groovy | 66 ++ .../shape/query27.groovy | 68 ++ .../shape/query28.groovy | 98 +++ .../shape/query29.groovy | 92 +++ .../shape/query3.groovy | 66 ++ .../shape/query30.groovy | 76 ++ .../shape/query31.groovy | 97 +++ .../shape/query32.groovy | 73 ++ .../shape/query33.groovy | 120 ++++ .../shape/query34.groovy | 76 ++ .../shape/query35.groovy | 103 +++ .../shape/query36.groovy | 75 ++ .../shape/query37.groovy | 62 ++ .../shape/query38.groovy | 68 ++ .../shape/query39.groovy | 73 ++ .../shape/query4.groovy | 161 +++++ .../shape/query40.groovy | 73 ++ .../shape/query41.groovy | 97 +++ .../shape/query42.groovy | 67 ++ .../shape/query43.groovy | 64 ++ .../shape/query44.groovy | 80 +++ .../shape/query45.groovy | 65 ++ .../shape/query46.groovy | 80 +++ .../shape/query47.groovy | 96 +++ .../shape/query48.groovy | 112 +++ .../shape/query49.groovy | 174 +++++ .../shape/query5.groovy | 173 +++++ .../shape/query50.groovy | 104 +++ .../shape/query51.groovy | 90 +++ .../shape/query52.groovy | 67 ++ .../shape/query53.groovy | 73 ++ .../shape/query54.groovy | 101 +++ .../shape/query55.groovy | 59 ++ .../shape/query56.groovy | 114 +++ .../shape/query57.groovy | 93 +++ .../shape/query58.groovy | 110 +++ .../shape/query59.groovy | 89 +++ .../shape/query6.groovy | 71 ++ .../shape/query60.groovy | 123 ++++ .../shape/query61.groovy | 89 +++ .../shape/query62.groovy | 80 +++ .../shape/query63.groovy | 74 ++ .../shape/query64.groovy | 166 +++++ .../shape/query65.groovy | 74 ++ .../shape/query66.groovy | 265 +++++++ .../shape/query67.groovy | 89 +++ .../shape/query68.groovy | 87 +++ .../shape/query69.groovy | 92 +++ .../shape/query7.groovy | 66 ++ .../shape/query70.groovy | 83 +++ .../shape/query71.groovy | 85 +++ .../shape/query72.groovy | 74 ++ .../shape/query73.groovy | 73 ++ .../shape/query74.groovy | 106 +++ .../shape/query75.groovy | 115 +++ .../shape/query76.groovy | 69 ++ .../shape/query77.groovy | 153 ++++ .../shape/query78.groovy | 103 +++ .../shape/query79.groovy | 68 ++ .../shape/query8.groovy | 153 ++++ .../shape/query80.groovy | 141 ++++ .../shape/query81.groovy | 76 ++ .../shape/query82.groovy | 62 ++ .../shape/query83.groovy | 112 +++ .../shape/query84.groovy | 66 ++ .../shape/query85.groovy | 129 ++++ .../shape/query86.groovy | 71 ++ .../shape/query87.groovy | 68 ++ .../shape/query88.groovy | 139 ++++ .../shape/query89.groovy | 73 ++ .../shape/query9.groovy | 96 +++ .../shape/query90.groovy | 67 ++ .../shape/query91.groovy | 76 ++ .../shape/query92.groovy | 75 ++ .../shape/query93.groovy | 63 ++ .../shape/query94.groovy | 74 ++ .../shape/query95.groovy | 77 ++ .../shape/query96.groovy | 61 ++ .../shape/query97.groovy | 70 ++ .../shape/query98.groovy | 78 +++ .../shape/query99.groovy | 80 +++ 201 files changed, 14587 insertions(+) create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query1.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query10.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query11.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query12.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query13.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query14.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query15.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query16.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query17.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query18.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query19.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query2.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query20.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query21.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query22.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query23.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query24.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query25.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query26.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query27.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query28.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query29.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query3.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query30.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query31.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query32.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query33.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query34.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query35.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query36.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query37.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query38.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query39.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query4.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query40.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query41.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query42.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query43.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query44.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query45.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query46.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query47.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query48.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query49.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query5.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query50.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query51.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query52.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query53.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query54.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query55.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query56.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query57.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query58.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query59.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query6.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query60.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query61.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query62.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query63.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query64.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query65.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query66.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query67.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query68.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query69.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query7.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query70.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query71.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query72.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query73.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query74.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query75.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query76.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query77.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query78.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query79.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query8.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query80.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query81.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query82.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query83.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query84.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query85.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query86.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query87.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query88.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query89.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query9.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query90.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query91.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query92.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query93.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query94.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query95.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query96.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query97.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query98.out create mode 100644 regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query99.out create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/ddl/gen_shape.py create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/ddl/shape.tmpl create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/load.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query1.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query10.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query11.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query12.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query13.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query14.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query15.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query16.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query17.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query18.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query19.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query2.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query20.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query21.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query22.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query23.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query24.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query25.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query26.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query27.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query28.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query29.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query3.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query30.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query31.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query32.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query33.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query34.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query35.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query36.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query37.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query38.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query39.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query4.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query40.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query41.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query42.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query43.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query44.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query45.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query46.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query47.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query48.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query49.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query5.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query50.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query51.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query52.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query53.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query54.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query55.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query56.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query57.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query58.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query59.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query6.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query60.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query61.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query62.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query63.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query64.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query65.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query66.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query67.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query68.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query69.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query7.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query70.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query71.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query72.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query73.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query74.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query75.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query76.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query77.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query78.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query79.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query8.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query80.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query81.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query82.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query83.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query84.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query85.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query86.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query87.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query88.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query89.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query9.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query90.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query91.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query92.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query93.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query94.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query95.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query96.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query97.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query98.groovy create mode 100644 regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query99.groovy diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query1.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query1.out new file mode 100644 index 00000000000000..ddb350cc178e33 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query1.out @@ -0,0 +1,37 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_1 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecHash] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[sr_returned_date_sk] +----------------PhysicalProject +------------------PhysicalOlapScan[store_returns] apply RFs: RF0 +----------------PhysicalProject +------------------filter((date_dim.d_year = 2000)) +--------------------PhysicalOlapScan[date_dim] +--PhysicalResultSink +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------hashJoin[INNER_JOIN shuffleBucket] hashCondition=((ctr1.ctr_store_sk = ctr2.ctr_store_sk)) otherCondition=((cast(ctr_total_return as DOUBLE) > cast((avg(cast(ctr_total_return as DECIMALV3(38, 4))) * 1.2) as DOUBLE))) build RFs:RF3 ctr_store_sk->[ctr_store_sk,s_store_sk] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = ctr1.ctr_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ctr_store_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF1 c_customer_sk->[ctr_customer_sk] +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF1 RF2 RF3 +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] +------------------PhysicalProject +--------------------filter((store.s_state = 'NM')) +----------------------PhysicalOlapScan[store] apply RFs: RF3 +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalDistribute[DistributionSpecExecutionAny] +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query10.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query10.out new file mode 100644 index 00000000000000..e1cace0be0ccec --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query10.out @@ -0,0 +1,47 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_10 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------filter((ifnull($c$1, FALSE) OR ifnull($c$2, FALSE))) +--------------------hashJoin[LEFT_SEMI_JOIN bucketShuffle] hashCondition=((c.c_customer_sk = catalog_sales.cs_ship_customer_sk)) otherCondition=() +----------------------hashJoin[LEFT_SEMI_JOIN shuffle] hashCondition=((c.c_customer_sk = web_sales.ws_bill_customer_sk)) otherCondition=() +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_demographics.cd_demo_sk = c.c_current_cdemo_sk)) otherCondition=() build RFs:RF5 cd_demo_sk->[c_current_cdemo_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((c.c_current_addr_sk = ca.ca_address_sk)) otherCondition=() build RFs:RF4 ca_address_sk->[c_current_addr_sk] +--------------------------------hashJoin[RIGHT_SEMI_JOIN shuffle] hashCondition=((c.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ss_customer_sk] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 +--------------------------------------PhysicalProject +----------------------------------------filter((date_dim.d_moy <= 6) and (date_dim.d_moy >= 3) and (date_dim.d_year = 2000)) +------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[customer] apply RFs: RF4 RF5 +--------------------------------PhysicalProject +----------------------------------filter(ca_county IN ('Bonneville County', 'Boone County', 'Brown County', 'Fillmore County', 'McPherson County')) +------------------------------------PhysicalOlapScan[customer_address] +----------------------------PhysicalOlapScan[customer_demographics] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 +----------------------------PhysicalProject +------------------------------filter((date_dim.d_moy <= 6) and (date_dim.d_moy >= 3) and (date_dim.d_year = 2000)) +--------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[cs_sold_date_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 +--------------------------PhysicalProject +----------------------------filter((date_dim.d_moy <= 6) and (date_dim.d_moy >= 3) and (date_dim.d_year = 2000)) +------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query11.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query11.out new file mode 100644 index 00000000000000..82db2123eb155c --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query11.out @@ -0,0 +1,57 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_11 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalUnion +------PhysicalProject +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF0 c_customer_sk->[ss_customer_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] +------------------PhysicalProject +--------------------filter(d_year IN (1999, 2000)) +----------------------PhysicalOlapScan[date_dim] +------PhysicalProject +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ws_sold_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_customer_sk = web_sales.ws_bill_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[ws_bill_customer_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] +------------------PhysicalProject +--------------------filter(d_year IN (1999, 2000)) +----------------------PhysicalOlapScan[date_dim] +--PhysicalResultSink +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------hashJoin[INNER_JOIN shuffleBucket] hashCondition=((t_s_firstyear.customer_id = t_w_secyear.customer_id)) otherCondition=((if((year_total > 0.00), (cast(year_total as DECIMALV3(38, 8)) / year_total), 0.000000) > if((year_total > 0.00), (cast(year_total as DECIMALV3(38, 8)) / year_total), 0.000000))) build RFs:RF6 customer_id->[customer_id] +--------------PhysicalProject +----------------filter((t_w_secyear.dyear = 2000) and (t_w_secyear.sale_type = 'w')) +------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF6 +--------------PhysicalProject +----------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((t_s_firstyear.customer_id = t_w_firstyear.customer_id)) otherCondition=() build RFs:RF5 customer_id->[customer_id,customer_id] +------------------hashJoin[INNER_JOIN shuffle] hashCondition=((t_s_secyear.customer_id = t_s_firstyear.customer_id)) otherCondition=() build RFs:RF4 customer_id->[customer_id] +--------------------PhysicalProject +----------------------filter((t_s_secyear.dyear = 2000) and (t_s_secyear.sale_type = 's')) +------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF4 RF5 +--------------------PhysicalProject +----------------------filter((t_s_firstyear.dyear = 1999) and (t_s_firstyear.sale_type = 's') and (t_s_firstyear.year_total > 0.00)) +------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF5 +------------------PhysicalProject +--------------------filter((t_w_firstyear.dyear = 1999) and (t_w_firstyear.sale_type = 'w') and (t_w_firstyear.year_total > 0.00)) +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query12.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query12.out new file mode 100644 index 00000000000000..31121aee38f722 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query12.out @@ -0,0 +1,26 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_12 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------PhysicalWindow +------------PhysicalQuickSort[LOCAL_SORT] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ws_item_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF1 +------------------------------PhysicalProject +--------------------------------filter(i_category IN ('Books', 'Electronics', 'Women')) +----------------------------------PhysicalOlapScan[item] +--------------------------PhysicalProject +----------------------------filter((date_dim.d_date <= '1998-02-05') and (date_dim.d_date >= '1998-01-06')) +------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query13.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query13.out new file mode 100644 index 00000000000000..2487ceb9b58feb --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query13.out @@ -0,0 +1,34 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_13 -- +PhysicalResultSink +--hashAgg[GLOBAL] +----PhysicalDistribute[DistributionSpecGather] +------hashAgg[LOCAL] +--------PhysicalProject +----------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[ss_sold_date_sk] +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_addr_sk = customer_address.ca_address_sk)) otherCondition=((((ca_state IN ('MI', 'OK', 'TX') AND ((store_sales.ss_net_profit >= 100.00) AND (store_sales.ss_net_profit <= 200.00))) OR (ca_state IN ('NC', 'OH', 'WA') AND ((store_sales.ss_net_profit >= 150.00) AND (store_sales.ss_net_profit <= 300.00)))) OR (ca_state IN ('FL', 'GA', 'MT') AND ((store_sales.ss_net_profit >= 50.00) AND (store_sales.ss_net_profit <= 250.00))))) build RFs:RF3 ca_address_sk->[ss_addr_sk] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=((((((household_demographics.hd_dep_count = 1) AND cd_marital_status IN ('D', 'W')) AND cd_education_status IN ('College', 'Primary')) AND ((cd_marital_status IN ('D', 'W') AND cd_education_status IN ('College', 'Primary')) AND ((((customer_demographics.cd_marital_status = 'W') AND (customer_demographics.cd_education_status = 'College')) AND ((store_sales.ss_sales_price >= 50.00) AND (store_sales.ss_sales_price <= 100.00))) OR (((customer_demographics.cd_marital_status = 'D') AND (customer_demographics.cd_education_status = 'Primary')) AND ((store_sales.ss_sales_price >= 150.00) AND (store_sales.ss_sales_price <= 200.00)))))) OR ((((customer_demographics.cd_marital_status = 'U') AND (customer_demographics.cd_education_status = 'Secondary')) AND ((store_sales.ss_sales_price >= 100.00) AND (store_sales.ss_sales_price <= 150.00))) AND (household_demographics.hd_dep_count = 3)))) build RFs:RF2 hd_demo_sk->[ss_hdemo_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_demographics.cd_demo_sk = store_sales.ss_cdemo_sk)) otherCondition=() build RFs:RF1 cd_demo_sk->[ss_cdemo_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF0 s_store_sk->[ss_store_sk] +----------------------------PhysicalProject +------------------------------filter((store_sales.ss_net_profit <= 300.00) and (store_sales.ss_net_profit >= 50.00) and (store_sales.ss_sales_price <= 200.00) and (store_sales.ss_sales_price >= 50.00)) +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF3 RF4 +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store] +------------------------PhysicalProject +--------------------------filter(((((customer_demographics.cd_marital_status = 'U') AND (customer_demographics.cd_education_status = 'Secondary')) OR ((customer_demographics.cd_marital_status = 'W') AND (customer_demographics.cd_education_status = 'College'))) OR ((customer_demographics.cd_marital_status = 'D') AND (customer_demographics.cd_education_status = 'Primary'))) and cd_education_status IN ('College', 'Primary', 'Secondary') and cd_marital_status IN ('D', 'U', 'W')) +----------------------------PhysicalOlapScan[customer_demographics] +--------------------PhysicalProject +----------------------filter(hd_dep_count IN (1, 3)) +------------------------PhysicalOlapScan[household_demographics] +----------------PhysicalProject +------------------filter((customer_address.ca_country = 'United States') and ca_state IN ('FL', 'GA', 'MI', 'MT', 'NC', 'OH', 'OK', 'TX', 'WA')) +--------------------PhysicalOlapScan[customer_address] +------------PhysicalProject +--------------filter((date_dim.d_year = 2001)) +----------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query14.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query14.out new file mode 100644 index 00000000000000..299549d2b2ce02 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query14.out @@ -0,0 +1,162 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_14 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((item.i_brand_id = t.brand_id) and (item.i_category_id = t.category_id) and (item.i_class_id = t.class_id)) otherCondition=() build RFs:RF6 i_brand_id->[i_brand_id,i_brand_id,i_brand_id];RF7 i_class_id->[i_class_id,i_class_id,i_class_id];RF8 i_category_id->[i_category_id,i_category_id,i_category_id] +--------PhysicalIntersect +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = d3.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = iws.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ws_item_sk] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF1 +------------------------PhysicalProject +--------------------------PhysicalOlapScan[item] apply RFs: RF6 RF7 RF8 +--------------------PhysicalProject +----------------------filter((d3.d_year <= 2002) and (d3.d_year >= 2000)) +------------------------PhysicalOlapScan[date_dim] +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = d2.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cs_sold_date_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = ics.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[cs_item_sk] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3 +------------------------PhysicalProject +--------------------------PhysicalOlapScan[item] apply RFs: RF6 RF7 RF8 +--------------------PhysicalProject +----------------------filter((d2.d_year <= 2002) and (d2.d_year >= 2000)) +------------------------PhysicalOlapScan[date_dim] +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = d1.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[ss_sold_date_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = iss.i_item_sk)) otherCondition=() build RFs:RF4 i_item_sk->[ss_item_sk] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[store_sales] apply RFs: RF4 RF5 +------------------------PhysicalProject +--------------------------PhysicalOlapScan[item] apply RFs: RF6 RF7 RF8 +--------------------PhysicalProject +----------------------filter((d1.d_year <= 2002) and (d1.d_year >= 2000)) +------------------------PhysicalOlapScan[date_dim] +--------PhysicalProject +----------PhysicalOlapScan[item] +--PhysicalCteAnchor ( cteId=CTEId#1 ) +----PhysicalCteProducer ( cteId=CTEId#1 ) +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecGather] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------PhysicalUnion +----------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF9 d_date_sk->[ss_sold_date_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_sales] apply RFs: RF9 +----------------------PhysicalProject +------------------------filter((date_dim.d_year <= 2002) and (date_dim.d_year >= 2000)) +--------------------------PhysicalOlapScan[date_dim] +----------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF10 d_date_sk->[cs_sold_date_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF10 +----------------------PhysicalProject +------------------------filter((date_dim.d_year <= 2002) and (date_dim.d_year >= 2000)) +--------------------------PhysicalOlapScan[date_dim] +----------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF11 d_date_sk->[ws_sold_date_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[web_sales] apply RFs: RF11 +----------------------PhysicalProject +------------------------filter((date_dim.d_year <= 2002) and (date_dim.d_year >= 2000)) +--------------------------PhysicalOlapScan[date_dim] +----PhysicalResultSink +------PhysicalTopN[MERGE_SORT] +--------PhysicalDistribute[DistributionSpecGather] +----------PhysicalTopN[LOCAL_SORT] +------------PhysicalProject +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalRepeat +----------------------PhysicalUnion +------------------------PhysicalProject +--------------------------NestedLoopJoin[INNER_JOIN](cast(sales as DOUBLE) > cast(average_sales as DOUBLE)) +----------------------------PhysicalProject +------------------------------hashAgg[GLOBAL] +--------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------hashAgg[LOCAL] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF14 d_date_sk->[ss_sold_date_sk] +----------------------------------------PhysicalProject +------------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF13 i_item_sk->[ss_item_sk,ss_item_sk] +--------------------------------------------hashJoin[LEFT_SEMI_JOIN shuffle] hashCondition=((store_sales.ss_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF12 ss_item_sk->[ss_item_sk] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF12 RF13 RF14 +----------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF13 +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[item] +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +--------------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------PhysicalAssertNumRows +--------------------------------PhysicalDistribute[DistributionSpecGather] +----------------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) +------------------------PhysicalProject +--------------------------NestedLoopJoin[INNER_JOIN](cast(sales as DOUBLE) > cast(average_sales as DOUBLE)) +----------------------------PhysicalProject +------------------------------hashAgg[GLOBAL] +--------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------hashAgg[LOCAL] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF17 d_date_sk->[cs_sold_date_sk] +----------------------------------------PhysicalProject +------------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF16 i_item_sk->[cs_item_sk,ss_item_sk] +--------------------------------------------hashJoin[LEFT_SEMI_JOIN shuffle] hashCondition=((catalog_sales.cs_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF15 ss_item_sk->[cs_item_sk] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF15 RF16 RF17 +----------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF16 +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[item] +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +--------------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------PhysicalAssertNumRows +--------------------------------PhysicalDistribute[DistributionSpecGather] +----------------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) +------------------------PhysicalProject +--------------------------NestedLoopJoin[INNER_JOIN](cast(sales as DOUBLE) > cast(average_sales as DOUBLE)) +----------------------------PhysicalProject +------------------------------hashAgg[GLOBAL] +--------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------hashAgg[LOCAL] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF20 d_date_sk->[ws_sold_date_sk] +----------------------------------------PhysicalProject +------------------------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF19 i_item_sk->[ss_item_sk,ws_item_sk] +--------------------------------------------hashJoin[LEFT_SEMI_JOIN shuffle] hashCondition=((web_sales.ws_item_sk = cross_items.ss_item_sk)) otherCondition=() build RFs:RF18 ss_item_sk->[ws_item_sk] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF18 RF19 RF20 +----------------------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF19 +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[item] +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 2002)) +--------------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------PhysicalAssertNumRows +--------------------------------PhysicalDistribute[DistributionSpecGather] +----------------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query15.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query15.out new file mode 100644 index 00000000000000..31789e71f5b27a --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query15.out @@ -0,0 +1,25 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_15 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[cs_sold_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_current_addr_sk = customer_address.ca_address_sk)) otherCondition=(((substring(ca_zip, 1, 5) IN ('80348', '81792', '83405', '85392', '85460', '85669', '86197', '86475', '88274') OR ca_state IN ('CA', 'GA', 'WA')) OR (catalog_sales.cs_sales_price > 500.00))) build RFs:RF1 ca_address_sk->[c_current_addr_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((catalog_sales.cs_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF0 c_customer_sk->[cs_bill_customer_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF2 +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[customer] apply RFs: RF1 +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer_address] +------------------PhysicalProject +--------------------filter((date_dim.d_qoy = 2) and (date_dim.d_year = 1998)) +----------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query16.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query16.out new file mode 100644 index 00000000000000..e9d35f9e131c3e --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query16.out @@ -0,0 +1,34 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_16 -- +PhysicalResultSink +--PhysicalTopN[GATHER_SORT] +----hashAgg[DISTINCT_GLOBAL] +------PhysicalDistribute[DistributionSpecGather] +--------hashAgg[DISTINCT_LOCAL] +----------hashAgg[GLOBAL] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((cs1.cs_call_center_sk = call_center.cc_call_center_sk)) otherCondition=() build RFs:RF3 cc_call_center_sk->[cs_call_center_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((cs1.cs_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF2 ca_address_sk->[cs_ship_addr_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((cs1.cs_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[cs_ship_date_sk] +--------------------------hashJoin[LEFT_ANTI_JOIN bucketShuffle] hashCondition=((cs1.cs_order_number = cr1.cr_order_number)) otherCondition=() +----------------------------PhysicalProject +------------------------------hashJoin[RIGHT_SEMI_JOIN shuffle] hashCondition=((cs1.cs_order_number = cs2.cs_order_number)) otherCondition=(( not (cs_warehouse_sk = cs_warehouse_sk))) build RFs:RF0 cs_order_number->[cs_order_number] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF1 RF2 RF3 +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[catalog_returns] +--------------------------PhysicalProject +----------------------------filter((date_dim.d_date <= '1999-05-31') and (date_dim.d_date >= '1999-04-01')) +------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------filter((customer_address.ca_state = 'IL')) +--------------------------PhysicalOlapScan[customer_address] +------------------PhysicalProject +--------------------filter(cc_county IN ('Bronx County', 'Maverick County', 'Mesa County', 'Raleigh County', 'Richland County')) +----------------------PhysicalOlapScan[call_center] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query17.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query17.out new file mode 100644 index 00000000000000..e0b281146ad099 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query17.out @@ -0,0 +1,44 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_17 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF9 s_store_sk->[ss_store_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = d3.d_date_sk)) otherCondition=() build RFs:RF8 d_date_sk->[cs_sold_date_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_returned_date_sk = d2.d_date_sk)) otherCondition=() build RFs:RF7 d_date_sk->[sr_returned_date_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((d1.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[ss_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = store_sales.ss_item_sk)) otherCondition=() build RFs:RF5 i_item_sk->[sr_item_sk,ss_item_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_returns.sr_customer_sk = catalog_sales.cs_bill_customer_sk) and (store_returns.sr_item_sk = catalog_sales.cs_item_sk)) otherCondition=() build RFs:RF3 cs_bill_customer_sk->[sr_customer_sk,ss_customer_sk];RF4 cs_item_sk->[sr_item_sk,ss_item_sk] +----------------------------------------PhysicalProject +------------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_customer_sk = store_returns.sr_customer_sk) and (store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number)) otherCondition=() build RFs:RF0 sr_customer_sk->[ss_customer_sk];RF1 sr_item_sk->[ss_item_sk];RF2 sr_ticket_number->[ss_ticket_number] +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF3 RF4 RF5 RF6 RF9 +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[store_returns] apply RFs: RF3 RF4 RF5 RF7 +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF8 +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[item] +--------------------------------PhysicalProject +----------------------------------filter((d1.d_quarter_name = '2000Q1')) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------filter(d_quarter_name IN ('2000Q1', '2000Q2', '2000Q3')) +--------------------------------PhysicalOlapScan[date_dim] +------------------------PhysicalProject +--------------------------filter(d_quarter_name IN ('2000Q1', '2000Q2', '2000Q3')) +----------------------------PhysicalOlapScan[date_dim] +--------------------PhysicalProject +----------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query18.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query18.out new file mode 100644 index 00000000000000..083105bf02dd54 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query18.out @@ -0,0 +1,42 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_18 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalRepeat +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[cs_sold_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF4 i_item_sk->[cs_item_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_bill_cdemo_sk = cd1.cd_demo_sk)) otherCondition=() build RFs:RF3 cd_demo_sk->[cs_bill_cdemo_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_current_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF2 ca_address_sk->[c_current_addr_sk] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_current_cdemo_sk = cd2.cd_demo_sk)) otherCondition=() build RFs:RF1 cd_demo_sk->[c_current_cdemo_sk] +--------------------------------------PhysicalProject +----------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF0 c_customer_sk->[cs_bill_customer_sk] +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF3 RF4 RF5 +------------------------------------------PhysicalProject +--------------------------------------------filter(c_birth_month IN (1, 4, 5, 7, 8, 9)) +----------------------------------------------PhysicalOlapScan[customer] apply RFs: RF1 RF2 +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[customer_demographics] +----------------------------------PhysicalProject +------------------------------------filter(ca_state IN ('AL', 'AR', 'GA', 'MS', 'NC', 'TX', 'WV')) +--------------------------------------PhysicalOlapScan[customer_address] +------------------------------PhysicalProject +--------------------------------filter((cd1.cd_education_status = 'Unknown') and (cd1.cd_gender = 'M')) +----------------------------------PhysicalOlapScan[customer_demographics] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[item] +----------------------PhysicalProject +------------------------filter((date_dim.d_year = 2002)) +--------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query19.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query19.out new file mode 100644 index 00000000000000..6a9401f72ec7f3 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query19.out @@ -0,0 +1,35 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_19 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=(( not (substring(ca_zip, 1, 5) = substring(s_zip, 1, 5)))) build RFs:RF4 s_store_sk->[ss_store_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF3 i_item_sk->[ss_item_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_current_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[c_current_addr_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF0 c_customer_sk->[ss_customer_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF2 RF3 RF4 +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[customer] apply RFs: RF1 +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[customer_address] +----------------------------PhysicalProject +------------------------------filter((date_dim.d_moy = 12) and (date_dim.d_year = 1998)) +--------------------------------PhysicalOlapScan[date_dim] +------------------------PhysicalProject +--------------------------filter((item.i_manager_id = 16)) +----------------------------PhysicalOlapScan[item] +--------------------PhysicalProject +----------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query2.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query2.out new file mode 100644 index 00000000000000..45d3bd88c05b96 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query2.out @@ -0,0 +1,39 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_2 -- +PhysicalCteAnchor ( cteId=CTEId#1 ) +--PhysicalCteProducer ( cteId=CTEId#1 ) +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecHash] +--------hashAgg[LOCAL] +----------PhysicalProject +------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = wscs.sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[cs_sold_date_sk,ws_sold_date_sk] +--------------PhysicalUnion +----------------PhysicalDistribute[DistributionSpecHash] +------------------PhysicalProject +--------------------PhysicalOlapScan[web_sales] apply RFs: RF0 +----------------PhysicalDistribute[DistributionSpecHash] +------------------PhysicalProject +--------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 +--------------PhysicalProject +----------------PhysicalOlapScan[date_dim] +--PhysicalResultSink +----PhysicalQuickSort[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalQuickSort[LOCAL_SORT] +----------PhysicalProject +------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_week_seq = d_week_seq2)) otherCondition=() build RFs:RF3 d_week_seq->[d_week_seq] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN shuffle] hashCondition=((date_dim.d_week_seq = d_week_seq1)) otherCondition=() build RFs:RF2 d_week_seq1->[d_week_seq] +------------------PhysicalProject +--------------------filter((date_dim.d_year = 1998)) +----------------------PhysicalOlapScan[date_dim] apply RFs: RF2 +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((expr_cast(d_week_seq1 as BIGINT) = expr_(d_week_seq2 - 53))) otherCondition=() build RFs:RF1 expr_(d_week_seq2 - 53)->[cast(d_week_seq as BIGINT)] +----------------------PhysicalProject +------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) apply RFs: RF1 +----------------------PhysicalProject +------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) apply RFs: RF3 +--------------PhysicalProject +----------------filter((date_dim.d_year = 1999)) +------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query20.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query20.out new file mode 100644 index 00000000000000..5ea9d277dedaba --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query20.out @@ -0,0 +1,26 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_20 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------PhysicalWindow +------------PhysicalQuickSort[LOCAL_SORT] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[cs_sold_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[cs_item_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 +------------------------------PhysicalProject +--------------------------------filter(i_category IN ('Children', 'Electronics', 'Shoes')) +----------------------------------PhysicalOlapScan[item] +--------------------------PhysicalProject +----------------------------filter((date_dim.d_date <= '2001-04-13') and (date_dim.d_date >= '2001-03-14')) +------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query21.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query21.out new file mode 100644 index 00000000000000..31448491385145 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query21.out @@ -0,0 +1,26 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_21 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------filter((if((inv_before > 0), (cast(inv_after as DOUBLE) / cast(inv_before as DOUBLE)), NULL) <= 1.5) and (if((inv_before > 0), (cast(inv_after as DOUBLE) / cast(inv_before as DOUBLE)), NULL) >= cast((2.000000 / 3.0) as DOUBLE))) +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((inventory.inv_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[inv_date_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = inventory.inv_item_sk)) otherCondition=() build RFs:RF1 i_item_sk->[inv_item_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((inventory.inv_warehouse_sk = warehouse.w_warehouse_sk)) otherCondition=() build RFs:RF0 w_warehouse_sk->[inv_warehouse_sk] +----------------------------PhysicalOlapScan[inventory] apply RFs: RF0 RF1 RF2 +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[warehouse] +------------------------PhysicalProject +--------------------------filter((item.i_current_price <= 1.49) and (item.i_current_price >= 0.99)) +----------------------------PhysicalOlapScan[item] +--------------------PhysicalProject +----------------------filter((date_dim.d_date <= '1999-04-19') and (date_dim.d_date >= '1999-02-18')) +------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query22.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query22.out new file mode 100644 index 00000000000000..9a0efd7d83bee7 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query22.out @@ -0,0 +1,23 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_22 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalRepeat +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((inventory.inv_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[inv_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((inventory.inv_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[inv_item_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[inventory] apply RFs: RF0 RF1 +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[item] +----------------------PhysicalProject +------------------------filter((date_dim.d_month_seq <= 1197) and (date_dim.d_month_seq >= 1186)) +--------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query23.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query23.out new file mode 100644 index 00000000000000..5b81b4629a48e0 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query23.out @@ -0,0 +1,82 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_23 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------filter((cnt > 4)) +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------PhysicalProject +------------------------PhysicalOlapScan[item] +------------------PhysicalProject +--------------------filter(d_year IN (2000, 2001, 2002, 2003)) +----------------------PhysicalOlapScan[date_dim] +--PhysicalCteAnchor ( cteId=CTEId#2 ) +----PhysicalCteProducer ( cteId=CTEId#2 ) +------PhysicalProject +--------NestedLoopJoin[INNER_JOIN](cast(ssales as DOUBLE) > cast((0.9500 * tpcds_cmax) as DOUBLE)) +----------PhysicalProject +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF4 c_customer_sk->[ss_customer_sk] +------------------PhysicalProject +--------------------PhysicalOlapScan[store_sales] apply RFs: RF4 +------------------PhysicalProject +--------------------PhysicalOlapScan[customer] +----------PhysicalProject +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecGather] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ss_sold_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[ss_customer_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[customer] +--------------------------PhysicalProject +----------------------------filter(d_year IN (2000, 2001, 2002, 2003)) +------------------------------PhysicalOlapScan[date_dim] +----PhysicalResultSink +------PhysicalTopN[GATHER_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecGather] +------------hashAgg[LOCAL] +--------------PhysicalUnion +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF7 d_date_sk->[cs_sold_date_sk] +--------------------PhysicalProject +----------------------hashJoin[LEFT_SEMI_JOIN shuffle] hashCondition=((catalog_sales.cs_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=() build RFs:RF6 c_customer_sk->[cs_bill_customer_sk] +------------------------PhysicalProject +--------------------------hashJoin[LEFT_SEMI_JOIN shuffle] hashCondition=((catalog_sales.cs_item_sk = frequent_ss_items.item_sk)) otherCondition=() build RFs:RF5 item_sk->[cs_item_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF5 RF6 RF7 +----------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +------------------------PhysicalCteConsumer ( cteId=CTEId#2 ) +--------------------PhysicalProject +----------------------filter((date_dim.d_moy = 3) and (date_dim.d_year = 2000)) +------------------------PhysicalOlapScan[date_dim] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF10 d_date_sk->[ws_sold_date_sk] +--------------------PhysicalProject +----------------------hashJoin[LEFT_SEMI_JOIN shuffle] hashCondition=((web_sales.ws_bill_customer_sk = best_ss_customer.c_customer_sk)) otherCondition=() build RFs:RF9 c_customer_sk->[ws_bill_customer_sk] +------------------------PhysicalProject +--------------------------hashJoin[LEFT_SEMI_JOIN shuffle] hashCondition=((web_sales.ws_item_sk = frequent_ss_items.item_sk)) otherCondition=() build RFs:RF8 item_sk->[ws_item_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_sales] apply RFs: RF8 RF9 RF10 +----------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +------------------------PhysicalCteConsumer ( cteId=CTEId#2 ) +--------------------PhysicalProject +----------------------filter((date_dim.d_moy = 3) and (date_dim.d_year = 2000)) +------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query24.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query24.out new file mode 100644 index 00000000000000..09f12e931c61f5 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query24.out @@ -0,0 +1,52 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_24 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecHash] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_zip = customer_address.ca_zip) and (store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF5 s_zip->[ca_zip];RF6 s_store_sk->[ss_store_sk] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF4 i_item_sk->[sr_item_sk,ss_item_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_current_addr_sk = customer_address.ca_address_sk)) otherCondition=(( not (c_birth_country = upper(ca_country)))) build RFs:RF3 ca_address_sk->[c_current_addr_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[ss_customer_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number)) otherCondition=() build RFs:RF0 sr_ticket_number->[ss_ticket_number];RF1 sr_item_sk->[ss_item_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF4 RF6 +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_returns] apply RFs: RF4 +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[customer] apply RFs: RF3 +------------------------PhysicalProject +--------------------------PhysicalOlapScan[customer_address] apply RFs: RF5 +--------------------PhysicalProject +----------------------PhysicalOlapScan[item] +----------------PhysicalProject +------------------filter((store.s_market_id = 10)) +--------------------PhysicalOlapScan[store] +--PhysicalResultSink +----PhysicalQuickSort[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalQuickSort[LOCAL_SORT] +----------PhysicalProject +------------NestedLoopJoin[INNER_JOIN](cast(paid as DOUBLE) > cast((0.05 * avg(cast(netpaid as DECIMALV3(38, 4)))) as DOUBLE)) +--------------PhysicalProject +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------------PhysicalProject +--------------------------filter((ssales.i_color = 'snow')) +----------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +--------------PhysicalProject +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecGather] +--------------------hashAgg[LOCAL] +----------------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query25.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query25.out new file mode 100644 index 00000000000000..768ad92e931b56 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query25.out @@ -0,0 +1,43 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_25 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF9 s_store_sk->[ss_store_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = d3.d_date_sk)) otherCondition=() build RFs:RF8 d_date_sk->[cs_sold_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_returned_date_sk = d2.d_date_sk)) otherCondition=() build RFs:RF7 d_date_sk->[sr_returned_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((d1.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[ss_sold_date_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = store_sales.ss_item_sk)) otherCondition=() build RFs:RF5 i_item_sk->[sr_item_sk,ss_item_sk] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_returns.sr_customer_sk = catalog_sales.cs_bill_customer_sk) and (store_returns.sr_item_sk = catalog_sales.cs_item_sk)) otherCondition=() build RFs:RF3 cs_bill_customer_sk->[sr_customer_sk,ss_customer_sk];RF4 cs_item_sk->[sr_item_sk,ss_item_sk] +--------------------------------------PhysicalProject +----------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_customer_sk = store_returns.sr_customer_sk) and (store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number)) otherCondition=() build RFs:RF0 sr_customer_sk->[ss_customer_sk];RF1 sr_item_sk->[ss_item_sk];RF2 sr_ticket_number->[ss_ticket_number] +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF3 RF4 RF5 RF6 RF9 +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[store_returns] apply RFs: RF3 RF4 RF5 RF7 +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF8 +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[item] +------------------------------PhysicalProject +--------------------------------filter((d1.d_moy = 4) and (d1.d_year = 2000)) +----------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalProject +----------------------------filter((d2.d_moy <= 10) and (d2.d_moy >= 4) and (d2.d_year = 2000)) +------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------filter((d3.d_moy <= 10) and (d3.d_moy >= 4) and (d3.d_year = 2000)) +--------------------------PhysicalOlapScan[date_dim] +------------------PhysicalProject +--------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query26.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query26.out new file mode 100644 index 00000000000000..68a8944b8ce179 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query26.out @@ -0,0 +1,31 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_26 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_promo_sk = promotion.p_promo_sk)) otherCondition=() build RFs:RF3 p_promo_sk->[cs_promo_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[cs_sold_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_bill_cdemo_sk = customer_demographics.cd_demo_sk)) otherCondition=() build RFs:RF1 cd_demo_sk->[cs_bill_cdemo_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[cs_item_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 RF2 RF3 +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[item] +--------------------------PhysicalProject +----------------------------filter((customer_demographics.cd_education_status = 'College') and (customer_demographics.cd_gender = 'F') and (customer_demographics.cd_marital_status = 'S')) +------------------------------PhysicalOlapScan[customer_demographics] +----------------------PhysicalProject +------------------------filter((date_dim.d_year = 1998)) +--------------------------PhysicalOlapScan[date_dim] +------------------PhysicalProject +--------------------filter(((promotion.p_channel_email = 'N') OR (promotion.p_channel_event = 'N'))) +----------------------PhysicalOlapScan[promotion] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query27.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query27.out new file mode 100644 index 00000000000000..f203bce45719dc --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query27.out @@ -0,0 +1,33 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_27 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalRepeat +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF3 s_store_sk->[ss_store_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_cdemo_sk = customer_demographics.cd_demo_sk)) otherCondition=() build RFs:RF1 cd_demo_sk->[ss_cdemo_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF3 +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[item] +------------------------------PhysicalProject +--------------------------------filter((customer_demographics.cd_education_status = '2 yr Degree') and (customer_demographics.cd_gender = 'F') and (customer_demographics.cd_marital_status = 'U')) +----------------------------------PhysicalOlapScan[customer_demographics] +--------------------------PhysicalProject +----------------------------filter((date_dim.d_year = 2000)) +------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------filter(s_state IN ('AL', 'FL', 'IN', 'NY', 'OH', 'SC')) +--------------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query28.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query28.out new file mode 100644 index 00000000000000..eb43c81cde41c2 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query28.out @@ -0,0 +1,57 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_28 -- +PhysicalResultSink +--PhysicalLimit[GLOBAL] +----PhysicalLimit[LOCAL] +------NestedLoopJoin[CROSS_JOIN] +--------PhysicalLimit[LOCAL] +----------NestedLoopJoin[CROSS_JOIN] +------------PhysicalLimit[LOCAL] +--------------NestedLoopJoin[CROSS_JOIN] +----------------PhysicalLimit[LOCAL] +------------------NestedLoopJoin[CROSS_JOIN] +--------------------PhysicalLimit[LOCAL] +----------------------NestedLoopJoin[CROSS_JOIN] +------------------------PhysicalLimit[LOCAL] +--------------------------hashAgg[GLOBAL] +----------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------hashAgg[LOCAL] +--------------------------------PhysicalProject +----------------------------------filter(((((store_sales.ss_list_price >= 73.00) AND (store_sales.ss_list_price <= 83.00)) OR ((store_sales.ss_coupon_amt >= 7826.00) AND (store_sales.ss_coupon_amt <= 8826.00))) OR ((store_sales.ss_wholesale_cost >= 70.00) AND (store_sales.ss_wholesale_cost <= 90.00))) and (store_sales.ss_quantity <= 5) and (store_sales.ss_quantity >= 0)) +------------------------------------PhysicalOlapScan[store_sales] +------------------------PhysicalLimit[LOCAL] +--------------------------hashAgg[GLOBAL] +----------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------hashAgg[LOCAL] +--------------------------------PhysicalProject +----------------------------------filter(((((store_sales.ss_list_price >= 152.00) AND (store_sales.ss_list_price <= 162.00)) OR ((store_sales.ss_coupon_amt >= 2196.00) AND (store_sales.ss_coupon_amt <= 3196.00))) OR ((store_sales.ss_wholesale_cost >= 56.00) AND (store_sales.ss_wholesale_cost <= 76.00))) and (store_sales.ss_quantity <= 10) and (store_sales.ss_quantity >= 6)) +------------------------------------PhysicalOlapScan[store_sales] +--------------------PhysicalLimit[LOCAL] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecGather] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------filter(((((store_sales.ss_list_price >= 53.00) AND (store_sales.ss_list_price <= 63.00)) OR ((store_sales.ss_coupon_amt >= 3430.00) AND (store_sales.ss_coupon_amt <= 4430.00))) OR ((store_sales.ss_wholesale_cost >= 13.00) AND (store_sales.ss_wholesale_cost <= 33.00))) and (store_sales.ss_quantity <= 15) and (store_sales.ss_quantity >= 11)) +--------------------------------PhysicalOlapScan[store_sales] +----------------PhysicalLimit[LOCAL] +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecGather] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------filter(((((store_sales.ss_list_price >= 182.00) AND (store_sales.ss_list_price <= 192.00)) OR ((store_sales.ss_coupon_amt >= 3262.00) AND (store_sales.ss_coupon_amt <= 4262.00))) OR ((store_sales.ss_wholesale_cost >= 20.00) AND (store_sales.ss_wholesale_cost <= 40.00))) and (store_sales.ss_quantity <= 20) and (store_sales.ss_quantity >= 16)) +----------------------------PhysicalOlapScan[store_sales] +------------PhysicalLimit[LOCAL] +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecGather] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------filter(((((store_sales.ss_list_price >= 85.00) AND (store_sales.ss_list_price <= 95.00)) OR ((store_sales.ss_coupon_amt >= 3310.00) AND (store_sales.ss_coupon_amt <= 4310.00))) OR ((store_sales.ss_wholesale_cost >= 37.00) AND (store_sales.ss_wholesale_cost <= 57.00))) and (store_sales.ss_quantity <= 25) and (store_sales.ss_quantity >= 21)) +------------------------PhysicalOlapScan[store_sales] +--------PhysicalLimit[LOCAL] +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecGather] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------filter(((((store_sales.ss_list_price >= 180.00) AND (store_sales.ss_list_price <= 190.00)) OR ((store_sales.ss_coupon_amt >= 12592.00) AND (store_sales.ss_coupon_amt <= 13592.00))) OR ((store_sales.ss_wholesale_cost >= 22.00) AND (store_sales.ss_wholesale_cost <= 42.00))) and (store_sales.ss_quantity <= 30) and (store_sales.ss_quantity >= 26)) +--------------------PhysicalOlapScan[store_sales] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query29.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query29.out new file mode 100644 index 00000000000000..706d570662c86b --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query29.out @@ -0,0 +1,43 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_29 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF9 s_store_sk->[ss_store_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = d3.d_date_sk)) otherCondition=() build RFs:RF8 d_date_sk->[cs_sold_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_returned_date_sk = d2.d_date_sk)) otherCondition=() build RFs:RF7 d_date_sk->[sr_returned_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((d1.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[ss_sold_date_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = store_sales.ss_item_sk)) otherCondition=() build RFs:RF5 i_item_sk->[sr_item_sk,ss_item_sk] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_returns.sr_customer_sk = catalog_sales.cs_bill_customer_sk) and (store_returns.sr_item_sk = catalog_sales.cs_item_sk)) otherCondition=() build RFs:RF3 cs_bill_customer_sk->[sr_customer_sk,ss_customer_sk];RF4 cs_item_sk->[sr_item_sk,ss_item_sk] +--------------------------------------PhysicalProject +----------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_customer_sk = store_returns.sr_customer_sk) and (store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number)) otherCondition=() build RFs:RF0 sr_customer_sk->[ss_customer_sk];RF1 sr_item_sk->[ss_item_sk];RF2 sr_ticket_number->[ss_ticket_number] +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF3 RF4 RF5 RF6 RF9 +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[store_returns] apply RFs: RF3 RF4 RF5 RF7 +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF8 +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[item] +------------------------------PhysicalProject +--------------------------------filter((d1.d_moy = 4) and (d1.d_year = 1998)) +----------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalProject +----------------------------filter((d2.d_moy <= 7) and (d2.d_moy >= 4) and (d2.d_year = 1998)) +------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------filter(d_year IN (1998, 1999, 2000)) +--------------------------PhysicalOlapScan[date_dim] +------------------PhysicalProject +--------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query3.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query3.out new file mode 100644 index 00000000000000..8beaf9b74953fb --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query3.out @@ -0,0 +1,23 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_3 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF1 i_item_sk->[ss_item_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((dt.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +------------------------PhysicalProject +--------------------------filter((dt.d_moy = 11)) +----------------------------PhysicalOlapScan[date_dim] +--------------------PhysicalProject +----------------------filter((item.i_manufact_id = 816)) +------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query30.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query30.out new file mode 100644 index 00000000000000..cf017069f995b3 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query30.out @@ -0,0 +1,41 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_30 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecHash] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_returns.wr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[wr_returned_date_sk] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN shuffle] hashCondition=((web_returns.wr_returning_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF0 ca_address_sk->[wr_returning_addr_sk] +--------------------PhysicalProject +----------------------PhysicalOlapScan[web_returns] apply RFs: RF0 RF1 +--------------------PhysicalProject +----------------------PhysicalOlapScan[customer_address] +----------------PhysicalProject +------------------filter((date_dim.d_year = 2000)) +--------------------PhysicalOlapScan[date_dim] +--PhysicalResultSink +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_address.ca_address_sk = customer.c_current_addr_sk)) otherCondition=() build RFs:RF4 ca_address_sk->[c_current_addr_sk] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN shuffle] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ctr_customer_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffleBucket] hashCondition=((ctr1.ctr_state = ctr2.ctr_state)) otherCondition=((cast(ctr_total_return as DOUBLE) > cast((avg(cast(ctr_total_return as DECIMALV3(38, 4))) * 1.2) as DOUBLE))) build RFs:RF2 ctr_state->[ctr_state] +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF2 RF3 +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +------------------PhysicalProject +--------------------PhysicalOlapScan[customer] apply RFs: RF4 +--------------PhysicalProject +----------------filter((customer_address.ca_state = 'GA')) +------------------PhysicalOlapScan[customer_address] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query31.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query31.out new file mode 100644 index 00000000000000..177a039758745c --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query31.out @@ -0,0 +1,65 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_31 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecHash] +--------hashAgg[LOCAL] +----------PhysicalProject +------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF0 ca_address_sk->[ss_addr_sk] +------------------PhysicalProject +--------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +------------------PhysicalProject +--------------------PhysicalOlapScan[customer_address] +--------------PhysicalProject +----------------filter((ss.d_year = 1999) and d_qoy IN (1, 2, 3)) +------------------PhysicalOlapScan[date_dim] +--PhysicalCteAnchor ( cteId=CTEId#1 ) +----PhysicalCteProducer ( cteId=CTEId#1 ) +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecHash] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ws_sold_date_sk] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN shuffle] hashCondition=((web_sales.ws_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF2 ca_address_sk->[ws_bill_addr_sk] +--------------------PhysicalProject +----------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 +--------------------PhysicalProject +----------------------PhysicalOlapScan[customer_address] +----------------PhysicalProject +------------------filter((ws.d_year = 1999) and d_qoy IN (1, 2, 3)) +--------------------PhysicalOlapScan[date_dim] +----PhysicalResultSink +------PhysicalQuickSort[MERGE_SORT] +--------PhysicalDistribute[DistributionSpecGather] +----------PhysicalQuickSort[LOCAL_SORT] +------------PhysicalProject +--------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((ws1.ca_county = ws3.ca_county)) otherCondition=((if((web_sales > 0.00), (cast(web_sales as DECIMALV3(38, 8)) / web_sales), NULL) > if((store_sales > 0.00), (cast(store_sales as DECIMALV3(38, 8)) / store_sales), NULL))) build RFs:RF8 ca_county->[ca_county,ca_county,ca_county,ca_county] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((ws1.ca_county = ws2.ca_county)) otherCondition=((if((web_sales > 0.00), (cast(web_sales as DECIMALV3(38, 8)) / web_sales), NULL) > if((store_sales > 0.00), (cast(store_sales as DECIMALV3(38, 8)) / store_sales), NULL))) build RFs:RF7 ca_county->[ca_county,ca_county,ca_county] +--------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((ss1.ca_county = ws1.ca_county)) otherCondition=() build RFs:RF6 ca_county->[ca_county,ca_county] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((ss2.ca_county = ss3.ca_county)) otherCondition=() build RFs:RF5 ca_county->[ca_county,ca_county] +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((ss1.ca_county = ss2.ca_county)) otherCondition=() build RFs:RF4 ca_county->[ca_county] +----------------------------PhysicalProject +------------------------------filter((ss1.d_qoy = 1) and (ss1.d_year = 1999)) +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF4 RF5 RF6 RF7 RF8 +----------------------------PhysicalProject +------------------------------filter((ss2.d_qoy = 2) and (ss2.d_year = 1999)) +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF5 RF6 RF7 RF8 +--------------------------PhysicalProject +----------------------------filter((ss3.d_qoy = 3) and (ss3.d_year = 1999)) +------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +----------------------PhysicalProject +------------------------filter((ws1.d_qoy = 1) and (ws1.d_year = 1999)) +--------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) apply RFs: RF7 RF8 +--------------------PhysicalProject +----------------------filter((ws2.d_qoy = 2) and (ws2.d_year = 1999)) +------------------------PhysicalCteConsumer ( cteId=CTEId#1 ) apply RFs: RF8 +----------------PhysicalProject +------------------filter((ws3.d_qoy = 3) and (ws3.d_year = 1999)) +--------------------PhysicalCteConsumer ( cteId=CTEId#1 ) + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query32.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query32.out new file mode 100644 index 00000000000000..a9acbffc271bf6 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query32.out @@ -0,0 +1,25 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_32 -- +PhysicalResultSink +--PhysicalTopN[GATHER_SORT] +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecGather] +--------hashAgg[LOCAL] +----------PhysicalProject +------------filter((cast(cs_ext_discount_amt as DECIMALV3(38, 5)) > (1.3 * avg(cast(cs_ext_discount_amt as DECIMALV3(9, 4))) OVER(PARTITION BY i_item_sk)))) +--------------PhysicalWindow +----------------PhysicalQuickSort[LOCAL_SORT] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = catalog_sales.cs_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[cs_sold_date_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = catalog_sales.cs_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[cs_item_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 +----------------------------PhysicalProject +------------------------------filter((item.i_manufact_id = 66)) +--------------------------------PhysicalOlapScan[item] +------------------------PhysicalProject +--------------------------filter((date_dim.d_date <= '2002-06-27') and (date_dim.d_date >= '2002-03-29')) +----------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query33.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query33.out new file mode 100644 index 00000000000000..25ccfd29c87dfc --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query33.out @@ -0,0 +1,83 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_33 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalUnion +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ss_sold_date_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ss_item_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[ss_addr_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 RF2 RF3 +------------------------------------PhysicalProject +--------------------------------------filter((customer_address.ca_gmt_offset = -6.00)) +----------------------------------------PhysicalOlapScan[customer_address] +--------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((item.i_manufact_id = item.i_manufact_id)) otherCondition=() build RFs:RF0 i_manufact_id->[i_manufact_id] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[item] apply RFs: RF0 +----------------------------------PhysicalProject +------------------------------------filter((item.i_category = 'Home')) +--------------------------------------PhysicalOlapScan[item] +----------------------------PhysicalProject +------------------------------filter((date_dim.d_moy = 5) and (date_dim.d_year = 1998)) +--------------------------------PhysicalOlapScan[date_dim] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF7 d_date_sk->[cs_sold_date_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF6 i_item_sk->[cs_item_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF5 ca_address_sk->[cs_bill_addr_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF5 RF6 RF7 +------------------------------------PhysicalProject +--------------------------------------filter((customer_address.ca_gmt_offset = -6.00)) +----------------------------------------PhysicalOlapScan[customer_address] +--------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((item.i_manufact_id = item.i_manufact_id)) otherCondition=() build RFs:RF4 i_manufact_id->[i_manufact_id] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[item] apply RFs: RF4 +----------------------------------PhysicalProject +------------------------------------filter((item.i_category = 'Home')) +--------------------------------------PhysicalOlapScan[item] +----------------------------PhysicalProject +------------------------------filter((date_dim.d_moy = 5) and (date_dim.d_year = 1998)) +--------------------------------PhysicalOlapScan[date_dim] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF11 d_date_sk->[ws_sold_date_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF10 i_item_sk->[ws_item_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF9 ca_address_sk->[ws_bill_addr_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF9 RF10 RF11 +------------------------------------PhysicalProject +--------------------------------------filter((customer_address.ca_gmt_offset = -6.00)) +----------------------------------------PhysicalOlapScan[customer_address] +--------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((item.i_manufact_id = item.i_manufact_id)) otherCondition=() build RFs:RF8 i_manufact_id->[i_manufact_id] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[item] apply RFs: RF8 +----------------------------------PhysicalProject +------------------------------------filter((item.i_category = 'Home')) +--------------------------------------PhysicalOlapScan[item] +----------------------------PhysicalProject +------------------------------filter((date_dim.d_moy = 5) and (date_dim.d_year = 1998)) +--------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query34.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query34.out new file mode 100644 index 00000000000000..a883135293b760 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query34.out @@ -0,0 +1,32 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_34 -- +PhysicalResultSink +--PhysicalQuickSort[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalQuickSort[LOCAL_SORT] +--------PhysicalProject +----------hashJoin[INNER_JOIN shuffle] hashCondition=((dn.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ss_customer_sk] +------------filter((dn.cnt <= 20) and (dn.cnt >= 15)) +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF2 hd_demo_sk->[ss_hdemo_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF3 +--------------------------------PhysicalProject +----------------------------------filter((((date_dim.d_dom >= 1) AND (date_dim.d_dom <= 3)) OR ((date_dim.d_dom >= 25) AND (date_dim.d_dom <= 28))) and d_year IN (2000, 2001, 2002)) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------filter(s_county IN ('Arthur County', 'Halifax County', 'Lunenburg County', 'Oglethorpe County', 'Perry County', 'Salem County', 'Sumner County', 'Terrell County')) +--------------------------------PhysicalOlapScan[store] +------------------------PhysicalProject +--------------------------filter((household_demographics.hd_vehicle_count > 0) and (if((hd_vehicle_count > 0), (cast(hd_dep_count as DOUBLE) / cast(hd_vehicle_count as DOUBLE)), NULL) > 1.2) and hd_buy_potential IN ('>10000', 'Unknown')) +----------------------------PhysicalOlapScan[household_demographics] +------------PhysicalProject +--------------PhysicalOlapScan[customer] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query35.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query35.out new file mode 100644 index 00000000000000..b14e619cc70b34 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query35.out @@ -0,0 +1,47 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_35 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------filter((ifnull($c$1, FALSE) OR ifnull($c$2, FALSE))) +--------------------hashJoin[LEFT_SEMI_JOIN bucketShuffle] hashCondition=((c.c_customer_sk = catalog_sales.cs_ship_customer_sk)) otherCondition=() +----------------------hashJoin[LEFT_SEMI_JOIN shuffle] hashCondition=((c.c_customer_sk = web_sales.ws_bill_customer_sk)) otherCondition=() +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_demographics.cd_demo_sk = c.c_current_cdemo_sk)) otherCondition=() build RFs:RF5 cd_demo_sk->[c_current_cdemo_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((c.c_current_addr_sk = ca.ca_address_sk)) otherCondition=() build RFs:RF4 ca_address_sk->[c_current_addr_sk] +--------------------------------hashJoin[RIGHT_SEMI_JOIN shuffle] hashCondition=((c.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ss_customer_sk] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 +--------------------------------------PhysicalProject +----------------------------------------filter((date_dim.d_qoy < 4) and (date_dim.d_year = 2001)) +------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[customer] apply RFs: RF4 RF5 +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[customer_address] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[customer_demographics] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 +----------------------------PhysicalProject +------------------------------filter((date_dim.d_qoy < 4) and (date_dim.d_year = 2001)) +--------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[cs_sold_date_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 +--------------------------PhysicalProject +----------------------------filter((date_dim.d_qoy < 4) and (date_dim.d_year = 2001)) +------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query36.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query36.out new file mode 100644 index 00000000000000..e2879bb57387ed --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query36.out @@ -0,0 +1,33 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_36 -- +PhysicalResultSink +--PhysicalProject +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------PhysicalWindow +--------------PhysicalQuickSort[LOCAL_SORT] +----------------PhysicalDistribute[DistributionSpecHash] +------------------PhysicalProject +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalRepeat +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((d1.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = store_sales.ss_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[item] +------------------------------------PhysicalProject +--------------------------------------filter((d1.d_year = 1999)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalProject +----------------------------------filter(s_state IN ('AL', 'FL', 'IN', 'LA', 'MI', 'MN', 'NM', 'TN')) +------------------------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query37.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query37.out new file mode 100644 index 00000000000000..adb94069ace3e3 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query37.out @@ -0,0 +1,27 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_37 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN shuffle] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[cs_item_sk] +------------------PhysicalProject +--------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = inventory.inv_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[inv_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((inventory.inv_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[inv_item_sk] +--------------------------PhysicalProject +----------------------------filter((inventory.inv_quantity_on_hand <= 500) and (inventory.inv_quantity_on_hand >= 100)) +------------------------------PhysicalOlapScan[inventory] apply RFs: RF0 RF1 +--------------------------PhysicalProject +----------------------------filter((item.i_current_price <= 69.00) and (item.i_current_price >= 39.00) and i_manufact_id IN (728, 765, 886, 889)) +------------------------------PhysicalOlapScan[item] +----------------------PhysicalProject +------------------------filter((date_dim.d_date <= '2001-03-17') and (date_dim.d_date >= '2001-01-16')) +--------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query38.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query38.out new file mode 100644 index 00000000000000..08d22c95f4ff40 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query38.out @@ -0,0 +1,52 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_38 -- +PhysicalResultSink +--PhysicalTopN[GATHER_SORT] +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecGather] +--------hashAgg[LOCAL] +----------PhysicalProject +------------PhysicalIntersect +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((web_sales.ws_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF0 c_customer_sk->[ws_bill_customer_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF1 +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[customer] +------------------------PhysicalProject +--------------------------filter((date_dim.d_month_seq <= 1197) and (date_dim.d_month_seq >= 1186)) +----------------------------PhysicalOlapScan[date_dim] +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cs_sold_date_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((catalog_sales.cs_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[cs_bill_customer_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3 +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[customer] +------------------------PhysicalProject +--------------------------filter((date_dim.d_month_seq <= 1197) and (date_dim.d_month_seq >= 1186)) +----------------------------PhysicalOlapScan[date_dim] +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[ss_sold_date_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF4 c_customer_sk->[ss_customer_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store_sales] apply RFs: RF4 RF5 +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[customer] +------------------------PhysicalProject +--------------------------filter((date_dim.d_month_seq <= 1197) and (date_dim.d_month_seq >= 1186)) +----------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query39.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query39.out new file mode 100644 index 00000000000000..b238464ddeedbb --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query39.out @@ -0,0 +1,33 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_39 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------filter((if((mean = 0.0), 0.0, (stdev / mean)) > 1.0)) +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((inventory.inv_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[inv_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((inventory.inv_warehouse_sk = warehouse.w_warehouse_sk)) otherCondition=() build RFs:RF1 w_warehouse_sk->[inv_warehouse_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((inventory.inv_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[inv_item_sk] +--------------------------PhysicalOlapScan[inventory] apply RFs: RF0 RF1 RF2 +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[item] +----------------------PhysicalProject +------------------------PhysicalOlapScan[warehouse] +------------------PhysicalProject +--------------------filter((date_dim.d_year = 2000) and d_moy IN (2, 3)) +----------------------PhysicalOlapScan[date_dim] +--PhysicalResultSink +----PhysicalQuickSort[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalQuickSort[LOCAL_SORT] +----------hashJoin[INNER_JOIN shuffle] hashCondition=((inv1.i_item_sk = inv2.i_item_sk) and (inv1.w_warehouse_sk = inv2.w_warehouse_sk)) otherCondition=() build RFs:RF3 i_item_sk->[i_item_sk];RF4 w_warehouse_sk->[w_warehouse_sk] +------------filter((inv1.d_moy = 2)) +--------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF3 RF4 +------------filter((inv2.d_moy = 3)) +--------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query4.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query4.out new file mode 100644 index 00000000000000..163b1cb7c71753 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query4.out @@ -0,0 +1,82 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_4 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalUnion +------PhysicalProject +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF0 c_customer_sk->[ss_customer_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] +------------------PhysicalProject +--------------------filter(d_year IN (1999, 2000)) +----------------------PhysicalOlapScan[date_dim] +------PhysicalProject +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cs_sold_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_customer_sk = catalog_sales.cs_bill_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[cs_bill_customer_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3 +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] +------------------PhysicalProject +--------------------filter(d_year IN (1999, 2000)) +----------------------PhysicalOlapScan[date_dim] +------PhysicalProject +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[ws_sold_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_customer_sk = web_sales.ws_bill_customer_sk)) otherCondition=() build RFs:RF4 c_customer_sk->[ws_bill_customer_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[web_sales] apply RFs: RF4 RF5 +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] +------------------PhysicalProject +--------------------filter(d_year IN (1999, 2000)) +----------------------PhysicalOlapScan[date_dim] +--PhysicalResultSink +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------hashJoin[INNER_JOIN shuffleBucket] hashCondition=((t_s_firstyear.customer_id = t_w_secyear.customer_id)) otherCondition=((if((year_total > 0.000000), (cast(year_total as DECIMALV3(38, 16)) / year_total), NULL) > if((year_total > 0.000000), (cast(year_total as DECIMALV3(38, 16)) / year_total), NULL))) build RFs:RF10 customer_id->[customer_id] +--------------PhysicalProject +----------------filter((t_w_secyear.dyear = 2000) and (t_w_secyear.sale_type = 'w')) +------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF10 +--------------PhysicalProject +----------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((t_s_firstyear.customer_id = t_w_firstyear.customer_id)) otherCondition=() build RFs:RF9 customer_id->[customer_id,customer_id,customer_id,customer_id] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffleBucket] hashCondition=((t_s_firstyear.customer_id = t_c_secyear.customer_id)) otherCondition=((if((year_total > 0.000000), (cast(year_total as DECIMALV3(38, 16)) / year_total), NULL) > if((year_total > 0.000000), (cast(year_total as DECIMALV3(38, 16)) / year_total), NULL))) build RFs:RF8 customer_id->[customer_id] +----------------------PhysicalProject +------------------------filter((t_c_secyear.dyear = 2000) and (t_c_secyear.sale_type = 'c')) +--------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF8 RF9 +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((t_s_firstyear.customer_id = t_c_firstyear.customer_id)) otherCondition=() build RFs:RF7 customer_id->[customer_id,customer_id] +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((t_s_secyear.customer_id = t_s_firstyear.customer_id)) otherCondition=() build RFs:RF6 customer_id->[customer_id] +----------------------------PhysicalProject +------------------------------filter((t_s_secyear.dyear = 2000) and (t_s_secyear.sale_type = 's')) +--------------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF6 RF7 RF9 +----------------------------PhysicalProject +------------------------------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 ) apply RFs: RF7 RF9 +--------------------------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 ) apply RFs: RF9 +------------------PhysicalProject +--------------------filter((t_w_firstyear.dyear = 1999) and (t_w_firstyear.sale_type = 'w') and (t_w_firstyear.year_total > 0.000000)) +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query40.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query40.out new file mode 100644 index 00000000000000..414f6e3e0bd2ed --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query40.out @@ -0,0 +1,30 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_40 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[cs_sold_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = catalog_sales.cs_item_sk)) otherCondition=() build RFs:RF1 i_item_sk->[cs_item_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_warehouse_sk = warehouse.w_warehouse_sk)) otherCondition=() build RFs:RF0 w_warehouse_sk->[cs_warehouse_sk] +--------------------------PhysicalProject +----------------------------hashJoin[LEFT_OUTER_JOIN shuffle] hashCondition=((catalog_sales.cs_item_sk = catalog_returns.cr_item_sk) and (catalog_sales.cs_order_number = catalog_returns.cr_order_number)) otherCondition=() +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 RF2 +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[catalog_returns] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[warehouse] +----------------------PhysicalProject +------------------------filter((item.i_current_price <= 1.49) and (item.i_current_price >= 0.99)) +--------------------------PhysicalOlapScan[item] +------------------PhysicalProject +--------------------filter((date_dim.d_date <= '2000-04-17') and (date_dim.d_date >= '2000-02-17')) +----------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query41.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query41.out new file mode 100644 index 00000000000000..11bcf3db2e7c79 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query41.out @@ -0,0 +1,23 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_41 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_manufact = i1.i_manufact)) otherCondition=() build RFs:RF0 i_manufact->[i_manufact] +------------------PhysicalProject +--------------------filter((i1.i_manufact_id <= 1010) and (i1.i_manufact_id >= 970)) +----------------------PhysicalOlapScan[item] apply RFs: RF0 +------------------PhysicalProject +--------------------filter((ifnull(item_cnt, 0) > 0)) +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------filter((((i_color IN ('black', 'chocolate', 'cornflower', 'firebrick', 'frosted', 'magenta', 'rose', 'slate') AND i_units IN ('Box', 'Bundle', 'Carton', 'Dram', 'Gross', 'Lb', 'Oz', 'Pound')) AND ((((((item.i_category = 'Women') AND i_color IN ('frosted', 'rose')) AND i_units IN ('Gross', 'Lb')) AND i_size IN ('large', 'medium')) OR ((((item.i_category = 'Women') AND i_color IN ('black', 'chocolate')) AND i_units IN ('Box', 'Dram')) AND i_size IN ('economy', 'petite'))) OR (((((item.i_category = 'Men') AND i_color IN ('magenta', 'slate')) AND i_units IN ('Bundle', 'Carton')) AND i_size IN ('N/A', 'small')) OR ((((item.i_category = 'Men') AND i_color IN ('cornflower', 'firebrick')) AND i_units IN ('Oz', 'Pound')) AND i_size IN ('large', 'medium'))))) OR ((i_color IN ('almond', 'aquamarine', 'cyan', 'lavender', 'maroon', 'papaya', 'purple', 'steel') AND i_units IN ('Bunch', 'Case', 'Cup', 'Each', 'Gram', 'N/A', 'Pallet', 'Tsp')) AND ((((((item.i_category = 'Women') AND i_color IN ('almond', 'steel')) AND i_units IN ('Case', 'Tsp')) AND i_size IN ('large', 'medium')) OR ((((item.i_category = 'Women') AND i_color IN ('aquamarine', 'purple')) AND i_units IN ('Bunch', 'Gram')) AND i_size IN ('economy', 'petite'))) OR (((((item.i_category = 'Men') AND i_color IN ('lavender', 'papaya')) AND i_units IN ('Cup', 'Pallet')) AND i_size IN ('N/A', 'small')) OR ((((item.i_category = 'Men') AND i_color IN ('cyan', 'maroon')) AND i_units IN ('Each', 'N/A')) AND i_size IN ('large', 'medium')))))) and i_category IN ('Men', 'Women') and i_size IN ('N/A', 'economy', 'large', 'medium', 'petite', 'small')) +--------------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query42.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query42.out new file mode 100644 index 00000000000000..913ce1a76228d5 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query42.out @@ -0,0 +1,22 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_42 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF1 i_item_sk->[ss_item_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((dt.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------PhysicalProject +------------------------filter((dt.d_moy = 12) and (dt.d_year = 1998)) +--------------------------PhysicalOlapScan[date_dim] +------------------PhysicalProject +--------------------filter((item.i_manager_id = 1)) +----------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query43.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query43.out new file mode 100644 index 00000000000000..78b5268407800c --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query43.out @@ -0,0 +1,22 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_43 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------PhysicalProject +------------------------filter((date_dim.d_year = 2001)) +--------------------------PhysicalOlapScan[date_dim] +------------------PhysicalProject +--------------------filter((store.s_gmt_offset = -6.00)) +----------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query44.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query44.out new file mode 100644 index 00000000000000..6549d1401b11a3 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query44.out @@ -0,0 +1,69 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_44 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashJoin[INNER_JOIN broadcast] hashCondition=((i2.i_item_sk = descending.item_sk)) otherCondition=() +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((i1.i_item_sk = asceding.item_sk)) otherCondition=() build RFs:RF0 item_sk->[i_item_sk] +----------------PhysicalProject +------------------PhysicalOlapScan[item] apply RFs: RF0 +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((asceding.rnk = descending.rnk)) otherCondition=() +--------------------PhysicalProject +----------------------filter((rnk < 11)) +------------------------PhysicalWindow +--------------------------PhysicalQuickSort[MERGE_SORT] +----------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------PhysicalQuickSort[LOCAL_SORT] +--------------------------------PhysicalPartitionTopN +----------------------------------PhysicalProject +------------------------------------NestedLoopJoin[INNER_JOIN](cast(rank_col as DOUBLE) > cast((0.9 * rank_col) as DOUBLE)) +--------------------------------------PhysicalProject +----------------------------------------hashAgg[GLOBAL] +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------hashAgg[LOCAL] +----------------------------------------------PhysicalProject +------------------------------------------------filter((ss1.ss_store_sk = 366)) +--------------------------------------------------PhysicalOlapScan[store_sales] +--------------------------------------PhysicalProject +----------------------------------------PhysicalAssertNumRows +------------------------------------------PhysicalDistribute[DistributionSpecGather] +--------------------------------------------PhysicalProject +----------------------------------------------hashAgg[GLOBAL] +------------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------------hashAgg[LOCAL] +----------------------------------------------------PhysicalProject +------------------------------------------------------filter((store_sales.ss_store_sk = 366) and ss_cdemo_sk IS NULL) +--------------------------------------------------------PhysicalOlapScan[store_sales] +--------------------PhysicalProject +----------------------filter((rnk < 11)) +------------------------PhysicalWindow +--------------------------PhysicalQuickSort[MERGE_SORT] +----------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------PhysicalQuickSort[LOCAL_SORT] +--------------------------------PhysicalPartitionTopN +----------------------------------PhysicalProject +------------------------------------NestedLoopJoin[INNER_JOIN](cast(rank_col as DOUBLE) > cast((0.9 * rank_col) as DOUBLE)) +--------------------------------------PhysicalProject +----------------------------------------hashAgg[GLOBAL] +------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------hashAgg[LOCAL] +----------------------------------------------PhysicalProject +------------------------------------------------filter((ss1.ss_store_sk = 366)) +--------------------------------------------------PhysicalOlapScan[store_sales] +--------------------------------------PhysicalProject +----------------------------------------PhysicalAssertNumRows +------------------------------------------PhysicalDistribute[DistributionSpecGather] +--------------------------------------------PhysicalProject +----------------------------------------------hashAgg[GLOBAL] +------------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------------hashAgg[LOCAL] +----------------------------------------------------PhysicalProject +------------------------------------------------------filter((store_sales.ss_store_sk = 366) and ss_cdemo_sk IS NULL) +--------------------------------------------------------PhysicalOlapScan[store_sales] +------------PhysicalProject +--------------PhysicalOlapScan[item] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query45.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query45.out new file mode 100644 index 00000000000000..98618affdbd763 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query45.out @@ -0,0 +1,35 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_45 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------filter((substring(ca_zip, 1, 5) IN ('80348', '81792', '83405', '85392', '85460', '85669', '86197', '86475', '88274') OR $c$1)) +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF3 i_item_sk->[ws_item_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_sold_date_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_current_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[c_current_addr_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((web_sales.ws_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF0 c_customer_sk->[ws_bill_customer_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF2 RF3 +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[customer] apply RFs: RF1 +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[customer_address] +------------------------PhysicalProject +--------------------------filter((date_dim.d_qoy = 1) and (date_dim.d_year = 1998)) +----------------------------PhysicalOlapScan[date_dim] +--------------------PhysicalProject +----------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((item.i_item_id = item.i_item_id)) otherCondition=() +------------------------PhysicalProject +--------------------------PhysicalOlapScan[item] +------------------------PhysicalProject +--------------------------filter(i_item_sk IN (11, 13, 17, 19, 2, 23, 29, 3, 5, 7)) +----------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query46.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query46.out new file mode 100644 index 00000000000000..2831d1a7f8f00a --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query46.out @@ -0,0 +1,38 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_46 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_current_addr_sk = current_addr.ca_address_sk)) otherCondition=(( not (ca_city = bought_city))) build RFs:RF5 ca_address_sk->[c_current_addr_sk] +------------PhysicalProject +--------------hashJoin[INNER_JOIN shuffle] hashCondition=((dn.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF4 c_customer_sk->[ss_customer_sk] +----------------PhysicalProject +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF3 ca_address_sk->[ss_addr_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF2 hd_demo_sk->[ss_hdemo_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF3 RF4 +------------------------------------PhysicalProject +--------------------------------------filter(d_dow IN (0, 6) and d_year IN (2000, 2001, 2002)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalProject +----------------------------------filter(s_city IN ('Fairview', 'Farmington', 'Five Forks', 'Oakland', 'Winchester')) +------------------------------------PhysicalOlapScan[store] +----------------------------PhysicalProject +------------------------------filter(((household_demographics.hd_dep_count = 0) OR (household_demographics.hd_vehicle_count = 1))) +--------------------------------PhysicalOlapScan[household_demographics] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[customer_address] +----------------PhysicalProject +------------------PhysicalOlapScan[customer] apply RFs: RF5 +------------PhysicalProject +--------------PhysicalOlapScan[customer_address] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query47.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query47.out new file mode 100644 index 00000000000000..591df70c5abce8 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query47.out @@ -0,0 +1,45 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_47 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------PhysicalWindow +--------PhysicalQuickSort[LOCAL_SORT] +----------PhysicalWindow +------------PhysicalQuickSort[LOCAL_SORT] +--------------PhysicalDistribute[DistributionSpecHash] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[item] +--------------------------------PhysicalProject +----------------------------------filter((((date_dim.d_year = 1999) OR ((date_dim.d_year = 1998) AND (date_dim.d_moy = 12))) OR ((date_dim.d_year = 2000) AND (date_dim.d_moy = 1))) and d_year IN (1998, 1999, 2000) and d_year IN (1998, 1999, 2000)) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store] +--PhysicalResultSink +----PhysicalProject +------PhysicalTopN[MERGE_SORT] +--------PhysicalDistribute[DistributionSpecGather] +----------PhysicalTopN[LOCAL_SORT] +------------PhysicalProject +--------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((v1.i_brand = v1_lead.i_brand) and (v1.i_category = v1_lead.i_category) and (v1.rn = expr_(rn - 1)) and (v1.s_company_name = v1_lead.s_company_name) and (v1.s_store_name = v1_lead.s_store_name)) otherCondition=() build RFs:RF8 i_category->[i_category,i_category];RF9 i_brand->[i_brand,i_brand];RF10 s_store_name->[s_store_name,s_store_name];RF11 s_company_name->[s_company_name,s_company_name];RF12 expr_(rn - 1)->[(rn + 1),rn] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN shuffle] hashCondition=((v1.i_brand = v1_lag.i_brand) and (v1.i_category = v1_lag.i_category) and (v1.rn = expr_(rn + 1)) and (v1.s_company_name = v1_lag.s_company_name) and (v1.s_store_name = v1_lag.s_store_name)) otherCondition=() build RFs:RF3 i_category->[i_category];RF4 i_brand->[i_brand];RF5 s_store_name->[s_store_name];RF6 s_company_name->[s_company_name];RF7 rn->[(rn + 1)] +--------------------PhysicalProject +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF3 RF4 RF5 RF6 RF7 RF8 RF9 RF10 RF11 RF12 +--------------------filter((if((avg_monthly_sales > 0.0000), (cast(abs((sum_sales - cast(avg_monthly_sales as DECIMALV3(38, 2)))) as DECIMALV3(38, 10)) / avg_monthly_sales), NULL) > 0.100000) and (v2.avg_monthly_sales > 0.0000) and (v2.d_year = 1999)) +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF8 RF9 RF10 RF11 RF12 +----------------PhysicalProject +------------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query48.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query48.out new file mode 100644 index 00000000000000..cb48bf987d7340 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query48.out @@ -0,0 +1,29 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_48 -- +PhysicalResultSink +--hashAgg[GLOBAL] +----PhysicalDistribute[DistributionSpecGather] +------hashAgg[LOCAL] +--------PhysicalProject +----------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ss_sold_date_sk] +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_addr_sk = customer_address.ca_address_sk)) otherCondition=((((ca_state IN ('GA', 'MI', 'NH') AND ((store_sales.ss_net_profit >= 0.00) AND (store_sales.ss_net_profit <= 2000.00))) OR (ca_state IN ('KY', 'SD', 'TX') AND ((store_sales.ss_net_profit >= 150.00) AND (store_sales.ss_net_profit <= 3000.00)))) OR (ca_state IN ('FL', 'NY', 'OH') AND ((store_sales.ss_net_profit >= 50.00) AND (store_sales.ss_net_profit <= 25000.00))))) build RFs:RF2 ca_address_sk->[ss_addr_sk] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_demographics.cd_demo_sk = store_sales.ss_cdemo_sk)) otherCondition=((((((customer_demographics.cd_marital_status = 'M') AND (customer_demographics.cd_education_status = 'Unknown')) AND ((store_sales.ss_sales_price >= 100.00) AND (store_sales.ss_sales_price <= 150.00))) OR (((customer_demographics.cd_marital_status = 'W') AND (customer_demographics.cd_education_status = 'College')) AND ((store_sales.ss_sales_price >= 50.00) AND (store_sales.ss_sales_price <= 100.00)))) OR (((customer_demographics.cd_marital_status = 'D') AND (customer_demographics.cd_education_status = 'Primary')) AND ((store_sales.ss_sales_price >= 150.00) AND (store_sales.ss_sales_price <= 200.00))))) build RFs:RF1 cd_demo_sk->[ss_cdemo_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF0 s_store_sk->[ss_store_sk] +------------------------PhysicalProject +--------------------------filter((store_sales.ss_net_profit <= 25000.00) and (store_sales.ss_net_profit >= 0.00) and (store_sales.ss_sales_price <= 200.00) and (store_sales.ss_sales_price >= 50.00)) +----------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF3 +------------------------PhysicalProject +--------------------------PhysicalOlapScan[store] +--------------------PhysicalProject +----------------------filter(((((customer_demographics.cd_marital_status = 'M') AND (customer_demographics.cd_education_status = 'Unknown')) OR ((customer_demographics.cd_marital_status = 'W') AND (customer_demographics.cd_education_status = 'College'))) OR ((customer_demographics.cd_marital_status = 'D') AND (customer_demographics.cd_education_status = 'Primary'))) and cd_education_status IN ('College', 'Primary', 'Unknown') and cd_marital_status IN ('D', 'M', 'W')) +------------------------PhysicalOlapScan[customer_demographics] +----------------PhysicalProject +------------------filter((customer_address.ca_country = 'United States') and ca_state IN ('FL', 'GA', 'KY', 'MI', 'NH', 'NY', 'OH', 'SD', 'TX')) +--------------------PhysicalOlapScan[customer_address] +------------PhysicalProject +--------------filter((date_dim.d_year = 1998)) +----------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query49.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query49.out new file mode 100644 index 00000000000000..398dcef280ccea --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query49.out @@ -0,0 +1,107 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_49 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalUnion +----------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------PhysicalTopN[MERGE_SORT] +--------------------PhysicalDistribute[DistributionSpecGather] +----------------------PhysicalTopN[LOCAL_SORT] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +----------------------------------PhysicalWindow +------------------------------------PhysicalQuickSort[LOCAL_SORT] +--------------------------------------PhysicalWindow +----------------------------------------PhysicalQuickSort[MERGE_SORT] +------------------------------------------PhysicalDistribute[DistributionSpecGather] +--------------------------------------------PhysicalQuickSort[LOCAL_SORT] +----------------------------------------------PhysicalProject +------------------------------------------------hashAgg[GLOBAL] +--------------------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------------------hashAgg[LOCAL] +------------------------------------------------------PhysicalProject +--------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((ws.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_sold_date_sk] +----------------------------------------------------------PhysicalProject +------------------------------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((ws.ws_item_sk = wr.wr_item_sk) and (ws.ws_order_number = wr.wr_order_number)) otherCondition=() build RFs:RF0 wr_order_number->[ws_order_number];RF1 wr_item_sk->[ws_item_sk] +--------------------------------------------------------------PhysicalProject +----------------------------------------------------------------filter((ws.ws_net_paid > 0.00) and (ws.ws_net_profit > 1.00) and (ws.ws_quantity > 0)) +------------------------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF1 RF2 +--------------------------------------------------------------PhysicalProject +----------------------------------------------------------------filter((wr.wr_return_amt > 10000.00)) +------------------------------------------------------------------PhysicalOlapScan[web_returns] +----------------------------------------------------------PhysicalProject +------------------------------------------------------------filter((date_dim.d_moy = 12) and (date_dim.d_year = 2000)) +--------------------------------------------------------------PhysicalOlapScan[date_dim] +----------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------PhysicalTopN[MERGE_SORT] +--------------------PhysicalDistribute[DistributionSpecGather] +----------------------PhysicalTopN[LOCAL_SORT] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +----------------------------------PhysicalWindow +------------------------------------PhysicalQuickSort[LOCAL_SORT] +--------------------------------------PhysicalWindow +----------------------------------------PhysicalQuickSort[MERGE_SORT] +------------------------------------------PhysicalDistribute[DistributionSpecGather] +--------------------------------------------PhysicalQuickSort[LOCAL_SORT] +----------------------------------------------PhysicalProject +------------------------------------------------hashAgg[GLOBAL] +--------------------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------------------hashAgg[LOCAL] +------------------------------------------------------PhysicalProject +--------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((cs.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[cs_sold_date_sk] +----------------------------------------------------------PhysicalProject +------------------------------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((cs.cs_item_sk = cr.cr_item_sk) and (cs.cs_order_number = cr.cr_order_number)) otherCondition=() build RFs:RF3 cr_order_number->[cs_order_number];RF4 cr_item_sk->[cs_item_sk] +--------------------------------------------------------------PhysicalProject +----------------------------------------------------------------filter((cs.cs_net_paid > 0.00) and (cs.cs_net_profit > 1.00) and (cs.cs_quantity > 0)) +------------------------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF3 RF4 RF5 +--------------------------------------------------------------PhysicalProject +----------------------------------------------------------------filter((cr.cr_return_amount > 10000.00)) +------------------------------------------------------------------PhysicalOlapScan[catalog_returns] +----------------------------------------------------------PhysicalProject +------------------------------------------------------------filter((date_dim.d_moy = 12) and (date_dim.d_year = 2000)) +--------------------------------------------------------------PhysicalOlapScan[date_dim] +----------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------PhysicalTopN[MERGE_SORT] +--------------------PhysicalDistribute[DistributionSpecGather] +----------------------PhysicalTopN[LOCAL_SORT] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +----------------------------------PhysicalWindow +------------------------------------PhysicalQuickSort[LOCAL_SORT] +--------------------------------------PhysicalWindow +----------------------------------------PhysicalQuickSort[MERGE_SORT] +------------------------------------------PhysicalDistribute[DistributionSpecGather] +--------------------------------------------PhysicalQuickSort[LOCAL_SORT] +----------------------------------------------PhysicalProject +------------------------------------------------hashAgg[GLOBAL] +--------------------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------------------hashAgg[LOCAL] +------------------------------------------------------PhysicalProject +--------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((sts.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF8 d_date_sk->[ss_sold_date_sk] +----------------------------------------------------------PhysicalProject +------------------------------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((sts.ss_item_sk = sr.sr_item_sk) and (sts.ss_ticket_number = sr.sr_ticket_number)) otherCondition=() build RFs:RF6 sr_ticket_number->[ss_ticket_number];RF7 sr_item_sk->[ss_item_sk] +--------------------------------------------------------------PhysicalProject +----------------------------------------------------------------filter((sts.ss_net_paid > 0.00) and (sts.ss_net_profit > 1.00) and (sts.ss_quantity > 0)) +------------------------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF6 RF7 RF8 +--------------------------------------------------------------PhysicalProject +----------------------------------------------------------------filter((sr.sr_return_amt > 10000.00)) +------------------------------------------------------------------PhysicalOlapScan[store_returns] +----------------------------------------------------------PhysicalProject +------------------------------------------------------------filter((date_dim.d_moy = 12) and (date_dim.d_year = 2000)) +--------------------------------------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query5.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query5.out new file mode 100644 index 00000000000000..db6861185074c9 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query5.out @@ -0,0 +1,77 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_5 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalRepeat +------------------PhysicalUnion +--------------------PhysicalProject +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((salesreturns.store_sk = store.s_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[sr_store_sk,ss_store_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((salesreturns.date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[sr_returned_date_sk,ss_sold_date_sk] +------------------------------------PhysicalUnion +--------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +--------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[store_returns] apply RFs: RF0 RF1 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_date <= '2000-09-02') and (date_dim.d_date >= '2000-08-19')) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store] +--------------------PhysicalProject +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((salesreturns.date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cr_returned_date_sk,cs_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((salesreturns.page_sk = catalog_page.cp_catalog_page_sk)) otherCondition=() build RFs:RF2 cp_catalog_page_sk->[cr_catalog_page_sk,cs_catalog_page_sk] +------------------------------------PhysicalUnion +--------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3 +--------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[catalog_returns] apply RFs: RF2 RF3 +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[catalog_page] +--------------------------------PhysicalProject +----------------------------------filter((date_dim.d_date <= '2000-09-02') and (date_dim.d_date >= '2000-08-19')) +------------------------------------PhysicalOlapScan[date_dim] +--------------------PhysicalProject +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((salesreturns.wsr_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF7 web_site_sk->[ws_web_site_sk,ws_web_site_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((salesreturns.date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[wr_returned_date_sk,ws_sold_date_sk] +------------------------------------PhysicalUnion +--------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF6 RF7 +--------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------PhysicalProject +------------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((web_returns.wr_item_sk = web_sales.ws_item_sk) and (web_returns.wr_order_number = web_sales.ws_order_number)) otherCondition=() build RFs:RF4 wr_item_sk->[ws_item_sk];RF5 wr_order_number->[ws_order_number] +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF4 RF5 RF7 +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[web_returns] apply RFs: RF6 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_date <= '2000-09-02') and (date_dim.d_date >= '2000-08-19')) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[web_site] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query50.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query50.out new file mode 100644 index 00000000000000..d2eda4d35debce --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query50.out @@ -0,0 +1,29 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_50 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_returned_date_sk = d2.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[sr_returned_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = d1.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[ss_sold_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF3 s_store_sk->[ss_store_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_customer_sk = store_returns.sr_customer_sk) and (store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number)) otherCondition=() build RFs:RF0 sr_ticket_number->[ss_ticket_number];RF1 sr_item_sk->[ss_item_sk];RF2 sr_customer_sk->[ss_customer_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF3 RF4 +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_returns] apply RFs: RF5 +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[store] +----------------------PhysicalProject +------------------------PhysicalOlapScan[date_dim] +------------------PhysicalProject +--------------------filter((d2.d_moy = 9) and (d2.d_year = 1998)) +----------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query51.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query51.out new file mode 100644 index 00000000000000..5635b5dbabf1b6 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query51.out @@ -0,0 +1,43 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_51 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------filter((web_cumulative > store_cumulative)) +----------PhysicalWindow +------------PhysicalQuickSort[LOCAL_SORT] +--------------PhysicalDistribute[DistributionSpecHash] +----------------PhysicalProject +------------------hashJoin[FULL_OUTER_JOIN colocated] hashCondition=((web.d_date = store.d_date) and (web.item_sk = store.item_sk)) otherCondition=() +--------------------PhysicalProject +----------------------PhysicalWindow +------------------------PhysicalQuickSort[LOCAL_SORT] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------PhysicalProject +------------------------------hashAgg[GLOBAL] +--------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------hashAgg[LOCAL] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_month_seq <= 1225) and (date_dim.d_month_seq >= 1214)) +--------------------------------------------PhysicalOlapScan[date_dim] +--------------------PhysicalProject +----------------------PhysicalWindow +------------------------PhysicalQuickSort[LOCAL_SORT] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------PhysicalProject +------------------------------hashAgg[GLOBAL] +--------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------hashAgg[LOCAL] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ws_sold_date_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_month_seq <= 1225) and (date_dim.d_month_seq >= 1214)) +--------------------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query52.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query52.out new file mode 100644 index 00000000000000..c4ca0099a7bf6c --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query52.out @@ -0,0 +1,23 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_52 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF1 i_item_sk->[ss_item_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((dt.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +------------------------PhysicalProject +--------------------------filter((dt.d_moy = 12) and (dt.d_year = 2000)) +----------------------------PhysicalOlapScan[date_dim] +--------------------PhysicalProject +----------------------filter((item.i_manager_id = 1)) +------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query53.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query53.out new file mode 100644 index 00000000000000..0ef41f5f16c373 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query53.out @@ -0,0 +1,32 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_53 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------filter((if((avg_quarterly_sales > 0.0000), (cast(abs((sum_sales - cast(avg_quarterly_sales as DECIMALV3(38, 2)))) as DECIMALV3(38, 10)) / avg_quarterly_sales), NULL) > 0.100000)) +------------PhysicalWindow +--------------PhysicalQuickSort[LOCAL_SORT] +----------------PhysicalDistribute[DistributionSpecHash] +------------------PhysicalProject +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +--------------------------------------PhysicalProject +----------------------------------------filter((((i_category IN ('Books', 'Children', 'Electronics') AND i_class IN ('personal', 'portable', 'reference', 'self-help')) AND i_brand IN ('exportiunivamalg #9', 'scholaramalgamalg #14', 'scholaramalgamalg #7', 'scholaramalgamalg #9')) OR ((i_category IN ('Men', 'Music', 'Women') AND i_class IN ('accessories', 'classical', 'fragrances', 'pants')) AND i_brand IN ('amalgimporto #1', 'edu packscholar #1', 'exportiimporto #1', 'importoamalg #1'))) and i_brand IN ('amalgimporto #1', 'edu packscholar #1', 'exportiimporto #1', 'exportiunivamalg #9', 'importoamalg #1', 'scholaramalgamalg #14', 'scholaramalgamalg #7', 'scholaramalgamalg #9') and i_category IN ('Books', 'Children', 'Electronics', 'Men', 'Music', 'Women') and i_class IN ('accessories', 'classical', 'fragrances', 'pants', 'personal', 'portable', 'reference', 'self-help')) +------------------------------------------PhysicalOlapScan[item] +----------------------------------PhysicalProject +------------------------------------filter(d_month_seq IN (1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223)) +--------------------------------------PhysicalOlapScan[date_dim] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query54.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query54.out new file mode 100644 index 00000000000000..4ee5ff3b075462 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query54.out @@ -0,0 +1,74 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_54 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------NestedLoopJoin[INNER_JOIN](cast(d_month_seq as BIGINT) <= (d_month_seq + 3)) +----------------------------PhysicalProject +------------------------------NestedLoopJoin[INNER_JOIN](cast(d_month_seq as BIGINT) >= (d_month_seq + 1)) +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF7 d_date_sk->[ss_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_address.ca_county = store.s_county) and (customer_address.ca_state = store.s_state)) otherCondition=() build RFs:RF5 s_county->[ca_county];RF6 s_state->[ca_state] +----------------------------------------PhysicalProject +------------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((my_customers.c_current_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF4 ca_address_sk->[c_current_addr_sk] +--------------------------------------------PhysicalProject +----------------------------------------------hashJoin[INNER_JOIN shuffleBucket] hashCondition=((my_customers.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ss_customer_sk] +------------------------------------------------PhysicalProject +--------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF3 RF7 +------------------------------------------------PhysicalProject +--------------------------------------------------hashAgg[LOCAL] +----------------------------------------------------PhysicalProject +------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((cs_or_ws_sales.sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[cs_sold_date_sk,ws_sold_date_sk] +--------------------------------------------------------PhysicalProject +----------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((cs_or_ws_sales.item_sk = item.i_item_sk)) otherCondition=() build RFs:RF1 i_item_sk->[cs_item_sk,ws_item_sk] +------------------------------------------------------------PhysicalProject +--------------------------------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_customer_sk = cs_or_ws_sales.customer_sk)) otherCondition=() build RFs:RF0 c_customer_sk->[cs_bill_customer_sk,ws_bill_customer_sk] +----------------------------------------------------------------PhysicalUnion +------------------------------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------------------------------PhysicalProject +----------------------------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 RF2 +------------------------------------------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------------------------------------------PhysicalProject +----------------------------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF1 RF2 +----------------------------------------------------------------PhysicalProject +------------------------------------------------------------------PhysicalOlapScan[customer] apply RFs: RF4 +------------------------------------------------------------PhysicalProject +--------------------------------------------------------------filter((item.i_category = 'Books') and (item.i_class = 'business')) +----------------------------------------------------------------PhysicalOlapScan[item] +--------------------------------------------------------PhysicalProject +----------------------------------------------------------filter((date_dim.d_moy = 2) and (date_dim.d_year = 2000)) +------------------------------------------------------------PhysicalOlapScan[date_dim] +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[customer_address] apply RFs: RF5 RF6 +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[store] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalAssertNumRows +----------------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------------hashAgg[GLOBAL] +--------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------hashAgg[LOCAL] +------------------------------------------PhysicalProject +--------------------------------------------filter((date_dim.d_moy = 2) and (date_dim.d_year = 2000)) +----------------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalAssertNumRows +------------------------------PhysicalDistribute[DistributionSpecGather] +--------------------------------hashAgg[GLOBAL] +----------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------hashAgg[LOCAL] +--------------------------------------PhysicalProject +----------------------------------------filter((date_dim.d_moy = 2) and (date_dim.d_year = 2000)) +------------------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query55.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query55.out new file mode 100644 index 00000000000000..cf69d556c8c13a --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query55.out @@ -0,0 +1,23 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_55 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF1 i_item_sk->[ss_item_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +------------------------PhysicalProject +--------------------------filter((date_dim.d_moy = 11) and (date_dim.d_year = 1999)) +----------------------------PhysicalOlapScan[date_dim] +--------------------PhysicalProject +----------------------filter((item.i_manager_id = 13)) +------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query56.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query56.out new file mode 100644 index 00000000000000..cf15de9fc368e7 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query56.out @@ -0,0 +1,83 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_56 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalUnion +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ss_sold_date_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ss_item_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[ss_addr_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 RF2 RF3 +------------------------------------PhysicalProject +--------------------------------------filter((customer_address.ca_gmt_offset = -6.00)) +----------------------------------------PhysicalOlapScan[customer_address] +--------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((item.i_item_id = item.i_item_id)) otherCondition=() build RFs:RF0 i_item_id->[i_item_id] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[item] apply RFs: RF0 +----------------------------------PhysicalProject +------------------------------------filter(i_color IN ('chiffon', 'lace', 'smoke')) +--------------------------------------PhysicalOlapScan[item] +----------------------------PhysicalProject +------------------------------filter((date_dim.d_moy = 5) and (date_dim.d_year = 2001)) +--------------------------------PhysicalOlapScan[date_dim] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF7 d_date_sk->[cs_sold_date_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF6 i_item_sk->[cs_item_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF5 ca_address_sk->[cs_bill_addr_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF5 RF6 RF7 +------------------------------------PhysicalProject +--------------------------------------filter((customer_address.ca_gmt_offset = -6.00)) +----------------------------------------PhysicalOlapScan[customer_address] +--------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((item.i_item_id = item.i_item_id)) otherCondition=() build RFs:RF4 i_item_id->[i_item_id] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[item] apply RFs: RF4 +----------------------------------PhysicalProject +------------------------------------filter(i_color IN ('chiffon', 'lace', 'smoke')) +--------------------------------------PhysicalOlapScan[item] +----------------------------PhysicalProject +------------------------------filter((date_dim.d_moy = 5) and (date_dim.d_year = 2001)) +--------------------------------PhysicalOlapScan[date_dim] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF11 d_date_sk->[ws_sold_date_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF10 i_item_sk->[ws_item_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF9 ca_address_sk->[ws_bill_addr_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF9 RF10 RF11 +------------------------------------PhysicalProject +--------------------------------------filter((customer_address.ca_gmt_offset = -6.00)) +----------------------------------------PhysicalOlapScan[customer_address] +--------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((item.i_item_id = item.i_item_id)) otherCondition=() build RFs:RF8 i_item_id->[i_item_id] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[item] apply RFs: RF8 +----------------------------------PhysicalProject +------------------------------------filter(i_color IN ('chiffon', 'lace', 'smoke')) +--------------------------------------PhysicalOlapScan[item] +----------------------------PhysicalProject +------------------------------filter((date_dim.d_moy = 5) and (date_dim.d_year = 2001)) +--------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query57.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query57.out new file mode 100644 index 00000000000000..9b61dc54e2a91e --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query57.out @@ -0,0 +1,45 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_57 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------PhysicalWindow +--------PhysicalQuickSort[LOCAL_SORT] +----------PhysicalWindow +------------PhysicalQuickSort[LOCAL_SORT] +--------------PhysicalDistribute[DistributionSpecHash] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((call_center.cc_call_center_sk = catalog_sales.cs_call_center_sk)) otherCondition=() build RFs:RF2 cc_call_center_sk->[cs_call_center_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[cs_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[cs_item_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 RF2 +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[item] +--------------------------------PhysicalProject +----------------------------------filter((((date_dim.d_year = 1999) OR ((date_dim.d_year = 1998) AND (date_dim.d_moy = 12))) OR ((date_dim.d_year = 2000) AND (date_dim.d_moy = 1))) and d_year IN (1998, 1999, 2000) and d_year IN (1998, 1999, 2000)) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[call_center] +--PhysicalResultSink +----PhysicalProject +------PhysicalTopN[MERGE_SORT] +--------PhysicalDistribute[DistributionSpecGather] +----------PhysicalTopN[LOCAL_SORT] +------------PhysicalProject +--------------hashJoin[INNER_JOIN shuffleBucket] hashCondition=((v1.cc_name = v1_lead.cc_name) and (v1.i_brand = v1_lead.i_brand) and (v1.i_category = v1_lead.i_category) and (v1.rn = expr_(rn - 1))) otherCondition=() build RFs:RF7 i_category->[i_category];RF8 i_brand->[i_brand];RF9 cc_name->[cc_name];RF10 rn->[(rn - 1)] +----------------PhysicalProject +------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF7 RF8 RF9 RF10 +----------------PhysicalProject +------------------hashJoin[INNER_JOIN shuffle] hashCondition=((v1.cc_name = v1_lag.cc_name) and (v1.i_brand = v1_lag.i_brand) and (v1.i_category = v1_lag.i_category) and (v1.rn = expr_(rn + 1))) otherCondition=() build RFs:RF3 i_category->[i_category];RF4 i_brand->[i_brand];RF5 cc_name->[cc_name];RF6 rn->[(rn + 1)] +--------------------PhysicalProject +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF3 RF4 RF5 RF6 +--------------------filter((if((avg_monthly_sales > 0.0000), (cast(abs((sum_sales - cast(avg_monthly_sales as DECIMALV3(38, 2)))) as DECIMALV3(38, 10)) / avg_monthly_sales), NULL) > 0.100000) and (v2.avg_monthly_sales > 0.0000) and (v2.d_year = 1999)) +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query58.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query58.out new file mode 100644 index 00000000000000..7a9b30a8cce45c --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query58.out @@ -0,0 +1,86 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_58 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashJoin[INNER_JOIN colocated] 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,i_item_id] +------------PhysicalProject +--------------hashJoin[INNER_JOIN colocated] 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:RF12 item_id->[i_item_id] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF11 d_date_sk->[ss_sold_date_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF10 i_item_sk->[ss_item_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF10 RF11 +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[item] apply RFs: RF12 RF13 +----------------------------PhysicalProject +------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build RFs:RF9 d_date->[d_date] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[date_dim] apply RFs: RF9 +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_week_seq = date_dim.d_week_seq)) otherCondition=() build RFs:RF8 d_week_seq->[d_week_seq] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[date_dim] apply RFs: RF8 +------------------------------------PhysicalAssertNumRows +--------------------------------------PhysicalDistribute[DistributionSpecGather] +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_date = '1998-02-21')) +--------------------------------------------PhysicalOlapScan[date_dim] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF7 d_date_sk->[cs_sold_date_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF6 i_item_sk->[cs_item_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF6 RF7 +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[item] apply RFs: RF13 +----------------------------PhysicalProject +------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build RFs:RF5 d_date->[d_date] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[date_dim] apply RFs: RF5 +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] 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 +------------------------------------PhysicalAssertNumRows +--------------------------------------PhysicalDistribute[DistributionSpecGather] +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_date = '1998-02-21')) +--------------------------------------------PhysicalOlapScan[date_dim] +------------PhysicalProject +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ws_sold_date_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ws_item_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[item] +------------------------PhysicalProject +--------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build RFs:RF1 d_date->[d_date] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[date_dim] apply RFs: RF1 +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] 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 +--------------------------------PhysicalAssertNumRows +----------------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_date = '1998-02-21')) +----------------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query59.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query59.out new file mode 100644 index 00000000000000..689a702ea7a479 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query59.out @@ -0,0 +1,42 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_59 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecHash] +--------hashAgg[LOCAL] +----------PhysicalProject +------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +--------------PhysicalProject +----------------PhysicalOlapScan[store_sales] apply RFs: RF0 +--------------PhysicalProject +----------------PhysicalOlapScan[date_dim] +--PhysicalResultSink +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------hashJoin[INNER_JOIN broadcast] hashCondition=((d.d_week_seq = d_week_seq1)) otherCondition=() build RFs:RF5 d_week_seq->[d_week_seq] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN shuffle] hashCondition=((expr_cast(d_week_seq1 as BIGINT) = expr_(d_week_seq2 - 52)) and (y.s_store_id1 = x.s_store_id2)) otherCondition=() build RFs:RF4 s_store_id2->[s_store_id] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((wss.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF3 s_store_sk->[ss_store_sk] +----------------------PhysicalProject +------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF3 RF5 +----------------------PhysicalProject +------------------------PhysicalOlapScan[store] apply RFs: RF4 +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((d.d_week_seq = d_week_seq2)) otherCondition=() build RFs:RF2 d_week_seq->[d_week_seq] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((wss.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] +--------------------------PhysicalProject +----------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF1 RF2 +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[store] +----------------------PhysicalProject +------------------------filter((d.d_month_seq <= 1228) and (d.d_month_seq >= 1217)) +--------------------------PhysicalOlapScan[date_dim] +--------------PhysicalProject +----------------filter((d.d_month_seq <= 1216) and (d.d_month_seq >= 1205)) +------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query6.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query6.out new file mode 100644 index 00000000000000..0c390df2e8e5f8 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query6.out @@ -0,0 +1,47 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_6 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------filter((cnt >= 10)) +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((j.i_category = i.i_category)) otherCondition=((cast(i_current_price as DECIMALV3(38, 5)) > (1.2 * avg(cast(i_current_price as DECIMALV3(9, 4)))))) build RFs:RF5 i_category->[i_category] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((d.d_month_seq = date_dim.d_month_seq)) otherCondition=() build RFs:RF4 d_month_seq->[d_month_seq] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((s.ss_item_sk = i.i_item_sk)) otherCondition=() build RFs:RF3 i_item_sk->[ss_item_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((s.ss_sold_date_sk = d.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((c.c_customer_sk = s.ss_customer_sk)) otherCondition=() build RFs:RF1 c_customer_sk->[ss_customer_sk] +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 RF2 RF3 +--------------------------------------PhysicalProject +----------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((a.ca_address_sk = c.c_current_addr_sk)) otherCondition=() build RFs:RF0 ca_address_sk->[c_current_addr_sk] +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[customer] apply RFs: RF0 +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[customer_address] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[date_dim] apply RFs: RF4 +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[item] apply RFs: RF5 +--------------------------PhysicalAssertNumRows +----------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------hashAgg[GLOBAL] +--------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------hashAgg[LOCAL] +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy = 3) and (date_dim.d_year = 2002)) +----------------------------------------PhysicalOlapScan[date_dim] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query60.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query60.out new file mode 100644 index 00000000000000..7884fdb7891a59 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query60.out @@ -0,0 +1,83 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_60 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalUnion +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ss_sold_date_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ss_item_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[ss_addr_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 RF2 RF3 +------------------------------------PhysicalProject +--------------------------------------filter((customer_address.ca_gmt_offset = -5.00)) +----------------------------------------PhysicalOlapScan[customer_address] +--------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((item.i_item_id = item.i_item_id)) otherCondition=() build RFs:RF0 i_item_id->[i_item_id] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[item] apply RFs: RF0 +----------------------------------PhysicalProject +------------------------------------filter((item.i_category = 'Children')) +--------------------------------------PhysicalOlapScan[item] +----------------------------PhysicalProject +------------------------------filter((date_dim.d_moy = 10) and (date_dim.d_year = 1998)) +--------------------------------PhysicalOlapScan[date_dim] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF7 d_date_sk->[cs_sold_date_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF6 i_item_sk->[cs_item_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF5 ca_address_sk->[cs_bill_addr_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF5 RF6 RF7 +------------------------------------PhysicalProject +--------------------------------------filter((customer_address.ca_gmt_offset = -5.00)) +----------------------------------------PhysicalOlapScan[customer_address] +--------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((item.i_item_id = item.i_item_id)) otherCondition=() build RFs:RF4 i_item_id->[i_item_id] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[item] apply RFs: RF4 +----------------------------------PhysicalProject +------------------------------------filter((item.i_category = 'Children')) +--------------------------------------PhysicalOlapScan[item] +----------------------------PhysicalProject +------------------------------filter((date_dim.d_moy = 10) and (date_dim.d_year = 1998)) +--------------------------------PhysicalOlapScan[date_dim] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF11 d_date_sk->[ws_sold_date_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF10 i_item_sk->[ws_item_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_bill_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF9 ca_address_sk->[ws_bill_addr_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF9 RF10 RF11 +------------------------------------PhysicalProject +--------------------------------------filter((customer_address.ca_gmt_offset = -5.00)) +----------------------------------------PhysicalOlapScan[customer_address] +--------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((item.i_item_id = item.i_item_id)) otherCondition=() build RFs:RF8 i_item_id->[i_item_id] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[item] apply RFs: RF8 +----------------------------------PhysicalProject +------------------------------------filter((item.i_category = 'Children')) +--------------------------------------PhysicalOlapScan[item] +----------------------------PhysicalProject +------------------------------filter((date_dim.d_moy = 10) and (date_dim.d_year = 1998)) +--------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query61.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query61.out new file mode 100644 index 00000000000000..a45d788af7c5a8 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query61.out @@ -0,0 +1,70 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_61 -- +PhysicalResultSink +--PhysicalTopN[GATHER_SORT] +----PhysicalProject +------NestedLoopJoin[CROSS_JOIN] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecGather] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF10 i_item_sk->[ss_item_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_address.ca_address_sk = customer.c_current_addr_sk)) otherCondition=() build RFs:RF9 ca_address_sk->[c_current_addr_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF8 d_date_sk->[ss_sold_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF7 s_store_sk->[ss_store_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF6 c_customer_sk->[ss_customer_sk] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_promo_sk = promotion.p_promo_sk)) otherCondition=() build RFs:RF5 p_promo_sk->[ss_promo_sk] +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF5 RF6 RF7 RF8 RF10 +--------------------------------------PhysicalProject +----------------------------------------filter((((promotion.p_channel_dmail = 'Y') OR (promotion.p_channel_email = 'Y')) OR (promotion.p_channel_tv = 'Y'))) +------------------------------------------PhysicalOlapScan[promotion] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[customer] apply RFs: RF9 +------------------------------PhysicalProject +--------------------------------filter((store.s_gmt_offset = -6.00)) +----------------------------------PhysicalOlapScan[store] +--------------------------PhysicalProject +----------------------------filter((date_dim.d_moy = 12) and (date_dim.d_year = 2001)) +------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------filter((customer_address.ca_gmt_offset = -6.00)) +--------------------------PhysicalOlapScan[customer_address] +------------------PhysicalProject +--------------------filter((item.i_category = 'Sports')) +----------------------PhysicalOlapScan[item] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecGather] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF4 i_item_sk->[ss_item_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_address.ca_address_sk = customer.c_current_addr_sk)) otherCondition=() build RFs:RF3 ca_address_sk->[c_current_addr_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF0 c_customer_sk->[ss_customer_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF4 +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[customer] apply RFs: RF3 +------------------------------PhysicalProject +--------------------------------filter((store.s_gmt_offset = -6.00)) +----------------------------------PhysicalOlapScan[store] +--------------------------PhysicalProject +----------------------------filter((date_dim.d_moy = 12) and (date_dim.d_year = 2001)) +------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------filter((customer_address.ca_gmt_offset = -6.00)) +--------------------------PhysicalOlapScan[customer_address] +------------------PhysicalProject +--------------------filter((item.i_category = 'Sports')) +----------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query62.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query62.out new file mode 100644 index 00000000000000..48210f34fe86e1 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query62.out @@ -0,0 +1,29 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_62 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ws_ship_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF2 web_site_sk->[ws_web_site_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_ship_mode_sk = ship_mode.sm_ship_mode_sk)) otherCondition=() build RFs:RF1 sm_ship_mode_sk->[ws_ship_mode_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_warehouse_sk = warehouse.w_warehouse_sk)) otherCondition=() build RFs:RF0 w_warehouse_sk->[ws_warehouse_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF1 RF2 RF3 +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[warehouse] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[ship_mode] +----------------------PhysicalProject +------------------------PhysicalOlapScan[web_site] +------------------PhysicalProject +--------------------filter((date_dim.d_month_seq <= 1226) and (date_dim.d_month_seq >= 1215)) +----------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query63.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query63.out new file mode 100644 index 00000000000000..5d47dbe07f57cb --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query63.out @@ -0,0 +1,32 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_63 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------filter((if((avg_monthly_sales > 0.0000), (cast(abs((sum_sales - cast(avg_monthly_sales as DECIMALV3(38, 2)))) as DECIMALV3(38, 10)) / avg_monthly_sales), NULL) > 0.100000)) +------------PhysicalWindow +--------------PhysicalQuickSort[LOCAL_SORT] +----------------PhysicalDistribute[DistributionSpecHash] +------------------PhysicalProject +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +--------------------------------------PhysicalProject +----------------------------------------filter((((i_category IN ('Books', 'Children', 'Electronics') AND i_class IN ('personal', 'portable', 'reference', 'self-help')) AND i_brand IN ('exportiunivamalg #9', 'scholaramalgamalg #14', 'scholaramalgamalg #7', 'scholaramalgamalg #9')) OR ((i_category IN ('Men', 'Music', 'Women') AND i_class IN ('accessories', 'classical', 'fragrances', 'pants')) AND i_brand IN ('amalgimporto #1', 'edu packscholar #1', 'exportiimporto #1', 'importoamalg #1'))) and i_brand IN ('amalgimporto #1', 'edu packscholar #1', 'exportiimporto #1', 'exportiunivamalg #9', 'importoamalg #1', 'scholaramalgamalg #14', 'scholaramalgamalg #7', 'scholaramalgamalg #9') and i_category IN ('Books', 'Children', 'Electronics', 'Men', 'Music', 'Women') and i_class IN ('accessories', 'classical', 'fragrances', 'pants', 'personal', 'portable', 'reference', 'self-help')) +------------------------------------------PhysicalOlapScan[item] +----------------------------------PhysicalProject +------------------------------------filter(d_month_seq IN (1211, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222)) +--------------------------------------PhysicalOlapScan[date_dim] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query64.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query64.out new file mode 100644 index 00000000000000..8399143cb6a33e --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query64.out @@ -0,0 +1,102 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_64 -- +PhysicalCteAnchor ( cteId=CTEId#1 ) +--PhysicalCteProducer ( cteId=CTEId#1 ) +----PhysicalProject +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecHash] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF19 i_item_sk->[cr_item_sk,cs_item_sk,sr_item_sk,ss_item_sk] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((hd2.hd_income_band_sk = ib2.ib_income_band_sk)) otherCondition=() build RFs:RF18 ib_income_band_sk->[hd_income_band_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((hd1.hd_income_band_sk = ib1.ib_income_band_sk)) otherCondition=() build RFs:RF17 ib_income_band_sk->[hd_income_band_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_current_hdemo_sk = hd2.hd_demo_sk)) otherCondition=() build RFs:RF16 hd_demo_sk->[c_current_hdemo_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = hd1.hd_demo_sk)) otherCondition=() build RFs:RF15 hd_demo_sk->[ss_hdemo_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_current_addr_sk = ad2.ca_address_sk)) otherCondition=() build RFs:RF14 ca_address_sk->[c_current_addr_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_addr_sk = ad1.ca_address_sk)) otherCondition=() build RFs:RF13 ca_address_sk->[ss_addr_sk] +----------------------------------------PhysicalProject +------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_promo_sk = promotion.p_promo_sk)) otherCondition=() build RFs:RF12 p_promo_sk->[ss_promo_sk] +--------------------------------------------PhysicalProject +----------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_current_cdemo_sk = cd2.cd_demo_sk)) otherCondition=(( not (cd_marital_status = cd_marital_status))) build RFs:RF11 cd_demo_sk->[c_current_cdemo_sk] +------------------------------------------------PhysicalProject +--------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_cdemo_sk = cd1.cd_demo_sk)) otherCondition=() build RFs:RF10 cd_demo_sk->[ss_cdemo_sk] +----------------------------------------------------PhysicalProject +------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_first_shipto_date_sk = d3.d_date_sk)) otherCondition=() build RFs:RF9 d_date_sk->[c_first_shipto_date_sk] +--------------------------------------------------------PhysicalProject +----------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer.c_first_sales_date_sk = d2.d_date_sk)) otherCondition=() build RFs:RF8 d_date_sk->[c_first_sales_date_sk] +------------------------------------------------------------PhysicalProject +--------------------------------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF7 c_customer_sk->[ss_customer_sk] +----------------------------------------------------------------PhysicalProject +------------------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF6 s_store_sk->[ss_store_sk] +--------------------------------------------------------------------PhysicalProject +----------------------------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = d1.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[ss_sold_date_sk] +------------------------------------------------------------------------PhysicalProject +--------------------------------------------------------------------------hashJoin[INNER_JOIN shuffleBucket] hashCondition=((store_sales.ss_item_sk = cs_ui.cs_item_sk)) otherCondition=() build RFs:RF4 cs_item_sk->[sr_item_sk,ss_item_sk] +----------------------------------------------------------------------------PhysicalProject +------------------------------------------------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number)) otherCondition=() build RFs:RF2 sr_item_sk->[ss_item_sk];RF3 sr_ticket_number->[ss_ticket_number] +--------------------------------------------------------------------------------PhysicalProject +----------------------------------------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 RF4 RF5 RF6 RF7 RF10 RF12 RF13 RF15 RF19 +--------------------------------------------------------------------------------PhysicalProject +----------------------------------------------------------------------------------PhysicalOlapScan[store_returns] apply RFs: RF4 RF19 +----------------------------------------------------------------------------PhysicalProject +------------------------------------------------------------------------------filter((sale > (2 * refund))) +--------------------------------------------------------------------------------hashAgg[GLOBAL] +----------------------------------------------------------------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------------------------------------------------------------hashAgg[LOCAL] +--------------------------------------------------------------------------------------PhysicalProject +----------------------------------------------------------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((catalog_sales.cs_item_sk = catalog_returns.cr_item_sk) and (catalog_sales.cs_order_number = catalog_returns.cr_order_number)) otherCondition=() build RFs:RF0 cr_item_sk->[cs_item_sk];RF1 cr_order_number->[cs_order_number] +------------------------------------------------------------------------------------------PhysicalProject +--------------------------------------------------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 RF19 +------------------------------------------------------------------------------------------PhysicalProject +--------------------------------------------------------------------------------------------PhysicalOlapScan[catalog_returns] apply RFs: RF19 +------------------------------------------------------------------------PhysicalProject +--------------------------------------------------------------------------filter(d_year IN (1999, 2000)) +----------------------------------------------------------------------------PhysicalOlapScan[date_dim] +--------------------------------------------------------------------PhysicalProject +----------------------------------------------------------------------PhysicalOlapScan[store] +----------------------------------------------------------------PhysicalProject +------------------------------------------------------------------PhysicalOlapScan[customer] apply RFs: RF8 RF9 RF11 RF14 RF16 +------------------------------------------------------------PhysicalProject +--------------------------------------------------------------PhysicalOlapScan[date_dim] +--------------------------------------------------------PhysicalProject +----------------------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------------------------PhysicalProject +------------------------------------------------------PhysicalOlapScan[customer_demographics] +------------------------------------------------PhysicalProject +--------------------------------------------------PhysicalOlapScan[customer_demographics] +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[promotion] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[customer_address] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[customer_address] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[household_demographics] apply RFs: RF17 +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[household_demographics] apply RFs: RF18 +------------------------PhysicalProject +--------------------------PhysicalOlapScan[income_band] +--------------------PhysicalProject +----------------------PhysicalOlapScan[income_band] +----------------PhysicalProject +------------------filter((item.i_current_price <= 90.00) and (item.i_current_price >= 81.00) and i_color IN ('azure', 'blush', 'gainsboro', 'hot', 'lemon', 'misty')) +--------------------PhysicalOlapScan[item] +--PhysicalResultSink +----PhysicalQuickSort[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalQuickSort[LOCAL_SORT] +----------PhysicalProject +------------hashJoin[INNER_JOIN shuffle] hashCondition=((cs1.item_sk = cs2.item_sk) and (cs1.store_name = cs2.store_name) and (cs1.store_zip = cs2.store_zip)) otherCondition=((cs2.cnt <= cs1.cnt)) build RFs:RF20 item_sk->[item_sk];RF21 store_name->[store_name];RF22 store_zip->[store_zip] +--------------PhysicalProject +----------------filter((cs1.syear = 1999)) +------------------PhysicalCteConsumer ( cteId=CTEId#1 ) apply RFs: RF20 RF21 RF22 +--------------PhysicalProject +----------------filter((cs2.syear = 2000)) +------------------PhysicalCteConsumer ( cteId=CTEId#1 ) + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query65.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query65.out new file mode 100644 index 00000000000000..574a272c000358 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query65.out @@ -0,0 +1,41 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_65 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashJoin[INNER_JOIN shuffleBucket] hashCondition=((sb.ss_store_sk = sc.ss_store_sk)) otherCondition=((cast(revenue as DOUBLE) <= cast((0.1 * ave) as DOUBLE))) build RFs:RF4 ss_store_sk->[s_store_sk,ss_store_sk] +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = sc.ss_item_sk)) otherCondition=() build RFs:RF3 i_item_sk->[ss_item_sk] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = sc.ss_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk] +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 RF2 RF3 RF4 +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_month_seq <= 1197) and (date_dim.d_month_seq >= 1186)) +----------------------------------PhysicalOlapScan[date_dim] +--------------------PhysicalProject +----------------------PhysicalOlapScan[store] apply RFs: RF4 +----------------PhysicalProject +------------------PhysicalOlapScan[item] +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_month_seq <= 1197) and (date_dim.d_month_seq >= 1186)) +----------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query66.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query66.out new file mode 100644 index 00000000000000..e9d1404570f6ed --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query66.out @@ -0,0 +1,62 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_66 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------PhysicalUnion +------------------PhysicalProject +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_ship_mode_sk = ship_mode.sm_ship_mode_sk)) otherCondition=() build RFs:RF3 sm_ship_mode_sk->[ws_ship_mode_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF2 t_time_sk->[ws_sold_time_sk] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_warehouse_sk = warehouse.w_warehouse_sk)) otherCondition=() build RFs:RF0 w_warehouse_sk->[ws_warehouse_sk] +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF1 RF2 RF3 +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[warehouse] +--------------------------------------PhysicalProject +----------------------------------------filter((date_dim.d_year = 2001)) +------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------PhysicalProject +------------------------------------filter((time_dim.t_time <= 38253) and (time_dim.t_time >= 9453)) +--------------------------------------PhysicalOlapScan[time_dim] +------------------------------PhysicalProject +--------------------------------filter(sm_carrier IN ('GERMA', 'MSC')) +----------------------------------PhysicalOlapScan[ship_mode] +------------------PhysicalProject +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_ship_mode_sk = ship_mode.sm_ship_mode_sk)) otherCondition=() build RFs:RF7 sm_ship_mode_sk->[cs_ship_mode_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF6 t_time_sk->[cs_sold_time_sk] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[cs_sold_date_sk] +--------------------------------------PhysicalProject +----------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_warehouse_sk = warehouse.w_warehouse_sk)) otherCondition=() build RFs:RF4 w_warehouse_sk->[cs_warehouse_sk] +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF4 RF5 RF6 RF7 +------------------------------------------PhysicalProject +--------------------------------------------PhysicalOlapScan[warehouse] +--------------------------------------PhysicalProject +----------------------------------------filter((date_dim.d_year = 2001)) +------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------PhysicalProject +------------------------------------filter((time_dim.t_time <= 38253) and (time_dim.t_time >= 9453)) +--------------------------------------PhysicalOlapScan[time_dim] +------------------------------PhysicalProject +--------------------------------filter(sm_carrier IN ('GERMA', 'MSC')) +----------------------------------PhysicalOlapScan[ship_mode] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query67.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query67.out new file mode 100644 index 00000000000000..72490b12bb4c6d --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query67.out @@ -0,0 +1,32 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_67 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------filter((rk <= 100)) +----------PhysicalWindow +------------PhysicalQuickSort[LOCAL_SORT] +--------------PhysicalDistribute[DistributionSpecHash] +----------------PhysicalPartitionTopN +------------------PhysicalProject +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalRepeat +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ss_item_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_month_seq <= 1196) and (date_dim.d_month_seq >= 1185)) +--------------------------------------------PhysicalOlapScan[date_dim] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[item] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query68.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query68.out new file mode 100644 index 00000000000000..a96932c173fb69 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query68.out @@ -0,0 +1,38 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_68 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_current_addr_sk = current_addr.ca_address_sk)) otherCondition=(( not (ca_city = bought_city))) build RFs:RF5 ca_address_sk->[c_current_addr_sk] +------------PhysicalProject +--------------hashJoin[INNER_JOIN shuffle] hashCondition=((dn.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF4 c_customer_sk->[ss_customer_sk] +----------------PhysicalProject +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF3 ca_address_sk->[ss_addr_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF2 hd_demo_sk->[ss_hdemo_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF3 RF4 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_dom <= 2) and (date_dim.d_dom >= 1) and d_year IN (1999, 2000, 2001)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalProject +----------------------------------filter(s_city IN ('Bethel', 'Pleasant Hill')) +------------------------------------PhysicalOlapScan[store] +----------------------------PhysicalProject +------------------------------filter(((household_demographics.hd_dep_count = 4) OR (household_demographics.hd_vehicle_count = 0))) +--------------------------------PhysicalOlapScan[household_demographics] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[customer_address] +----------------PhysicalProject +------------------PhysicalOlapScan[customer] apply RFs: RF5 +------------PhysicalProject +--------------PhysicalOlapScan[customer_address] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query69.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query69.out new file mode 100644 index 00000000000000..115564d2edf45e --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query69.out @@ -0,0 +1,47 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_69 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[LEFT_ANTI_JOIN shuffle] hashCondition=((c.c_customer_sk = catalog_sales.cs_ship_customer_sk)) otherCondition=() +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_demographics.cd_demo_sk = c.c_current_cdemo_sk)) otherCondition=() build RFs:RF5 cd_demo_sk->[c_current_cdemo_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((c.c_current_addr_sk = ca.ca_address_sk)) otherCondition=() build RFs:RF4 ca_address_sk->[c_current_addr_sk] +----------------------------hashJoin[LEFT_ANTI_JOIN bucketShuffle] hashCondition=((c.c_customer_sk = web_sales.ws_bill_customer_sk)) otherCondition=() +------------------------------hashJoin[RIGHT_SEMI_JOIN shuffle] hashCondition=((c.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ss_customer_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_moy <= 4) and (date_dim.d_moy >= 2) and (date_dim.d_year = 2003)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[customer] apply RFs: RF4 RF5 +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 +----------------------------------PhysicalProject +------------------------------------filter((date_dim.d_moy <= 4) and (date_dim.d_moy >= 2) and (date_dim.d_year = 2003)) +--------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------filter(ca_state IN ('AZ', 'MN', 'MO')) +--------------------------------PhysicalOlapScan[customer_address] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[customer_demographics] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[cs_sold_date_sk] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 +------------------------PhysicalProject +--------------------------filter((date_dim.d_moy <= 4) and (date_dim.d_moy >= 2) and (date_dim.d_year = 2003)) +----------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query7.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query7.out new file mode 100644 index 00000000000000..9ebde668ccdb31 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query7.out @@ -0,0 +1,31 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_7 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_promo_sk = promotion.p_promo_sk)) otherCondition=() build RFs:RF3 p_promo_sk->[ss_promo_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_cdemo_sk = customer_demographics.cd_demo_sk)) otherCondition=() build RFs:RF1 cd_demo_sk->[ss_cdemo_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF3 +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[item] +--------------------------PhysicalProject +----------------------------filter((customer_demographics.cd_education_status = 'College') and (customer_demographics.cd_gender = 'F') and (customer_demographics.cd_marital_status = 'W')) +------------------------------PhysicalOlapScan[customer_demographics] +----------------------PhysicalProject +------------------------filter((date_dim.d_year = 2001)) +--------------------------PhysicalOlapScan[date_dim] +------------------PhysicalProject +--------------------filter(((promotion.p_channel_email = 'N') OR (promotion.p_channel_event = 'N'))) +----------------------PhysicalOlapScan[promotion] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query70.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query70.out new file mode 100644 index 00000000000000..3038640513b88d --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query70.out @@ -0,0 +1,44 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_70 -- +PhysicalResultSink +--PhysicalProject +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------PhysicalWindow +--------------PhysicalQuickSort[LOCAL_SORT] +----------------PhysicalDistribute[DistributionSpecHash] +------------------PhysicalProject +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalRepeat +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF4 s_store_sk->[ss_store_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((d1.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ss_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF3 RF4 +------------------------------------PhysicalProject +--------------------------------------filter((d1.d_month_seq <= 1229) and (d1.d_month_seq >= 1218)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------hashJoin[RIGHT_SEMI_JOIN bucketShuffle] hashCondition=((store.s_state = tmp1.s_state)) otherCondition=() build RFs:RF2 s_state->[s_state] +----------------------------------PhysicalProject +------------------------------------hashAgg[GLOBAL] +--------------------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------------------hashAgg[LOCAL] +------------------------------------------PhysicalProject +--------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +----------------------------------------------PhysicalProject +------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store.s_store_sk = store_sales.ss_store_sk)) otherCondition=() build RFs:RF0 s_store_sk->[ss_store_sk] +--------------------------------------------------PhysicalProject +----------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +--------------------------------------------------PhysicalProject +----------------------------------------------------PhysicalOlapScan[store] apply RFs: RF2 +----------------------------------------------PhysicalProject +------------------------------------------------filter((date_dim.d_month_seq <= 1229) and (date_dim.d_month_seq >= 1218)) +--------------------------------------------------PhysicalOlapScan[date_dim] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query71.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query71.out new file mode 100644 index 00000000000000..b2717237b73c8b --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query71.out @@ -0,0 +1,46 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_71 -- +PhysicalResultSink +--PhysicalQuickSort[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalQuickSort[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((tmp.time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF4 t_time_sk->[cs_sold_time_sk,ss_sold_time_sk,ws_sold_time_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((tmp.sold_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF3 i_item_sk->[cs_item_sk,ss_item_sk,ws_item_sk] +------------------------PhysicalUnion +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = web_sales.ws_sold_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ws_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF3 RF4 +--------------------------------PhysicalProject +----------------------------------filter((date_dim.d_moy = 12) and (date_dim.d_year = 2000)) +------------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = catalog_sales.cs_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[cs_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF1 RF3 RF4 +--------------------------------PhysicalProject +----------------------------------filter((date_dim.d_moy = 12) and (date_dim.d_year = 2000)) +------------------------------------PhysicalOlapScan[date_dim] +--------------------------PhysicalDistribute[DistributionSpecHash] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 RF4 +--------------------------------PhysicalProject +----------------------------------filter((date_dim.d_moy = 12) and (date_dim.d_year = 2000)) +------------------------------------PhysicalOlapScan[date_dim] +------------------------PhysicalProject +--------------------------filter((item.i_manager_id = 1)) +----------------------------PhysicalOlapScan[item] +--------------------PhysicalProject +----------------------filter(t_meal_time IN ('breakfast', 'dinner')) +------------------------PhysicalOlapScan[time_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query72.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query72.out new file mode 100644 index 00000000000000..2aebd7f5200fa9 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query72.out @@ -0,0 +1,54 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_72 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = d1.d_date_sk) and (d1.d_week_seq = d2.d_week_seq)) otherCondition=((d3.d_date > cast((cast(d_date as BIGINT) + 5) as DATEV2))) build RFs:RF7 d_week_seq->[d_week_seq];RF8 d_date_sk->[cs_sold_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_bill_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF6 hd_demo_sk->[cs_bill_hdemo_sk] +----------------------PhysicalProject +------------------------hashJoin[LEFT_OUTER_JOIN bucketShuffle] hashCondition=((catalog_returns.cr_item_sk = catalog_sales.cs_item_sk) and (catalog_returns.cr_order_number = catalog_sales.cs_order_number)) otherCondition=() +--------------------------PhysicalProject +----------------------------hashJoin[LEFT_OUTER_JOIN broadcast] hashCondition=((catalog_sales.cs_promo_sk = promotion.p_promo_sk)) otherCondition=() +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_ship_date_sk = d3.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[cs_ship_date_sk] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((inventory.inv_date_sk = d2.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[inv_date_sk] +--------------------------------------PhysicalProject +----------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_bill_cdemo_sk = customer_demographics.cd_demo_sk)) otherCondition=() build RFs:RF3 cd_demo_sk->[cs_bill_cdemo_sk] +------------------------------------------PhysicalProject +--------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = catalog_sales.cs_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[cs_item_sk,inv_item_sk] +----------------------------------------------PhysicalProject +------------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((warehouse.w_warehouse_sk = inventory.inv_warehouse_sk)) otherCondition=() build RFs:RF1 w_warehouse_sk->[inv_warehouse_sk] +--------------------------------------------------PhysicalProject +----------------------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((catalog_sales.cs_item_sk = inventory.inv_item_sk)) otherCondition=((inventory.inv_quantity_on_hand < catalog_sales.cs_quantity)) build RFs:RF0 inv_item_sk->[cs_item_sk] +------------------------------------------------------PhysicalProject +--------------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF2 RF3 RF5 RF6 RF8 +------------------------------------------------------PhysicalOlapScan[inventory] apply RFs: RF1 RF2 RF4 +--------------------------------------------------PhysicalProject +----------------------------------------------------PhysicalOlapScan[warehouse] +----------------------------------------------PhysicalProject +------------------------------------------------PhysicalOlapScan[item] +------------------------------------------PhysicalProject +--------------------------------------------filter((customer_demographics.cd_marital_status = 'D')) +----------------------------------------------PhysicalOlapScan[customer_demographics] +--------------------------------------PhysicalProject +----------------------------------------PhysicalOlapScan[date_dim] apply RFs: RF7 +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[date_dim] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[promotion] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[catalog_returns] +----------------------PhysicalProject +------------------------filter((household_demographics.hd_buy_potential = '1001-5000')) +--------------------------PhysicalOlapScan[household_demographics] +------------------PhysicalProject +--------------------filter((d1.d_year = 2000)) +----------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query73.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query73.out new file mode 100644 index 00000000000000..33a130844295c9 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query73.out @@ -0,0 +1,32 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_73 -- +PhysicalResultSink +--PhysicalQuickSort[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalQuickSort[LOCAL_SORT] +--------PhysicalProject +----------hashJoin[INNER_JOIN shuffle] hashCondition=((dj.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ss_customer_sk] +------------filter((dj.cnt <= 5) and (dj.cnt >= 1)) +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF2 hd_demo_sk->[ss_hdemo_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF3 +--------------------------------PhysicalProject +----------------------------------filter((date_dim.d_dom <= 2) and (date_dim.d_dom >= 1) and d_year IN (2000, 2001, 2002)) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------filter(s_county IN ('Bronx County', 'Furnas County', 'Lea County', 'Pennington County')) +--------------------------------PhysicalOlapScan[store] +------------------------PhysicalProject +--------------------------filter((household_demographics.hd_vehicle_count > 0) and (if((hd_vehicle_count > 0), (cast(hd_dep_count as DOUBLE) / cast(hd_vehicle_count as DOUBLE)), NULL) > 1.0) and hd_buy_potential IN ('5001-10000', '>10000')) +----------------------------PhysicalOlapScan[household_demographics] +------------PhysicalProject +--------------PhysicalOlapScan[customer] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query74.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query74.out new file mode 100644 index 00000000000000..dd412dc06cf521 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query74.out @@ -0,0 +1,57 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_74 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalUnion +------PhysicalProject +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_customer_sk = store_sales.ss_customer_sk)) otherCondition=() build RFs:RF0 c_customer_sk->[ss_customer_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] +------------------PhysicalProject +--------------------filter(d_year IN (1998, 1999)) +----------------------PhysicalOlapScan[date_dim] +------PhysicalProject +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ws_sold_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_customer_sk = web_sales.ws_bill_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[ws_bill_customer_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] +------------------PhysicalProject +--------------------filter(d_year IN (1998, 1999)) +----------------------PhysicalOlapScan[date_dim] +--PhysicalResultSink +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((t_s_firstyear.customer_id = t_w_secyear.customer_id)) otherCondition=((if((year_total > 0.00), (cast(year_total as DECIMALV3(38, 8)) / year_total), NULL) > if((year_total > 0.00), (cast(year_total as DECIMALV3(38, 8)) / year_total), NULL))) build RFs:RF6 customer_id->[customer_id,customer_id,customer_id] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN bucketShuffle] hashCondition=((t_s_firstyear.customer_id = t_w_firstyear.customer_id)) otherCondition=() build RFs:RF5 customer_id->[customer_id,customer_id] +------------------hashJoin[INNER_JOIN shuffle] hashCondition=((t_s_secyear.customer_id = t_s_firstyear.customer_id)) otherCondition=() build RFs:RF4 customer_id->[customer_id] +--------------------PhysicalProject +----------------------filter((t_s_secyear.sale_type = 's') and (t_s_secyear.year = 1999)) +------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF4 RF5 RF6 +--------------------PhysicalProject +----------------------filter((t_s_firstyear.sale_type = 's') and (t_s_firstyear.year = 1998) and (t_s_firstyear.year_total > 0.00)) +------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF5 RF6 +------------------PhysicalProject +--------------------filter((t_w_firstyear.sale_type = 'w') and (t_w_firstyear.year = 1998) and (t_w_firstyear.year_total > 0.00)) +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF6 +--------------PhysicalProject +----------------filter((t_w_secyear.sale_type = 'w') and (t_w_secyear.year = 1999)) +------------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query75.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query75.out new file mode 100644 index 00000000000000..b45f54f94a72ed --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query75.out @@ -0,0 +1,78 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_75 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecHash] +--------hashAgg[LOCAL] +----------hashAgg[GLOBAL] +------------hashAgg[LOCAL] +--------------PhysicalUnion +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = catalog_sales.cs_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[cs_sold_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = catalog_sales.cs_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[cs_item_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[LEFT_OUTER_JOIN shuffle] hashCondition=((catalog_sales.cs_item_sk = catalog_returns.cr_item_sk) and (catalog_sales.cs_order_number = catalog_returns.cr_order_number)) otherCondition=() +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[catalog_returns] +------------------------------PhysicalProject +--------------------------------filter((item.i_category = 'Sports')) +----------------------------------PhysicalOlapScan[item] +--------------------------PhysicalProject +----------------------------filter(d_year IN (2000, 2001)) +------------------------------PhysicalOlapScan[date_dim] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = store_sales.ss_sold_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ss_sold_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = store_sales.ss_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ss_item_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[LEFT_OUTER_JOIN shuffle] hashCondition=((store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number)) otherCondition=() +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store_returns] +------------------------------PhysicalProject +--------------------------------filter((item.i_category = 'Sports')) +----------------------------------PhysicalOlapScan[item] +--------------------------PhysicalProject +----------------------------filter(d_year IN (2000, 2001)) +------------------------------PhysicalOlapScan[date_dim] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = web_sales.ws_sold_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[ws_sold_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = web_sales.ws_item_sk)) otherCondition=() build RFs:RF4 i_item_sk->[ws_item_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[LEFT_OUTER_JOIN shuffle] hashCondition=((web_sales.ws_item_sk = web_returns.wr_item_sk) and (web_sales.ws_order_number = web_returns.wr_order_number)) otherCondition=() +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF4 RF5 +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[web_returns] +------------------------------PhysicalProject +--------------------------------filter((item.i_category = 'Sports')) +----------------------------------PhysicalOlapScan[item] +--------------------------PhysicalProject +----------------------------filter(d_year IN (2000, 2001)) +------------------------------PhysicalOlapScan[date_dim] +--PhysicalResultSink +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------hashJoin[INNER_JOIN shuffle] hashCondition=((curr_yr.i_brand_id = prev_yr.i_brand_id) and (curr_yr.i_category_id = prev_yr.i_category_id) and (curr_yr.i_class_id = prev_yr.i_class_id) and (curr_yr.i_manufact_id = prev_yr.i_manufact_id)) otherCondition=(((cast(cast(sales_cnt as DECIMALV3(17, 2)) as DECIMALV3(23, 8)) / cast(sales_cnt as DECIMALV3(17, 2))) < 0.900000)) build RFs:RF6 i_brand_id->[i_brand_id];RF7 i_class_id->[i_class_id];RF8 i_category_id->[i_category_id];RF9 i_manufact_id->[i_manufact_id] +--------------filter((curr_yr.d_year = 2001)) +----------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF6 RF7 RF8 RF9 +--------------filter((prev_yr.d_year = 2000)) +----------------PhysicalCteConsumer ( cteId=CTEId#0 ) + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query76.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query76.out new file mode 100644 index 00000000000000..d929aca4ca8137 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query76.out @@ -0,0 +1,47 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_76 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalUnion +----------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +--------------------------PhysicalProject +----------------------------filter(ss_customer_sk IS NULL) +------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[item] +----------------------PhysicalProject +------------------------PhysicalOlapScan[date_dim] +----------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[ws_sold_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ws_item_sk] +--------------------------PhysicalProject +----------------------------filter(ws_ship_addr_sk IS NULL) +------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[item] +----------------------PhysicalProject +------------------------PhysicalOlapScan[date_dim] +----------------PhysicalDistribute[DistributionSpecExecutionAny] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[cs_sold_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF4 i_item_sk->[cs_item_sk] +--------------------------PhysicalProject +----------------------------filter(cs_ship_mode_sk IS NULL) +------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF4 RF5 +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[item] +----------------------PhysicalProject +------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query77.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query77.out new file mode 100644 index 00000000000000..ce4f3f7828757e --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query77.out @@ -0,0 +1,101 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_77 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalRepeat +------------------PhysicalUnion +--------------------PhysicalProject +----------------------hashJoin[LEFT_OUTER_JOIN colocated] hashCondition=((ss.s_store_sk = sr.s_store_sk)) otherCondition=() +------------------------PhysicalProject +--------------------------hashAgg[GLOBAL] +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------hashAgg[LOCAL] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF3 s_store_sk->[ss_store_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 RF3 +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_date <= '2000-09-15') and (date_dim.d_date >= '2000-08-16')) +--------------------------------------------PhysicalOlapScan[date_dim] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store] +------------------------PhysicalProject +--------------------------hashAgg[GLOBAL] +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------hashAgg[LOCAL] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[sr_store_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[sr_returned_date_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[store_returns] apply RFs: RF0 RF1 +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_date <= '2000-09-15') and (date_dim.d_date >= '2000-08-16')) +--------------------------------------------PhysicalOlapScan[date_dim] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[store] +--------------------PhysicalProject +----------------------NestedLoopJoin[CROSS_JOIN] +------------------------PhysicalProject +--------------------------hashAgg[GLOBAL] +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------hashAgg[LOCAL] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[cs_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF5 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_date <= '2000-09-15') and (date_dim.d_date >= '2000-08-16')) +----------------------------------------PhysicalOlapScan[date_dim] +------------------------PhysicalProject +--------------------------hashAgg[GLOBAL] +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------hashAgg[LOCAL] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_returns.cr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF4 d_date_sk->[cr_returned_date_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[catalog_returns] apply RFs: RF4 +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_date <= '2000-09-15') and (date_dim.d_date >= '2000-08-16')) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------PhysicalProject +----------------------hashJoin[LEFT_OUTER_JOIN colocated] hashCondition=((ws.wp_web_page_sk = wr.wp_web_page_sk)) otherCondition=() +------------------------PhysicalProject +--------------------------hashAgg[GLOBAL] +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------hashAgg[LOCAL] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_web_page_sk = web_page.wp_web_page_sk)) otherCondition=() build RFs:RF9 wp_web_page_sk->[ws_web_page_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF8 d_date_sk->[ws_sold_date_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF8 RF9 +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_date <= '2000-09-15') and (date_dim.d_date >= '2000-08-16')) +--------------------------------------------PhysicalOlapScan[date_dim] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[web_page] +------------------------PhysicalProject +--------------------------hashAgg[GLOBAL] +----------------------------PhysicalDistribute[DistributionSpecHash] +------------------------------hashAgg[LOCAL] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_returns.wr_web_page_sk = web_page.wp_web_page_sk)) otherCondition=() build RFs:RF7 wp_web_page_sk->[wr_web_page_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_returns.wr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF6 d_date_sk->[wr_returned_date_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[web_returns] apply RFs: RF6 RF7 +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_date <= '2000-09-15') and (date_dim.d_date >= '2000-08-16')) +--------------------------------------------PhysicalOlapScan[date_dim] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[web_page] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query78.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query78.out new file mode 100644 index 00000000000000..8662cb5a1ad007 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query78.out @@ -0,0 +1,57 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_78 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------filter(((coalesce(ws_qty, 0) > 0) OR (coalesce(cs_qty, 0) > 0))) +------------hashJoin[LEFT_OUTER_JOIN colocated] hashCondition=((cs.cs_customer_sk = ss.ss_customer_sk) and (cs.cs_item_sk = ss.ss_item_sk) and (cs.cs_sold_year = ss.ss_sold_year)) otherCondition=() +--------------PhysicalProject +----------------hashJoin[LEFT_OUTER_JOIN colocated] hashCondition=((ws.ws_customer_sk = ss.ss_customer_sk) and (ws.ws_item_sk = ss.ss_item_sk) and (ws.ws_sold_year = ss.ss_sold_year)) otherCondition=() +------------------PhysicalProject +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ss_sold_date_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[LEFT_ANTI_JOIN shuffle] hashCondition=((store_returns.sr_ticket_number = store_sales.ss_ticket_number) and (store_sales.ss_item_sk = store_returns.sr_item_sk)) otherCondition=() +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF2 +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store_returns] +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_year = 2001)) +----------------------------------PhysicalOlapScan[date_dim] +------------------PhysicalProject +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[LEFT_ANTI_JOIN shuffle] hashCondition=((web_returns.wr_order_number = web_sales.ws_order_number) and (web_sales.ws_item_sk = web_returns.wr_item_sk)) otherCondition=() +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF1 +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[web_returns] +------------------------------PhysicalProject +--------------------------------filter((date_dim.d_year = 2001)) +----------------------------------PhysicalOlapScan[date_dim] +--------------PhysicalProject +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[cs_sold_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[LEFT_ANTI_JOIN shuffle] hashCondition=((catalog_returns.cr_order_number = catalog_sales.cs_order_number) and (catalog_sales.cs_item_sk = catalog_returns.cr_item_sk)) otherCondition=() +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[catalog_returns] +--------------------------PhysicalProject +----------------------------filter((date_dim.d_year = 2001)) +------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query79.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query79.out new file mode 100644 index 00000000000000..8684d60ad233dd --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query79.out @@ -0,0 +1,32 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_79 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashJoin[INNER_JOIN shuffle] hashCondition=((ms.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF3 c_customer_sk->[ss_customer_sk] +------------PhysicalProject +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF2 hd_demo_sk->[ss_hdemo_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF3 +--------------------------------PhysicalProject +----------------------------------filter((date_dim.d_dow = 1) and d_year IN (1998, 1999, 2000)) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------filter((store.s_number_employees <= 295) and (store.s_number_employees >= 200)) +--------------------------------PhysicalOlapScan[store] +------------------------PhysicalProject +--------------------------filter(((household_demographics.hd_dep_count = 0) OR (household_demographics.hd_vehicle_count > 3))) +----------------------------PhysicalOlapScan[household_demographics] +------------PhysicalProject +--------------PhysicalOlapScan[customer] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query8.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query8.out new file mode 100644 index 00000000000000..00f211d12927a2 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query8.out @@ -0,0 +1,43 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_8 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((expr_substring(s_zip, 1, 2) = expr_substring(ca_zip, 1, 2))) otherCondition=() +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 RF2 +--------------------------PhysicalProject +----------------------------filter((date_dim.d_qoy = 2) and (date_dim.d_year = 1998)) +------------------------------PhysicalOlapScan[date_dim] +----------------------PhysicalProject +------------------------PhysicalOlapScan[store] +------------------PhysicalProject +--------------------PhysicalIntersect +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------PhysicalProject +--------------------------filter((cnt > 10)) +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer_address.ca_address_sk = customer.c_current_addr_sk)) otherCondition=() build RFs:RF0 ca_address_sk->[c_current_addr_sk] +--------------------------------------PhysicalProject +----------------------------------------filter((customer.c_preferred_cust_flag = 'Y')) +------------------------------------------PhysicalOlapScan[customer] apply RFs: RF0 +--------------------------------------PhysicalProject +----------------------------------------filter(substring(ca_zip, 1, 5) IN ('10298', '10374', '10425', '11340', '11489', '11618', '11652', '11686', '11855', '11912', '12197', '12318', '12320', '12350', '13086', '13123', '13261', '13338', '13376', '13378', '13443', '13844', '13869', '13918', '14073', '14155', '14196', '14242', '14312', '14440', '14530', '14851', '15371', '15475', '15543', '15734', '15751', '15782', '15794', '16005', '16226', '16364', '16515', '16704', '16791', '16891', '17167', '17193', '17291', '17672', '17819', '17879', '17895', '18218', '18360', '18367', '18410', '18421', '18434', '18569', '18700', '18767', '18829', '18884', '19326', '19444', '19489', '19753', '19833', '19988', '20244', '20317', '20534', '20601', '20712', '21060', '21094', '21204', '21231', '21343', '21727', '21800', '21814', '22728', '22815', '22911', '23065', '23952', '24227', '24255', '24286', '24594', '24660', '24891', '24987', '25115', '25178', '25214', '25264', '25333', '25494', '25717', '25973', '26217', '26689', '27052', '27116', '27156', '27287', '27369', '27385', '27413', '27642', '27700', '28055', '28239', '28571', '28577', '28810', '29086', '29392', '29450', '29752', '29818', '30106', '30415', '30621', '31013', '31016', '31655', '31830', '32489', '32669', '32754', '32919', '32958', '32961', '33113', '33122', '33159', '33467', '33562', '33773', '33869', '34306', '34473', '34594', '34948', '34972', '35076', '35390', '35834', '35863', '35926', '36201', '36335', '36430', '36479', '37119', '37788', '37914', '38353', '38607', '38919', '39214', '39459', '39500', '39503', '40146', '40936', '40979', '41162', '41232', '41255', '41331', '41351', '41352', '41419', '41807', '41836', '41967', '42361', '43432', '43639', '43830', '43933', '44529', '45266', '45484', '45533', '45645', '45676', '45859', '46081', '46131', '46507', '47289', '47369', '47529', '47602', '47770', '48017', '48162', '48333', '48530', '48567', '49101', '49130', '49140', '49211', '49230', '49254', '49472', '50412', '50632', '50636', '50679', '50788', '51089', '51184', '51195', '51634', '51717', '51766', '51782', '51793', '51933', '52094', '52301', '52389', '52868', '53163', '53535', '53565', '54010', '54207', '54364', '54558', '54585', '55233', '55349', '56224', '56355', '56436', '56455', '56600', '56877', '57025', '57553', '57631', '57649', '57839', '58032', '58058', '58062', '58117', '58218', '58412', '58454', '58581', '59004', '59080', '59130', '59226', '59345', '59386', '59494', '59852', '60083', '60298', '60560', '60624', '60736', '61527', '61794', '61860', '61997', '62361', '62585', '62878', '63073', '63180', '63193', '63294', '63792', '63991', '64592', '65148', '65177', '65501', '66057', '66943', '67881', '67975', '67998', '68101', '68293', '68341', '68605', '68730', '68770', '68843', '68852', '68908', '69280', '69952', '69998', '70041', '70070', '70073', '70450', '71144', '71256', '71286', '71836', '71948', '71954', '71997', '72592', '72991', '73021', '73108', '73134', '73146', '73219', '73873', '74686', '75660', '75675', '75742', '75752', '77454', '77817', '78093', '78366', '79077', '79658', '80332', '80846', '81003', '81070', '81084', '81335', '81504', '81755', '81963', '82080', '82602', '82620', '83041', '83086', '83583', '83647', '83833', '83910', '83986', '84247', '84680', '84844', '84919', '85066', '85761', '86057', '86379', '86709', '88086', '88137', '88217', '89193', '89338', '90209', '90229', '90669', '91110', '91894', '92292', '92380', '92645', '92696', '93498', '94791', '94835', '94898', '95042', '95430', '95464', '95694', '96435', '96560', '97173', '97462', '98069', '98072', '98338', '98533', '98569', '98584', '98862', '99060', '99132')) +------------------------------------------PhysicalOlapScan[customer_address] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------PhysicalProject +--------------------------filter(substring(ca_zip, 1, 5) IN ('10298', '10374', '10425', '11340', '11489', '11618', '11652', '11686', '11855', '11912', '12197', '12318', '12320', '12350', '13086', '13123', '13261', '13338', '13376', '13378', '13443', '13844', '13869', '13918', '14073', '14155', '14196', '14242', '14312', '14440', '14530', '14851', '15371', '15475', '15543', '15734', '15751', '15782', '15794', '16005', '16226', '16364', '16515', '16704', '16791', '16891', '17167', '17193', '17291', '17672', '17819', '17879', '17895', '18218', '18360', '18367', '18410', '18421', '18434', '18569', '18700', '18767', '18829', '18884', '19326', '19444', '19489', '19753', '19833', '19988', '20244', '20317', '20534', '20601', '20712', '21060', '21094', '21204', '21231', '21343', '21727', '21800', '21814', '22728', '22815', '22911', '23065', '23952', '24227', '24255', '24286', '24594', '24660', '24891', '24987', '25115', '25178', '25214', '25264', '25333', '25494', '25717', '25973', '26217', '26689', '27052', '27116', '27156', '27287', '27369', '27385', '27413', '27642', '27700', '28055', '28239', '28571', '28577', '28810', '29086', '29392', '29450', '29752', '29818', '30106', '30415', '30621', '31013', '31016', '31655', '31830', '32489', '32669', '32754', '32919', '32958', '32961', '33113', '33122', '33159', '33467', '33562', '33773', '33869', '34306', '34473', '34594', '34948', '34972', '35076', '35390', '35834', '35863', '35926', '36201', '36335', '36430', '36479', '37119', '37788', '37914', '38353', '38607', '38919', '39214', '39459', '39500', '39503', '40146', '40936', '40979', '41162', '41232', '41255', '41331', '41351', '41352', '41419', '41807', '41836', '41967', '42361', '43432', '43639', '43830', '43933', '44529', '45266', '45484', '45533', '45645', '45676', '45859', '46081', '46131', '46507', '47289', '47369', '47529', '47602', '47770', '48017', '48162', '48333', '48530', '48567', '49101', '49130', '49140', '49211', '49230', '49254', '49472', '50412', '50632', '50636', '50679', '50788', '51089', '51184', '51195', '51634', '51717', '51766', '51782', '51793', '51933', '52094', '52301', '52389', '52868', '53163', '53535', '53565', '54010', '54207', '54364', '54558', '54585', '55233', '55349', '56224', '56355', '56436', '56455', '56600', '56877', '57025', '57553', '57631', '57649', '57839', '58032', '58058', '58062', '58117', '58218', '58412', '58454', '58581', '59004', '59080', '59130', '59226', '59345', '59386', '59494', '59852', '60083', '60298', '60560', '60624', '60736', '61527', '61794', '61860', '61997', '62361', '62585', '62878', '63073', '63180', '63193', '63294', '63792', '63991', '64592', '65148', '65177', '65501', '66057', '66943', '67881', '67975', '67998', '68101', '68293', '68341', '68605', '68730', '68770', '68843', '68852', '68908', '69280', '69952', '69998', '70041', '70070', '70073', '70450', '71144', '71256', '71286', '71836', '71948', '71954', '71997', '72592', '72991', '73021', '73108', '73134', '73146', '73219', '73873', '74686', '75660', '75675', '75742', '75752', '77454', '77817', '78093', '78366', '79077', '79658', '80332', '80846', '81003', '81070', '81084', '81335', '81504', '81755', '81963', '82080', '82602', '82620', '83041', '83086', '83583', '83647', '83833', '83910', '83986', '84247', '84680', '84844', '84919', '85066', '85761', '86057', '86379', '86709', '88086', '88137', '88217', '89193', '89338', '90209', '90229', '90669', '91110', '91894', '92292', '92380', '92645', '92696', '93498', '94791', '94835', '94898', '95042', '95430', '95464', '95694', '96435', '96560', '97173', '97462', '98069', '98072', '98338', '98533', '98569', '98584', '98862', '99060', '99132')) +----------------------------PhysicalOlapScan[customer_address] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query80.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query80.out new file mode 100644 index 00000000000000..8805cfd6e7362c --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query80.out @@ -0,0 +1,100 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_80 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalRepeat +------------------PhysicalUnion +--------------------PhysicalProject +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------hashJoin[LEFT_OUTER_JOIN shuffle] hashCondition=((store_sales.ss_item_sk = store_returns.sr_item_sk) and (store_sales.ss_ticket_number = store_returns.sr_ticket_number)) otherCondition=() +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_promo_sk = promotion.p_promo_sk)) otherCondition=() build RFs:RF3 p_promo_sk->[ss_promo_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ss_item_sk] +----------------------------------------PhysicalProject +------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF1 s_store_sk->[ss_store_sk] +--------------------------------------------PhysicalProject +----------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ss_sold_date_sk] +------------------------------------------------PhysicalProject +--------------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 RF3 +------------------------------------------------PhysicalProject +--------------------------------------------------filter((date_dim.d_date <= '2002-09-05') and (date_dim.d_date >= '2002-08-06')) +----------------------------------------------------PhysicalOlapScan[date_dim] +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[store] +----------------------------------------PhysicalProject +------------------------------------------filter((item.i_current_price > 50.00)) +--------------------------------------------PhysicalOlapScan[item] +------------------------------------PhysicalProject +--------------------------------------filter((promotion.p_channel_tv = 'N')) +----------------------------------------PhysicalOlapScan[promotion] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_returns] +--------------------PhysicalProject +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_promo_sk = promotion.p_promo_sk)) otherCondition=() build RFs:RF7 p_promo_sk->[cs_promo_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF6 i_item_sk->[cs_item_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[cs_sold_date_sk] +----------------------------------------PhysicalProject +------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_catalog_page_sk = catalog_page.cp_catalog_page_sk)) otherCondition=() build RFs:RF4 cp_catalog_page_sk->[cs_catalog_page_sk] +--------------------------------------------PhysicalProject +----------------------------------------------hashJoin[LEFT_OUTER_JOIN shuffle] hashCondition=((catalog_sales.cs_item_sk = catalog_returns.cr_item_sk) and (catalog_sales.cs_order_number = catalog_returns.cr_order_number)) otherCondition=() +------------------------------------------------PhysicalProject +--------------------------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF4 RF5 RF6 RF7 +------------------------------------------------PhysicalProject +--------------------------------------------------PhysicalOlapScan[catalog_returns] +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[catalog_page] +----------------------------------------PhysicalProject +------------------------------------------filter((date_dim.d_date <= '2002-09-05') and (date_dim.d_date >= '2002-08-06')) +--------------------------------------------PhysicalOlapScan[date_dim] +------------------------------------PhysicalProject +--------------------------------------filter((item.i_current_price > 50.00)) +----------------------------------------PhysicalOlapScan[item] +--------------------------------PhysicalProject +----------------------------------filter((promotion.p_channel_tv = 'N')) +------------------------------------PhysicalOlapScan[promotion] +--------------------PhysicalProject +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_promo_sk = promotion.p_promo_sk)) otherCondition=() build RFs:RF11 p_promo_sk->[ws_promo_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF10 i_item_sk->[ws_item_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[LEFT_OUTER_JOIN shuffle] hashCondition=((web_sales.ws_item_sk = web_returns.wr_item_sk) and (web_sales.ws_order_number = web_returns.wr_order_number)) otherCondition=() +----------------------------------------PhysicalProject +------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF9 web_site_sk->[ws_web_site_sk] +--------------------------------------------PhysicalProject +----------------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF8 d_date_sk->[ws_sold_date_sk] +------------------------------------------------PhysicalProject +--------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF8 RF9 RF10 RF11 +------------------------------------------------PhysicalProject +--------------------------------------------------filter((date_dim.d_date <= '2002-09-05') and (date_dim.d_date >= '2002-08-06')) +----------------------------------------------------PhysicalOlapScan[date_dim] +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[web_site] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[web_returns] +------------------------------------PhysicalProject +--------------------------------------filter((item.i_current_price > 50.00)) +----------------------------------------PhysicalOlapScan[item] +--------------------------------PhysicalProject +----------------------------------filter((promotion.p_channel_tv = 'N')) +------------------------------------PhysicalOlapScan[promotion] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query81.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query81.out new file mode 100644 index 00000000000000..da27f4206dda1a --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query81.out @@ -0,0 +1,41 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_81 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecHash] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_returns.cr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[cr_returned_date_sk] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN shuffle] hashCondition=((catalog_returns.cr_returning_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF0 ca_address_sk->[cr_returning_addr_sk] +--------------------PhysicalProject +----------------------PhysicalOlapScan[catalog_returns] apply RFs: RF0 RF1 +--------------------PhysicalProject +----------------------PhysicalOlapScan[customer_address] +----------------PhysicalProject +------------------filter((date_dim.d_year = 1998)) +--------------------PhysicalOlapScan[date_dim] +--PhysicalResultSink +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_address.ca_address_sk = customer.c_current_addr_sk)) otherCondition=() build RFs:RF4 ca_address_sk->[c_current_addr_sk] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN shuffleBucket] hashCondition=((ctr1.ctr_state = ctr2.ctr_state)) otherCondition=((cast(ctr_total_return as DOUBLE) > cast((avg(cast(ctr_total_return as DECIMALV3(38, 4))) * 1.2) as DOUBLE))) build RFs:RF3 ctr_state->[ctr_state] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((ctr1.ctr_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[ctr_customer_sk] +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF2 RF3 +----------------------PhysicalProject +------------------------PhysicalOlapScan[customer] apply RFs: RF4 +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalDistribute[DistributionSpecExecutionAny] +--------------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +--------------PhysicalProject +----------------filter((customer_address.ca_state = 'TX')) +------------------PhysicalOlapScan[customer_address] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query82.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query82.out new file mode 100644 index 00000000000000..1c36a3b82fb29e --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query82.out @@ -0,0 +1,27 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_82 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[ss_item_sk] +------------------PhysicalProject +--------------------PhysicalOlapScan[store_sales] apply RFs: RF2 +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = inventory.inv_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[inv_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((inventory.inv_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[inv_item_sk] +--------------------------PhysicalProject +----------------------------filter((inventory.inv_quantity_on_hand <= 500) and (inventory.inv_quantity_on_hand >= 100)) +------------------------------PhysicalOlapScan[inventory] apply RFs: RF0 RF1 +--------------------------PhysicalProject +----------------------------filter((item.i_current_price <= 79.00) and (item.i_current_price >= 49.00) and i_manufact_id IN (17, 292, 675, 80)) +------------------------------PhysicalOlapScan[item] +----------------------PhysicalProject +------------------------filter((date_dim.d_date <= '2001-03-29') and (date_dim.d_date >= '2001-01-28')) +--------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query83.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query83.out new file mode 100644 index 00000000000000..e5be6405f585a7 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query83.out @@ -0,0 +1,80 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_83 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashJoin[INNER_JOIN colocated] hashCondition=((sr_items.item_id = wr_items.item_id)) otherCondition=() build RFs:RF13 item_id->[i_item_id,i_item_id] +------------PhysicalProject +--------------hashJoin[INNER_JOIN colocated] hashCondition=((sr_items.item_id = cr_items.item_id)) otherCondition=() build RFs:RF12 item_id->[i_item_id] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF11 d_date_sk->[sr_returned_date_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF10 i_item_sk->[sr_item_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_returns] apply RFs: RF10 RF11 +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[item] apply RFs: RF12 RF13 +----------------------------PhysicalProject +------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build RFs:RF9 d_date->[d_date] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[date_dim] apply RFs: RF9 +--------------------------------PhysicalProject +----------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((date_dim.d_week_seq = date_dim.d_week_seq)) otherCondition=() build RFs:RF8 d_week_seq->[d_week_seq] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[date_dim] apply RFs: RF8 +------------------------------------PhysicalProject +--------------------------------------filter(d_date IN ('2000-06-17', '2000-08-22', '2000-11-17')) +----------------------------------------PhysicalOlapScan[date_dim] +----------------PhysicalProject +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecHash] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_returns.cr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF7 d_date_sk->[cr_returned_date_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_returns.cr_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF6 i_item_sk->[cr_item_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[catalog_returns] apply RFs: RF6 RF7 +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[item] apply RFs: RF13 +----------------------------PhysicalProject +------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build RFs:RF5 d_date->[d_date] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[date_dim] apply RFs: RF5 +--------------------------------PhysicalProject +----------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] 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 +------------------------------------PhysicalProject +--------------------------------------filter(d_date IN ('2000-06-17', '2000-08-22', '2000-11-17')) +----------------------------------------PhysicalOlapScan[date_dim] +------------PhysicalProject +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecHash] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_returns.wr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[wr_returned_date_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_returns.wr_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF2 i_item_sk->[wr_item_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_returns] apply RFs: RF2 RF3 +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[item] +------------------------PhysicalProject +--------------------------hashJoin[LEFT_SEMI_JOIN broadcast] hashCondition=((date_dim.d_date = date_dim.d_date)) otherCondition=() build RFs:RF1 d_date->[d_date] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[date_dim] apply RFs: RF1 +----------------------------PhysicalProject +------------------------------hashJoin[LEFT_SEMI_JOIN broadcast] 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 +--------------------------------PhysicalProject +----------------------------------filter(d_date IN ('2000-06-17', '2000-08-22', '2000-11-17')) +------------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query84.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query84.out new file mode 100644 index 00000000000000..031ed47a26e9ea --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query84.out @@ -0,0 +1,31 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_84 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_cdemo_sk = customer_demographics.cd_demo_sk)) otherCondition=() build RFs:RF4 cd_demo_sk->[sr_cdemo_sk] +------------PhysicalProject +--------------PhysicalOlapScan[store_returns] apply RFs: RF4 +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((income_band.ib_income_band_sk = household_demographics.hd_income_band_sk)) otherCondition=() build RFs:RF3 ib_income_band_sk->[hd_income_band_sk] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((household_demographics.hd_demo_sk = customer.c_current_hdemo_sk)) otherCondition=() build RFs:RF2 hd_demo_sk->[c_current_hdemo_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_demographics.cd_demo_sk = customer.c_current_cdemo_sk)) otherCondition=() build RFs:RF1 cd_demo_sk->[c_current_cdemo_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((customer.c_current_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF0 ca_address_sk->[c_current_addr_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[customer] apply RFs: RF0 RF1 RF2 +----------------------------PhysicalProject +------------------------------filter((customer_address.ca_city = 'Hopewell')) +--------------------------------PhysicalOlapScan[customer_address] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[customer_demographics] +--------------------PhysicalProject +----------------------PhysicalOlapScan[household_demographics] apply RFs: RF3 +----------------PhysicalProject +------------------filter((cast(ib_upper_bound as BIGINT) <= 87855) and (income_band.ib_lower_bound >= 37855)) +--------------------PhysicalOlapScan[income_band] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query85.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query85.out new file mode 100644 index 00000000000000..74754368bc4f59 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query85.out @@ -0,0 +1,46 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_85 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((reason.r_reason_sk = web_returns.wr_reason_sk)) otherCondition=() build RFs:RF9 r_reason_sk->[wr_reason_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF8 d_date_sk->[ws_sold_date_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_address.ca_address_sk = web_returns.wr_refunded_addr_sk)) otherCondition=((((ca_state IN ('CA', 'TX', 'VA') AND ((web_sales.ws_net_profit >= 100.00) AND (web_sales.ws_net_profit <= 200.00))) OR (ca_state IN ('AR', 'MO', 'NE') AND ((web_sales.ws_net_profit >= 150.00) AND (web_sales.ws_net_profit <= 300.00)))) OR (ca_state IN ('IA', 'MS', 'WA') AND ((web_sales.ws_net_profit >= 50.00) AND (web_sales.ws_net_profit <= 250.00))))) build RFs:RF7 ca_address_sk->[wr_refunded_addr_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((cd1.cd_education_status = cd2.cd_education_status) and (cd1.cd_marital_status = cd2.cd_marital_status) and (cd2.cd_demo_sk = web_returns.wr_returning_cdemo_sk)) otherCondition=() build RFs:RF4 cd_demo_sk->[wr_returning_cdemo_sk];RF5 cd_marital_status->[cd_marital_status];RF6 cd_education_status->[cd_education_status] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((cd1.cd_demo_sk = web_returns.wr_refunded_cdemo_sk)) otherCondition=((((((cd1.cd_marital_status = 'M') AND (cd1.cd_education_status = '4 yr Degree')) AND ((web_sales.ws_sales_price >= 100.00) AND (web_sales.ws_sales_price <= 150.00))) OR (((cd1.cd_marital_status = 'S') AND (cd1.cd_education_status = 'College')) AND ((web_sales.ws_sales_price >= 50.00) AND (web_sales.ws_sales_price <= 100.00)))) OR (((cd1.cd_marital_status = 'D') AND (cd1.cd_education_status = 'Secondary')) AND ((web_sales.ws_sales_price >= 150.00) AND (web_sales.ws_sales_price <= 200.00))))) build RFs:RF3 cd_demo_sk->[wr_refunded_cdemo_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_web_page_sk = web_page.wp_web_page_sk)) otherCondition=() build RFs:RF2 wp_web_page_sk->[ws_web_page_sk] +----------------------------------------PhysicalProject +------------------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((web_sales.ws_item_sk = web_returns.wr_item_sk) and (web_sales.ws_order_number = web_returns.wr_order_number)) otherCondition=() build RFs:RF0 ws_item_sk->[wr_item_sk];RF1 ws_order_number->[wr_order_number] +--------------------------------------------PhysicalProject +----------------------------------------------PhysicalOlapScan[web_returns] apply RFs: RF0 RF1 RF3 RF4 RF7 RF9 +--------------------------------------------PhysicalProject +----------------------------------------------filter((web_sales.ws_net_profit <= 300.00) and (web_sales.ws_net_profit >= 50.00) and (web_sales.ws_sales_price <= 200.00) and (web_sales.ws_sales_price >= 50.00)) +------------------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF8 +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[web_page] +------------------------------------PhysicalProject +--------------------------------------filter(((((cd1.cd_marital_status = 'M') AND (cd1.cd_education_status = '4 yr Degree')) OR ((cd1.cd_marital_status = 'S') AND (cd1.cd_education_status = 'College'))) OR ((cd1.cd_marital_status = 'D') AND (cd1.cd_education_status = 'Secondary'))) and cd_education_status IN ('4 yr Degree', 'College', 'Secondary') and cd_marital_status IN ('D', 'M', 'S')) +----------------------------------------PhysicalOlapScan[customer_demographics] apply RFs: RF5 RF6 +--------------------------------PhysicalProject +----------------------------------filter(cd_education_status IN ('4 yr Degree', 'College', 'Secondary') and cd_marital_status IN ('D', 'M', 'S')) +------------------------------------PhysicalOlapScan[customer_demographics] +----------------------------PhysicalProject +------------------------------filter((customer_address.ca_country = 'United States') and ca_state IN ('AR', 'CA', 'IA', 'MO', 'MS', 'NE', 'TX', 'VA', 'WA')) +--------------------------------PhysicalOlapScan[customer_address] +------------------------PhysicalProject +--------------------------filter((date_dim.d_year = 2001)) +----------------------------PhysicalOlapScan[date_dim] +--------------------PhysicalProject +----------------------PhysicalOlapScan[reason] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query86.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query86.out new file mode 100644 index 00000000000000..5173961b93d094 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query86.out @@ -0,0 +1,28 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_86 -- +PhysicalResultSink +--PhysicalProject +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------PhysicalWindow +--------------PhysicalQuickSort[LOCAL_SORT] +----------------PhysicalDistribute[DistributionSpecHash] +------------------PhysicalProject +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecHash] +------------------------hashAgg[LOCAL] +--------------------------PhysicalRepeat +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((d1.d_date_sk = web_sales.ws_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = web_sales.ws_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ws_item_sk] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF1 +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[item] +--------------------------------PhysicalProject +----------------------------------filter((d1.d_month_seq <= 1226) and (d1.d_month_seq >= 1215)) +------------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query87.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query87.out new file mode 100644 index 00000000000000..995578ba1f269c --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query87.out @@ -0,0 +1,51 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_87 -- +PhysicalResultSink +--hashAgg[GLOBAL] +----PhysicalDistribute[DistributionSpecGather] +------hashAgg[LOCAL] +--------PhysicalProject +----------PhysicalExcept +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_sales.ss_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF0 c_customer_sk->[ss_customer_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[customer] +----------------------PhysicalProject +------------------------filter((date_dim.d_month_seq <= 1232) and (date_dim.d_month_seq >= 1221)) +--------------------------PhysicalOlapScan[date_dim] +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cs_sold_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((catalog_sales.cs_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF2 c_customer_sk->[cs_bill_customer_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF2 RF3 +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[customer] +----------------------PhysicalProject +------------------------filter((date_dim.d_month_seq <= 1232) and (date_dim.d_month_seq >= 1221)) +--------------------------PhysicalOlapScan[date_dim] +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF5 d_date_sk->[ws_sold_date_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((web_sales.ws_bill_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF4 c_customer_sk->[ws_bill_customer_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[web_sales] apply RFs: RF4 RF5 +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[customer] +----------------------PhysicalProject +------------------------filter((date_dim.d_month_seq <= 1232) and (date_dim.d_month_seq >= 1221)) +--------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query88.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query88.out new file mode 100644 index 00000000000000..fa1d26b12e7fa8 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query88.out @@ -0,0 +1,171 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_88 -- +PhysicalResultSink +--NestedLoopJoin[CROSS_JOIN] +----NestedLoopJoin[CROSS_JOIN] +------NestedLoopJoin[CROSS_JOIN] +--------NestedLoopJoin[CROSS_JOIN] +----------NestedLoopJoin[CROSS_JOIN] +------------NestedLoopJoin[CROSS_JOIN] +--------------NestedLoopJoin[CROSS_JOIN] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecGather] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF23 s_store_sk->[ss_store_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF22 t_time_sk->[ss_sold_time_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF21 hd_demo_sk->[ss_hdemo_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF21 RF22 RF23 +----------------------------------PhysicalProject +------------------------------------filter(((((household_demographics.hd_dep_count = 2) AND (household_demographics.hd_vehicle_count <= 4)) OR ((household_demographics.hd_dep_count = 4) AND (household_demographics.hd_vehicle_count <= 6))) OR ((household_demographics.hd_dep_count = 3) AND (household_demographics.hd_vehicle_count <= 5))) and hd_dep_count IN (2, 3, 4)) +--------------------------------------PhysicalOlapScan[household_demographics] +------------------------------PhysicalProject +--------------------------------filter((time_dim.t_hour = 8) and (time_dim.t_minute >= 30)) +----------------------------------PhysicalOlapScan[time_dim] +--------------------------PhysicalProject +----------------------------filter((store.s_store_name = 'ese')) +------------------------------PhysicalOlapScan[store] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecGather] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF20 s_store_sk->[ss_store_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF19 t_time_sk->[ss_sold_time_sk] +------------------------------PhysicalProject +--------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF18 hd_demo_sk->[ss_hdemo_sk] +----------------------------------PhysicalProject +------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF18 RF19 RF20 +----------------------------------PhysicalProject +------------------------------------filter(((((household_demographics.hd_dep_count = 2) AND (household_demographics.hd_vehicle_count <= 4)) OR ((household_demographics.hd_dep_count = 4) AND (household_demographics.hd_vehicle_count <= 6))) OR ((household_demographics.hd_dep_count = 3) AND (household_demographics.hd_vehicle_count <= 5))) and hd_dep_count IN (2, 3, 4)) +--------------------------------------PhysicalOlapScan[household_demographics] +------------------------------PhysicalProject +--------------------------------filter((time_dim.t_hour = 9) and (time_dim.t_minute < 30)) +----------------------------------PhysicalOlapScan[time_dim] +--------------------------PhysicalProject +----------------------------filter((store.s_store_name = 'ese')) +------------------------------PhysicalOlapScan[store] +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecGather] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF17 s_store_sk->[ss_store_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF16 t_time_sk->[ss_sold_time_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF15 hd_demo_sk->[ss_hdemo_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store_sales] apply RFs: RF15 RF16 RF17 +--------------------------------PhysicalProject +----------------------------------filter(((((household_demographics.hd_dep_count = 2) AND (household_demographics.hd_vehicle_count <= 4)) OR ((household_demographics.hd_dep_count = 4) AND (household_demographics.hd_vehicle_count <= 6))) OR ((household_demographics.hd_dep_count = 3) AND (household_demographics.hd_vehicle_count <= 5))) and hd_dep_count IN (2, 3, 4)) +------------------------------------PhysicalOlapScan[household_demographics] +----------------------------PhysicalProject +------------------------------filter((time_dim.t_hour = 9) and (time_dim.t_minute >= 30)) +--------------------------------PhysicalOlapScan[time_dim] +------------------------PhysicalProject +--------------------------filter((store.s_store_name = 'ese')) +----------------------------PhysicalOlapScan[store] +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecGather] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF14 s_store_sk->[ss_store_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF13 t_time_sk->[ss_sold_time_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF12 hd_demo_sk->[ss_hdemo_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF12 RF13 RF14 +------------------------------PhysicalProject +--------------------------------filter(((((household_demographics.hd_dep_count = 2) AND (household_demographics.hd_vehicle_count <= 4)) OR ((household_demographics.hd_dep_count = 4) AND (household_demographics.hd_vehicle_count <= 6))) OR ((household_demographics.hd_dep_count = 3) AND (household_demographics.hd_vehicle_count <= 5))) and hd_dep_count IN (2, 3, 4)) +----------------------------------PhysicalOlapScan[household_demographics] +--------------------------PhysicalProject +----------------------------filter((time_dim.t_hour = 10) and (time_dim.t_minute < 30)) +------------------------------PhysicalOlapScan[time_dim] +----------------------PhysicalProject +------------------------filter((store.s_store_name = 'ese')) +--------------------------PhysicalOlapScan[store] +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecGather] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF11 s_store_sk->[ss_store_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF10 t_time_sk->[ss_sold_time_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF9 hd_demo_sk->[ss_hdemo_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[store_sales] apply RFs: RF9 RF10 RF11 +----------------------------PhysicalProject +------------------------------filter(((((household_demographics.hd_dep_count = 2) AND (household_demographics.hd_vehicle_count <= 4)) OR ((household_demographics.hd_dep_count = 4) AND (household_demographics.hd_vehicle_count <= 6))) OR ((household_demographics.hd_dep_count = 3) AND (household_demographics.hd_vehicle_count <= 5))) and hd_dep_count IN (2, 3, 4)) +--------------------------------PhysicalOlapScan[household_demographics] +------------------------PhysicalProject +--------------------------filter((time_dim.t_hour = 10) and (time_dim.t_minute >= 30)) +----------------------------PhysicalOlapScan[time_dim] +--------------------PhysicalProject +----------------------filter((store.s_store_name = 'ese')) +------------------------PhysicalOlapScan[store] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecGather] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF8 s_store_sk->[ss_store_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF7 t_time_sk->[ss_sold_time_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF6 hd_demo_sk->[ss_hdemo_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[store_sales] apply RFs: RF6 RF7 RF8 +--------------------------PhysicalProject +----------------------------filter(((((household_demographics.hd_dep_count = 2) AND (household_demographics.hd_vehicle_count <= 4)) OR ((household_demographics.hd_dep_count = 4) AND (household_demographics.hd_vehicle_count <= 6))) OR ((household_demographics.hd_dep_count = 3) AND (household_demographics.hd_vehicle_count <= 5))) and hd_dep_count IN (2, 3, 4)) +------------------------------PhysicalOlapScan[household_demographics] +----------------------PhysicalProject +------------------------filter((time_dim.t_hour = 11) and (time_dim.t_minute < 30)) +--------------------------PhysicalOlapScan[time_dim] +------------------PhysicalProject +--------------------filter((store.s_store_name = 'ese')) +----------------------PhysicalOlapScan[store] +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecGather] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF5 s_store_sk->[ss_store_sk] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF4 t_time_sk->[ss_sold_time_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF3 hd_demo_sk->[ss_hdemo_sk] +------------------------PhysicalProject +--------------------------PhysicalOlapScan[store_sales] apply RFs: RF3 RF4 RF5 +------------------------PhysicalProject +--------------------------filter(((((household_demographics.hd_dep_count = 2) AND (household_demographics.hd_vehicle_count <= 4)) OR ((household_demographics.hd_dep_count = 4) AND (household_demographics.hd_vehicle_count <= 6))) OR ((household_demographics.hd_dep_count = 3) AND (household_demographics.hd_vehicle_count <= 5))) and hd_dep_count IN (2, 3, 4)) +----------------------------PhysicalOlapScan[household_demographics] +--------------------PhysicalProject +----------------------filter((time_dim.t_hour = 11) and (time_dim.t_minute >= 30)) +------------------------PhysicalOlapScan[time_dim] +----------------PhysicalProject +------------------filter((store.s_store_name = 'ese')) +--------------------PhysicalOlapScan[store] +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecGather] +--------hashAgg[LOCAL] +----------PhysicalProject +------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF1 t_time_sk->[ss_sold_time_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF0 hd_demo_sk->[ss_hdemo_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +----------------------PhysicalProject +------------------------filter(((((household_demographics.hd_dep_count = 2) AND (household_demographics.hd_vehicle_count <= 4)) OR ((household_demographics.hd_dep_count = 4) AND (household_demographics.hd_vehicle_count <= 6))) OR ((household_demographics.hd_dep_count = 3) AND (household_demographics.hd_vehicle_count <= 5))) and hd_dep_count IN (2, 3, 4)) +--------------------------PhysicalOlapScan[household_demographics] +------------------PhysicalProject +--------------------filter((time_dim.t_hour = 12) and (time_dim.t_minute < 30)) +----------------------PhysicalOlapScan[time_dim] +--------------PhysicalProject +----------------filter((store.s_store_name = 'ese')) +------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query89.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query89.out new file mode 100644 index 00000000000000..a57dfec0fc83fc --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query89.out @@ -0,0 +1,33 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_89 -- +PhysicalResultSink +--PhysicalProject +----PhysicalTopN[MERGE_SORT] +------PhysicalDistribute[DistributionSpecGather] +--------PhysicalTopN[LOCAL_SORT] +----------PhysicalProject +------------filter((if(( not (avg_monthly_sales = 0.0000)), (cast(abs((sum_sales - cast(avg_monthly_sales as DECIMALV3(38, 2)))) as DECIMALV3(38, 10)) / avg_monthly_sales), NULL) > 0.100000)) +--------------PhysicalWindow +----------------PhysicalQuickSort[LOCAL_SORT] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------PhysicalProject +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecHash] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +----------------------------------------PhysicalProject +------------------------------------------filter(((i_category IN ('Books', 'Home', 'Music') AND i_class IN ('classical', 'fiction', 'glassware')) OR (i_category IN ('Jewelry', 'Sports', 'Women') AND i_class IN ('baseball', 'dresses', 'semi-precious'))) and i_category IN ('Books', 'Home', 'Jewelry', 'Music', 'Sports', 'Women') and i_class IN ('baseball', 'classical', 'dresses', 'fiction', 'glassware', 'semi-precious')) +--------------------------------------------PhysicalOlapScan[item] +------------------------------------PhysicalProject +--------------------------------------filter((date_dim.d_year = 2000)) +----------------------------------------PhysicalOlapScan[date_dim] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query9.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query9.out new file mode 100644 index 00000000000000..c6d5dd064ce48b --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query9.out @@ -0,0 +1,114 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_9 -- +PhysicalResultSink +--PhysicalProject +----NestedLoopJoin[CROSS_JOIN] +------NestedLoopJoin[CROSS_JOIN] +--------NestedLoopJoin[CROSS_JOIN] +----------NestedLoopJoin[CROSS_JOIN] +------------NestedLoopJoin[CROSS_JOIN] +--------------NestedLoopJoin[CROSS_JOIN] +----------------NestedLoopJoin[CROSS_JOIN] +------------------NestedLoopJoin[CROSS_JOIN] +--------------------NestedLoopJoin[CROSS_JOIN] +----------------------NestedLoopJoin[CROSS_JOIN] +------------------------NestedLoopJoin[CROSS_JOIN] +--------------------------NestedLoopJoin[CROSS_JOIN] +----------------------------NestedLoopJoin[CROSS_JOIN] +------------------------------NestedLoopJoin[CROSS_JOIN] +--------------------------------PhysicalProject +----------------------------------NestedLoopJoin[CROSS_JOIN] +------------------------------------PhysicalProject +--------------------------------------filter((reason.r_reason_sk = 1)) +----------------------------------------PhysicalOlapScan[reason] +------------------------------------hashAgg[GLOBAL] +--------------------------------------PhysicalDistribute[DistributionSpecGather] +----------------------------------------hashAgg[LOCAL] +------------------------------------------PhysicalProject +--------------------------------------------filter((store_sales.ss_quantity <= 20) and (store_sales.ss_quantity >= 1)) +----------------------------------------------PhysicalOlapScan[store_sales] +--------------------------------hashAgg[GLOBAL] +----------------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------------hashAgg[LOCAL] +--------------------------------------PhysicalProject +----------------------------------------filter((store_sales.ss_quantity <= 20) and (store_sales.ss_quantity >= 1)) +------------------------------------------PhysicalOlapScan[store_sales] +------------------------------hashAgg[GLOBAL] +--------------------------------PhysicalDistribute[DistributionSpecGather] +----------------------------------hashAgg[LOCAL] +------------------------------------PhysicalProject +--------------------------------------filter((store_sales.ss_quantity <= 20) and (store_sales.ss_quantity >= 1)) +----------------------------------------PhysicalOlapScan[store_sales] +----------------------------hashAgg[GLOBAL] +------------------------------PhysicalDistribute[DistributionSpecGather] +--------------------------------hashAgg[LOCAL] +----------------------------------PhysicalProject +------------------------------------filter((store_sales.ss_quantity <= 40) and (store_sales.ss_quantity >= 21)) +--------------------------------------PhysicalOlapScan[store_sales] +--------------------------hashAgg[GLOBAL] +----------------------------PhysicalDistribute[DistributionSpecGather] +------------------------------hashAgg[LOCAL] +--------------------------------PhysicalProject +----------------------------------filter((store_sales.ss_quantity <= 40) and (store_sales.ss_quantity >= 21)) +------------------------------------PhysicalOlapScan[store_sales] +------------------------hashAgg[GLOBAL] +--------------------------PhysicalDistribute[DistributionSpecGather] +----------------------------hashAgg[LOCAL] +------------------------------PhysicalProject +--------------------------------filter((store_sales.ss_quantity <= 40) and (store_sales.ss_quantity >= 21)) +----------------------------------PhysicalOlapScan[store_sales] +----------------------hashAgg[GLOBAL] +------------------------PhysicalDistribute[DistributionSpecGather] +--------------------------hashAgg[LOCAL] +----------------------------PhysicalProject +------------------------------filter((store_sales.ss_quantity <= 60) and (store_sales.ss_quantity >= 41)) +--------------------------------PhysicalOlapScan[store_sales] +--------------------hashAgg[GLOBAL] +----------------------PhysicalDistribute[DistributionSpecGather] +------------------------hashAgg[LOCAL] +--------------------------PhysicalProject +----------------------------filter((store_sales.ss_quantity <= 60) and (store_sales.ss_quantity >= 41)) +------------------------------PhysicalOlapScan[store_sales] +------------------hashAgg[GLOBAL] +--------------------PhysicalDistribute[DistributionSpecGather] +----------------------hashAgg[LOCAL] +------------------------PhysicalProject +--------------------------filter((store_sales.ss_quantity <= 60) and (store_sales.ss_quantity >= 41)) +----------------------------PhysicalOlapScan[store_sales] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecGather] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------filter((store_sales.ss_quantity <= 80) and (store_sales.ss_quantity >= 61)) +--------------------------PhysicalOlapScan[store_sales] +--------------hashAgg[GLOBAL] +----------------PhysicalDistribute[DistributionSpecGather] +------------------hashAgg[LOCAL] +--------------------PhysicalProject +----------------------filter((store_sales.ss_quantity <= 80) and (store_sales.ss_quantity >= 61)) +------------------------PhysicalOlapScan[store_sales] +------------hashAgg[GLOBAL] +--------------PhysicalDistribute[DistributionSpecGather] +----------------hashAgg[LOCAL] +------------------PhysicalProject +--------------------filter((store_sales.ss_quantity <= 80) and (store_sales.ss_quantity >= 61)) +----------------------PhysicalOlapScan[store_sales] +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecGather] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------filter((store_sales.ss_quantity <= 100) and (store_sales.ss_quantity >= 81)) +--------------------PhysicalOlapScan[store_sales] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecGather] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------filter((store_sales.ss_quantity <= 100) and (store_sales.ss_quantity >= 81)) +------------------PhysicalOlapScan[store_sales] +------hashAgg[GLOBAL] +--------PhysicalDistribute[DistributionSpecGather] +----------hashAgg[LOCAL] +------------PhysicalProject +--------------filter((store_sales.ss_quantity <= 100) and (store_sales.ss_quantity >= 81)) +----------------PhysicalOlapScan[store_sales] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query90.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query90.out new file mode 100644 index 00000000000000..798742dbb31a22 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query90.out @@ -0,0 +1,47 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_90 -- +PhysicalResultSink +--PhysicalTopN[GATHER_SORT] +----PhysicalProject +------NestedLoopJoin[CROSS_JOIN] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecGather] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_web_page_sk = web_page.wp_web_page_sk)) otherCondition=() build RFs:RF5 wp_web_page_sk->[ws_web_page_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF4 t_time_sk->[ws_sold_time_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_ship_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF3 hd_demo_sk->[ws_ship_hdemo_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[web_sales] apply RFs: RF3 RF4 RF5 +--------------------------PhysicalProject +----------------------------filter((household_demographics.hd_dep_count = 3)) +------------------------------PhysicalOlapScan[household_demographics] +----------------------PhysicalProject +------------------------filter((time_dim.t_hour <= 10) and (time_dim.t_hour >= 9)) +--------------------------PhysicalOlapScan[time_dim] +------------------PhysicalProject +--------------------filter((web_page.wp_char_count <= 5200) and (web_page.wp_char_count >= 5000)) +----------------------PhysicalOlapScan[web_page] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecGather] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_web_page_sk = web_page.wp_web_page_sk)) otherCondition=() build RFs:RF2 wp_web_page_sk->[ws_web_page_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF1 t_time_sk->[ws_sold_time_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((web_sales.ws_ship_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF0 hd_demo_sk->[ws_ship_hdemo_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF1 RF2 +--------------------------PhysicalProject +----------------------------filter((household_demographics.hd_dep_count = 3)) +------------------------------PhysicalOlapScan[household_demographics] +----------------------PhysicalProject +------------------------filter((time_dim.t_hour <= 17) and (time_dim.t_hour >= 16)) +--------------------------PhysicalOlapScan[time_dim] +------------------PhysicalProject +--------------------filter((web_page.wp_char_count <= 5200) and (web_page.wp_char_count >= 5000)) +----------------------PhysicalOlapScan[web_page] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query91.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query91.out new file mode 100644 index 00000000000000..48587871410146 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query91.out @@ -0,0 +1,41 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_91 -- +PhysicalResultSink +--PhysicalQuickSort[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalQuickSort[LOCAL_SORT] +--------PhysicalProject +----------hashAgg[GLOBAL] +------------PhysicalDistribute[DistributionSpecHash] +--------------hashAgg[LOCAL] +----------------PhysicalProject +------------------hashJoin[INNER_JOIN broadcast] hashCondition=((household_demographics.hd_demo_sk = customer.c_current_hdemo_sk)) otherCondition=() build RFs:RF5 hd_demo_sk->[c_current_hdemo_sk] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_demographics.cd_demo_sk = customer.c_current_cdemo_sk)) otherCondition=() build RFs:RF4 cd_demo_sk->[c_current_cdemo_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((customer_address.ca_address_sk = customer.c_current_addr_sk)) otherCondition=() build RFs:RF3 ca_address_sk->[c_current_addr_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_returns.cr_returned_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[cr_returned_date_sk] +--------------------------------PhysicalProject +----------------------------------hashJoin[INNER_JOIN shuffle] hashCondition=((catalog_returns.cr_returning_customer_sk = customer.c_customer_sk)) otherCondition=() build RFs:RF1 c_customer_sk->[cr_returning_customer_sk] +------------------------------------PhysicalProject +--------------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_returns.cr_call_center_sk = call_center.cc_call_center_sk)) otherCondition=() build RFs:RF0 cc_call_center_sk->[cr_call_center_sk] +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[catalog_returns] apply RFs: RF0 RF1 RF2 +----------------------------------------PhysicalProject +------------------------------------------PhysicalOlapScan[call_center] +------------------------------------PhysicalProject +--------------------------------------PhysicalOlapScan[customer] apply RFs: RF3 RF4 RF5 +--------------------------------PhysicalProject +----------------------------------filter((date_dim.d_moy = 12) and (date_dim.d_year = 2000)) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------filter((customer_address.ca_gmt_offset = -7.00)) +--------------------------------PhysicalOlapScan[customer_address] +------------------------PhysicalProject +--------------------------filter((((customer_demographics.cd_marital_status = 'M') AND (customer_demographics.cd_education_status = 'Unknown')) OR ((customer_demographics.cd_marital_status = 'W') AND (customer_demographics.cd_education_status = 'Advanced Degree'))) and cd_education_status IN ('Advanced Degree', 'Unknown') and cd_marital_status IN ('M', 'W')) +----------------------------PhysicalOlapScan[customer_demographics] +--------------------PhysicalProject +----------------------filter((hd_buy_potential like 'Unknown%')) +------------------------PhysicalOlapScan[household_demographics] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query92.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query92.out new file mode 100644 index 00000000000000..138971f0b42575 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query92.out @@ -0,0 +1,25 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_92 -- +PhysicalResultSink +--PhysicalTopN[GATHER_SORT] +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecGather] +--------hashAgg[LOCAL] +----------PhysicalProject +------------filter((cast(ws_ext_discount_amt as DECIMALV3(38, 5)) > (1.3 * avg(cast(ws_ext_discount_amt as DECIMALV3(9, 4))) OVER(PARTITION BY i_item_sk)))) +--------------PhysicalWindow +----------------PhysicalQuickSort[LOCAL_SORT] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((date_dim.d_date_sk = web_sales.ws_sold_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ws_sold_date_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((item.i_item_sk = web_sales.ws_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ws_item_sk] +----------------------------PhysicalProject +------------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF1 +----------------------------PhysicalProject +------------------------------filter((item.i_manufact_id = 356)) +--------------------------------PhysicalOlapScan[item] +------------------------PhysicalProject +--------------------------filter((date_dim.d_date <= '2001-06-10') and (date_dim.d_date >= '2001-03-12')) +----------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query93.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query93.out new file mode 100644 index 00000000000000..ea2a35bae4e88b --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query93.out @@ -0,0 +1,21 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_93 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_returns.sr_reason_sk = reason.r_reason_sk)) otherCondition=() build RFs:RF2 r_reason_sk->[sr_reason_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((store_returns.sr_item_sk = store_sales.ss_item_sk) and (store_returns.sr_ticket_number = store_sales.ss_ticket_number)) otherCondition=() build RFs:RF0 sr_item_sk->[ss_item_sk];RF1 sr_ticket_number->[ss_ticket_number] +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_returns] apply RFs: RF2 +------------------PhysicalProject +--------------------filter((reason.r_reason_desc = 'reason 66')) +----------------------PhysicalOlapScan[reason] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query94.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query94.out new file mode 100644 index 00000000000000..792f183626c468 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query94.out @@ -0,0 +1,34 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_94 -- +PhysicalResultSink +--PhysicalTopN[GATHER_SORT] +----hashAgg[DISTINCT_GLOBAL] +------PhysicalDistribute[DistributionSpecGather] +--------hashAgg[DISTINCT_LOCAL] +----------hashAgg[GLOBAL] +------------hashAgg[LOCAL] +--------------hashJoin[LEFT_ANTI_JOIN bucketShuffle] hashCondition=((ws1.ws_order_number = wr1.wr_order_number)) otherCondition=() +----------------PhysicalProject +------------------hashJoin[LEFT_SEMI_JOIN shuffle] hashCondition=((ws1.ws_order_number = ws2.ws_order_number)) otherCondition=(( not (ws_warehouse_sk = ws_warehouse_sk))) build RFs:RF3 ws_order_number->[ws_order_number] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((ws1.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF2 web_site_sk->[ws_web_site_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((ws1.ws_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF1 ca_address_sk->[ws_ship_addr_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((ws1.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[ws_ship_date_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF0 RF1 RF2 RF3 +--------------------------------PhysicalProject +----------------------------------filter((date_dim.d_date <= '1999-05-31') and (date_dim.d_date >= '1999-04-01')) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------filter((customer_address.ca_state = 'NE')) +--------------------------------PhysicalOlapScan[customer_address] +------------------------PhysicalProject +--------------------------filter((web_site.web_company_name = 'pri')) +----------------------------PhysicalOlapScan[web_site] +--------------------PhysicalProject +----------------------PhysicalOlapScan[web_sales] +----------------PhysicalProject +------------------PhysicalOlapScan[web_returns] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query95.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query95.out new file mode 100644 index 00000000000000..4146fd70b83ac6 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query95.out @@ -0,0 +1,43 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_95 -- +PhysicalCteAnchor ( cteId=CTEId#0 ) +--PhysicalCteProducer ( cteId=CTEId#0 ) +----PhysicalProject +------hashJoin[INNER_JOIN shuffle] hashCondition=((ws1.ws_order_number = ws2.ws_order_number)) otherCondition=(( not (ws_warehouse_sk = ws_warehouse_sk))) build RFs:RF0 ws_order_number->[ws_order_number] +--------PhysicalProject +----------PhysicalOlapScan[web_sales] apply RFs: RF0 RF7 +--------PhysicalProject +----------PhysicalOlapScan[web_sales] apply RFs: RF7 +--PhysicalResultSink +----PhysicalTopN[GATHER_SORT] +------hashAgg[DISTINCT_GLOBAL] +--------PhysicalDistribute[DistributionSpecGather] +----------hashAgg[DISTINCT_LOCAL] +------------hashAgg[GLOBAL] +--------------hashAgg[LOCAL] +----------------hashJoin[LEFT_SEMI_JOIN colocated] hashCondition=((ws1.ws_order_number = web_returns.wr_order_number)) otherCondition=() build RFs:RF6 wr_order_number->[ws_order_number,ws_order_number] +------------------hashJoin[LEFT_SEMI_JOIN shuffle] hashCondition=((ws1.ws_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF5 ws_order_number->[ws_order_number] +--------------------PhysicalProject +----------------------hashJoin[INNER_JOIN broadcast] hashCondition=((ws1.ws_web_site_sk = web_site.web_site_sk)) otherCondition=() build RFs:RF4 web_site_sk->[ws_web_site_sk] +------------------------PhysicalProject +--------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((ws1.ws_ship_addr_sk = customer_address.ca_address_sk)) otherCondition=() build RFs:RF3 ca_address_sk->[ws_ship_addr_sk] +----------------------------PhysicalProject +------------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((ws1.ws_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF2 d_date_sk->[ws_ship_date_sk] +--------------------------------PhysicalProject +----------------------------------PhysicalOlapScan[web_sales] apply RFs: RF2 RF3 RF4 RF5 RF6 +--------------------------------PhysicalProject +----------------------------------filter((date_dim.d_date <= '2002-05-31') and (date_dim.d_date >= '2002-04-01')) +------------------------------------PhysicalOlapScan[date_dim] +----------------------------PhysicalProject +------------------------------filter((customer_address.ca_state = 'AL')) +--------------------------------PhysicalOlapScan[customer_address] +------------------------PhysicalProject +--------------------------filter((web_site.web_company_name = 'pri')) +----------------------------PhysicalOlapScan[web_site] +--------------------PhysicalCteConsumer ( cteId=CTEId#0 ) apply RFs: RF6 +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN shuffle] hashCondition=((web_returns.wr_order_number = ws_wh.ws_order_number)) otherCondition=() build RFs:RF7 wr_order_number->[ws_order_number,ws_order_number] +----------------------PhysicalCteConsumer ( cteId=CTEId#0 ) +----------------------PhysicalProject +------------------------PhysicalOlapScan[web_returns] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query96.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query96.out new file mode 100644 index 00000000000000..5b0549e0eb3739 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query96.out @@ -0,0 +1,25 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_96 -- +PhysicalResultSink +--PhysicalTopN[GATHER_SORT] +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecGather] +--------hashAgg[LOCAL] +----------PhysicalProject +------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_store_sk = store.s_store_sk)) otherCondition=() build RFs:RF2 s_store_sk->[ss_store_sk] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_time_sk = time_dim.t_time_sk)) otherCondition=() build RFs:RF1 t_time_sk->[ss_sold_time_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk)) otherCondition=() build RFs:RF0 hd_demo_sk->[ss_hdemo_sk] +----------------------PhysicalProject +------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 RF2 +----------------------PhysicalProject +------------------------filter((household_demographics.hd_dep_count = 6)) +--------------------------PhysicalOlapScan[household_demographics] +------------------PhysicalProject +--------------------filter((time_dim.t_hour = 16) and (time_dim.t_minute >= 30)) +----------------------PhysicalOlapScan[time_dim] +--------------PhysicalProject +----------------filter((store.s_store_name = 'ese')) +------------------PhysicalOlapScan[store] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query97.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query97.out new file mode 100644 index 00000000000000..199f8d20f62131 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query97.out @@ -0,0 +1,32 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_97 -- +PhysicalResultSink +--PhysicalTopN[GATHER_SORT] +----hashAgg[GLOBAL] +------PhysicalDistribute[DistributionSpecGather] +--------hashAgg[LOCAL] +----------PhysicalProject +------------hashJoin[FULL_OUTER_JOIN colocated] hashCondition=((ssci.customer_sk = csci.customer_sk) and (ssci.item_sk = csci.item_sk)) otherCondition=() +--------------PhysicalProject +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[store_sales] apply RFs: RF1 +--------------------------PhysicalProject +----------------------------filter((date_dim.d_month_seq <= 1201) and (date_dim.d_month_seq >= 1190)) +------------------------------PhysicalOlapScan[date_dim] +--------------PhysicalProject +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF0 d_date_sk->[cs_sold_date_sk] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 +--------------------------PhysicalProject +----------------------------filter((date_dim.d_month_seq <= 1201) and (date_dim.d_month_seq >= 1190)) +------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query98.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query98.out new file mode 100644 index 00000000000000..65aec39f800674 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query98.out @@ -0,0 +1,26 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_98 -- +PhysicalResultSink +--PhysicalQuickSort[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalQuickSort[LOCAL_SORT] +--------PhysicalProject +----------PhysicalWindow +------------PhysicalQuickSort[LOCAL_SORT] +--------------PhysicalDistribute[DistributionSpecHash] +----------------hashAgg[GLOBAL] +------------------PhysicalDistribute[DistributionSpecHash] +--------------------hashAgg[LOCAL] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_sold_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF1 d_date_sk->[ss_sold_date_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((store_sales.ss_item_sk = item.i_item_sk)) otherCondition=() build RFs:RF0 i_item_sk->[ss_item_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[store_sales] apply RFs: RF0 RF1 +------------------------------PhysicalProject +--------------------------------filter(i_category IN ('Home', 'Men', 'Sports')) +----------------------------------PhysicalOlapScan[item] +--------------------------PhysicalProject +----------------------------filter((date_dim.d_date <= '2002-02-04') and (date_dim.d_date >= '2002-01-05')) +------------------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query99.out b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query99.out new file mode 100644 index 00000000000000..d9bb469d649b59 --- /dev/null +++ b/regression-test/data/nereids_tpcds_shape_sf10t_orc/shape/query99.out @@ -0,0 +1,29 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !ds_shape_99 -- +PhysicalResultSink +--PhysicalTopN[MERGE_SORT] +----PhysicalDistribute[DistributionSpecGather] +------PhysicalTopN[LOCAL_SORT] +--------hashAgg[GLOBAL] +----------PhysicalDistribute[DistributionSpecHash] +------------hashAgg[LOCAL] +--------------PhysicalProject +----------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_ship_date_sk = date_dim.d_date_sk)) otherCondition=() build RFs:RF3 d_date_sk->[cs_ship_date_sk] +------------------PhysicalProject +--------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_call_center_sk = call_center.cc_call_center_sk)) otherCondition=() build RFs:RF2 cc_call_center_sk->[cs_call_center_sk] +----------------------PhysicalProject +------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_ship_mode_sk = ship_mode.sm_ship_mode_sk)) otherCondition=() build RFs:RF1 sm_ship_mode_sk->[cs_ship_mode_sk] +--------------------------PhysicalProject +----------------------------hashJoin[INNER_JOIN broadcast] hashCondition=((catalog_sales.cs_warehouse_sk = warehouse.w_warehouse_sk)) otherCondition=() build RFs:RF0 w_warehouse_sk->[cs_warehouse_sk] +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[catalog_sales] apply RFs: RF0 RF1 RF2 RF3 +------------------------------PhysicalProject +--------------------------------PhysicalOlapScan[warehouse] +--------------------------PhysicalProject +----------------------------PhysicalOlapScan[ship_mode] +----------------------PhysicalProject +------------------------PhysicalOlapScan[call_center] +------------------PhysicalProject +--------------------filter((date_dim.d_month_seq <= 1189) and (date_dim.d_month_seq >= 1178)) +----------------------PhysicalOlapScan[date_dim] + diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/ddl/gen_shape.py b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/ddl/gen_shape.py new file mode 100644 index 00000000000000..fca3239c48896c --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/ddl/gen_shape.py @@ -0,0 +1,26 @@ +# // 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. +if __name__ == '__main__': + with open('shape.tmpl', 'r') as f: + tmpl = f.read() + for i in range(1,100): + with open('../../../../tools/tpcds-tools/queries/sf10000/query'+str(i)+'.sql', 'r') as fi: + casei = tmpl.replace('{--}', str(i)) + casei = casei.replace('{query}', fi.read().split(";")[0]) + + with open('../shape/query'+str(i)+'.groovy', 'w') as out: + out.write(casei) \ No newline at end of file diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/ddl/shape.tmpl b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/ddl/shape.tmpl new file mode 100644 index 00000000000000..9a26f444e293cc --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/ddl/shape.tmpl @@ -0,0 +1,49 @@ +/* + * 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. + */ + +suite("query{--}") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_{--} ''' + explain shape plan + {query} + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/load.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/load.groovy new file mode 100644 index 00000000000000..d7f96be6492e3a --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/load.groovy @@ -0,0 +1,662 @@ +// 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. + +suite("load") { + String database = context.config.getDbNameByFile(context.file) + sql "drop database if exists ${database}" + sql "create database ${database}" + sql "use ${database}" + + sql """ +drop table if exists customer_demographics; +CREATE TABLE IF NOT EXISTS customer_demographics ( + cd_demo_sk bigint not null, + cd_gender char(1), + cd_marital_status char(1), + cd_education_status char(20), + cd_purchase_estimate integer, + cd_credit_rating char(10), + cd_dep_count integer, + cd_dep_employed_count integer, + cd_dep_college_count integer +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists reason; +CREATE TABLE IF NOT EXISTS reason ( + r_reason_sk bigint not null, + r_reason_id char(16) not null, + r_reason_desc char(100) + ) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists date_dim; +CREATE TABLE IF NOT EXISTS date_dim ( + d_date_sk bigint not null, + d_date_id char(16) not null, + d_date date, + d_month_seq integer, + d_week_seq integer, + d_quarter_seq integer, + d_year integer, + d_dow integer, + d_moy integer, + d_dom integer, + d_qoy integer, + d_fy_year integer, + d_fy_quarter_seq integer, + d_fy_week_seq integer, + d_day_name char(9), + d_quarter_name char(6), + d_holiday char(1), + d_weekend char(1), + d_following_holiday char(1), + d_first_dom integer, + d_last_dom integer, + d_same_day_ly integer, + d_same_day_lq integer, + d_current_day char(1), + d_current_week char(1), + d_current_month char(1), + d_current_quarter char(1), + d_current_year char(1) +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists warehouse; +CREATE TABLE IF NOT EXISTS warehouse ( + w_warehouse_sk bigint not null, + w_warehouse_id char(16) not null, + w_warehouse_name varchar(20), + w_warehouse_sq_ft integer, + w_street_number char(10), + w_street_name varchar(60), + w_street_type char(15), + w_suite_number char(10), + w_city varchar(60), + w_county varchar(30), + w_state char(2), + w_zip char(10), + w_country varchar(20), + w_gmt_offset decimal(5,2) +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists catalog_sales; +CREATE TABLE IF NOT EXISTS catalog_sales ( + cs_item_sk bigint not null, + cs_order_number bigint not null, + cs_sold_date_sk bigint, + cs_sold_time_sk bigint, + cs_ship_date_sk bigint, + cs_bill_customer_sk bigint, + cs_bill_cdemo_sk bigint, + cs_bill_hdemo_sk bigint, + cs_bill_addr_sk bigint, + cs_ship_customer_sk bigint, + cs_ship_cdemo_sk bigint, + cs_ship_hdemo_sk bigint, + cs_ship_addr_sk bigint, + cs_call_center_sk bigint, + cs_catalog_page_sk bigint, + cs_ship_mode_sk bigint, + cs_warehouse_sk bigint, + cs_promo_sk bigint, + cs_quantity integer, + cs_wholesale_cost decimal(7,2), + cs_list_price decimal(7,2), + cs_sales_price decimal(7,2), + cs_ext_discount_amt decimal(7,2), + cs_ext_sales_price decimal(7,2), + cs_ext_wholesale_cost decimal(7,2), + cs_ext_list_price decimal(7,2), + cs_ext_tax decimal(7,2), + cs_coupon_amt decimal(7,2), + cs_ext_ship_cost decimal(7,2), + cs_net_paid decimal(7,2), + cs_net_paid_inc_tax decimal(7,2), + cs_net_paid_inc_ship decimal(7,2), + cs_net_paid_inc_ship_tax decimal(7,2), + cs_net_profit decimal(7,2) +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists call_center; +CREATE TABLE IF NOT EXISTS call_center ( + cc_call_center_sk bigint not null, + cc_call_center_id char(16) not null, + cc_rec_start_date date, + cc_rec_end_date date, + cc_closed_date_sk integer, + cc_open_date_sk integer, + cc_name varchar(50), + cc_class varchar(50), + cc_employees integer, + cc_sq_ft integer, + cc_hours char(20), + cc_manager varchar(40), + cc_mkt_id integer, + cc_mkt_class char(50), + cc_mkt_desc varchar(100), + cc_market_manager varchar(40), + cc_division integer, + cc_division_name varchar(50), + cc_company integer, + cc_company_name char(50), + cc_street_number char(10), + cc_street_name varchar(60), + cc_street_type char(15), + cc_suite_number char(10), + cc_city varchar(60), + cc_county varchar(30), + cc_state char(2), + cc_zip char(10), + cc_country varchar(20), + cc_gmt_offset decimal(5,2), + cc_tax_percentage decimal(5,2) +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); + +drop table if exists inventory; +CREATE TABLE IF NOT EXISTS inventory ( + inv_date_sk bigint not null, + inv_item_sk bigint not null, + inv_warehouse_sk bigint, + inv_quantity_on_hand integer +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists catalog_returns; +CREATE TABLE IF NOT EXISTS catalog_returns ( + cr_item_sk bigint not null, + cr_order_number bigint not null, + cr_returned_date_sk bigint, + cr_returned_time_sk bigint, + cr_refunded_customer_sk bigint, + cr_refunded_cdemo_sk bigint, + cr_refunded_hdemo_sk bigint, + cr_refunded_addr_sk bigint, + cr_returning_customer_sk bigint, + cr_returning_cdemo_sk bigint, + cr_returning_hdemo_sk bigint, + cr_returning_addr_sk bigint, + cr_call_center_sk bigint, + cr_catalog_page_sk bigint, + cr_ship_mode_sk bigint, + cr_warehouse_sk bigint, + cr_reason_sk bigint, + cr_return_quantity integer, + cr_return_amount decimal(7,2), + cr_return_tax decimal(7,2), + cr_return_amt_inc_tax decimal(7,2), + cr_fee decimal(7,2), + cr_return_ship_cost decimal(7,2), + cr_refunded_cash decimal(7,2), + cr_reversed_charge decimal(7,2), + cr_store_credit decimal(7,2), + cr_net_loss decimal(7,2) +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists household_demographics; +CREATE TABLE IF NOT EXISTS household_demographics ( + hd_demo_sk bigint not null, + hd_income_band_sk bigint, + hd_buy_potential char(15), + hd_dep_count integer, + hd_vehicle_count integer +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists customer_address; +CREATE TABLE IF NOT EXISTS customer_address ( + ca_address_sk bigint not null, + ca_address_id char(16) not null, + ca_street_number char(10), + ca_street_name varchar(60), + ca_street_type char(15), + ca_suite_number char(10), + ca_city varchar(60), + ca_county varchar(30), + ca_state char(2), + ca_zip char(10), + ca_country varchar(20), + ca_gmt_offset decimal(5,2), + ca_location_type char(20) +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists income_band; +CREATE TABLE IF NOT EXISTS income_band ( + ib_income_band_sk bigint not null, + ib_lower_bound integer, + ib_upper_bound integer +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists catalog_page; +CREATE TABLE IF NOT EXISTS catalog_page ( + cp_catalog_page_sk bigint not null, + cp_catalog_page_id char(16) not null, + cp_start_date_sk integer, + cp_end_date_sk integer, + cp_department varchar(50), + cp_catalog_number integer, + cp_catalog_page_number integer, + cp_description varchar(100), + cp_type varchar(100) +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists item; +CREATE TABLE IF NOT EXISTS item ( + i_item_sk bigint not null, + i_item_id char(16) not null, + i_rec_start_date date, + i_rec_end_date date, + i_item_desc varchar(200), + i_current_price decimal(7,2), + i_wholesale_cost decimal(7,2), + i_brand_id integer, + i_brand char(50), + i_class_id integer, + i_class char(50), + i_category_id integer, + i_category char(50), + i_manufact_id integer, + i_manufact char(50), + i_size char(20), + i_formulation char(20), + i_color char(20), + i_units char(10), + i_container char(10), + i_manager_id integer, + i_product_name char(50) +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists web_returns; +CREATE TABLE IF NOT EXISTS web_returns ( + wr_item_sk bigint not null, + wr_order_number bigint not null, + wr_returned_date_sk bigint, + wr_returned_time_sk bigint, + wr_refunded_customer_sk bigint, + wr_refunded_cdemo_sk bigint, + wr_refunded_hdemo_sk bigint, + wr_refunded_addr_sk bigint, + wr_returning_customer_sk bigint, + wr_returning_cdemo_sk bigint, + wr_returning_hdemo_sk bigint, + wr_returning_addr_sk bigint, + wr_web_page_sk bigint, + wr_reason_sk bigint, + wr_return_quantity integer, + wr_return_amt decimal(7,2), + wr_return_tax decimal(7,2), + wr_return_amt_inc_tax decimal(7,2), + wr_fee decimal(7,2), + wr_return_ship_cost decimal(7,2), + wr_refunded_cash decimal(7,2), + wr_reversed_charge decimal(7,2), + wr_account_credit decimal(7,2), + wr_net_loss decimal(7,2) +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists web_site; +CREATE TABLE IF NOT EXISTS web_site ( + web_site_sk bigint not null, + web_site_id char(16) not null, + web_rec_start_date date, + web_rec_end_date date, + web_name varchar(50), + web_open_date_sk bigint, + web_close_date_sk bigint, + web_class varchar(50), + web_manager varchar(40), + web_mkt_id integer, + web_mkt_class varchar(50), + web_mkt_desc varchar(100), + web_market_manager varchar(40), + web_company_id integer, + web_company_name char(50), + web_street_number char(10), + web_street_name varchar(60), + web_street_type char(15), + web_suite_number char(10), + web_city varchar(60), + web_county varchar(30), + web_state char(2), + web_zip char(10), + web_country varchar(20), + web_gmt_offset decimal(5,2), + web_tax_percentage decimal(5,2) +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists promotion; +CREATE TABLE IF NOT EXISTS promotion ( + p_promo_sk bigint not null, + p_promo_id char(16) not null, + p_start_date_sk bigint, + p_end_date_sk bigint, + p_item_sk bigint, + p_cost decimal(15,2), + p_response_targe integer, + p_promo_name char(50), + p_channel_dmail char(1), + p_channel_email char(1), + p_channel_catalog char(1), + p_channel_tv char(1), + p_channel_radio char(1), + p_channel_press char(1), + p_channel_event char(1), + p_channel_demo char(1), + p_channel_details varchar(100), + p_purpose char(15), + p_discount_active char(1) +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists web_sales; +CREATE TABLE IF NOT EXISTS web_sales ( + ws_item_sk bigint not null, + ws_order_number bigint not null, + ws_sold_date_sk bigint, + ws_sold_time_sk bigint, + ws_ship_date_sk bigint, + ws_bill_customer_sk bigint, + ws_bill_cdemo_sk bigint, + ws_bill_hdemo_sk bigint, + ws_bill_addr_sk bigint, + ws_ship_customer_sk bigint, + ws_ship_cdemo_sk bigint, + ws_ship_hdemo_sk bigint, + ws_ship_addr_sk bigint, + ws_web_page_sk bigint, + ws_web_site_sk bigint, + ws_ship_mode_sk bigint, + ws_warehouse_sk bigint, + ws_promo_sk bigint, + ws_quantity integer, + ws_wholesale_cost decimal(7,2), + ws_list_price decimal(7,2), + ws_sales_price decimal(7,2), + ws_ext_discount_amt decimal(7,2), + ws_ext_sales_price decimal(7,2), + ws_ext_wholesale_cost decimal(7,2), + ws_ext_list_price decimal(7,2), + ws_ext_tax decimal(7,2), + ws_coupon_amt decimal(7,2), + ws_ext_ship_cost decimal(7,2), + ws_net_paid decimal(7,2), + ws_net_paid_inc_tax decimal(7,2), + ws_net_paid_inc_ship decimal(7,2), + ws_net_paid_inc_ship_tax decimal(7,2), + ws_net_profit decimal(7,2) +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists store; +CREATE TABLE IF NOT EXISTS store ( + s_store_sk bigint not null, + s_store_id char(16) not null, + s_rec_start_date date, + s_rec_end_date date, + s_closed_date_sk bigint, + s_store_name varchar(50), + s_number_employees integer, + s_floor_space integer, + s_hours char(20), + s_manager varchar(40), + s_market_id integer, + s_geography_class varchar(100), + s_market_desc varchar(100), + s_market_manager varchar(40), + s_division_id integer, + s_division_name varchar(50), + s_company_id integer, + s_company_name varchar(50), + s_street_number varchar(10), + s_street_name varchar(60), + s_street_type char(15), + s_suite_number char(10), + s_city varchar(60), + s_county varchar(30), + s_state char(2), + s_zip char(10), + s_country varchar(20), + s_gmt_offset decimal(5,2), + s_tax_precentage decimal(5,2) +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists time_dim; +CREATE TABLE IF NOT EXISTS time_dim ( + t_time_sk bigint not null, + t_time_id char(16) not null, + t_time integer, + t_hour integer, + t_minute integer, + t_second integer, + t_am_pm char(2), + t_shift char(20), + t_sub_shift char(20), + t_meal_time char(20) +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists web_page; +CREATE TABLE IF NOT EXISTS web_page ( + wp_web_page_sk bigint not null, + wp_web_page_id char(16) not null, + wp_rec_start_date date, + wp_rec_end_date date, + wp_creation_date_sk bigint, + wp_access_date_sk bigint, + wp_autogen_flag char(1), + wp_customer_sk bigint, + wp_url varchar(100), + wp_type char(50), + wp_char_count integer, + wp_link_count integer, + wp_image_count integer, + wp_max_ad_count integer +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists store_returns; +CREATE TABLE IF NOT EXISTS store_returns ( + sr_item_sk bigint not null, + sr_ticket_number bigint not null, + sr_returned_date_sk bigint, + sr_return_time_sk bigint, + sr_customer_sk bigint, + sr_cdemo_sk bigint, + sr_hdemo_sk bigint, + sr_addr_sk bigint, + sr_store_sk bigint, + sr_reason_sk bigint, + sr_return_quantity integer, + sr_return_amt decimal(7,2), + sr_return_tax decimal(7,2), + sr_return_amt_inc_tax decimal(7,2), + sr_fee decimal(7,2), + sr_return_ship_cost decimal(7,2), + sr_refunded_cash decimal(7,2), + sr_reversed_charge decimal(7,2), + sr_store_credit decimal(7,2), + sr_net_loss decimal(7,2) +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists store_sales; +CREATE TABLE IF NOT EXISTS store_sales ( + ss_item_sk bigint not null, + ss_ticket_number bigint not null, + ss_sold_date_sk bigint, + ss_sold_time_sk bigint, + ss_customer_sk bigint, + ss_cdemo_sk bigint, + ss_hdemo_sk bigint, + ss_addr_sk bigint, + ss_store_sk bigint, + ss_promo_sk bigint, + ss_quantity integer, + ss_wholesale_cost decimal(7,2), + ss_list_price decimal(7,2), + ss_sales_price decimal(7,2), + ss_ext_discount_amt decimal(7,2), + ss_ext_sales_price decimal(7,2), + ss_ext_wholesale_cost decimal(7,2), + ss_ext_list_price decimal(7,2), + ss_ext_tax decimal(7,2), + ss_coupon_amt decimal(7,2), + ss_net_paid decimal(7,2), + ss_net_paid_inc_tax decimal(7,2), + ss_net_profit decimal(7,2) +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists ship_mode; +CREATE TABLE IF NOT EXISTS ship_mode ( + sm_ship_mode_sk bigint not null, + sm_ship_mode_id char(16) not null, + sm_type char(30), + sm_code char(10), + sm_carrier char(20), + sm_contract char(20) +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists customer; +CREATE TABLE IF NOT EXISTS customer ( + c_customer_sk bigint not null, + c_customer_id char(16) not null, + c_current_cdemo_sk bigint, + c_current_hdemo_sk bigint, + c_current_addr_sk bigint, + c_first_shipto_date_sk bigint, + c_first_sales_date_sk bigint, + c_salutation char(10), + c_first_name char(20), + c_last_name char(30), + c_preferred_cust_flag char(1), + c_birth_day integer, + c_birth_month integer, + c_birth_year integer, + c_birth_country varchar(20), + c_login char(13), + c_email_address char(50), + c_last_review_date_sk bigint +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); +drop table if exists dbgen_version; +CREATE TABLE IF NOT EXISTS dbgen_version +( + dv_version varchar(16) , + dv_create_date date , + dv_create_time datetime , + dv_cmdline_args varchar(200) +) +DISTRIBUTED BY RANDOM +PROPERTIES ( + "replication_num" = "1" +); + + """ + + sql """ + +alter table catalog_returns modify column cr_reason_sk set stats ('row_count'='1440033112', 'ndv'='55', 'min_value'='1', 'max_value'='55', 'avg_size'='115234992', 'max_size'='115234992' ); +alter table catalog_sales modify column cs_wholesale_cost set stats ('row_count'='14399964710', 'ndv'='100', 'min_value'='1.00', 'max_value'='100.00', 'avg_size'='575988260', 'max_size'='575988260' ); +alter table catalog_page modify column cp_catalog_page_sk set stats ('row_count'='40000', 'ndv'='20554', 'min_value'='1', 'max_value'='20400', 'avg_size'='163200', 'max_size'='163200' ); +alter table call_center modify column cc_sq_ft set stats ('row_count'='54', 'ndv'='22', 'min_value'='1670015', 'max_value'='31896816', 'avg_size'='120', 'max_size'='120' ); +alter table customer_address modify column ca_country set stats ('row_count'='32500000', 'ndv'='2', 'min_value'='', 'max_value'='United States', 'avg_size'='12608739', 'max_size'='12608739' ); +alter table income_band modify column ib_income_band_sk set stats ('row_count'='20', 'ndv'='20', 'min_value'='1', 'max_value'='20', 'avg_size'='160', 'max_size'='160' ); +alter table inventory modify column inv_item_sk set stats ('row_count'='1311525000', 'ndv'='205012', 'min_value'='1', 'max_value'='204000', 'avg_size'='3194640000', 'max_size'='3194640000' ); +alter table promotion modify column p_promo_sk set stats ('row_count'='2000', 'ndv'='986', 'min_value'='1', 'max_value'='1000', 'avg_size'='8000', 'max_size'='8000' ); +alter table reason modify column r_reason_id set stats ('row_count'='70', 'ndv'='55', 'min_value'='AAAAAAAAABAAAAAA', 'max_value'='AAAAAAAAPCAAAAAA', 'avg_size'='880', 'max_size'='880' ); +alter table ship_mode modify column sm_code set stats ('row_count'='20', 'ndv'='4', 'min_value'='AIR', 'max_value'='SURFACE', 'avg_size'='87', 'max_size'='87' ); +alter table time_dim modify column t_am_pm set stats ('row_count'='86400', 'ndv'='2', 'min_value'='AM', 'max_value'='PM', 'avg_size'='172800', 'max_size'='172800' ); +alter table store_sales modify column ss_ticket_number set stats ('row_count'='28800002049', 'ndv'='23905324', 'min_value'='1', 'max_value'='24000000', 'avg_size'='2303976192', 'max_size'='2303976192' ); +alter table web_site modify column web_close_date_sk set stats ('row_count'='78', 'ndv'='8', 'min_value'='2443328', 'max_value'='2447131', 'avg_size'='192', 'max_size'='192' ); + +alter table web_sales modify column ws_web_site_sk set stats ('row_count'='7199963324', 'ndv'='24', 'min_value'='1', 'max_value'='24', 'avg_size'='576009896', 'max_size'='576009896' ); +alter table web_returns modify column wr_item_sk set stats ('row_count'='720020485', 'ndv'='205012', 'min_value'='1', 'max_value'='204000', 'avg_size'='57581360', 'max_size'='57581360' ); +alter table customer modify column c_birth_country set stats ('row_count'='65000000', 'ndv'='211', 'min_value'='', 'max_value'='ZIMBABWE', 'avg_size'='16787900', 'max_size'='16787900' ); +alter table web_page modify column wp_rec_start_date set stats ('row_count'='4002', 'ndv'='4', 'min_value'='1997-09-03', 'max_value'='2001-09-03', 'avg_size'='8160', 'max_size'='8160' ); +alter table store_returns modify column sr_store_credit set stats ('row_count'='2879991693', 'ndv'='9907', 'min_value'='0.00', 'max_value'='15642.11', 'avg_size'='115180320', 'max_size'='115180320' ); +alter table warehouse modify column w_county set stats ('row_count'='25', 'ndv'='8', 'min_value'='Barrow County', 'max_value'='Ziebach County', 'avg_size'='207', 'max_size'='207' ); +alter table customer_demographics modify column cd_gender set stats ('row_count'='1920800', 'ndv'='2', 'min_value'='F', 'max_value'='M', 'avg_size'='1920800', 'max_size'='1920800' ); +alter table item modify column i_size set stats ('row_count'='402000', 'ndv'='8', 'min_value'='', 'max_value'='small', 'avg_size'='880961', 'max_size'='880961' ); +alter table date_dim modify column d_week_seq set stats ('row_count'='73049', 'ndv'='10448', 'min_value'='1', 'max_value'='10436', 'avg_size'='292196', 'max_size'='292196' ); +alter table store modify column s_country set stats ('row_count'='1500', 'ndv'='2', 'min_value'='', 'max_value'='United States', 'avg_size'='5174', 'max_size'='5174' ); +alter table household_demographics modify column hd_income_band_sk set stats ('row_count'='7200', 'ndv'='20', 'min_value'='1', 'max_value'='20', 'avg_size'='57600', 'max_size'='57600' ); +""" +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query1.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query1.groovy new file mode 100644 index 00000000000000..b09ba3749dc821 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query1.groovy @@ -0,0 +1,70 @@ +/* + * 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. + */ + +suite("query1") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_1 ''' + explain shape plan + with customer_total_return as +(select sr_customer_sk as ctr_customer_sk +,sr_store_sk as ctr_store_sk +,sum(SR_FEE) as ctr_total_return +from store_returns +,date_dim +where sr_returned_date_sk = d_date_sk +and d_year =2000 +group by sr_customer_sk +,sr_store_sk) + select c_customer_id +from customer_total_return ctr1 +,store +,customer +where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2 +from customer_total_return ctr2 +where ctr1.ctr_store_sk = ctr2.ctr_store_sk) +and s_store_sk = ctr1.ctr_store_sk +and s_state = 'NM' +and ctr1.ctr_customer_sk = c_customer_sk +order by c_customer_id +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query10.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query10.groovy new file mode 100644 index 00000000000000..4cbb1818b6dc9e --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query10.groovy @@ -0,0 +1,104 @@ +/* + * 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. + */ + +suite("query10") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_10 ''' + explain shape plan + select + cd_gender, + cd_marital_status, + cd_education_status, + count(*) cnt1, + cd_purchase_estimate, + count(*) cnt2, + cd_credit_rating, + count(*) cnt3, + cd_dep_count, + count(*) cnt4, + cd_dep_employed_count, + count(*) cnt5, + cd_dep_college_count, + count(*) cnt6 + from + customer c,customer_address ca,customer_demographics + where + c.c_current_addr_sk = ca.ca_address_sk and + ca_county in ('Fillmore County','McPherson County','Bonneville County','Boone County','Brown County') and + cd_demo_sk = c.c_current_cdemo_sk and + exists (select * + from store_sales,date_dim + where c.c_customer_sk = ss_customer_sk and + ss_sold_date_sk = d_date_sk and + d_year = 2000 and + d_moy between 3 and 3+3) and + (exists (select * + from web_sales,date_dim + where c.c_customer_sk = ws_bill_customer_sk and + ws_sold_date_sk = d_date_sk and + d_year = 2000 and + d_moy between 3 ANd 3+3) or + exists (select * + from catalog_sales,date_dim + where c.c_customer_sk = cs_ship_customer_sk and + cs_sold_date_sk = d_date_sk and + d_year = 2000 and + d_moy between 3 and 3+3)) + group by cd_gender, + cd_marital_status, + cd_education_status, + cd_purchase_estimate, + cd_credit_rating, + cd_dep_count, + cd_dep_employed_count, + cd_dep_college_count + order by cd_gender, + cd_marital_status, + cd_education_status, + cd_purchase_estimate, + cd_credit_rating, + cd_dep_count, + cd_dep_employed_count, + cd_dep_college_count +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query11.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query11.groovy new file mode 100644 index 00000000000000..482ceb763132ab --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query11.groovy @@ -0,0 +1,126 @@ +/* + * 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. + */ + +suite("query11") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_11 ''' + explain shape plan + with year_total as ( + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum(ss_ext_list_price-ss_ext_discount_amt) year_total + ,'s' sale_type + from customer + ,store_sales + ,date_dim + where c_customer_sk = ss_customer_sk + and ss_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year + union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum(ws_ext_list_price-ws_ext_discount_amt) year_total + ,'w' sale_type + from customer + ,web_sales + ,date_dim + where c_customer_sk = ws_bill_customer_sk + and ws_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year + ) + select + t_s_secyear.customer_id + ,t_s_secyear.customer_first_name + ,t_s_secyear.customer_last_name + ,t_s_secyear.customer_birth_country + from year_total t_s_firstyear + ,year_total t_s_secyear + ,year_total t_w_firstyear + ,year_total t_w_secyear + where t_s_secyear.customer_id = t_s_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_secyear.customer_id + and t_s_firstyear.customer_id = t_w_firstyear.customer_id + and t_s_firstyear.sale_type = 's' + and t_w_firstyear.sale_type = 'w' + and t_s_secyear.sale_type = 's' + and t_w_secyear.sale_type = 'w' + and t_s_firstyear.dyear = 1999 + and t_s_secyear.dyear = 1999+1 + and t_w_firstyear.dyear = 1999 + and t_w_secyear.dyear = 1999+1 + and t_s_firstyear.year_total > 0 + and t_w_firstyear.year_total > 0 + and case when t_w_firstyear.year_total > 0 then t_w_secyear.year_total / t_w_firstyear.year_total else 0.0 end + > case when t_s_firstyear.year_total > 0 then t_s_secyear.year_total / t_s_firstyear.year_total else 0.0 end + order by t_s_secyear.customer_id + ,t_s_secyear.customer_first_name + ,t_s_secyear.customer_last_name + ,t_s_secyear.customer_birth_country +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query12.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query12.groovy new file mode 100644 index 00000000000000..f9f85398b2ec2c --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query12.groovy @@ -0,0 +1,79 @@ +/* + * 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. + */ + +suite("query12") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_12 ''' + explain shape plan + select i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price + ,sum(ws_ext_sales_price) as itemrevenue + ,sum(ws_ext_sales_price)*100/sum(sum(ws_ext_sales_price)) over + (partition by i_class) as revenueratio +from + web_sales + ,item + ,date_dim +where + ws_item_sk = i_item_sk + and i_category in ('Electronics', 'Books', 'Women') + and ws_sold_date_sk = d_date_sk + and d_date between cast('1998-01-06' as date) + and (cast('1998-01-06' as date) + interval 30 day) +group by + i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price +order by + i_category + ,i_class + ,i_item_id + ,i_item_desc + ,revenueratio +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query13.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query13.groovy new file mode 100644 index 00000000000000..a2f8a97e11fb00 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query13.groovy @@ -0,0 +1,97 @@ +/* + * 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. + */ + +suite("query13") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_13 ''' + explain shape plan + select avg(ss_quantity) + ,avg(ss_ext_sales_price) + ,avg(ss_ext_wholesale_cost) + ,sum(ss_ext_wholesale_cost) + from store_sales + ,store + ,customer_demographics + ,household_demographics + ,customer_address + ,date_dim + where s_store_sk = ss_store_sk + and ss_sold_date_sk = d_date_sk and d_year = 2001 + and((ss_hdemo_sk=hd_demo_sk + and cd_demo_sk = ss_cdemo_sk + and cd_marital_status = 'U' + and cd_education_status = 'Secondary' + and ss_sales_price between 100.00 and 150.00 + and hd_dep_count = 3 + )or + (ss_hdemo_sk=hd_demo_sk + and cd_demo_sk = ss_cdemo_sk + and cd_marital_status = 'W' + and cd_education_status = 'College' + and ss_sales_price between 50.00 and 100.00 + and hd_dep_count = 1 + ) or + (ss_hdemo_sk=hd_demo_sk + and cd_demo_sk = ss_cdemo_sk + and cd_marital_status = 'D' + and cd_education_status = 'Primary' + and ss_sales_price between 150.00 and 200.00 + and hd_dep_count = 1 + )) + and((ss_addr_sk = ca_address_sk + and ca_country = 'United States' + and ca_state in ('TX', 'OK', 'MI') + and ss_net_profit between 100 and 200 + ) or + (ss_addr_sk = ca_address_sk + and ca_country = 'United States' + and ca_state in ('WA', 'NC', 'OH') + and ss_net_profit between 150 and 300 + ) or + (ss_addr_sk = ca_address_sk + and ca_country = 'United States' + and ca_state in ('MT', 'FL', 'GA') + and ss_net_profit between 50 and 250 + )) + + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query14.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query14.groovy new file mode 100644 index 00000000000000..716356b71b9010 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query14.groovy @@ -0,0 +1,149 @@ +/* + * 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. + */ + +suite("query14") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_14 ''' + explain shape plan + with cross_items as + (select i_item_sk ss_item_sk + from item, + (select iss.i_brand_id brand_id + ,iss.i_class_id class_id + ,iss.i_category_id category_id + from store_sales + ,item iss + ,date_dim d1 + where ss_item_sk = iss.i_item_sk + and ss_sold_date_sk = d1.d_date_sk + and d1.d_year between 2000 AND 2000 + 2 + intersect + select ics.i_brand_id + ,ics.i_class_id + ,ics.i_category_id + from catalog_sales + ,item ics + ,date_dim d2 + where cs_item_sk = ics.i_item_sk + and cs_sold_date_sk = d2.d_date_sk + and d2.d_year between 2000 AND 2000 + 2 + intersect + select iws.i_brand_id + ,iws.i_class_id + ,iws.i_category_id + from web_sales + ,item iws + ,date_dim d3 + where ws_item_sk = iws.i_item_sk + and ws_sold_date_sk = d3.d_date_sk + and d3.d_year between 2000 AND 2000 + 2) + t where i_brand_id = brand_id + and i_class_id = class_id + and i_category_id = category_id +), + avg_sales as + (select avg(quantity*list_price) average_sales + from (select ss_quantity quantity + ,ss_list_price list_price + from store_sales + ,date_dim + where ss_sold_date_sk = d_date_sk + and d_year between 2000 and 2000 + 2 + union all + select cs_quantity quantity + ,cs_list_price list_price + from catalog_sales + ,date_dim + where cs_sold_date_sk = d_date_sk + and d_year between 2000 and 2000 + 2 + union all + select ws_quantity quantity + ,ws_list_price list_price + from web_sales + ,date_dim + where ws_sold_date_sk = d_date_sk + and d_year between 2000 and 2000 + 2) x) + select channel, i_brand_id,i_class_id,i_category_id,sum(sales), sum(number_sales) + from( + select 'store' channel, i_brand_id,i_class_id + ,i_category_id,sum(ss_quantity*ss_list_price) sales + , count(*) number_sales + from store_sales + ,item + ,date_dim + where ss_item_sk in (select ss_item_sk from cross_items) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 2000+2 + and d_moy = 11 + group by i_brand_id,i_class_id,i_category_id + having sum(ss_quantity*ss_list_price) > (select average_sales from avg_sales) + union all + select 'catalog' channel, i_brand_id,i_class_id,i_category_id, sum(cs_quantity*cs_list_price) sales, count(*) number_sales + from catalog_sales + ,item + ,date_dim + where cs_item_sk in (select ss_item_sk from cross_items) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 2000+2 + and d_moy = 11 + group by i_brand_id,i_class_id,i_category_id + having sum(cs_quantity*cs_list_price) > (select average_sales from avg_sales) + union all + select 'web' channel, i_brand_id,i_class_id,i_category_id, sum(ws_quantity*ws_list_price) sales , count(*) number_sales + from web_sales + ,item + ,date_dim + where ws_item_sk in (select ss_item_sk from cross_items) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 2000+2 + and d_moy = 11 + group by i_brand_id,i_class_id,i_category_id + having sum(ws_quantity*ws_list_price) > (select average_sales from avg_sales) + ) y + group by rollup (channel, i_brand_id,i_class_id,i_category_id) + order by channel,i_brand_id,i_class_id,i_category_id + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query15.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query15.groovy new file mode 100644 index 00000000000000..08b775a0b4cd2c --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query15.groovy @@ -0,0 +1,65 @@ +/* + * 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. + */ + +suite("query15") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_15 ''' + explain shape plan + select ca_zip + ,sum(cs_sales_price) + from catalog_sales + ,customer + ,customer_address + ,date_dim + where cs_bill_customer_sk = c_customer_sk + and c_current_addr_sk = ca_address_sk + and ( substr(ca_zip,1,5) in ('85669', '86197','88274','83405','86475', + '85392', '85460', '80348', '81792') + or ca_state in ('CA','WA','GA') + or cs_sales_price > 500) + and cs_sold_date_sk = d_date_sk + and d_qoy = 2 and d_year = 1998 + group by ca_zip + order by ca_zip + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query16.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query16.groovy new file mode 100644 index 00000000000000..2d06cc887c559e --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query16.groovy @@ -0,0 +1,76 @@ +/* + * 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. + */ + +suite("query16") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_16 ''' + explain shape plan + select + count(distinct cs_order_number) as "order count" + ,sum(cs_ext_ship_cost) as "total shipping cost" + ,sum(cs_net_profit) as "total net profit" +from + catalog_sales cs1 + ,date_dim + ,customer_address + ,call_center +where + d_date between '1999-4-01' and + (cast('1999-4-01' as date) + interval 60 day) +and cs1.cs_ship_date_sk = d_date_sk +and cs1.cs_ship_addr_sk = ca_address_sk +and ca_state = 'IL' +and cs1.cs_call_center_sk = cc_call_center_sk +and cc_county in ('Richland County','Bronx County','Maverick County','Mesa County', + 'Raleigh County' +) +and exists (select * + from catalog_sales cs2 + where cs1.cs_order_number = cs2.cs_order_number + and cs1.cs_warehouse_sk <> cs2.cs_warehouse_sk) +and not exists(select * + from catalog_returns cr1 + where cs1.cs_order_number = cr1.cr_order_number) +order by count(distinct cs_order_number) +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query17.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query17.groovy new file mode 100644 index 00000000000000..36de5b71d2f314 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query17.groovy @@ -0,0 +1,90 @@ +/* + * 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. + */ + +suite("query17") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_17 ''' + explain shape plan + select i_item_id + ,i_item_desc + ,s_state + ,count(ss_quantity) as store_sales_quantitycount + ,avg(ss_quantity) as store_sales_quantityave + ,stddev_samp(ss_quantity) as store_sales_quantitystdev + ,stddev_samp(ss_quantity)/avg(ss_quantity) as store_sales_quantitycov + ,count(sr_return_quantity) as store_returns_quantitycount + ,avg(sr_return_quantity) as store_returns_quantityave + ,stddev_samp(sr_return_quantity) as store_returns_quantitystdev + ,stddev_samp(sr_return_quantity)/avg(sr_return_quantity) as store_returns_quantitycov + ,count(cs_quantity) as catalog_sales_quantitycount ,avg(cs_quantity) as catalog_sales_quantityave + ,stddev_samp(cs_quantity) as catalog_sales_quantitystdev + ,stddev_samp(cs_quantity)/avg(cs_quantity) as catalog_sales_quantitycov + from store_sales + ,store_returns + ,catalog_sales + ,date_dim d1 + ,date_dim d2 + ,date_dim d3 + ,store + ,item + where d1.d_quarter_name = '2000Q1' + and d1.d_date_sk = ss_sold_date_sk + and i_item_sk = ss_item_sk + and s_store_sk = ss_store_sk + and ss_customer_sk = sr_customer_sk + and ss_item_sk = sr_item_sk + and ss_ticket_number = sr_ticket_number + and sr_returned_date_sk = d2.d_date_sk + and d2.d_quarter_name in ('2000Q1','2000Q2','2000Q3') + and sr_customer_sk = cs_bill_customer_sk + and sr_item_sk = cs_item_sk + and cs_sold_date_sk = d3.d_date_sk + and d3.d_quarter_name in ('2000Q1','2000Q2','2000Q3') + group by i_item_id + ,i_item_desc + ,s_state + order by i_item_id + ,i_item_desc + ,s_state +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query18.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query18.groovy new file mode 100644 index 00000000000000..9f06b83351db74 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query18.groovy @@ -0,0 +1,79 @@ +/* + * 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. + */ + +suite("query18") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_18 ''' + explain shape plan + select i_item_id, + ca_country, + ca_state, + ca_county, + avg( cast(cs_quantity as decimal(12,2))) agg1, + avg( cast(cs_list_price as decimal(12,2))) agg2, + avg( cast(cs_coupon_amt as decimal(12,2))) agg3, + avg( cast(cs_sales_price as decimal(12,2))) agg4, + avg( cast(cs_net_profit as decimal(12,2))) agg5, + avg( cast(c_birth_year as decimal(12,2))) agg6, + avg( cast(cd1.cd_dep_count as decimal(12,2))) agg7 + from catalog_sales, customer_demographics cd1, + customer_demographics cd2, customer, customer_address, date_dim, item + where cs_sold_date_sk = d_date_sk and + cs_item_sk = i_item_sk and + cs_bill_cdemo_sk = cd1.cd_demo_sk and + cs_bill_customer_sk = c_customer_sk and + cd1.cd_gender = 'M' and + cd1.cd_education_status = 'Unknown' and + c_current_cdemo_sk = cd2.cd_demo_sk and + c_current_addr_sk = ca_address_sk and + c_birth_month in (5,1,4,7,8,9) and + d_year = 2002 and + ca_state in ('AR','TX','NC' + ,'GA','MS','WV','AL') + group by rollup (i_item_id, ca_country, ca_state, ca_county) + order by ca_country, + ca_state, + ca_county, + i_item_id + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query19.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query19.groovy new file mode 100644 index 00000000000000..0a90db8a7bb304 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query19.groovy @@ -0,0 +1,70 @@ +/* + * 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. + */ + +suite("query19") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_19 ''' + explain shape plan + select i_brand_id brand_id, i_brand brand, i_manufact_id, i_manufact, + sum(ss_ext_sales_price) ext_price + from date_dim, store_sales, item,customer,customer_address,store + where d_date_sk = ss_sold_date_sk + and ss_item_sk = i_item_sk + and i_manager_id=16 + and d_moy=12 + and d_year=1998 + and ss_customer_sk = c_customer_sk + and c_current_addr_sk = ca_address_sk + and substr(ca_zip,1,5) <> substr(s_zip,1,5) + and ss_store_sk = s_store_sk + group by i_brand + ,i_brand_id + ,i_manufact_id + ,i_manufact + order by ext_price desc + ,i_brand + ,i_brand_id + ,i_manufact_id + ,i_manufact +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query2.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query2.groovy new file mode 100644 index 00000000000000..eafbc743cd5072 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query2.groovy @@ -0,0 +1,105 @@ +/* + * 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. + */ + +suite("query2") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_2 ''' + explain shape plan + with wscs as + (select sold_date_sk + ,sales_price + from (select ws_sold_date_sk sold_date_sk + ,ws_ext_sales_price sales_price + from web_sales + union all + select cs_sold_date_sk sold_date_sk + ,cs_ext_sales_price sales_price + from catalog_sales) t), + wswscs as + (select d_week_seq, + sum(case when (d_day_name='Sunday') then sales_price else null end) sun_sales, + sum(case when (d_day_name='Monday') then sales_price else null end) mon_sales, + sum(case when (d_day_name='Tuesday') then sales_price else null end) tue_sales, + sum(case when (d_day_name='Wednesday') then sales_price else null end) wed_sales, + sum(case when (d_day_name='Thursday') then sales_price else null end) thu_sales, + sum(case when (d_day_name='Friday') then sales_price else null end) fri_sales, + sum(case when (d_day_name='Saturday') then sales_price else null end) sat_sales + from wscs + ,date_dim + where d_date_sk = sold_date_sk + group by d_week_seq) + select d_week_seq1 + ,round(sun_sales1/sun_sales2,2) + ,round(mon_sales1/mon_sales2,2) + ,round(tue_sales1/tue_sales2,2) + ,round(wed_sales1/wed_sales2,2) + ,round(thu_sales1/thu_sales2,2) + ,round(fri_sales1/fri_sales2,2) + ,round(sat_sales1/sat_sales2,2) + from + (select wswscs.d_week_seq d_week_seq1 + ,sun_sales sun_sales1 + ,mon_sales mon_sales1 + ,tue_sales tue_sales1 + ,wed_sales wed_sales1 + ,thu_sales thu_sales1 + ,fri_sales fri_sales1 + ,sat_sales sat_sales1 + from wswscs,date_dim + where date_dim.d_week_seq = wswscs.d_week_seq and + d_year = 1998) y, + (select wswscs.d_week_seq d_week_seq2 + ,sun_sales sun_sales2 + ,mon_sales mon_sales2 + ,tue_sales tue_sales2 + ,wed_sales wed_sales2 + ,thu_sales thu_sales2 + ,fri_sales fri_sales2 + ,sat_sales sat_sales2 + from wswscs + ,date_dim + where date_dim.d_week_seq = wswscs.d_week_seq and + d_year = 1998+1) z + where d_week_seq1=d_week_seq2-53 + order by d_week_seq1 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query20.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query20.groovy new file mode 100644 index 00000000000000..633310f974d7c4 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query20.groovy @@ -0,0 +1,75 @@ +/* + * 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. + */ + +suite("query20") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_20 ''' + explain shape plan + select i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price + ,sum(cs_ext_sales_price) as itemrevenue + ,sum(cs_ext_sales_price)*100/sum(sum(cs_ext_sales_price)) over + (partition by i_class) as revenueratio + from catalog_sales + ,item + ,date_dim + where cs_item_sk = i_item_sk + and i_category in ('Shoes', 'Electronics', 'Children') + and cs_sold_date_sk = d_date_sk + and d_date between cast('2001-03-14' as date) + and (cast('2001-03-14' as date) + interval 30 day) + group by i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price + order by i_category + ,i_class + ,i_item_id + ,i_item_desc + ,revenueratio +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query21.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query21.groovy new file mode 100644 index 00000000000000..fb2d3590c054d2 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query21.groovy @@ -0,0 +1,75 @@ +/* + * 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. + */ + +suite("query21") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_21 ''' + explain shape plan + select * + from(select w_warehouse_name + ,i_item_id + ,sum(case when (cast(d_date as date) < cast ('1999-03-20' as date)) + then inv_quantity_on_hand + else 0 end) as inv_before + ,sum(case when (cast(d_date as date) >= cast ('1999-03-20' as date)) + then inv_quantity_on_hand + else 0 end) as inv_after + from inventory + ,warehouse + ,item + ,date_dim + where i_current_price between 0.99 and 1.49 + and i_item_sk = inv_item_sk + and inv_warehouse_sk = w_warehouse_sk + and inv_date_sk = d_date_sk + and d_date between (cast ('1999-03-20' as date) - interval 30 day) + and (cast ('1999-03-20' as date) + interval 30 day) + group by w_warehouse_name, i_item_id) x + where (case when inv_before > 0 + then inv_after / inv_before + else null + end) between 2.0/3.0 and 3.0/2.0 + order by w_warehouse_name + ,i_item_id + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query22.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query22.groovy new file mode 100644 index 00000000000000..d5b76e556249c6 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query22.groovy @@ -0,0 +1,65 @@ +/* + * 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. + */ + +suite("query22") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_22 ''' + explain shape plan + select i_product_name + ,i_brand + ,i_class + ,i_category + ,avg(inv_quantity_on_hand) qoh + from inventory + ,date_dim + ,item + where inv_date_sk=d_date_sk + and inv_item_sk=i_item_sk + and d_month_seq between 1186 and 1186 + 11 + group by rollup(i_product_name + ,i_brand + ,i_class + ,i_category) +order by qoh, i_product_name, i_brand, i_class, i_category +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query23.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query23.groovy new file mode 100644 index 00000000000000..a21c4feef86155 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query23.groovy @@ -0,0 +1,97 @@ +/* + * 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. + */ + +suite("query23") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_23 ''' + explain shape plan + with frequent_ss_items as + (select substr(i_item_desc,1,30) itemdesc,i_item_sk item_sk,d_date solddate,count(*) cnt + from store_sales + ,date_dim + ,item + where ss_sold_date_sk = d_date_sk + and ss_item_sk = i_item_sk + and d_year in (2000,2000+1,2000+2,2000+3) + group by substr(i_item_desc,1,30),i_item_sk,d_date + having count(*) >4), + max_store_sales as + (select max(csales) tpcds_cmax + from (select c_customer_sk,sum(ss_quantity*ss_sales_price) csales + from store_sales + ,date_dim + ,customer + where ss_customer_sk = c_customer_sk + and ss_sold_date_sk = d_date_sk + and d_year in (2000,2000+1,2000+2,2000+3) + group by c_customer_sk) t), + best_ss_customer as + (select c_customer_sk,sum(ss_quantity*ss_sales_price) ssales + from store_sales + ,customer + where ss_customer_sk = c_customer_sk + group by c_customer_sk + having sum(ss_quantity*ss_sales_price) > (95/100.0) * (select + * +from + max_store_sales)) + select sum(sales) + from (select cs_quantity*cs_list_price sales + from catalog_sales + ,date_dim + where d_year = 2000 + and d_moy = 3 + and cs_sold_date_sk = d_date_sk + and cs_item_sk in (select item_sk from frequent_ss_items) + and cs_bill_customer_sk in (select c_customer_sk from best_ss_customer) + union all + select ws_quantity*ws_list_price sales + from web_sales + ,date_dim + where d_year = 2000 + and d_moy = 3 + and ws_sold_date_sk = d_date_sk + and ws_item_sk in (select item_sk from frequent_ss_items) + and ws_bill_customer_sk in (select c_customer_sk from best_ss_customer)) t2 + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query24.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query24.groovy new file mode 100644 index 00000000000000..eec85d0f8356cf --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query24.groovy @@ -0,0 +1,100 @@ +/* + * 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. + */ + +suite("query24") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_24 ''' + explain shape plan + with ssales as +(select c_last_name + ,c_first_name + ,s_store_name + ,ca_state + ,s_state + ,i_color + ,i_current_price + ,i_manager_id + ,i_units + ,i_size + ,sum(ss_sales_price) netpaid +from store_sales + ,store_returns + ,store + ,item + ,customer + ,customer_address +where ss_ticket_number = sr_ticket_number + and ss_item_sk = sr_item_sk + and ss_customer_sk = c_customer_sk + and ss_item_sk = i_item_sk + and ss_store_sk = s_store_sk + and c_current_addr_sk = ca_address_sk + and c_birth_country <> upper(ca_country) + and s_zip = ca_zip +and s_market_id=10 +group by c_last_name + ,c_first_name + ,s_store_name + ,ca_state + ,s_state + ,i_color + ,i_current_price + ,i_manager_id + ,i_units + ,i_size) +select c_last_name + ,c_first_name + ,s_store_name + ,sum(netpaid) paid +from ssales +where i_color = 'snow' +group by c_last_name + ,c_first_name + ,s_store_name +having sum(netpaid) > (select 0.05*avg(netpaid) + from ssales) +order by c_last_name + ,c_first_name + ,s_store_name + + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query25.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query25.groovy new file mode 100644 index 00000000000000..eae27a1e818a70 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query25.groovy @@ -0,0 +1,93 @@ +/* + * 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. + */ + +suite("query25") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_25 ''' + explain shape plan + select + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + ,sum(ss_net_profit) as store_sales_profit + ,sum(sr_net_loss) as store_returns_loss + ,sum(cs_net_profit) as catalog_sales_profit + from + store_sales + ,store_returns + ,catalog_sales + ,date_dim d1 + ,date_dim d2 + ,date_dim d3 + ,store + ,item + where + d1.d_moy = 4 + and d1.d_year = 2000 + and d1.d_date_sk = ss_sold_date_sk + and i_item_sk = ss_item_sk + and s_store_sk = ss_store_sk + and ss_customer_sk = sr_customer_sk + and ss_item_sk = sr_item_sk + and ss_ticket_number = sr_ticket_number + and sr_returned_date_sk = d2.d_date_sk + and d2.d_moy between 4 and 10 + and d2.d_year = 2000 + and sr_customer_sk = cs_bill_customer_sk + and sr_item_sk = cs_item_sk + and cs_sold_date_sk = d3.d_date_sk + and d3.d_moy between 4 and 10 + and d3.d_year = 2000 + group by + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + order by + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query26.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query26.groovy new file mode 100644 index 00000000000000..6f9e1973c7d8f3 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query26.groovy @@ -0,0 +1,66 @@ +/* + * 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. + */ + +suite("query26") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_26 ''' + explain shape plan + select i_item_id, + avg(cs_quantity) agg1, + avg(cs_list_price) agg2, + avg(cs_coupon_amt) agg3, + avg(cs_sales_price) agg4 + from catalog_sales, customer_demographics, date_dim, item, promotion + where cs_sold_date_sk = d_date_sk and + cs_item_sk = i_item_sk and + cs_bill_cdemo_sk = cd_demo_sk and + cs_promo_sk = p_promo_sk and + cd_gender = 'F' and + cd_marital_status = 'S' and + cd_education_status = 'College' and + (p_channel_email = 'N' or p_channel_event = 'N') and + d_year = 1998 + group by i_item_id + order by i_item_id + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query27.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query27.groovy new file mode 100644 index 00000000000000..239e57f4eaac19 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query27.groovy @@ -0,0 +1,68 @@ +/* + * 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. + */ + +suite("query27") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_27 ''' + explain shape plan + select i_item_id, + s_state, grouping(s_state) g_state, + avg(ss_quantity) agg1, + avg(ss_list_price) agg2, + avg(ss_coupon_amt) agg3, + avg(ss_sales_price) agg4 + from store_sales, customer_demographics, date_dim, store, item + where ss_sold_date_sk = d_date_sk and + ss_item_sk = i_item_sk and + ss_store_sk = s_store_sk and + ss_cdemo_sk = cd_demo_sk and + cd_gender = 'F' and + cd_marital_status = 'U' and + cd_education_status = '2 yr Degree' and + d_year = 2000 and + s_state in ('AL','IN', 'SC', 'NY', 'OH', 'FL') + group by rollup (i_item_id, s_state) + order by i_item_id + ,s_state + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query28.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query28.groovy new file mode 100644 index 00000000000000..74fcddd47057a7 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query28.groovy @@ -0,0 +1,98 @@ +/* + * 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. + */ + +suite("query28") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_28 ''' + explain shape plan + select * +from (select avg(ss_list_price) B1_LP + ,count(ss_list_price) B1_CNT + ,count(distinct ss_list_price) B1_CNTD + from store_sales + where ss_quantity between 0 and 5 + and (ss_list_price between 73 and 73+10 + or ss_coupon_amt between 7826 and 7826+1000 + or ss_wholesale_cost between 70 and 70+20)) B1, + (select avg(ss_list_price) B2_LP + ,count(ss_list_price) B2_CNT + ,count(distinct ss_list_price) B2_CNTD + from store_sales + where ss_quantity between 6 and 10 + and (ss_list_price between 152 and 152+10 + or ss_coupon_amt between 2196 and 2196+1000 + or ss_wholesale_cost between 56 and 56+20)) B2, + (select avg(ss_list_price) B3_LP + ,count(ss_list_price) B3_CNT + ,count(distinct ss_list_price) B3_CNTD + from store_sales + where ss_quantity between 11 and 15 + and (ss_list_price between 53 and 53+10 + or ss_coupon_amt between 3430 and 3430+1000 + or ss_wholesale_cost between 13 and 13+20)) B3, + (select avg(ss_list_price) B4_LP + ,count(ss_list_price) B4_CNT + ,count(distinct ss_list_price) B4_CNTD + from store_sales + where ss_quantity between 16 and 20 + and (ss_list_price between 182 and 182+10 + or ss_coupon_amt between 3262 and 3262+1000 + or ss_wholesale_cost between 20 and 20+20)) B4, + (select avg(ss_list_price) B5_LP + ,count(ss_list_price) B5_CNT + ,count(distinct ss_list_price) B5_CNTD + from store_sales + where ss_quantity between 21 and 25 + and (ss_list_price between 85 and 85+10 + or ss_coupon_amt between 3310 and 3310+1000 + or ss_wholesale_cost between 37 and 37+20)) B5, + (select avg(ss_list_price) B6_LP + ,count(ss_list_price) B6_CNT + ,count(distinct ss_list_price) B6_CNTD + from store_sales + where ss_quantity between 26 and 30 + and (ss_list_price between 180 and 180+10 + or ss_coupon_amt between 12592 and 12592+1000 + or ss_wholesale_cost between 22 and 22+20)) B6 +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query29.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query29.groovy new file mode 100644 index 00000000000000..ec3b30e36a169e --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query29.groovy @@ -0,0 +1,92 @@ +/* + * 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. + */ + +suite("query29") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_29 ''' + explain shape plan + select + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + ,stddev_samp(ss_quantity) as store_sales_quantity + ,stddev_samp(sr_return_quantity) as store_returns_quantity + ,stddev_samp(cs_quantity) as catalog_sales_quantity + from + store_sales + ,store_returns + ,catalog_sales + ,date_dim d1 + ,date_dim d2 + ,date_dim d3 + ,store + ,item + where + d1.d_moy = 4 + and d1.d_year = 1998 + and d1.d_date_sk = ss_sold_date_sk + and i_item_sk = ss_item_sk + and s_store_sk = ss_store_sk + and ss_customer_sk = sr_customer_sk + and ss_item_sk = sr_item_sk + and ss_ticket_number = sr_ticket_number + and sr_returned_date_sk = d2.d_date_sk + and d2.d_moy between 4 and 4 + 3 + and d2.d_year = 1998 + and sr_customer_sk = cs_bill_customer_sk + and sr_item_sk = cs_item_sk + and cs_sold_date_sk = d3.d_date_sk + and d3.d_year in (1998,1998+1,1998+2) + group by + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + order by + i_item_id + ,i_item_desc + ,s_store_id + ,s_store_name + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query3.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query3.groovy new file mode 100644 index 00000000000000..eeced1e881f0dc --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query3.groovy @@ -0,0 +1,66 @@ +/* + * 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. + */ + +suite("query3") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_3 ''' + explain shape plan + select dt.d_year + ,item.i_brand_id brand_id + ,item.i_brand brand + ,sum(ss_sales_price) sum_agg + from date_dim dt + ,store_sales + ,item + where dt.d_date_sk = store_sales.ss_sold_date_sk + and store_sales.ss_item_sk = item.i_item_sk + and item.i_manufact_id = 816 + and dt.d_moy=11 + group by dt.d_year + ,item.i_brand + ,item.i_brand_id + order by dt.d_year + ,sum_agg desc + ,brand_id + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query30.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query30.groovy new file mode 100644 index 00000000000000..3abaaa8862cb91 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query30.groovy @@ -0,0 +1,76 @@ +/* + * 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. + */ + +suite("query30") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_30 ''' + explain shape plan + with customer_total_return as + (select wr_returning_customer_sk as ctr_customer_sk + ,ca_state as ctr_state, + sum(wr_return_amt) as ctr_total_return + from web_returns + ,date_dim + ,customer_address + where wr_returned_date_sk = d_date_sk + and d_year =2000 + and wr_returning_addr_sk = ca_address_sk + group by wr_returning_customer_sk + ,ca_state) + select c_customer_id,c_salutation,c_first_name,c_last_name,c_preferred_cust_flag + ,c_birth_day,c_birth_month,c_birth_year,c_birth_country,c_login,c_email_address + ,c_last_review_date_sk,ctr_total_return + from customer_total_return ctr1 + ,customer_address + ,customer + where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2 + from customer_total_return ctr2 + where ctr1.ctr_state = ctr2.ctr_state) + and ca_address_sk = c_current_addr_sk + and ca_state = 'GA' + and ctr1.ctr_customer_sk = c_customer_sk + order by c_customer_id,c_salutation,c_first_name,c_last_name,c_preferred_cust_flag + ,c_birth_day,c_birth_month,c_birth_year,c_birth_country,c_login,c_email_address + ,c_last_review_date_sk,ctr_total_return +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query31.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query31.groovy new file mode 100644 index 00000000000000..381484660a7d92 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query31.groovy @@ -0,0 +1,97 @@ +/* + * 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. + */ + +suite("query31") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_31 ''' + explain shape plan + with ss as + (select ca_county,d_qoy, d_year,sum(ss_ext_sales_price) as store_sales + from store_sales,date_dim,customer_address + where ss_sold_date_sk = d_date_sk + and ss_addr_sk=ca_address_sk + group by ca_county,d_qoy, d_year), + ws as + (select ca_county,d_qoy, d_year,sum(ws_ext_sales_price) as web_sales + from web_sales,date_dim,customer_address + where ws_sold_date_sk = d_date_sk + and ws_bill_addr_sk=ca_address_sk + group by ca_county,d_qoy, d_year) + select + ss1.ca_county + ,ss1.d_year + ,ws2.web_sales/ws1.web_sales web_q1_q2_increase + ,ss2.store_sales/ss1.store_sales store_q1_q2_increase + ,ws3.web_sales/ws2.web_sales web_q2_q3_increase + ,ss3.store_sales/ss2.store_sales store_q2_q3_increase + from + ss ss1 + ,ss ss2 + ,ss ss3 + ,ws ws1 + ,ws ws2 + ,ws ws3 + where + ss1.d_qoy = 1 + and ss1.d_year = 1999 + and ss1.ca_county = ss2.ca_county + and ss2.d_qoy = 2 + and ss2.d_year = 1999 + and ss2.ca_county = ss3.ca_county + and ss3.d_qoy = 3 + and ss3.d_year = 1999 + and ss1.ca_county = ws1.ca_county + and ws1.d_qoy = 1 + and ws1.d_year = 1999 + and ws1.ca_county = ws2.ca_county + and ws2.d_qoy = 2 + and ws2.d_year = 1999 + and ws1.ca_county = ws3.ca_county + and ws3.d_qoy = 3 + and ws3.d_year =1999 + and case when ws1.web_sales > 0 then ws2.web_sales/ws1.web_sales else null end + > case when ss1.store_sales > 0 then ss2.store_sales/ss1.store_sales else null end + and case when ws2.web_sales > 0 then ws3.web_sales/ws2.web_sales else null end + > case when ss2.store_sales > 0 then ss3.store_sales/ss2.store_sales else null end + order by ss1.d_year + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query32.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query32.groovy new file mode 100644 index 00000000000000..934c962261e899 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query32.groovy @@ -0,0 +1,73 @@ +/* + * 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. + */ + +suite("query32") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_32 ''' + explain shape plan + select sum(cs_ext_discount_amt) as "excess discount amount" +from + catalog_sales + ,item + ,date_dim +where +i_manufact_id = 66 +and i_item_sk = cs_item_sk +and d_date between '2002-03-29' and + (cast('2002-03-29' as date) + interval 90 day) +and d_date_sk = cs_sold_date_sk +and cs_ext_discount_amt + > ( + select + 1.3 * avg(cs_ext_discount_amt) + from + catalog_sales + ,date_dim + where + cs_item_sk = i_item_sk + and d_date between '2002-03-29' and + (cast('2002-03-29' as date) + interval 90 day) + and d_date_sk = cs_sold_date_sk + ) +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query33.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query33.groovy new file mode 100644 index 00000000000000..448b6332e8f734 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query33.groovy @@ -0,0 +1,120 @@ +/* + * 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. + */ + +suite("query33") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_33 ''' + explain shape plan + with ss as ( + select + i_manufact_id,sum(ss_ext_sales_price) total_sales + from + store_sales, + date_dim, + customer_address, + item + where + i_manufact_id in (select + i_manufact_id +from + item +where i_category in ('Home')) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 1998 + and d_moy = 5 + and ss_addr_sk = ca_address_sk + and ca_gmt_offset = -6 + group by i_manufact_id), + cs as ( + select + i_manufact_id,sum(cs_ext_sales_price) total_sales + from + catalog_sales, + date_dim, + customer_address, + item + where + i_manufact_id in (select + i_manufact_id +from + item +where i_category in ('Home')) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 1998 + and d_moy = 5 + and cs_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -6 + group by i_manufact_id), + ws as ( + select + i_manufact_id,sum(ws_ext_sales_price) total_sales + from + web_sales, + date_dim, + customer_address, + item + where + i_manufact_id in (select + i_manufact_id +from + item +where i_category in ('Home')) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 1998 + and d_moy = 5 + and ws_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -6 + group by i_manufact_id) + select i_manufact_id ,sum(total_sales) total_sales + from (select * from ss + union all + select * from cs + union all + select * from ws) tmp1 + group by i_manufact_id + order by total_sales +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query34.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query34.groovy new file mode 100644 index 00000000000000..80acc7f72e5ab2 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query34.groovy @@ -0,0 +1,76 @@ +/* + * 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. + */ + +suite("query34") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_34 ''' + explain shape plan + select c_last_name + ,c_first_name + ,c_salutation + ,c_preferred_cust_flag + ,ss_ticket_number + ,cnt from + (select ss_ticket_number + ,ss_customer_sk + ,count(*) cnt + from store_sales,date_dim,store,household_demographics + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and (date_dim.d_dom between 1 and 3 or date_dim.d_dom between 25 and 28) + and (household_demographics.hd_buy_potential = '>10000' or + household_demographics.hd_buy_potential = 'Unknown') + and household_demographics.hd_vehicle_count > 0 + and (case when household_demographics.hd_vehicle_count > 0 + then household_demographics.hd_dep_count/ household_demographics.hd_vehicle_count + else null + end) > 1.2 + and date_dim.d_year in (2000,2000+1,2000+2) + and store.s_county in ('Salem County','Terrell County','Arthur County','Oglethorpe County', + 'Lunenburg County','Perry County','Halifax County','Sumner County') + group by ss_ticket_number,ss_customer_sk) dn,customer + where ss_customer_sk = c_customer_sk + and cnt between 15 and 20 + order by c_last_name,c_first_name,c_salutation,c_preferred_cust_flag desc, ss_ticket_number + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query35.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query35.groovy new file mode 100644 index 00000000000000..9ba8368f3c1147 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query35.groovy @@ -0,0 +1,103 @@ +/* + * 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. + */ + +suite("query35") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_35 ''' + explain shape plan + select + ca_state, + cd_gender, + cd_marital_status, + cd_dep_count, + count(*) cnt1, + avg(cd_dep_count), + min(cd_dep_count), + stddev_samp(cd_dep_count), + cd_dep_employed_count, + count(*) cnt2, + avg(cd_dep_employed_count), + min(cd_dep_employed_count), + stddev_samp(cd_dep_employed_count), + cd_dep_college_count, + count(*) cnt3, + avg(cd_dep_college_count), + min(cd_dep_college_count), + stddev_samp(cd_dep_college_count) + from + customer c,customer_address ca,customer_demographics + where + c.c_current_addr_sk = ca.ca_address_sk and + cd_demo_sk = c.c_current_cdemo_sk and + exists (select * + from store_sales,date_dim + where c.c_customer_sk = ss_customer_sk and + ss_sold_date_sk = d_date_sk and + d_year = 2001 and + d_qoy < 4) and + (exists (select * + from web_sales,date_dim + where c.c_customer_sk = ws_bill_customer_sk and + ws_sold_date_sk = d_date_sk and + d_year = 2001 and + d_qoy < 4) or + exists (select * + from catalog_sales,date_dim + where c.c_customer_sk = cs_ship_customer_sk and + cs_sold_date_sk = d_date_sk and + d_year = 2001 and + d_qoy < 4)) + group by ca_state, + cd_gender, + cd_marital_status, + cd_dep_count, + cd_dep_employed_count, + cd_dep_college_count + order by ca_state, + cd_gender, + cd_marital_status, + cd_dep_count, + cd_dep_employed_count, + cd_dep_college_count + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query36.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query36.groovy new file mode 100644 index 00000000000000..b02cf7ceec4ad3 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query36.groovy @@ -0,0 +1,75 @@ +/* + * 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. + */ + +suite("query36") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_36 ''' + explain shape plan + select + sum(ss_net_profit)/sum(ss_ext_sales_price) as gross_margin + ,i_category + ,i_class + ,grouping(i_category)+grouping(i_class) as lochierarchy + ,rank() over ( + partition by grouping(i_category)+grouping(i_class), + case when grouping(i_class) = 0 then i_category end + order by sum(ss_net_profit)/sum(ss_ext_sales_price) asc) as rank_within_parent + from + store_sales + ,date_dim d1 + ,item + ,store + where + d1.d_year = 1999 + and d1.d_date_sk = ss_sold_date_sk + and i_item_sk = ss_item_sk + and s_store_sk = ss_store_sk + and s_state in ('IN','AL','MI','MN', + 'TN','LA','FL','NM') + group by rollup(i_category,i_class) + order by + lochierarchy desc + ,case when lochierarchy = 0 then i_category end + ,rank_within_parent + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query37.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query37.groovy new file mode 100644 index 00000000000000..bc891808012e28 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query37.groovy @@ -0,0 +1,62 @@ +/* + * 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. + */ + +suite("query37") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_37 ''' + explain shape plan + select i_item_id + ,i_item_desc + ,i_current_price + from item, inventory, date_dim, catalog_sales + where i_current_price between 39 and 39 + 30 + and inv_item_sk = i_item_sk + and d_date_sk=inv_date_sk + and d_date between cast('2001-01-16' as date) and (cast('2001-01-16' as date) + interval 60 day) + and i_manufact_id in (765,886,889,728) + and inv_quantity_on_hand between 100 and 500 + and cs_item_sk = i_item_sk + group by i_item_id,i_item_desc,i_current_price + order by i_item_id + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query38.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query38.groovy new file mode 100644 index 00000000000000..2edb416929885f --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query38.groovy @@ -0,0 +1,68 @@ +/* + * 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. + */ + +suite("query38") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_38 ''' + explain shape plan + select count(*) from ( + select distinct c_last_name, c_first_name, d_date + from store_sales, date_dim, customer + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_customer_sk = customer.c_customer_sk + and d_month_seq between 1186 and 1186 + 11 + intersect + select distinct c_last_name, c_first_name, d_date + from catalog_sales, date_dim, customer + where catalog_sales.cs_sold_date_sk = date_dim.d_date_sk + and catalog_sales.cs_bill_customer_sk = customer.c_customer_sk + and d_month_seq between 1186 and 1186 + 11 + intersect + select distinct c_last_name, c_first_name, d_date + from web_sales, date_dim, customer + where web_sales.ws_sold_date_sk = date_dim.d_date_sk + and web_sales.ws_bill_customer_sk = customer.c_customer_sk + and d_month_seq between 1186 and 1186 + 11 +) hot_cust +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query39.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query39.groovy new file mode 100644 index 00000000000000..ee3d855f57361c --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query39.groovy @@ -0,0 +1,73 @@ +/* + * 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. + */ + +suite("query39") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_39 ''' + explain shape plan + with inv as +(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy + ,stdev,mean, case mean when 0 then null else stdev/mean end cov + from(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy + ,stddev_samp(inv_quantity_on_hand) stdev,avg(inv_quantity_on_hand) mean + from inventory + ,item + ,warehouse + ,date_dim + where inv_item_sk = i_item_sk + and inv_warehouse_sk = w_warehouse_sk + and inv_date_sk = d_date_sk + and d_year =2000 + group by w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy) foo + where case mean when 0 then 0 else stdev/mean end > 1) +select inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean, inv1.cov + ,inv2.w_warehouse_sk,inv2.i_item_sk,inv2.d_moy,inv2.mean, inv2.cov +from inv inv1,inv inv2 +where inv1.i_item_sk = inv2.i_item_sk + and inv1.w_warehouse_sk = inv2.w_warehouse_sk + and inv1.d_moy=2 + and inv2.d_moy=2+1 +order by inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean,inv1.cov + ,inv2.d_moy,inv2.mean, inv2.cov + + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query4.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query4.groovy new file mode 100644 index 00000000000000..76ab78c6274c62 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query4.groovy @@ -0,0 +1,161 @@ +/* + * 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. + */ + +suite("query4") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_4 ''' + explain shape plan + with year_total as ( + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum(((ss_ext_list_price-ss_ext_wholesale_cost-ss_ext_discount_amt)+ss_ext_sales_price)/2) year_total + ,'s' sale_type + from customer + ,store_sales + ,date_dim + where c_customer_sk = ss_customer_sk + and ss_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year + union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum((((cs_ext_list_price-cs_ext_wholesale_cost-cs_ext_discount_amt)+cs_ext_sales_price)/2) ) year_total + ,'c' sale_type + from customer + ,catalog_sales + ,date_dim + where c_customer_sk = cs_bill_customer_sk + and cs_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year +union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,c_preferred_cust_flag customer_preferred_cust_flag + ,c_birth_country customer_birth_country + ,c_login customer_login + ,c_email_address customer_email_address + ,d_year dyear + ,sum((((ws_ext_list_price-ws_ext_wholesale_cost-ws_ext_discount_amt)+ws_ext_sales_price)/2) ) year_total + ,'w' sale_type + from customer + ,web_sales + ,date_dim + where c_customer_sk = ws_bill_customer_sk + and ws_sold_date_sk = d_date_sk + group by c_customer_id + ,c_first_name + ,c_last_name + ,c_preferred_cust_flag + ,c_birth_country + ,c_login + ,c_email_address + ,d_year + ) + select + t_s_secyear.customer_id + ,t_s_secyear.customer_first_name + ,t_s_secyear.customer_last_name + ,t_s_secyear.customer_birth_country + from year_total t_s_firstyear + ,year_total t_s_secyear + ,year_total t_c_firstyear + ,year_total t_c_secyear + ,year_total t_w_firstyear + ,year_total t_w_secyear + where t_s_secyear.customer_id = t_s_firstyear.customer_id + and t_s_firstyear.customer_id = t_c_secyear.customer_id + and t_s_firstyear.customer_id = t_c_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_secyear.customer_id + and t_s_firstyear.sale_type = 's' + and t_c_firstyear.sale_type = 'c' + and t_w_firstyear.sale_type = 'w' + and t_s_secyear.sale_type = 's' + and t_c_secyear.sale_type = 'c' + and t_w_secyear.sale_type = 'w' + and t_s_firstyear.dyear = 1999 + and t_s_secyear.dyear = 1999+1 + and t_c_firstyear.dyear = 1999 + and t_c_secyear.dyear = 1999+1 + and t_w_firstyear.dyear = 1999 + and t_w_secyear.dyear = 1999+1 + and t_s_firstyear.year_total > 0 + and t_c_firstyear.year_total > 0 + and t_w_firstyear.year_total > 0 + and case when t_c_firstyear.year_total > 0 then t_c_secyear.year_total / t_c_firstyear.year_total else null end + > case when t_s_firstyear.year_total > 0 then t_s_secyear.year_total / t_s_firstyear.year_total else null end + and case when t_c_firstyear.year_total > 0 then t_c_secyear.year_total / t_c_firstyear.year_total else null end + > case when t_w_firstyear.year_total > 0 then t_w_secyear.year_total / t_w_firstyear.year_total else null end + order by t_s_secyear.customer_id + ,t_s_secyear.customer_first_name + ,t_s_secyear.customer_last_name + ,t_s_secyear.customer_birth_country +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query40.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query40.groovy new file mode 100644 index 00000000000000..862bfafcfe1d4c --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query40.groovy @@ -0,0 +1,73 @@ +/* + * 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. + */ + +suite("query40") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_40 ''' + explain shape plan + select + w_state + ,i_item_id + ,sum(case when (cast(d_date as date) < cast ('2000-03-18' as date)) + then cs_sales_price - coalesce(cr_refunded_cash,0) else 0 end) as sales_before + ,sum(case when (cast(d_date as date) >= cast ('2000-03-18' as date)) + then cs_sales_price - coalesce(cr_refunded_cash,0) else 0 end) as sales_after + from + catalog_sales left outer join catalog_returns on + (cs_order_number = cr_order_number + and cs_item_sk = cr_item_sk) + ,warehouse + ,item + ,date_dim + where + i_current_price between 0.99 and 1.49 + and i_item_sk = cs_item_sk + and cs_warehouse_sk = w_warehouse_sk + and cs_sold_date_sk = d_date_sk + and d_date between (cast ('2000-03-18' as date) - interval 30 day) + and (cast ('2000-03-18' as date) + interval 30 day) + group by + w_state,i_item_id + order by w_state,i_item_id +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query41.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query41.groovy new file mode 100644 index 00000000000000..f0d71886c58d15 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query41.groovy @@ -0,0 +1,97 @@ +/* + * 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. + */ + +suite("query41") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_41 ''' + explain shape plan + select distinct(i_product_name) + from item i1 + where i_manufact_id between 970 and 970+40 + and (select count(*) as item_cnt + from item + where (i_manufact = i1.i_manufact and + ((i_category = 'Women' and + (i_color = 'frosted' or i_color = 'rose') and + (i_units = 'Lb' or i_units = 'Gross') and + (i_size = 'medium' or i_size = 'large') + ) or + (i_category = 'Women' and + (i_color = 'chocolate' or i_color = 'black') and + (i_units = 'Box' or i_units = 'Dram') and + (i_size = 'economy' or i_size = 'petite') + ) or + (i_category = 'Men' and + (i_color = 'slate' or i_color = 'magenta') and + (i_units = 'Carton' or i_units = 'Bundle') and + (i_size = 'N/A' or i_size = 'small') + ) or + (i_category = 'Men' and + (i_color = 'cornflower' or i_color = 'firebrick') and + (i_units = 'Pound' or i_units = 'Oz') and + (i_size = 'medium' or i_size = 'large') + ))) or + (i_manufact = i1.i_manufact and + ((i_category = 'Women' and + (i_color = 'almond' or i_color = 'steel') and + (i_units = 'Tsp' or i_units = 'Case') and + (i_size = 'medium' or i_size = 'large') + ) or + (i_category = 'Women' and + (i_color = 'purple' or i_color = 'aquamarine') and + (i_units = 'Bunch' or i_units = 'Gram') and + (i_size = 'economy' or i_size = 'petite') + ) or + (i_category = 'Men' and + (i_color = 'lavender' or i_color = 'papaya') and + (i_units = 'Pallet' or i_units = 'Cup') and + (i_size = 'N/A' or i_size = 'small') + ) or + (i_category = 'Men' and + (i_color = 'maroon' or i_color = 'cyan') and + (i_units = 'Each' or i_units = 'N/A') and + (i_size = 'medium' or i_size = 'large') + )))) > 0 + order by i_product_name + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query42.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query42.groovy new file mode 100644 index 00000000000000..f15088227fb372 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query42.groovy @@ -0,0 +1,67 @@ +/* + * 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. + */ + +suite("query42") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_42 ''' + explain shape plan + select dt.d_year + ,item.i_category_id + ,item.i_category + ,sum(ss_ext_sales_price) + from date_dim dt + ,store_sales + ,item + where dt.d_date_sk = store_sales.ss_sold_date_sk + and store_sales.ss_item_sk = item.i_item_sk + and item.i_manager_id = 1 + and dt.d_moy=12 + and dt.d_year=1998 + group by dt.d_year + ,item.i_category_id + ,item.i_category + order by sum(ss_ext_sales_price) desc,dt.d_year + ,item.i_category_id + ,item.i_category +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query43.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query43.groovy new file mode 100644 index 00000000000000..9d5e94bd7fb25e --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query43.groovy @@ -0,0 +1,64 @@ +/* + * 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. + */ + +suite("query43") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_43 ''' + explain shape plan + select s_store_name, s_store_id, + sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales, + sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales, + sum(case when (d_day_name='Tuesday') then ss_sales_price else null end) tue_sales, + sum(case when (d_day_name='Wednesday') then ss_sales_price else null end) wed_sales, + sum(case when (d_day_name='Thursday') then ss_sales_price else null end) thu_sales, + sum(case when (d_day_name='Friday') then ss_sales_price else null end) fri_sales, + sum(case when (d_day_name='Saturday') then ss_sales_price else null end) sat_sales + from date_dim, store_sales, store + where d_date_sk = ss_sold_date_sk and + s_store_sk = ss_store_sk and + s_gmt_offset = -6 and + d_year = 2001 + group by s_store_name, s_store_id + order by s_store_name, s_store_id,sun_sales,mon_sales,tue_sales,wed_sales,thu_sales,fri_sales,sat_sales + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query44.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query44.groovy new file mode 100644 index 00000000000000..19416a0a2b8513 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query44.groovy @@ -0,0 +1,80 @@ +/* + * 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. + */ + +suite("query44") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_44 ''' + explain shape plan + select asceding.rnk, i1.i_product_name best_performing, i2.i_product_name worst_performing +from(select * + from (select item_sk,rank() over (order by rank_col asc) rnk + from (select ss_item_sk item_sk,avg(ss_net_profit) rank_col + from store_sales ss1 + where ss_store_sk = 366 + group by ss_item_sk + having avg(ss_net_profit) > 0.9*(select avg(ss_net_profit) rank_col + from store_sales + where ss_store_sk = 366 + and ss_cdemo_sk is null + group by ss_store_sk))V1)V11 + where rnk < 11) asceding, + (select * + from (select item_sk,rank() over (order by rank_col desc) rnk + from (select ss_item_sk item_sk,avg(ss_net_profit) rank_col + from store_sales ss1 + where ss_store_sk = 366 + group by ss_item_sk + having avg(ss_net_profit) > 0.9*(select avg(ss_net_profit) rank_col + from store_sales + where ss_store_sk = 366 + and ss_cdemo_sk is null + group by ss_store_sk))V2)V21 + where rnk < 11) descending, +item i1, +item i2 +where asceding.rnk = descending.rnk + and i1.i_item_sk=asceding.item_sk + and i2.i_item_sk=descending.item_sk +order by asceding.rnk +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query45.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query45.groovy new file mode 100644 index 00000000000000..b0efcedf71157d --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query45.groovy @@ -0,0 +1,65 @@ +/* + * 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. + */ + +suite("query45") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_45 ''' + explain shape plan + select ca_zip, ca_county, sum(ws_sales_price) + from web_sales, customer, customer_address, date_dim, item + where ws_bill_customer_sk = c_customer_sk + and c_current_addr_sk = ca_address_sk + and ws_item_sk = i_item_sk + and ( substr(ca_zip,1,5) in ('85669', '86197','88274','83405','86475', '85392', '85460', '80348', '81792') + or + i_item_id in (select i_item_id + from item + where i_item_sk in (2, 3, 5, 7, 11, 13, 17, 19, 23, 29) + ) + ) + and ws_sold_date_sk = d_date_sk + and d_qoy = 1 and d_year = 1998 + group by ca_zip, ca_county + order by ca_zip, ca_county + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query46.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query46.groovy new file mode 100644 index 00000000000000..010ca3d08934d5 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query46.groovy @@ -0,0 +1,80 @@ +/* + * 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. + */ + +suite("query46") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_46 ''' + explain shape plan + select c_last_name + ,c_first_name + ,ca_city + ,bought_city + ,ss_ticket_number + ,amt,profit + from + (select ss_ticket_number + ,ss_customer_sk + ,ca_city bought_city + ,sum(ss_coupon_amt) amt + ,sum(ss_net_profit) profit + from store_sales,date_dim,store,household_demographics,customer_address + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and store_sales.ss_addr_sk = customer_address.ca_address_sk + and (household_demographics.hd_dep_count = 0 or + household_demographics.hd_vehicle_count= 1) + and date_dim.d_dow in (6,0) + and date_dim.d_year in (2000,2000+1,2000+2) + and store.s_city in ('Five Forks','Oakland','Fairview','Winchester','Farmington') + group by ss_ticket_number,ss_customer_sk,ss_addr_sk,ca_city) dn,customer,customer_address current_addr + where ss_customer_sk = c_customer_sk + and customer.c_current_addr_sk = current_addr.ca_address_sk + and current_addr.ca_city <> bought_city + order by c_last_name + ,c_first_name + ,ca_city + ,bought_city + ,ss_ticket_number + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query47.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query47.groovy new file mode 100644 index 00000000000000..68f186f6eb0176 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query47.groovy @@ -0,0 +1,96 @@ +/* + * 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. + */ + +suite("query47") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_47 ''' + explain shape plan + with v1 as( + select i_category, i_brand, + s_store_name, s_company_name, + d_year, d_moy, + sum(ss_sales_price) sum_sales, + avg(sum(ss_sales_price)) over + (partition by i_category, i_brand, + s_store_name, s_company_name, d_year) + avg_monthly_sales, + rank() over + (partition by i_category, i_brand, + s_store_name, s_company_name + order by d_year, d_moy) rn + from item, store_sales, date_dim, store + where ss_item_sk = i_item_sk and + ss_sold_date_sk = d_date_sk and + ss_store_sk = s_store_sk and + ( + d_year = 1999 or + ( d_year = 1999-1 and d_moy =12) or + ( d_year = 1999+1 and d_moy =1) + ) + group by i_category, i_brand, + s_store_name, s_company_name, + d_year, d_moy), + v2 as( + select v1.s_store_name + ,v1.d_year, v1.d_moy + ,v1.avg_monthly_sales + ,v1.sum_sales, v1_lag.sum_sales psum, v1_lead.sum_sales nsum + from v1, v1 v1_lag, v1 v1_lead + where v1.i_category = v1_lag.i_category and + v1.i_category = v1_lead.i_category and + v1.i_brand = v1_lag.i_brand and + v1.i_brand = v1_lead.i_brand and + v1.s_store_name = v1_lag.s_store_name and + v1.s_store_name = v1_lead.s_store_name and + v1.s_company_name = v1_lag.s_company_name and + v1.s_company_name = v1_lead.s_company_name and + v1.rn = v1_lag.rn + 1 and + v1.rn = v1_lead.rn - 1) + select * + from v2 + where d_year = 1999 and + avg_monthly_sales > 0 and + case when avg_monthly_sales > 0 then abs(sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1 + order by sum_sales - avg_monthly_sales, sum_sales + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query48.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query48.groovy new file mode 100644 index 00000000000000..cb5966bb03e9b7 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query48.groovy @@ -0,0 +1,112 @@ +/* + * 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. + */ + +suite("query48") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_48 ''' + explain shape plan + select sum (ss_quantity) + from store_sales, store, customer_demographics, customer_address, date_dim + where s_store_sk = ss_store_sk + and ss_sold_date_sk = d_date_sk and d_year = 1998 + and + ( + ( + cd_demo_sk = ss_cdemo_sk + and + cd_marital_status = 'M' + and + cd_education_status = 'Unknown' + and + ss_sales_price between 100.00 and 150.00 + ) + or + ( + cd_demo_sk = ss_cdemo_sk + and + cd_marital_status = 'W' + and + cd_education_status = 'College' + and + ss_sales_price between 50.00 and 100.00 + ) + or + ( + cd_demo_sk = ss_cdemo_sk + and + cd_marital_status = 'D' + and + cd_education_status = 'Primary' + and + ss_sales_price between 150.00 and 200.00 + ) + ) + and + ( + ( + ss_addr_sk = ca_address_sk + and + ca_country = 'United States' + and + ca_state in ('MI', 'GA', 'NH') + and ss_net_profit between 0 and 2000 + ) + or + (ss_addr_sk = ca_address_sk + and + ca_country = 'United States' + and + ca_state in ('TX', 'KY', 'SD') + and ss_net_profit between 150 and 3000 + ) + or + (ss_addr_sk = ca_address_sk + and + ca_country = 'United States' + and + ca_state in ('NY', 'OH', 'FL') + and ss_net_profit between 50 and 25000 + ) + ) + + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query49.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query49.groovy new file mode 100644 index 00000000000000..87d5898934809b --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query49.groovy @@ -0,0 +1,174 @@ +/* + * 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. + */ + +suite("query49") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_49 ''' + explain shape plan + select channel, item, return_ratio, return_rank, currency_rank from + (select + 'web' as channel + ,web.item + ,web.return_ratio + ,web.return_rank + ,web.currency_rank + from ( + select + item + ,return_ratio + ,currency_ratio + ,rank() over (order by return_ratio) as return_rank + ,rank() over (order by currency_ratio) as currency_rank + from + ( select ws.ws_item_sk as item + ,(cast(sum(coalesce(wr.wr_return_quantity,0)) as decimal(15,4))/ + cast(sum(coalesce(ws.ws_quantity,0)) as decimal(15,4) )) as return_ratio + ,(cast(sum(coalesce(wr.wr_return_amt,0)) as decimal(15,4))/ + cast(sum(coalesce(ws.ws_net_paid,0)) as decimal(15,4) )) as currency_ratio + from + web_sales ws left outer join web_returns wr + on (ws.ws_order_number = wr.wr_order_number and + ws.ws_item_sk = wr.wr_item_sk) + ,date_dim + where + wr.wr_return_amt > 10000 + and ws.ws_net_profit > 1 + and ws.ws_net_paid > 0 + and ws.ws_quantity > 0 + and ws_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 12 + group by ws.ws_item_sk + ) in_web + ) web + where + ( + web.return_rank <= 10 + or + web.currency_rank <= 10 + ) + union + select + 'catalog' as channel + ,catalog.item + ,catalog.return_ratio + ,catalog.return_rank + ,catalog.currency_rank + from ( + select + item + ,return_ratio + ,currency_ratio + ,rank() over (order by return_ratio) as return_rank + ,rank() over (order by currency_ratio) as currency_rank + from + ( select + cs.cs_item_sk as item + ,(cast(sum(coalesce(cr.cr_return_quantity,0)) as decimal(15,4))/ + cast(sum(coalesce(cs.cs_quantity,0)) as decimal(15,4) )) as return_ratio + ,(cast(sum(coalesce(cr.cr_return_amount,0)) as decimal(15,4))/ + cast(sum(coalesce(cs.cs_net_paid,0)) as decimal(15,4) )) as currency_ratio + from + catalog_sales cs left outer join catalog_returns cr + on (cs.cs_order_number = cr.cr_order_number and + cs.cs_item_sk = cr.cr_item_sk) + ,date_dim + where + cr.cr_return_amount > 10000 + and cs.cs_net_profit > 1 + and cs.cs_net_paid > 0 + and cs.cs_quantity > 0 + and cs_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 12 + group by cs.cs_item_sk + ) in_cat + ) catalog + where + ( + catalog.return_rank <= 10 + or + catalog.currency_rank <=10 + ) + union + select + 'store' as channel + ,store.item + ,store.return_ratio + ,store.return_rank + ,store.currency_rank + from ( + select + item + ,return_ratio + ,currency_ratio + ,rank() over (order by return_ratio) as return_rank + ,rank() over (order by currency_ratio) as currency_rank + from + ( select sts.ss_item_sk as item + ,(cast(sum(coalesce(sr.sr_return_quantity,0)) as decimal(15,4))/cast(sum(coalesce(sts.ss_quantity,0)) as decimal(15,4) )) as return_ratio + ,(cast(sum(coalesce(sr.sr_return_amt,0)) as decimal(15,4))/cast(sum(coalesce(sts.ss_net_paid,0)) as decimal(15,4) )) as currency_ratio + from + store_sales sts left outer join store_returns sr + on (sts.ss_ticket_number = sr.sr_ticket_number and sts.ss_item_sk = sr.sr_item_sk) + ,date_dim + where + sr.sr_return_amt > 10000 + and sts.ss_net_profit > 1 + and sts.ss_net_paid > 0 + and sts.ss_quantity > 0 + and ss_sold_date_sk = d_date_sk + and d_year = 2000 + and d_moy = 12 + group by sts.ss_item_sk + ) in_store + ) store + where ( + store.return_rank <= 10 + or + store.currency_rank <= 10 + ) + ) + t order by 1,4,5,2 + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query5.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query5.groovy new file mode 100644 index 00000000000000..7a017fe9bd5517 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query5.groovy @@ -0,0 +1,173 @@ +/* + * 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. + */ + +suite("query5") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_5 ''' + explain shape plan + with ssr as + (select s_store_id, + sum(sales_price) as sales, + sum(profit) as profit, + sum(return_amt) as returns, + sum(net_loss) as profit_loss + from + ( select ss_store_sk as store_sk, + ss_sold_date_sk as date_sk, + ss_ext_sales_price as sales_price, + ss_net_profit as profit, + cast(0 as decimal(7,2)) as return_amt, + cast(0 as decimal(7,2)) as net_loss + from store_sales + union all + select sr_store_sk as store_sk, + sr_returned_date_sk as date_sk, + cast(0 as decimal(7,2)) as sales_price, + cast(0 as decimal(7,2)) as profit, + sr_return_amt as return_amt, + sr_net_loss as net_loss + from store_returns + ) salesreturns, + date_dim, + store + where date_sk = d_date_sk + and d_date between cast('2000-08-19' as date) + and (cast('2000-08-19' as date) + interval 14 day) + and store_sk = s_store_sk + group by s_store_id) + , + csr as + (select cp_catalog_page_id, + sum(sales_price) as sales, + sum(profit) as profit, + sum(return_amt) as returns, + sum(net_loss) as profit_loss + from + ( select cs_catalog_page_sk as page_sk, + cs_sold_date_sk as date_sk, + cs_ext_sales_price as sales_price, + cs_net_profit as profit, + cast(0 as decimal(7,2)) as return_amt, + cast(0 as decimal(7,2)) as net_loss + from catalog_sales + union all + select cr_catalog_page_sk as page_sk, + cr_returned_date_sk as date_sk, + cast(0 as decimal(7,2)) as sales_price, + cast(0 as decimal(7,2)) as profit, + cr_return_amount as return_amt, + cr_net_loss as net_loss + from catalog_returns + ) salesreturns, + date_dim, + catalog_page + where date_sk = d_date_sk + and d_date between cast('2000-08-19' as date) + and (cast('2000-08-19' as date) + interval 14 day) + and page_sk = cp_catalog_page_sk + group by cp_catalog_page_id) + , + wsr as + (select web_site_id, + sum(sales_price) as sales, + sum(profit) as profit, + sum(return_amt) as returns, + sum(net_loss) as profit_loss + from + ( select ws_web_site_sk as wsr_web_site_sk, + ws_sold_date_sk as date_sk, + ws_ext_sales_price as sales_price, + ws_net_profit as profit, + cast(0 as decimal(7,2)) as return_amt, + cast(0 as decimal(7,2)) as net_loss + from web_sales + union all + select ws_web_site_sk as wsr_web_site_sk, + wr_returned_date_sk as date_sk, + cast(0 as decimal(7,2)) as sales_price, + cast(0 as decimal(7,2)) as profit, + wr_return_amt as return_amt, + wr_net_loss as net_loss + from web_returns left outer join web_sales on + ( wr_item_sk = ws_item_sk + and wr_order_number = ws_order_number) + ) salesreturns, + date_dim, + web_site + where date_sk = d_date_sk + and d_date between cast('2000-08-19' as date) + and (cast('2000-08-19' as date) + interval 14 day) + and wsr_web_site_sk = web_site_sk + group by web_site_id) + select channel + , id + , sum(sales) as sales + , sum(returns) as returns + , sum(profit) as profit + from + (select 'store channel' as channel + , concat('store', s_store_id) id + , sales + , returns + , (profit - profit_loss) as profit + from ssr + union all + select 'catalog channel' as channel + , concat('catalog_page', cp_catalog_page_id) id + , sales + , returns + , (profit - profit_loss) as profit + from csr + union all + select 'web channel' as channel + , concat('web_site', web_site_id) id + , sales + , returns + , (profit - profit_loss) as profit + from wsr + ) x + group by rollup (channel, id) + order by channel + ,id + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query50.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query50.groovy new file mode 100644 index 00000000000000..bc933c42d03a23 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query50.groovy @@ -0,0 +1,104 @@ +/* + * 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. + */ + +suite("query50") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_50 ''' + explain shape plan + select + s_store_name + ,s_company_id + ,s_street_number + ,s_street_name + ,s_street_type + ,s_suite_number + ,s_city + ,s_county + ,s_state + ,s_zip + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk <= 30 ) then 1 else 0 end) as "30 days" + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 30) and + (sr_returned_date_sk - ss_sold_date_sk <= 60) then 1 else 0 end ) as "31-60 days" + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 60) and + (sr_returned_date_sk - ss_sold_date_sk <= 90) then 1 else 0 end) as "61-90 days" + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 90) and + (sr_returned_date_sk - ss_sold_date_sk <= 120) then 1 else 0 end) as "91-120 days" + ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 120) then 1 else 0 end) as ">120 days" +from + store_sales + ,store_returns + ,store + ,date_dim d1 + ,date_dim d2 +where + d2.d_year = 1998 +and d2.d_moy = 9 +and ss_ticket_number = sr_ticket_number +and ss_item_sk = sr_item_sk +and ss_sold_date_sk = d1.d_date_sk +and sr_returned_date_sk = d2.d_date_sk +and ss_customer_sk = sr_customer_sk +and ss_store_sk = s_store_sk +group by + s_store_name + ,s_company_id + ,s_street_number + ,s_street_name + ,s_street_type + ,s_suite_number + ,s_city + ,s_county + ,s_state + ,s_zip +order by s_store_name + ,s_company_id + ,s_street_number + ,s_street_name + ,s_street_type + ,s_suite_number + ,s_city + ,s_county + ,s_state + ,s_zip +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query51.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query51.groovy new file mode 100644 index 00000000000000..79d7dd575ca11f --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query51.groovy @@ -0,0 +1,90 @@ +/* + * 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. + */ + +suite("query51") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_51 ''' + explain shape plan + WITH web_v1 as ( +select + ws_item_sk item_sk, d_date, + sum(sum(ws_sales_price)) + over (partition by ws_item_sk order by d_date rows between unbounded preceding and current row) cume_sales +from web_sales + ,date_dim +where ws_sold_date_sk=d_date_sk + and d_month_seq between 1214 and 1214+11 + and ws_item_sk is not NULL +group by ws_item_sk, d_date), +store_v1 as ( +select + ss_item_sk item_sk, d_date, + sum(sum(ss_sales_price)) + over (partition by ss_item_sk order by d_date rows between unbounded preceding and current row) cume_sales +from store_sales + ,date_dim +where ss_sold_date_sk=d_date_sk + and d_month_seq between 1214 and 1214+11 + and ss_item_sk is not NULL +group by ss_item_sk, d_date) + select * +from (select item_sk + ,d_date + ,web_sales + ,store_sales + ,max(web_sales) + over (partition by item_sk order by d_date rows between unbounded preceding and current row) web_cumulative + ,max(store_sales) + over (partition by item_sk order by d_date rows between unbounded preceding and current row) store_cumulative + from (select case when web.item_sk is not null then web.item_sk else store.item_sk end item_sk + ,case when web.d_date is not null then web.d_date else store.d_date end d_date + ,web.cume_sales web_sales + ,store.cume_sales store_sales + from web_v1 web full outer join store_v1 store on (web.item_sk = store.item_sk + and web.d_date = store.d_date) + )x )y +where web_cumulative > store_cumulative +order by item_sk + ,d_date +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query52.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query52.groovy new file mode 100644 index 00000000000000..2d4a8489f01241 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query52.groovy @@ -0,0 +1,67 @@ +/* + * 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. + */ + +suite("query52") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_52 ''' + explain shape plan + select dt.d_year + ,item.i_brand_id brand_id + ,item.i_brand brand + ,sum(ss_ext_sales_price) ext_price + from date_dim dt + ,store_sales + ,item + where dt.d_date_sk = store_sales.ss_sold_date_sk + and store_sales.ss_item_sk = item.i_item_sk + and item.i_manager_id = 1 + and dt.d_moy=12 + and dt.d_year=2000 + group by dt.d_year + ,item.i_brand + ,item.i_brand_id + order by dt.d_year + ,ext_price desc + ,brand_id +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query53.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query53.groovy new file mode 100644 index 00000000000000..3c50571c57950b --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query53.groovy @@ -0,0 +1,73 @@ +/* + * 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. + */ + +suite("query53") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_53 ''' + explain shape plan + select * from +(select i_manufact_id, +sum(ss_sales_price) sum_sales, +avg(sum(ss_sales_price)) over (partition by i_manufact_id) avg_quarterly_sales +from item, store_sales, date_dim, store +where ss_item_sk = i_item_sk and +ss_sold_date_sk = d_date_sk and +ss_store_sk = s_store_sk and +d_month_seq in (1212,1212+1,1212+2,1212+3,1212+4,1212+5,1212+6,1212+7,1212+8,1212+9,1212+10,1212+11) and +((i_category in ('Books','Children','Electronics') and +i_class in ('personal','portable','reference','self-help') and +i_brand in ('scholaramalgamalg #14','scholaramalgamalg #7', + 'exportiunivamalg #9','scholaramalgamalg #9')) +or(i_category in ('Women','Music','Men') and +i_class in ('accessories','classical','fragrances','pants') and +i_brand in ('amalgimporto #1','edu packscholar #1','exportiimporto #1', + 'importoamalg #1'))) +group by i_manufact_id, d_qoy ) tmp1 +where case when avg_quarterly_sales > 0 + then abs (sum_sales - avg_quarterly_sales)/ avg_quarterly_sales + else null end > 0.1 +order by avg_quarterly_sales, + sum_sales, + i_manufact_id +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query54.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query54.groovy new file mode 100644 index 00000000000000..277edbe3f33466 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query54.groovy @@ -0,0 +1,101 @@ +/* + * 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. + */ + +suite("query54") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_54 ''' + explain shape plan + with my_customers as ( + select distinct c_customer_sk + , c_current_addr_sk + from + ( select cs_sold_date_sk sold_date_sk, + cs_bill_customer_sk customer_sk, + cs_item_sk item_sk + from catalog_sales + union all + select ws_sold_date_sk sold_date_sk, + ws_bill_customer_sk customer_sk, + ws_item_sk item_sk + from web_sales + ) cs_or_ws_sales, + item, + date_dim, + customer + where sold_date_sk = d_date_sk + and item_sk = i_item_sk + and i_category = 'Books' + and i_class = 'business' + and c_customer_sk = cs_or_ws_sales.customer_sk + and d_moy = 2 + and d_year = 2000 + ) + , my_revenue as ( + select c_customer_sk, + sum(ss_ext_sales_price) as revenue + from my_customers, + store_sales, + customer_address, + store, + date_dim + where c_current_addr_sk = ca_address_sk + and ca_county = s_county + and ca_state = s_state + and ss_sold_date_sk = d_date_sk + and c_customer_sk = ss_customer_sk + and d_month_seq between (select distinct d_month_seq+1 + from date_dim where d_year = 2000 and d_moy = 2) + and (select distinct d_month_seq+3 + from date_dim where d_year = 2000 and d_moy = 2) + group by c_customer_sk + ) + , segments as + (select cast((revenue/50) as int) as segment + from my_revenue + ) + select segment, count(*) as num_customers, segment*50 as segment_base + from segments + group by segment + order by segment, num_customers + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query55.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query55.groovy new file mode 100644 index 00000000000000..407c432af68c2d --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query55.groovy @@ -0,0 +1,59 @@ +/* + * 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. + */ + +suite("query55") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_55 ''' + explain shape plan + select i_brand_id brand_id, i_brand brand, + sum(ss_ext_sales_price) ext_price + from date_dim, store_sales, item + where d_date_sk = ss_sold_date_sk + and ss_item_sk = i_item_sk + and i_manager_id=13 + and d_moy=11 + and d_year=1999 + group by i_brand, i_brand_id + order by ext_price desc, i_brand_id +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query56.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query56.groovy new file mode 100644 index 00000000000000..525032cc4c662e --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query56.groovy @@ -0,0 +1,114 @@ +/* + * 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. + */ + +suite("query56") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_56 ''' + explain shape plan + with ss as ( + select i_item_id,sum(ss_ext_sales_price) total_sales + from + store_sales, + date_dim, + customer_address, + item + where i_item_id in (select + i_item_id +from item +where i_color in ('chiffon','smoke','lace')) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 2001 + and d_moy = 5 + and ss_addr_sk = ca_address_sk + and ca_gmt_offset = -6 + group by i_item_id), + cs as ( + select i_item_id,sum(cs_ext_sales_price) total_sales + from + catalog_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from item +where i_color in ('chiffon','smoke','lace')) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 2001 + and d_moy = 5 + and cs_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -6 + group by i_item_id), + ws as ( + select i_item_id,sum(ws_ext_sales_price) total_sales + from + web_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from item +where i_color in ('chiffon','smoke','lace')) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 2001 + and d_moy = 5 + and ws_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -6 + group by i_item_id) + select i_item_id ,sum(total_sales) total_sales + from (select * from ss + union all + select * from cs + union all + select * from ws) tmp1 + group by i_item_id + order by total_sales, + i_item_id + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query57.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query57.groovy new file mode 100644 index 00000000000000..570ccdf8b625ce --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query57.groovy @@ -0,0 +1,93 @@ +/* + * 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. + */ + +suite("query57") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_57 ''' + explain shape plan + with v1 as( + select i_category, i_brand, + cc_name, + d_year, d_moy, + sum(cs_sales_price) sum_sales, + avg(sum(cs_sales_price)) over + (partition by i_category, i_brand, + cc_name, d_year) + avg_monthly_sales, + rank() over + (partition by i_category, i_brand, + cc_name + order by d_year, d_moy) rn + from item, catalog_sales, date_dim, call_center + where cs_item_sk = i_item_sk and + cs_sold_date_sk = d_date_sk and + cc_call_center_sk= cs_call_center_sk and + ( + d_year = 1999 or + ( d_year = 1999-1 and d_moy =12) or + ( d_year = 1999+1 and d_moy =1) + ) + group by i_category, i_brand, + cc_name , d_year, d_moy), + v2 as( + select v1.i_category, v1.i_brand + ,v1.d_year, v1.d_moy + ,v1.avg_monthly_sales + ,v1.sum_sales, v1_lag.sum_sales psum, v1_lead.sum_sales nsum + from v1, v1 v1_lag, v1 v1_lead + where v1.i_category = v1_lag.i_category and + v1.i_category = v1_lead.i_category and + v1.i_brand = v1_lag.i_brand and + v1.i_brand = v1_lead.i_brand and + v1. cc_name = v1_lag. cc_name and + v1. cc_name = v1_lead. cc_name and + v1.rn = v1_lag.rn + 1 and + v1.rn = v1_lead.rn - 1) + select * + from v2 + where d_year = 1999 and + avg_monthly_sales > 0 and + case when avg_monthly_sales > 0 then abs(sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1 + order by sum_sales - avg_monthly_sales, avg_monthly_sales + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query58.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query58.groovy new file mode 100644 index 00000000000000..ed78699b0b6610 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query58.groovy @@ -0,0 +1,110 @@ +/* + * 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. + */ + +suite("query58") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_58 ''' + explain shape plan + with ss_items as + (select i_item_id item_id + ,sum(ss_ext_sales_price) ss_item_rev + from store_sales + ,item + ,date_dim + where ss_item_sk = i_item_sk + and d_date in (select d_date + from date_dim + where d_week_seq = (select d_week_seq + from date_dim + where d_date = '1998-02-21')) + and ss_sold_date_sk = d_date_sk + group by i_item_id), + cs_items as + (select i_item_id item_id + ,sum(cs_ext_sales_price) cs_item_rev + from catalog_sales + ,item + ,date_dim + where cs_item_sk = i_item_sk + and d_date in (select d_date + from date_dim + where d_week_seq = (select d_week_seq + from date_dim + where d_date = '1998-02-21')) + and cs_sold_date_sk = d_date_sk + group by i_item_id), + ws_items as + (select i_item_id item_id + ,sum(ws_ext_sales_price) ws_item_rev + from web_sales + ,item + ,date_dim + where ws_item_sk = i_item_sk + and d_date in (select d_date + from date_dim + where d_week_seq =(select d_week_seq + from date_dim + where d_date = '1998-02-21')) + and ws_sold_date_sk = d_date_sk + group by i_item_id) + select ss_items.item_id + ,ss_item_rev + ,ss_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 ss_dev + ,cs_item_rev + ,cs_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 cs_dev + ,ws_item_rev + ,ws_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 ws_dev + ,(ss_item_rev+cs_item_rev+ws_item_rev)/3 average + from ss_items,cs_items,ws_items + where ss_items.item_id=cs_items.item_id + and ss_items.item_id=ws_items.item_id + and ss_item_rev between 0.9 * cs_item_rev and 1.1 * cs_item_rev + and ss_item_rev between 0.9 * ws_item_rev and 1.1 * ws_item_rev + and cs_item_rev between 0.9 * ss_item_rev and 1.1 * ss_item_rev + and cs_item_rev between 0.9 * ws_item_rev and 1.1 * ws_item_rev + and ws_item_rev between 0.9 * ss_item_rev and 1.1 * ss_item_rev + and ws_item_rev between 0.9 * cs_item_rev and 1.1 * cs_item_rev + order by item_id + ,ss_item_rev + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query59.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query59.groovy new file mode 100644 index 00000000000000..7c0e3126fb0095 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query59.groovy @@ -0,0 +1,89 @@ +/* + * 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. + */ + +suite("query59") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_59 ''' + explain shape plan + with wss as + (select d_week_seq, + ss_store_sk, + sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales, + sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales, + sum(case when (d_day_name='Tuesday') then ss_sales_price else null end) tue_sales, + sum(case when (d_day_name='Wednesday') then ss_sales_price else null end) wed_sales, + sum(case when (d_day_name='Thursday') then ss_sales_price else null end) thu_sales, + sum(case when (d_day_name='Friday') then ss_sales_price else null end) fri_sales, + sum(case when (d_day_name='Saturday') then ss_sales_price else null end) sat_sales + from store_sales,date_dim + where d_date_sk = ss_sold_date_sk + group by d_week_seq,ss_store_sk + ) + select s_store_name1,s_store_id1,d_week_seq1 + ,sun_sales1/sun_sales2,mon_sales1/mon_sales2 + ,tue_sales1/tue_sales2,wed_sales1/wed_sales2,thu_sales1/thu_sales2 + ,fri_sales1/fri_sales2,sat_sales1/sat_sales2 + from + (select s_store_name s_store_name1,wss.d_week_seq d_week_seq1 + ,s_store_id s_store_id1,sun_sales sun_sales1 + ,mon_sales mon_sales1,tue_sales tue_sales1 + ,wed_sales wed_sales1,thu_sales thu_sales1 + ,fri_sales fri_sales1,sat_sales sat_sales1 + from wss,store,date_dim d + where d.d_week_seq = wss.d_week_seq and + ss_store_sk = s_store_sk and + d_month_seq between 1205 and 1205 + 11) y, + (select s_store_name s_store_name2,wss.d_week_seq d_week_seq2 + ,s_store_id s_store_id2,sun_sales sun_sales2 + ,mon_sales mon_sales2,tue_sales tue_sales2 + ,wed_sales wed_sales2,thu_sales thu_sales2 + ,fri_sales fri_sales2,sat_sales sat_sales2 + from wss,store,date_dim d + where d.d_week_seq = wss.d_week_seq and + ss_store_sk = s_store_sk and + d_month_seq between 1205+ 12 and 1205 + 23) x + where s_store_id1=s_store_id2 + and d_week_seq1=d_week_seq2-52 + order by s_store_name1,s_store_id1,d_week_seq1 +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query6.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query6.groovy new file mode 100644 index 00000000000000..e51edf7df0a8f0 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query6.groovy @@ -0,0 +1,71 @@ +/* + * 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. + */ + +suite("query6") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_6 ''' + explain shape plan + select a.ca_state state, count(*) cnt + from customer_address a + ,customer c + ,store_sales s + ,date_dim d + ,item i + where a.ca_address_sk = c.c_current_addr_sk + and c.c_customer_sk = s.ss_customer_sk + and s.ss_sold_date_sk = d.d_date_sk + and s.ss_item_sk = i.i_item_sk + and d.d_month_seq = + (select distinct (d_month_seq) + from date_dim + where d_year = 2002 + and d_moy = 3 ) + and i.i_current_price > 1.2 * + (select avg(j.i_current_price) + from item j + where j.i_category = i.i_category) + group by a.ca_state + having count(*) >= 10 + order by cnt, a.ca_state + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query60.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query60.groovy new file mode 100644 index 00000000000000..595f8dd65a0f58 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query60.groovy @@ -0,0 +1,123 @@ +/* + * 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. + */ + +suite("query60") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_60 ''' + explain shape plan + with ss as ( + select + i_item_id,sum(ss_ext_sales_price) total_sales + from + store_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from + item +where i_category in ('Children')) + and ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and d_year = 1998 + and d_moy = 10 + and ss_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_item_id), + cs as ( + select + i_item_id,sum(cs_ext_sales_price) total_sales + from + catalog_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from + item +where i_category in ('Children')) + and cs_item_sk = i_item_sk + and cs_sold_date_sk = d_date_sk + and d_year = 1998 + and d_moy = 10 + and cs_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_item_id), + ws as ( + select + i_item_id,sum(ws_ext_sales_price) total_sales + from + web_sales, + date_dim, + customer_address, + item + where + i_item_id in (select + i_item_id +from + item +where i_category in ('Children')) + and ws_item_sk = i_item_sk + and ws_sold_date_sk = d_date_sk + and d_year = 1998 + and d_moy = 10 + and ws_bill_addr_sk = ca_address_sk + and ca_gmt_offset = -5 + group by i_item_id) + select + i_item_id +,sum(total_sales) total_sales + from (select * from ss + union all + select * from cs + union all + select * from ws) tmp1 + group by i_item_id + order by i_item_id + ,total_sales + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query61.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query61.groovy new file mode 100644 index 00000000000000..9078b2735829e2 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query61.groovy @@ -0,0 +1,89 @@ +/* + * 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. + */ + +suite("query61") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_61 ''' + explain shape plan + select promotions,total,cast(promotions as decimal(15,4))/cast(total as decimal(15,4))*100 +from + (select sum(ss_ext_sales_price) promotions + from store_sales + ,store + ,promotion + ,date_dim + ,customer + ,customer_address + ,item + where ss_sold_date_sk = d_date_sk + and ss_store_sk = s_store_sk + and ss_promo_sk = p_promo_sk + and ss_customer_sk= c_customer_sk + and ca_address_sk = c_current_addr_sk + and ss_item_sk = i_item_sk + and ca_gmt_offset = -6 + and i_category = 'Sports' + and (p_channel_dmail = 'Y' or p_channel_email = 'Y' or p_channel_tv = 'Y') + and s_gmt_offset = -6 + and d_year = 2001 + and d_moy = 12) promotional_sales, + (select sum(ss_ext_sales_price) total + from store_sales + ,store + ,date_dim + ,customer + ,customer_address + ,item + where ss_sold_date_sk = d_date_sk + and ss_store_sk = s_store_sk + and ss_customer_sk= c_customer_sk + and ca_address_sk = c_current_addr_sk + and ss_item_sk = i_item_sk + and ca_gmt_offset = -6 + and i_category = 'Sports' + and s_gmt_offset = -6 + and d_year = 2001 + and d_moy = 12) all_sales +order by promotions, total +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query62.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query62.groovy new file mode 100644 index 00000000000000..cf01109c779294 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query62.groovy @@ -0,0 +1,80 @@ +/* + * 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. + */ + +suite("query62") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_62 ''' + explain shape plan + select + substr(w_warehouse_name,1,20) + ,sm_type + ,web_name + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk <= 30 ) then 1 else 0 end) as "30 days" + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 30) and + (ws_ship_date_sk - ws_sold_date_sk <= 60) then 1 else 0 end ) as "31-60 days" + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 60) and + (ws_ship_date_sk - ws_sold_date_sk <= 90) then 1 else 0 end) as "61-90 days" + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 90) and + (ws_ship_date_sk - ws_sold_date_sk <= 120) then 1 else 0 end) as "91-120 days" + ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 120) then 1 else 0 end) as ">120 days" +from + web_sales + ,warehouse + ,ship_mode + ,web_site + ,date_dim +where + d_month_seq between 1215 and 1215 + 11 +and ws_ship_date_sk = d_date_sk +and ws_warehouse_sk = w_warehouse_sk +and ws_ship_mode_sk = sm_ship_mode_sk +and ws_web_site_sk = web_site_sk +group by + substr(w_warehouse_name,1,20) + ,sm_type + ,web_name +order by substr(w_warehouse_name,1,20) + ,sm_type + ,web_name +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query63.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query63.groovy new file mode 100644 index 00000000000000..17f99583c11ee9 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query63.groovy @@ -0,0 +1,74 @@ +/* + * 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. + */ + +suite("query63") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_63 ''' + explain shape plan + select * +from (select i_manager_id + ,sum(ss_sales_price) sum_sales + ,avg(sum(ss_sales_price)) over (partition by i_manager_id) avg_monthly_sales + from item + ,store_sales + ,date_dim + ,store + where ss_item_sk = i_item_sk + and ss_sold_date_sk = d_date_sk + and ss_store_sk = s_store_sk + and d_month_seq in (1211,1211+1,1211+2,1211+3,1211+4,1211+5,1211+6,1211+7,1211+8,1211+9,1211+10,1211+11) + and (( i_category in ('Books','Children','Electronics') + and i_class in ('personal','portable','reference','self-help') + and i_brand in ('scholaramalgamalg #14','scholaramalgamalg #7', + 'exportiunivamalg #9','scholaramalgamalg #9')) + or( i_category in ('Women','Music','Men') + and i_class in ('accessories','classical','fragrances','pants') + and i_brand in ('amalgimporto #1','edu packscholar #1','exportiimporto #1', + 'importoamalg #1'))) +group by i_manager_id, d_moy) tmp1 +where case when avg_monthly_sales > 0 then abs (sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1 +order by i_manager_id + ,avg_monthly_sales + ,sum_sales +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query64.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query64.groovy new file mode 100644 index 00000000000000..82087de873ceff --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query64.groovy @@ -0,0 +1,166 @@ +/* + * 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. + */ + +suite("query64") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_64 ''' + explain shape plan + with cs_ui as + (select cs_item_sk + ,sum(cs_ext_list_price) as sale,sum(cr_refunded_cash+cr_reversed_charge+cr_store_credit) as refund + from catalog_sales + ,catalog_returns + where cs_item_sk = cr_item_sk + and cs_order_number = cr_order_number + group by cs_item_sk + having sum(cs_ext_list_price)>2*sum(cr_refunded_cash+cr_reversed_charge+cr_store_credit)), +cross_sales as + (select i_product_name product_name + ,i_item_sk item_sk + ,s_store_name store_name + ,s_zip store_zip + ,ad1.ca_street_number b_street_number + ,ad1.ca_street_name b_street_name + ,ad1.ca_city b_city + ,ad1.ca_zip b_zip + ,ad2.ca_street_number c_street_number + ,ad2.ca_street_name c_street_name + ,ad2.ca_city c_city + ,ad2.ca_zip c_zip + ,d1.d_year as syear + ,d2.d_year as fsyear + ,d3.d_year s2year + ,count(*) cnt + ,sum(ss_wholesale_cost) s1 + ,sum(ss_list_price) s2 + ,sum(ss_coupon_amt) s3 + FROM store_sales + ,store_returns + ,cs_ui + ,date_dim d1 + ,date_dim d2 + ,date_dim d3 + ,store + ,customer + ,customer_demographics cd1 + ,customer_demographics cd2 + ,promotion + ,household_demographics hd1 + ,household_demographics hd2 + ,customer_address ad1 + ,customer_address ad2 + ,income_band ib1 + ,income_band ib2 + ,item + WHERE ss_store_sk = s_store_sk AND + ss_sold_date_sk = d1.d_date_sk AND + ss_customer_sk = c_customer_sk AND + ss_cdemo_sk= cd1.cd_demo_sk AND + ss_hdemo_sk = hd1.hd_demo_sk AND + ss_addr_sk = ad1.ca_address_sk and + ss_item_sk = i_item_sk and + ss_item_sk = sr_item_sk and + ss_ticket_number = sr_ticket_number and + ss_item_sk = cs_ui.cs_item_sk and + c_current_cdemo_sk = cd2.cd_demo_sk AND + c_current_hdemo_sk = hd2.hd_demo_sk AND + c_current_addr_sk = ad2.ca_address_sk and + c_first_sales_date_sk = d2.d_date_sk and + c_first_shipto_date_sk = d3.d_date_sk and + ss_promo_sk = p_promo_sk and + hd1.hd_income_band_sk = ib1.ib_income_band_sk and + hd2.hd_income_band_sk = ib2.ib_income_band_sk and + cd1.cd_marital_status <> cd2.cd_marital_status and + i_color in ('azure','gainsboro','misty','blush','hot','lemon') and + i_current_price between 80 and 80 + 10 and + i_current_price between 80 + 1 and 80 + 15 +group by i_product_name + ,i_item_sk + ,s_store_name + ,s_zip + ,ad1.ca_street_number + ,ad1.ca_street_name + ,ad1.ca_city + ,ad1.ca_zip + ,ad2.ca_street_number + ,ad2.ca_street_name + ,ad2.ca_city + ,ad2.ca_zip + ,d1.d_year + ,d2.d_year + ,d3.d_year +) +select cs1.product_name + ,cs1.store_name + ,cs1.store_zip + ,cs1.b_street_number + ,cs1.b_street_name + ,cs1.b_city + ,cs1.b_zip + ,cs1.c_street_number + ,cs1.c_street_name + ,cs1.c_city + ,cs1.c_zip + ,cs1.syear + ,cs1.cnt + ,cs1.s1 as s11 + ,cs1.s2 as s21 + ,cs1.s3 as s31 + ,cs2.s1 as s12 + ,cs2.s2 as s22 + ,cs2.s3 as s32 + ,cs2.syear + ,cs2.cnt +from cross_sales cs1,cross_sales cs2 +where cs1.item_sk=cs2.item_sk and + cs1.syear = 1999 and + cs2.syear = 1999 + 1 and + cs2.cnt <= cs1.cnt and + cs1.store_name = cs2.store_name and + cs1.store_zip = cs2.store_zip +order by cs1.product_name + ,cs1.store_name + ,cs2.cnt + ,cs1.s1 + ,cs2.s1 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query65.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query65.groovy new file mode 100644 index 00000000000000..6369f02078c700 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query65.groovy @@ -0,0 +1,74 @@ +/* + * 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. + */ + +suite("query65") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_65 ''' + explain shape plan + select + s_store_name, + i_item_desc, + sc.revenue, + i_current_price, + i_wholesale_cost, + i_brand + from store, item, + (select ss_store_sk, avg(revenue) as ave + from + (select ss_store_sk, ss_item_sk, + sum(ss_sales_price) as revenue + from store_sales, date_dim + where ss_sold_date_sk = d_date_sk and d_month_seq between 1186 and 1186+11 + group by ss_store_sk, ss_item_sk) sa + group by ss_store_sk) sb, + (select ss_store_sk, ss_item_sk, sum(ss_sales_price) as revenue + from store_sales, date_dim + where ss_sold_date_sk = d_date_sk and d_month_seq between 1186 and 1186+11 + group by ss_store_sk, ss_item_sk) sc + where sb.ss_store_sk = sc.ss_store_sk and + sc.revenue <= 0.1 * sb.ave and + s_store_sk = sc.ss_store_sk and + i_item_sk = sc.ss_item_sk + order by s_store_name, i_item_desc +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query66.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query66.groovy new file mode 100644 index 00000000000000..450c224b70963b --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query66.groovy @@ -0,0 +1,265 @@ +/* + * 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. + */ + +suite("query66") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_66 ''' + explain shape plan + select + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,ship_carriers + ,year + ,sum(jan_sales) as jan_sales + ,sum(feb_sales) as feb_sales + ,sum(mar_sales) as mar_sales + ,sum(apr_sales) as apr_sales + ,sum(may_sales) as may_sales + ,sum(jun_sales) as jun_sales + ,sum(jul_sales) as jul_sales + ,sum(aug_sales) as aug_sales + ,sum(sep_sales) as sep_sales + ,sum(oct_sales) as oct_sales + ,sum(nov_sales) as nov_sales + ,sum(dec_sales) as dec_sales + ,sum(jan_sales/w_warehouse_sq_ft) as jan_sales_per_sq_foot + ,sum(feb_sales/w_warehouse_sq_ft) as feb_sales_per_sq_foot + ,sum(mar_sales/w_warehouse_sq_ft) as mar_sales_per_sq_foot + ,sum(apr_sales/w_warehouse_sq_ft) as apr_sales_per_sq_foot + ,sum(may_sales/w_warehouse_sq_ft) as may_sales_per_sq_foot + ,sum(jun_sales/w_warehouse_sq_ft) as jun_sales_per_sq_foot + ,sum(jul_sales/w_warehouse_sq_ft) as jul_sales_per_sq_foot + ,sum(aug_sales/w_warehouse_sq_ft) as aug_sales_per_sq_foot + ,sum(sep_sales/w_warehouse_sq_ft) as sep_sales_per_sq_foot + ,sum(oct_sales/w_warehouse_sq_ft) as oct_sales_per_sq_foot + ,sum(nov_sales/w_warehouse_sq_ft) as nov_sales_per_sq_foot + ,sum(dec_sales/w_warehouse_sq_ft) as dec_sales_per_sq_foot + ,sum(jan_net) as jan_net + ,sum(feb_net) as feb_net + ,sum(mar_net) as mar_net + ,sum(apr_net) as apr_net + ,sum(may_net) as may_net + ,sum(jun_net) as jun_net + ,sum(jul_net) as jul_net + ,sum(aug_net) as aug_net + ,sum(sep_net) as sep_net + ,sum(oct_net) as oct_net + ,sum(nov_net) as nov_net + ,sum(dec_net) as dec_net + from ( + select + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,concat(concat('MSC ', ','), ' GERMA') as ship_carriers + ,d_year as year + ,sum(case when d_moy = 1 + then ws_sales_price* ws_quantity else 0 end) as jan_sales + ,sum(case when d_moy = 2 + then ws_sales_price* ws_quantity else 0 end) as feb_sales + ,sum(case when d_moy = 3 + then ws_sales_price* ws_quantity else 0 end) as mar_sales + ,sum(case when d_moy = 4 + then ws_sales_price* ws_quantity else 0 end) as apr_sales + ,sum(case when d_moy = 5 + then ws_sales_price* ws_quantity else 0 end) as may_sales + ,sum(case when d_moy = 6 + then ws_sales_price* ws_quantity else 0 end) as jun_sales + ,sum(case when d_moy = 7 + then ws_sales_price* ws_quantity else 0 end) as jul_sales + ,sum(case when d_moy = 8 + then ws_sales_price* ws_quantity else 0 end) as aug_sales + ,sum(case when d_moy = 9 + then ws_sales_price* ws_quantity else 0 end) as sep_sales + ,sum(case when d_moy = 10 + then ws_sales_price* ws_quantity else 0 end) as oct_sales + ,sum(case when d_moy = 11 + then ws_sales_price* ws_quantity else 0 end) as nov_sales + ,sum(case when d_moy = 12 + then ws_sales_price* ws_quantity else 0 end) as dec_sales + ,sum(case when d_moy = 1 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as jan_net + ,sum(case when d_moy = 2 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as feb_net + ,sum(case when d_moy = 3 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as mar_net + ,sum(case when d_moy = 4 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as apr_net + ,sum(case when d_moy = 5 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as may_net + ,sum(case when d_moy = 6 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as jun_net + ,sum(case when d_moy = 7 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as jul_net + ,sum(case when d_moy = 8 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as aug_net + ,sum(case when d_moy = 9 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as sep_net + ,sum(case when d_moy = 10 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as oct_net + ,sum(case when d_moy = 11 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as nov_net + ,sum(case when d_moy = 12 + then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as dec_net + from + web_sales + ,warehouse + ,date_dim + ,time_dim + ,ship_mode + where + ws_warehouse_sk = w_warehouse_sk + and ws_sold_date_sk = d_date_sk + and ws_sold_time_sk = t_time_sk + and ws_ship_mode_sk = sm_ship_mode_sk + and d_year = 2001 + and t_time between 9453 and 9453+28800 + and sm_carrier in ('MSC','GERMA') + group by + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,d_year + union all + select + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,concat(concat('MSC ', ','), ' GERMA') as ship_carriers + ,d_year as year + ,sum(case when d_moy = 1 + then cs_ext_list_price* cs_quantity else 0 end) as jan_sales + ,sum(case when d_moy = 2 + then cs_ext_list_price* cs_quantity else 0 end) as feb_sales + ,sum(case when d_moy = 3 + then cs_ext_list_price* cs_quantity else 0 end) as mar_sales + ,sum(case when d_moy = 4 + then cs_ext_list_price* cs_quantity else 0 end) as apr_sales + ,sum(case when d_moy = 5 + then cs_ext_list_price* cs_quantity else 0 end) as may_sales + ,sum(case when d_moy = 6 + then cs_ext_list_price* cs_quantity else 0 end) as jun_sales + ,sum(case when d_moy = 7 + then cs_ext_list_price* cs_quantity else 0 end) as jul_sales + ,sum(case when d_moy = 8 + then cs_ext_list_price* cs_quantity else 0 end) as aug_sales + ,sum(case when d_moy = 9 + then cs_ext_list_price* cs_quantity else 0 end) as sep_sales + ,sum(case when d_moy = 10 + then cs_ext_list_price* cs_quantity else 0 end) as oct_sales + ,sum(case when d_moy = 11 + then cs_ext_list_price* cs_quantity else 0 end) as nov_sales + ,sum(case when d_moy = 12 + then cs_ext_list_price* cs_quantity else 0 end) as dec_sales + ,sum(case when d_moy = 1 + then cs_net_paid_inc_ship * cs_quantity else 0 end) as jan_net + ,sum(case when d_moy = 2 + then cs_net_paid_inc_ship * cs_quantity else 0 end) as feb_net + ,sum(case when d_moy = 3 + then cs_net_paid_inc_ship * cs_quantity else 0 end) as mar_net + ,sum(case when d_moy = 4 + then cs_net_paid_inc_ship * cs_quantity else 0 end) as apr_net + ,sum(case when d_moy = 5 + then cs_net_paid_inc_ship * cs_quantity else 0 end) as may_net + ,sum(case when d_moy = 6 + then cs_net_paid_inc_ship * cs_quantity else 0 end) as jun_net + ,sum(case when d_moy = 7 + then cs_net_paid_inc_ship * cs_quantity else 0 end) as jul_net + ,sum(case when d_moy = 8 + then cs_net_paid_inc_ship * cs_quantity else 0 end) as aug_net + ,sum(case when d_moy = 9 + then cs_net_paid_inc_ship * cs_quantity else 0 end) as sep_net + ,sum(case when d_moy = 10 + then cs_net_paid_inc_ship * cs_quantity else 0 end) as oct_net + ,sum(case when d_moy = 11 + then cs_net_paid_inc_ship * cs_quantity else 0 end) as nov_net + ,sum(case when d_moy = 12 + then cs_net_paid_inc_ship * cs_quantity else 0 end) as dec_net + from + catalog_sales + ,warehouse + ,date_dim + ,time_dim + ,ship_mode + where + cs_warehouse_sk = w_warehouse_sk + and cs_sold_date_sk = d_date_sk + and cs_sold_time_sk = t_time_sk + and cs_ship_mode_sk = sm_ship_mode_sk + and d_year = 2001 + and t_time between 9453 AND 9453+28800 + and sm_carrier in ('MSC','GERMA') + group by + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,d_year + ) x + group by + w_warehouse_name + ,w_warehouse_sq_ft + ,w_city + ,w_county + ,w_state + ,w_country + ,ship_carriers + ,year + order by w_warehouse_name + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query67.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query67.groovy new file mode 100644 index 00000000000000..9c066e838416a6 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query67.groovy @@ -0,0 +1,89 @@ +/* + * 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. + */ + +suite("query67") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_67 ''' + explain shape plan + select * +from (select i_category + ,i_class + ,i_brand + ,i_product_name + ,d_year + ,d_qoy + ,d_moy + ,s_store_id + ,sumsales + ,rank() over (partition by i_category order by sumsales desc) rk + from (select i_category + ,i_class + ,i_brand + ,i_product_name + ,d_year + ,d_qoy + ,d_moy + ,s_store_id + ,sum(coalesce(ss_sales_price*ss_quantity,0)) sumsales + from store_sales + ,date_dim + ,store + ,item + where ss_sold_date_sk=d_date_sk + and ss_item_sk=i_item_sk + and ss_store_sk = s_store_sk + and d_month_seq between 1185 and 1185+11 + group by rollup(i_category, i_class, i_brand, i_product_name, d_year, d_qoy, d_moy,s_store_id))dw1) dw2 +where rk <= 100 +order by i_category + ,i_class + ,i_brand + ,i_product_name + ,d_year + ,d_qoy + ,d_moy + ,s_store_id + ,sumsales + ,rk +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query68.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query68.groovy new file mode 100644 index 00000000000000..ada357640a4b0c --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query68.groovy @@ -0,0 +1,87 @@ +/* + * 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. + */ + +suite("query68") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_68 ''' + explain shape plan + select c_last_name + ,c_first_name + ,ca_city + ,bought_city + ,ss_ticket_number + ,extended_price + ,extended_tax + ,list_price + from (select ss_ticket_number + ,ss_customer_sk + ,ca_city bought_city + ,sum(ss_ext_sales_price) extended_price + ,sum(ss_ext_list_price) list_price + ,sum(ss_ext_tax) extended_tax + from store_sales + ,date_dim + ,store + ,household_demographics + ,customer_address + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and store_sales.ss_addr_sk = customer_address.ca_address_sk + and date_dim.d_dom between 1 and 2 + and (household_demographics.hd_dep_count = 4 or + household_demographics.hd_vehicle_count= 0) + and date_dim.d_year in (1999,1999+1,1999+2) + and store.s_city in ('Pleasant Hill','Bethel') + group by ss_ticket_number + ,ss_customer_sk + ,ss_addr_sk,ca_city) dn + ,customer + ,customer_address current_addr + where ss_customer_sk = c_customer_sk + and customer.c_current_addr_sk = current_addr.ca_address_sk + and current_addr.ca_city <> bought_city + order by c_last_name + ,ss_ticket_number + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query69.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query69.groovy new file mode 100644 index 00000000000000..73e9ebdd0529f5 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query69.groovy @@ -0,0 +1,92 @@ +/* + * 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. + */ + +suite("query69") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_69 ''' + explain shape plan + select + cd_gender, + cd_marital_status, + cd_education_status, + count(*) cnt1, + cd_purchase_estimate, + count(*) cnt2, + cd_credit_rating, + count(*) cnt3 + from + customer c,customer_address ca,customer_demographics + where + c.c_current_addr_sk = ca.ca_address_sk and + ca_state in ('MO','MN','AZ') and + cd_demo_sk = c.c_current_cdemo_sk and + exists (select * + from store_sales,date_dim + where c.c_customer_sk = ss_customer_sk and + ss_sold_date_sk = d_date_sk and + d_year = 2003 and + d_moy between 2 and 2+2) and + (not exists (select * + from web_sales,date_dim + where c.c_customer_sk = ws_bill_customer_sk and + ws_sold_date_sk = d_date_sk and + d_year = 2003 and + d_moy between 2 and 2+2) and + not exists (select * + from catalog_sales,date_dim + where c.c_customer_sk = cs_ship_customer_sk and + cs_sold_date_sk = d_date_sk and + d_year = 2003 and + d_moy between 2 and 2+2)) + group by cd_gender, + cd_marital_status, + cd_education_status, + cd_purchase_estimate, + cd_credit_rating + order by cd_gender, + cd_marital_status, + cd_education_status, + cd_purchase_estimate, + cd_credit_rating + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query7.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query7.groovy new file mode 100644 index 00000000000000..cb18f6341a43ca --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query7.groovy @@ -0,0 +1,66 @@ +/* + * 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. + */ + +suite("query7") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_7 ''' + explain shape plan + select i_item_id, + avg(ss_quantity) agg1, + avg(ss_list_price) agg2, + avg(ss_coupon_amt) agg3, + avg(ss_sales_price) agg4 + from store_sales, customer_demographics, date_dim, item, promotion + where ss_sold_date_sk = d_date_sk and + ss_item_sk = i_item_sk and + ss_cdemo_sk = cd_demo_sk and + ss_promo_sk = p_promo_sk and + cd_gender = 'F' and + cd_marital_status = 'W' and + cd_education_status = 'College' and + (p_channel_email = 'N' or p_channel_event = 'N') and + d_year = 2001 + group by i_item_id + order by i_item_id + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query70.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query70.groovy new file mode 100644 index 00000000000000..79b189284e60fa --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query70.groovy @@ -0,0 +1,83 @@ +/* + * 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. + */ + +suite("query70") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_70 ''' + explain shape plan + select + sum(ss_net_profit) as total_sum + ,s_state + ,s_county + ,grouping(s_state)+grouping(s_county) as lochierarchy + ,rank() over ( + partition by grouping(s_state)+grouping(s_county), + case when grouping(s_county) = 0 then s_state end + order by sum(ss_net_profit) desc) as rank_within_parent + from + store_sales + ,date_dim d1 + ,store + where + d1.d_month_seq between 1218 and 1218+11 + and d1.d_date_sk = ss_sold_date_sk + and s_store_sk = ss_store_sk + and s_state in + ( select s_state + from (select s_state as s_state, + rank() over ( partition by s_state order by sum(ss_net_profit) desc) as ranking + from store_sales, store, date_dim + where d_month_seq between 1218 and 1218+11 + and d_date_sk = ss_sold_date_sk + and s_store_sk = ss_store_sk + group by s_state + ) tmp1 + where ranking <= 5 + ) + group by rollup(s_state,s_county) + order by + lochierarchy desc + ,case when lochierarchy = 0 then s_state end + ,rank_within_parent + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query71.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query71.groovy new file mode 100644 index 00000000000000..6bfb2633732647 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query71.groovy @@ -0,0 +1,85 @@ +/* + * 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. + */ + +suite("query71") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_71 ''' + explain shape plan + select i_brand_id brand_id, i_brand brand,t_hour,t_minute, + sum(ext_price) ext_price + from item, (select ws_ext_sales_price as ext_price, + ws_sold_date_sk as sold_date_sk, + ws_item_sk as sold_item_sk, + ws_sold_time_sk as time_sk + from web_sales,date_dim + where d_date_sk = ws_sold_date_sk + and d_moy=12 + and d_year=2000 + union all + select cs_ext_sales_price as ext_price, + cs_sold_date_sk as sold_date_sk, + cs_item_sk as sold_item_sk, + cs_sold_time_sk as time_sk + from catalog_sales,date_dim + where d_date_sk = cs_sold_date_sk + and d_moy=12 + and d_year=2000 + union all + select ss_ext_sales_price as ext_price, + ss_sold_date_sk as sold_date_sk, + ss_item_sk as sold_item_sk, + ss_sold_time_sk as time_sk + from store_sales,date_dim + where d_date_sk = ss_sold_date_sk + and d_moy=12 + and d_year=2000 + ) tmp,time_dim + where + sold_item_sk = i_item_sk + and i_manager_id=1 + and time_sk = t_time_sk + and (t_meal_time = 'breakfast' or t_meal_time = 'dinner') + group by i_brand, i_brand_id,t_hour,t_minute + order by ext_price desc, i_brand_id + + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query72.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query72.groovy new file mode 100644 index 00000000000000..9ef1f85a4d6505 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query72.groovy @@ -0,0 +1,74 @@ +/* + * 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. + */ + +suite("query72") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_72 ''' + explain shape plan + select i_item_desc + ,w_warehouse_name + ,d1.d_week_seq + ,sum(case when p_promo_sk is null then 1 else 0 end) no_promo + ,sum(case when p_promo_sk is not null then 1 else 0 end) promo + ,count(*) total_cnt +from catalog_sales +join inventory on (cs_item_sk = inv_item_sk) +join warehouse on (w_warehouse_sk=inv_warehouse_sk) +join item on (i_item_sk = cs_item_sk) +join customer_demographics on (cs_bill_cdemo_sk = cd_demo_sk) +join household_demographics on (cs_bill_hdemo_sk = hd_demo_sk) +join date_dim d1 on (cs_sold_date_sk = d1.d_date_sk) +join date_dim d2 on (inv_date_sk = d2.d_date_sk) +join date_dim d3 on (cs_ship_date_sk = d3.d_date_sk) +left outer join promotion on (cs_promo_sk=p_promo_sk) +left outer join catalog_returns on (cr_item_sk = cs_item_sk and cr_order_number = cs_order_number) +where d1.d_week_seq = d2.d_week_seq + and inv_quantity_on_hand < cs_quantity + and d3.d_date > d1.d_date + 5 + and hd_buy_potential = '1001-5000' + and d1.d_year = 2000 + and cd_marital_status = 'D' +group by i_item_desc,w_warehouse_name,d1.d_week_seq +order by total_cnt desc, i_item_desc, w_warehouse_name, d_week_seq +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query73.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query73.groovy new file mode 100644 index 00000000000000..1da37f1f77c904 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query73.groovy @@ -0,0 +1,73 @@ +/* + * 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. + */ + +suite("query73") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_73 ''' + explain shape plan + select c_last_name + ,c_first_name + ,c_salutation + ,c_preferred_cust_flag + ,ss_ticket_number + ,cnt from + (select ss_ticket_number + ,ss_customer_sk + ,count(*) cnt + from store_sales,date_dim,store,household_demographics + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and date_dim.d_dom between 1 and 2 + and (household_demographics.hd_buy_potential = '>10000' or + household_demographics.hd_buy_potential = '5001-10000') + and household_demographics.hd_vehicle_count > 0 + and case when household_demographics.hd_vehicle_count > 0 then + household_demographics.hd_dep_count/ household_demographics.hd_vehicle_count else null end > 1 + and date_dim.d_year in (2000,2000+1,2000+2) + and store.s_county in ('Lea County','Furnas County','Pennington County','Bronx County') + group by ss_ticket_number,ss_customer_sk) dj,customer + where ss_customer_sk = c_customer_sk + and cnt between 1 and 5 + order by cnt desc, c_last_name asc + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query74.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query74.groovy new file mode 100644 index 00000000000000..fb06f43c8520bb --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query74.groovy @@ -0,0 +1,106 @@ +/* + * 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. + */ + +suite("query74") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_74 ''' + explain shape plan + with year_total as ( + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,d_year as year + ,sum(ss_net_paid) year_total + ,'s' sale_type + from customer + ,store_sales + ,date_dim + where c_customer_sk = ss_customer_sk + and ss_sold_date_sk = d_date_sk + and d_year in (1998,1998+1) + group by c_customer_id + ,c_first_name + ,c_last_name + ,d_year + union all + select c_customer_id customer_id + ,c_first_name customer_first_name + ,c_last_name customer_last_name + ,d_year as year + ,sum(ws_net_paid) year_total + ,'w' sale_type + from customer + ,web_sales + ,date_dim + where c_customer_sk = ws_bill_customer_sk + and ws_sold_date_sk = d_date_sk + and d_year in (1998,1998+1) + group by c_customer_id + ,c_first_name + ,c_last_name + ,d_year + ) + select + t_s_secyear.customer_id, t_s_secyear.customer_first_name, t_s_secyear.customer_last_name + from year_total t_s_firstyear + ,year_total t_s_secyear + ,year_total t_w_firstyear + ,year_total t_w_secyear + where t_s_secyear.customer_id = t_s_firstyear.customer_id + and t_s_firstyear.customer_id = t_w_secyear.customer_id + and t_s_firstyear.customer_id = t_w_firstyear.customer_id + and t_s_firstyear.sale_type = 's' + and t_w_firstyear.sale_type = 'w' + and t_s_secyear.sale_type = 's' + and t_w_secyear.sale_type = 'w' + and t_s_firstyear.year = 1998 + and t_s_secyear.year = 1998+1 + and t_w_firstyear.year = 1998 + and t_w_secyear.year = 1998+1 + and t_s_firstyear.year_total > 0 + and t_w_firstyear.year_total > 0 + and case when t_w_firstyear.year_total > 0 then t_w_secyear.year_total / t_w_firstyear.year_total else null end + > case when t_s_firstyear.year_total > 0 then t_s_secyear.year_total / t_s_firstyear.year_total else null end + order by 3,1,2 +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query75.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query75.groovy new file mode 100644 index 00000000000000..8dec01afbd9f1c --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query75.groovy @@ -0,0 +1,115 @@ +/* + * 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. + */ + +suite("query75") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_75 ''' + explain shape plan + WITH all_sales AS ( + SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,SUM(sales_cnt) AS sales_cnt + ,SUM(sales_amt) AS sales_amt + FROM (SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,cs_quantity - COALESCE(cr_return_quantity,0) AS sales_cnt + ,cs_ext_sales_price - COALESCE(cr_return_amount,0.0) AS sales_amt + FROM catalog_sales JOIN item ON i_item_sk=cs_item_sk + JOIN date_dim ON d_date_sk=cs_sold_date_sk + LEFT JOIN catalog_returns ON (cs_order_number=cr_order_number + AND cs_item_sk=cr_item_sk) + WHERE i_category='Sports' + UNION + SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,ss_quantity - COALESCE(sr_return_quantity,0) AS sales_cnt + ,ss_ext_sales_price - COALESCE(sr_return_amt,0.0) AS sales_amt + FROM store_sales JOIN item ON i_item_sk=ss_item_sk + JOIN date_dim ON d_date_sk=ss_sold_date_sk + LEFT JOIN store_returns ON (ss_ticket_number=sr_ticket_number + AND ss_item_sk=sr_item_sk) + WHERE i_category='Sports' + UNION + SELECT d_year + ,i_brand_id + ,i_class_id + ,i_category_id + ,i_manufact_id + ,ws_quantity - COALESCE(wr_return_quantity,0) AS sales_cnt + ,ws_ext_sales_price - COALESCE(wr_return_amt,0.0) AS sales_amt + FROM web_sales JOIN item ON i_item_sk=ws_item_sk + JOIN date_dim ON d_date_sk=ws_sold_date_sk + LEFT JOIN web_returns ON (ws_order_number=wr_order_number + AND ws_item_sk=wr_item_sk) + WHERE i_category='Sports') sales_detail + GROUP BY d_year, i_brand_id, i_class_id, i_category_id, i_manufact_id) + SELECT prev_yr.d_year AS prev_year + ,curr_yr.d_year AS year + ,curr_yr.i_brand_id + ,curr_yr.i_class_id + ,curr_yr.i_category_id + ,curr_yr.i_manufact_id + ,prev_yr.sales_cnt AS prev_yr_cnt + ,curr_yr.sales_cnt AS curr_yr_cnt + ,curr_yr.sales_cnt-prev_yr.sales_cnt AS sales_cnt_diff + ,curr_yr.sales_amt-prev_yr.sales_amt AS sales_amt_diff + FROM all_sales curr_yr, all_sales prev_yr + WHERE curr_yr.i_brand_id=prev_yr.i_brand_id + AND curr_yr.i_class_id=prev_yr.i_class_id + AND curr_yr.i_category_id=prev_yr.i_category_id + AND curr_yr.i_manufact_id=prev_yr.i_manufact_id + AND curr_yr.d_year=2001 + AND prev_yr.d_year=2001-1 + AND CAST(curr_yr.sales_cnt AS DECIMAL(17,2))/CAST(prev_yr.sales_cnt AS DECIMAL(17,2))<0.9 + ORDER BY sales_cnt_diff,sales_amt_diff + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query76.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query76.groovy new file mode 100644 index 00000000000000..b9de4e0243d327 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query76.groovy @@ -0,0 +1,69 @@ +/* + * 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. + */ + +suite("query76") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_76 ''' + explain shape plan + select channel, col_name, d_year, d_qoy, i_category, COUNT(*) sales_cnt, SUM(ext_sales_price) sales_amt FROM ( + SELECT 'store' as channel, 'ss_customer_sk' col_name, d_year, d_qoy, i_category, ss_ext_sales_price ext_sales_price + FROM store_sales, item, date_dim + WHERE ss_customer_sk IS NULL + AND ss_sold_date_sk=d_date_sk + AND ss_item_sk=i_item_sk + UNION ALL + SELECT 'web' as channel, 'ws_ship_addr_sk' col_name, d_year, d_qoy, i_category, ws_ext_sales_price ext_sales_price + FROM web_sales, item, date_dim + WHERE ws_ship_addr_sk IS NULL + AND ws_sold_date_sk=d_date_sk + AND ws_item_sk=i_item_sk + UNION ALL + SELECT 'catalog' as channel, 'cs_ship_mode_sk' col_name, d_year, d_qoy, i_category, cs_ext_sales_price ext_sales_price + FROM catalog_sales, item, date_dim + WHERE cs_ship_mode_sk IS NULL + AND cs_sold_date_sk=d_date_sk + AND cs_item_sk=i_item_sk) foo +GROUP BY channel, col_name, d_year, d_qoy, i_category +ORDER BY channel, col_name, d_year, d_qoy, i_category +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query77.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query77.groovy new file mode 100644 index 00000000000000..7b966b5c10c17c --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query77.groovy @@ -0,0 +1,153 @@ +/* + * 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. + */ + +suite("query77") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_77 ''' + explain shape plan + with ss as + (select s_store_sk, + sum(ss_ext_sales_price) as sales, + sum(ss_net_profit) as profit + from store_sales, + date_dim, + store + where ss_sold_date_sk = d_date_sk + and d_date between cast('2000-08-16' as date) + and (cast('2000-08-16' as date) + interval 30 day) + and ss_store_sk = s_store_sk + group by s_store_sk) + , + sr as + (select s_store_sk, + sum(sr_return_amt) as returns, + sum(sr_net_loss) as profit_loss + from store_returns, + date_dim, + store + where sr_returned_date_sk = d_date_sk + and d_date between cast('2000-08-16' as date) + and (cast('2000-08-16' as date) + interval 30 day) + and sr_store_sk = s_store_sk + group by s_store_sk), + cs as + (select cs_call_center_sk, + sum(cs_ext_sales_price) as sales, + sum(cs_net_profit) as profit + from catalog_sales, + date_dim + where cs_sold_date_sk = d_date_sk + and d_date between cast('2000-08-16' as date) + and (cast('2000-08-16' as date) + interval 30 day) + group by cs_call_center_sk + ), + cr as + (select cr_call_center_sk, + sum(cr_return_amount) as returns, + sum(cr_net_loss) as profit_loss + from catalog_returns, + date_dim + where cr_returned_date_sk = d_date_sk + and d_date between cast('2000-08-16' as date) + and (cast('2000-08-16' as date) + interval 30 day) + group by cr_call_center_sk + ), + ws as + ( select wp_web_page_sk, + sum(ws_ext_sales_price) as sales, + sum(ws_net_profit) as profit + from web_sales, + date_dim, + web_page + where ws_sold_date_sk = d_date_sk + and d_date between cast('2000-08-16' as date) + and (cast('2000-08-16' as date) + interval 30 day) + and ws_web_page_sk = wp_web_page_sk + group by wp_web_page_sk), + wr as + (select wp_web_page_sk, + sum(wr_return_amt) as returns, + sum(wr_net_loss) as profit_loss + from web_returns, + date_dim, + web_page + where wr_returned_date_sk = d_date_sk + and d_date between cast('2000-08-16' as date) + and (cast('2000-08-16' as date) + interval 30 day) + and wr_web_page_sk = wp_web_page_sk + group by wp_web_page_sk) + select channel + , id + , sum(sales) as sales + , sum(returns) as returns + , sum(profit) as profit + from + (select 'store channel' as channel + , ss.s_store_sk as id + , sales + , coalesce(returns, 0) as returns + , (profit - coalesce(profit_loss,0)) as profit + from ss left join sr + on ss.s_store_sk = sr.s_store_sk + union all + select 'catalog channel' as channel + , cs_call_center_sk as id + , sales + , returns + , (profit - profit_loss) as profit + from cs + , cr + union all + select 'web channel' as channel + , ws.wp_web_page_sk as id + , sales + , coalesce(returns, 0) returns + , (profit - coalesce(profit_loss,0)) as profit + from ws left join wr + on ws.wp_web_page_sk = wr.wp_web_page_sk + ) x + group by rollup (channel, id) + order by channel + ,id + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query78.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query78.groovy new file mode 100644 index 00000000000000..74bb2ecbaa6344 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query78.groovy @@ -0,0 +1,103 @@ +/* + * 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. + */ + +suite("query78") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_78 ''' + explain shape plan + with ws as + (select d_year AS ws_sold_year, ws_item_sk, + ws_bill_customer_sk ws_customer_sk, + sum(ws_quantity) ws_qty, + sum(ws_wholesale_cost) ws_wc, + sum(ws_sales_price) ws_sp + from web_sales + left join web_returns on wr_order_number=ws_order_number and ws_item_sk=wr_item_sk + join date_dim on ws_sold_date_sk = d_date_sk + where wr_order_number is null + group by d_year, ws_item_sk, ws_bill_customer_sk + ), +cs as + (select d_year AS cs_sold_year, cs_item_sk, + cs_bill_customer_sk cs_customer_sk, + sum(cs_quantity) cs_qty, + sum(cs_wholesale_cost) cs_wc, + sum(cs_sales_price) cs_sp + from catalog_sales + left join catalog_returns on cr_order_number=cs_order_number and cs_item_sk=cr_item_sk + join date_dim on cs_sold_date_sk = d_date_sk + where cr_order_number is null + group by d_year, cs_item_sk, cs_bill_customer_sk + ), +ss as + (select d_year AS ss_sold_year, ss_item_sk, + ss_customer_sk, + sum(ss_quantity) ss_qty, + sum(ss_wholesale_cost) ss_wc, + sum(ss_sales_price) ss_sp + from store_sales + left join store_returns on sr_ticket_number=ss_ticket_number and ss_item_sk=sr_item_sk + join date_dim on ss_sold_date_sk = d_date_sk + where sr_ticket_number is null + group by d_year, ss_item_sk, ss_customer_sk + ) +select +ss_customer_sk, +round(ss_qty/(coalesce(ws_qty,0)+coalesce(cs_qty,0)),2) ratio, +ss_qty store_qty, ss_wc store_wholesale_cost, ss_sp store_sales_price, +coalesce(ws_qty,0)+coalesce(cs_qty,0) other_chan_qty, +coalesce(ws_wc,0)+coalesce(cs_wc,0) other_chan_wholesale_cost, +coalesce(ws_sp,0)+coalesce(cs_sp,0) other_chan_sales_price +from ss +left join ws on (ws_sold_year=ss_sold_year and ws_item_sk=ss_item_sk and ws_customer_sk=ss_customer_sk) +left join cs on (cs_sold_year=ss_sold_year and cs_item_sk=ss_item_sk and cs_customer_sk=ss_customer_sk) +where (coalesce(ws_qty,0)>0 or coalesce(cs_qty, 0)>0) and ss_sold_year=2001 +order by + ss_customer_sk, + ss_qty desc, ss_wc desc, ss_sp desc, + other_chan_qty, + other_chan_wholesale_cost, + other_chan_sales_price, + ratio +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query79.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query79.groovy new file mode 100644 index 00000000000000..eb66d7bb3e9648 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query79.groovy @@ -0,0 +1,68 @@ +/* + * 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. + */ + +suite("query79") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_79 ''' + explain shape plan + select + c_last_name,c_first_name,substr(s_city,1,30),ss_ticket_number,amt,profit + from + (select ss_ticket_number + ,ss_customer_sk + ,store.s_city + ,sum(ss_coupon_amt) amt + ,sum(ss_net_profit) profit + from store_sales,date_dim,store,household_demographics + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_store_sk = store.s_store_sk + and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk + and (household_demographics.hd_dep_count = 0 or household_demographics.hd_vehicle_count > 3) + and date_dim.d_dow = 1 + and date_dim.d_year in (1998,1998+1,1998+2) + and store.s_number_employees between 200 and 295 + group by ss_ticket_number,ss_customer_sk,ss_addr_sk,store.s_city) ms,customer + where ss_customer_sk = c_customer_sk + order by c_last_name,c_first_name,substr(s_city,1,30), profit +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query8.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query8.groovy new file mode 100644 index 00000000000000..428594e4e509d4 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query8.groovy @@ -0,0 +1,153 @@ +/* + * 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. + */ + +suite("query8") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_8 ''' + explain shape plan + select s_store_name + ,sum(ss_net_profit) + from store_sales + ,date_dim + ,store, + (select ca_zip + from ( + SELECT substr(ca_zip,1,5) ca_zip + FROM customer_address + WHERE substr(ca_zip,1,5) IN ( + '47602','16704','35863','28577','83910','36201', + '58412','48162','28055','41419','80332', + '38607','77817','24891','16226','18410', + '21231','59345','13918','51089','20317', + '17167','54585','67881','78366','47770', + '18360','51717','73108','14440','21800', + '89338','45859','65501','34948','25973', + '73219','25333','17291','10374','18829', + '60736','82620','41351','52094','19326', + '25214','54207','40936','21814','79077', + '25178','75742','77454','30621','89193', + '27369','41232','48567','83041','71948', + '37119','68341','14073','16891','62878', + '49130','19833','24286','27700','40979', + '50412','81504','94835','84844','71954', + '39503','57649','18434','24987','12350', + '86379','27413','44529','98569','16515', + '27287','24255','21094','16005','56436', + '91110','68293','56455','54558','10298', + '83647','32754','27052','51766','19444', + '13869','45645','94791','57631','20712', + '37788','41807','46507','21727','71836', + '81070','50632','88086','63991','20244', + '31655','51782','29818','63792','68605', + '94898','36430','57025','20601','82080', + '33869','22728','35834','29086','92645', + '98584','98072','11652','78093','57553', + '43830','71144','53565','18700','90209', + '71256','38353','54364','28571','96560', + '57839','56355','50679','45266','84680', + '34306','34972','48530','30106','15371', + '92380','84247','92292','68852','13338', + '34594','82602','70073','98069','85066', + '47289','11686','98862','26217','47529', + '63294','51793','35926','24227','14196', + '24594','32489','99060','49472','43432', + '49211','14312','88137','47369','56877', + '20534','81755','15794','12318','21060', + '73134','41255','63073','81003','73873', + '66057','51184','51195','45676','92696', + '70450','90669','98338','25264','38919', + '59226','58581','60298','17895','19489', + '52301','80846','95464','68770','51634', + '19988','18367','18421','11618','67975', + '25494','41352','95430','15734','62585', + '97173','33773','10425','75675','53535', + '17879','41967','12197','67998','79658', + '59130','72592','14851','43933','68101', + '50636','25717','71286','24660','58058', + '72991','95042','15543','33122','69280', + '11912','59386','27642','65177','17672', + '33467','64592','36335','54010','18767', + '63193','42361','49254','33113','33159', + '36479','59080','11855','81963','31016', + '49140','29392','41836','32958','53163', + '13844','73146','23952','65148','93498', + '14530','46131','58454','13376','13378', + '83986','12320','17193','59852','46081', + '98533','52389','13086','68843','31013', + '13261','60560','13443','45533','83583', + '11489','58218','19753','22911','25115', + '86709','27156','32669','13123','51933', + '39214','41331','66943','14155','69998', + '49101','70070','35076','14242','73021', + '59494','15782','29752','37914','74686', + '83086','34473','15751','81084','49230', + '91894','60624','17819','28810','63180', + '56224','39459','55233','75752','43639', + '55349','86057','62361','50788','31830', + '58062','18218','85761','60083','45484', + '21204','90229','70041','41162','35390', + '16364','39500','68908','26689','52868', + '81335','40146','11340','61527','61794', + '71997','30415','59004','29450','58117', + '69952','33562','83833','27385','61860', + '96435','48333','23065','32961','84919', + '61997','99132','22815','56600','68730', + '48017','95694','32919','88217','27116', + '28239','58032','18884','16791','21343', + '97462','18569','75660','15475') + intersect + select ca_zip + from (SELECT substr(ca_zip,1,5) ca_zip,count(*) cnt + FROM customer_address, customer + WHERE ca_address_sk = c_current_addr_sk and + c_preferred_cust_flag='Y' + group by ca_zip + having count(*) > 10)A1)A2) V1 + where ss_store_sk = s_store_sk + and ss_sold_date_sk = d_date_sk + and d_qoy = 2 and d_year = 1998 + and (substr(s_zip,1,2) = substr(V1.ca_zip,1,2)) + group by s_store_name + order by s_store_name + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query80.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query80.groovy new file mode 100644 index 00000000000000..f4d3ed5847097c --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query80.groovy @@ -0,0 +1,141 @@ +/* + * 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. + */ + +suite("query80") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_80 ''' + explain shape plan + with ssr as + (select s_store_id as store_id, + sum(ss_ext_sales_price) as sales, + sum(coalesce(sr_return_amt, 0)) as returns, + sum(ss_net_profit - coalesce(sr_net_loss, 0)) as profit + from store_sales left outer join store_returns on + (ss_item_sk = sr_item_sk and ss_ticket_number = sr_ticket_number), + date_dim, + store, + item, + promotion + where ss_sold_date_sk = d_date_sk + and d_date between cast('2002-08-06' as date) + and (cast('2002-08-06' as date) + interval 30 day) + and ss_store_sk = s_store_sk + and ss_item_sk = i_item_sk + and i_current_price > 50 + and ss_promo_sk = p_promo_sk + and p_channel_tv = 'N' + group by s_store_id) + , + csr as + (select cp_catalog_page_id as catalog_page_id, + sum(cs_ext_sales_price) as sales, + sum(coalesce(cr_return_amount, 0)) as returns, + sum(cs_net_profit - coalesce(cr_net_loss, 0)) as profit + from catalog_sales left outer join catalog_returns on + (cs_item_sk = cr_item_sk and cs_order_number = cr_order_number), + date_dim, + catalog_page, + item, + promotion + where cs_sold_date_sk = d_date_sk + and d_date between cast('2002-08-06' as date) + and (cast('2002-08-06' as date) + interval 30 day) + and cs_catalog_page_sk = cp_catalog_page_sk + and cs_item_sk = i_item_sk + and i_current_price > 50 + and cs_promo_sk = p_promo_sk + and p_channel_tv = 'N' +group by cp_catalog_page_id) + , + wsr as + (select web_site_id, + sum(ws_ext_sales_price) as sales, + sum(coalesce(wr_return_amt, 0)) as returns, + sum(ws_net_profit - coalesce(wr_net_loss, 0)) as profit + from web_sales left outer join web_returns on + (ws_item_sk = wr_item_sk and ws_order_number = wr_order_number), + date_dim, + web_site, + item, + promotion + where ws_sold_date_sk = d_date_sk + and d_date between cast('2002-08-06' as date) + and (cast('2002-08-06' as date) + interval 30 day) + and ws_web_site_sk = web_site_sk + and ws_item_sk = i_item_sk + and i_current_price > 50 + and ws_promo_sk = p_promo_sk + and p_channel_tv = 'N' +group by web_site_id) + select channel + , id + , sum(sales) as sales + , sum(returns) as returns + , sum(profit) as profit + from + (select 'store channel' as channel + , concat('store', store_id) as id + , sales + , returns + , profit + from ssr + union all + select 'catalog channel' as channel + , concat('catalog_page', catalog_page_id) as id + , sales + , returns + , profit + from csr + union all + select 'web channel' as channel + , concat('web_site', web_site_id) as id + , sales + , returns + , profit + from wsr + ) x + group by rollup (channel, id) + order by channel + ,id + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query81.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query81.groovy new file mode 100644 index 00000000000000..05a51faffa8ffc --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query81.groovy @@ -0,0 +1,76 @@ +/* + * 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. + */ + +suite("query81") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_81 ''' + explain shape plan + with customer_total_return as + (select cr_returning_customer_sk as ctr_customer_sk + ,ca_state as ctr_state, + sum(cr_return_amt_inc_tax) as ctr_total_return + from catalog_returns + ,date_dim + ,customer_address + where cr_returned_date_sk = d_date_sk + and d_year =1998 + and cr_returning_addr_sk = ca_address_sk + group by cr_returning_customer_sk + ,ca_state ) + select c_customer_id,c_salutation,c_first_name,c_last_name,ca_street_number,ca_street_name + ,ca_street_type,ca_suite_number,ca_city,ca_county,ca_state,ca_zip,ca_country,ca_gmt_offset + ,ca_location_type,ctr_total_return + from customer_total_return ctr1 + ,customer_address + ,customer + where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2 + from customer_total_return ctr2 + where ctr1.ctr_state = ctr2.ctr_state) + and ca_address_sk = c_current_addr_sk + and ca_state = 'TX' + and ctr1.ctr_customer_sk = c_customer_sk + order by c_customer_id,c_salutation,c_first_name,c_last_name,ca_street_number,ca_street_name + ,ca_street_type,ca_suite_number,ca_city,ca_county,ca_state,ca_zip,ca_country,ca_gmt_offset + ,ca_location_type,ctr_total_return + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query82.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query82.groovy new file mode 100644 index 00000000000000..6a17545e339bde --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query82.groovy @@ -0,0 +1,62 @@ +/* + * 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. + */ + +suite("query82") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_82 ''' + explain shape plan + select i_item_id + ,i_item_desc + ,i_current_price + from item, inventory, date_dim, store_sales + where i_current_price between 49 and 49+30 + and inv_item_sk = i_item_sk + and d_date_sk=inv_date_sk + and d_date between cast('2001-01-28' as date) and (cast('2001-01-28' as date) + interval 60 day) + and i_manufact_id in (80,675,292,17) + and inv_quantity_on_hand between 100 and 500 + and ss_item_sk = i_item_sk + group by i_item_id,i_item_desc,i_current_price + order by i_item_id + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query83.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query83.groovy new file mode 100644 index 00000000000000..37565aa1cbca98 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query83.groovy @@ -0,0 +1,112 @@ +/* + * 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. + */ + +suite("query83") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_83 ''' + explain shape plan + with sr_items as + (select i_item_id item_id, + sum(sr_return_quantity) sr_item_qty + from store_returns, + item, + date_dim + where sr_item_sk = i_item_sk + and d_date in + (select d_date + from date_dim + where d_week_seq in + (select d_week_seq + from date_dim + where d_date in ('2000-06-17','2000-08-22','2000-11-17'))) + and sr_returned_date_sk = d_date_sk + group by i_item_id), + cr_items as + (select i_item_id item_id, + sum(cr_return_quantity) cr_item_qty + from catalog_returns, + item, + date_dim + where cr_item_sk = i_item_sk + and d_date in + (select d_date + from date_dim + where d_week_seq in + (select d_week_seq + from date_dim + where d_date in ('2000-06-17','2000-08-22','2000-11-17'))) + and cr_returned_date_sk = d_date_sk + group by i_item_id), + wr_items as + (select i_item_id item_id, + sum(wr_return_quantity) wr_item_qty + from web_returns, + item, + date_dim + where wr_item_sk = i_item_sk + and d_date in + (select d_date + from date_dim + where d_week_seq in + (select d_week_seq + from date_dim + where d_date in ('2000-06-17','2000-08-22','2000-11-17'))) + and wr_returned_date_sk = d_date_sk + group by i_item_id) + select sr_items.item_id + ,sr_item_qty + ,sr_item_qty/(sr_item_qty+cr_item_qty+wr_item_qty)/3.0 * 100 sr_dev + ,cr_item_qty + ,cr_item_qty/(sr_item_qty+cr_item_qty+wr_item_qty)/3.0 * 100 cr_dev + ,wr_item_qty + ,wr_item_qty/(sr_item_qty+cr_item_qty+wr_item_qty)/3.0 * 100 wr_dev + ,(sr_item_qty+cr_item_qty+wr_item_qty)/3.0 average + from sr_items + ,cr_items + ,wr_items + where sr_items.item_id=cr_items.item_id + and sr_items.item_id=wr_items.item_id + order by sr_items.item_id + ,sr_item_qty + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query84.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query84.groovy new file mode 100644 index 00000000000000..33e97e1c257114 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query84.groovy @@ -0,0 +1,66 @@ +/* + * 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. + */ + +suite("query84") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_84 ''' + explain shape plan + select c_customer_id as customer_id + , concat(concat(coalesce(c_last_name,''), ','), coalesce(c_first_name,'')) as customername + from customer + ,customer_address + ,customer_demographics + ,household_demographics + ,income_band + ,store_returns + where ca_city = 'Hopewell' + and c_current_addr_sk = ca_address_sk + and ib_lower_bound >= 37855 + and ib_upper_bound <= 37855 + 50000 + and ib_income_band_sk = hd_income_band_sk + and cd_demo_sk = c_current_cdemo_sk + and hd_demo_sk = c_current_hdemo_sk + and sr_cdemo_sk = cd_demo_sk + order by c_customer_id + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query85.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query85.groovy new file mode 100644 index 00000000000000..d7c71bd0a32701 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query85.groovy @@ -0,0 +1,129 @@ +/* + * 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. + */ + +suite("query85") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_85 ''' + explain shape plan + select substr(r_reason_desc,1,20) + ,avg(ws_quantity) + ,avg(wr_refunded_cash) + ,avg(wr_fee) + from web_sales, web_returns, web_page, customer_demographics cd1, + customer_demographics cd2, customer_address, date_dim, reason + where ws_web_page_sk = wp_web_page_sk + and ws_item_sk = wr_item_sk + and ws_order_number = wr_order_number + and ws_sold_date_sk = d_date_sk and d_year = 2001 + and cd1.cd_demo_sk = wr_refunded_cdemo_sk + and cd2.cd_demo_sk = wr_returning_cdemo_sk + and ca_address_sk = wr_refunded_addr_sk + and r_reason_sk = wr_reason_sk + and + ( + ( + cd1.cd_marital_status = 'M' + and + cd1.cd_marital_status = cd2.cd_marital_status + and + cd1.cd_education_status = '4 yr Degree' + and + cd1.cd_education_status = cd2.cd_education_status + and + ws_sales_price between 100.00 and 150.00 + ) + or + ( + cd1.cd_marital_status = 'S' + and + cd1.cd_marital_status = cd2.cd_marital_status + and + cd1.cd_education_status = 'College' + and + cd1.cd_education_status = cd2.cd_education_status + and + ws_sales_price between 50.00 and 100.00 + ) + or + ( + cd1.cd_marital_status = 'D' + and + cd1.cd_marital_status = cd2.cd_marital_status + and + cd1.cd_education_status = 'Secondary' + and + cd1.cd_education_status = cd2.cd_education_status + and + ws_sales_price between 150.00 and 200.00 + ) + ) + and + ( + ( + ca_country = 'United States' + and + ca_state in ('TX', 'VA', 'CA') + and ws_net_profit between 100 and 200 + ) + or + ( + ca_country = 'United States' + and + ca_state in ('AR', 'NE', 'MO') + and ws_net_profit between 150 and 300 + ) + or + ( + ca_country = 'United States' + and + ca_state in ('IA', 'MS', 'WA') + and ws_net_profit between 50 and 250 + ) + ) +group by r_reason_desc +order by substr(r_reason_desc,1,20) + ,avg(ws_quantity) + ,avg(wr_refunded_cash) + ,avg(wr_fee) +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query86.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query86.groovy new file mode 100644 index 00000000000000..0d6d1d88d7cbdb --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query86.groovy @@ -0,0 +1,71 @@ +/* + * 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. + */ + +suite("query86") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_86 ''' + explain shape plan + select + sum(ws_net_paid) as total_sum + ,i_category + ,i_class + ,grouping(i_category)+grouping(i_class) as lochierarchy + ,rank() over ( + partition by grouping(i_category)+grouping(i_class), + case when grouping(i_class) = 0 then i_category end + order by sum(ws_net_paid) desc) as rank_within_parent + from + web_sales + ,date_dim d1 + ,item + where + d1.d_month_seq between 1215 and 1215+11 + and d1.d_date_sk = ws_sold_date_sk + and i_item_sk = ws_item_sk + group by rollup(i_category,i_class) + order by + lochierarchy desc, + case when lochierarchy = 0 then i_category end, + rank_within_parent + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query87.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query87.groovy new file mode 100644 index 00000000000000..7e9d529b96a203 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query87.groovy @@ -0,0 +1,68 @@ +/* + * 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. + */ + +suite("query87") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_87 ''' + explain shape plan + select count(*) +from ((select distinct c_last_name, c_first_name, d_date + from store_sales, date_dim, customer + where store_sales.ss_sold_date_sk = date_dim.d_date_sk + and store_sales.ss_customer_sk = customer.c_customer_sk + and d_month_seq between 1221 and 1221+11) + except + (select distinct c_last_name, c_first_name, d_date + from catalog_sales, date_dim, customer + where catalog_sales.cs_sold_date_sk = date_dim.d_date_sk + and catalog_sales.cs_bill_customer_sk = customer.c_customer_sk + and d_month_seq between 1221 and 1221+11) + except + (select distinct c_last_name, c_first_name, d_date + from web_sales, date_dim, customer + where web_sales.ws_sold_date_sk = date_dim.d_date_sk + and web_sales.ws_bill_customer_sk = customer.c_customer_sk + and d_month_seq between 1221 and 1221+11) +) cool_cust + + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query88.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query88.groovy new file mode 100644 index 00000000000000..e5b0f1e665f729 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query88.groovy @@ -0,0 +1,139 @@ +/* + * 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. + */ + +suite("query88") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_88 ''' + explain shape plan + select * +from + (select count(*) h8_30_to_9 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 8 + and time_dim.t_minute >= 30 + and ((household_demographics.hd_dep_count = 2 and household_demographics.hd_vehicle_count<=2+2) or + (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s1, + (select count(*) h9_to_9_30 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 9 + and time_dim.t_minute < 30 + and ((household_demographics.hd_dep_count = 2 and household_demographics.hd_vehicle_count<=2+2) or + (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s2, + (select count(*) h9_30_to_10 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 9 + and time_dim.t_minute >= 30 + and ((household_demographics.hd_dep_count = 2 and household_demographics.hd_vehicle_count<=2+2) or + (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s3, + (select count(*) h10_to_10_30 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 10 + and time_dim.t_minute < 30 + and ((household_demographics.hd_dep_count = 2 and household_demographics.hd_vehicle_count<=2+2) or + (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s4, + (select count(*) h10_30_to_11 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 10 + and time_dim.t_minute >= 30 + and ((household_demographics.hd_dep_count = 2 and household_demographics.hd_vehicle_count<=2+2) or + (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s5, + (select count(*) h11_to_11_30 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 11 + and time_dim.t_minute < 30 + and ((household_demographics.hd_dep_count = 2 and household_demographics.hd_vehicle_count<=2+2) or + (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s6, + (select count(*) h11_30_to_12 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 11 + and time_dim.t_minute >= 30 + and ((household_demographics.hd_dep_count = 2 and household_demographics.hd_vehicle_count<=2+2) or + (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s7, + (select count(*) h12_to_12_30 + from store_sales, household_demographics , time_dim, store + where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 12 + and time_dim.t_minute < 30 + and ((household_demographics.hd_dep_count = 2 and household_demographics.hd_vehicle_count<=2+2) or + (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or + (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2)) + and store.s_store_name = 'ese') s8 + + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query89.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query89.groovy new file mode 100644 index 00000000000000..bbd6a98205bfac --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query89.groovy @@ -0,0 +1,73 @@ +/* + * 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. + */ + +suite("query89") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_89 ''' + explain shape plan + select * +from( +select i_category, i_class, i_brand, + s_store_name, s_company_name, + d_moy, + sum(ss_sales_price) sum_sales, + avg(sum(ss_sales_price)) over + (partition by i_category, i_brand, s_store_name, s_company_name) + avg_monthly_sales +from item, store_sales, date_dim, store +where ss_item_sk = i_item_sk and + ss_sold_date_sk = d_date_sk and + ss_store_sk = s_store_sk and + d_year in (2000) and + ((i_category in ('Home','Music','Books') and + i_class in ('glassware','classical','fiction') + ) + or (i_category in ('Jewelry','Sports','Women') and + i_class in ('semi-precious','baseball','dresses') + )) +group by i_category, i_class, i_brand, + s_store_name, s_company_name, d_moy) tmp1 +where case when (avg_monthly_sales <> 0) then (abs(sum_sales - avg_monthly_sales) / avg_monthly_sales) else null end > 0.1 +order by sum_sales - avg_monthly_sales, s_store_name +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query9.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query9.groovy new file mode 100644 index 00000000000000..026e327d4b9713 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query9.groovy @@ -0,0 +1,96 @@ +/* + * 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. + */ + +suite("query9") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_9 ''' + explain shape plan + select case when (select count(*) + from store_sales + where ss_quantity between 1 and 20) > 98972190 + then (select avg(ss_ext_discount_amt) + from store_sales + where ss_quantity between 1 and 20) + else (select avg(ss_net_profit) + from store_sales + where ss_quantity between 1 and 20) end bucket1 , + case when (select count(*) + from store_sales + where ss_quantity between 21 and 40) > 160856845 + then (select avg(ss_ext_discount_amt) + from store_sales + where ss_quantity between 21 and 40) + else (select avg(ss_net_profit) + from store_sales + where ss_quantity between 21 and 40) end bucket2, + case when (select count(*) + from store_sales + where ss_quantity between 41 and 60) > 12733327 + then (select avg(ss_ext_discount_amt) + from store_sales + where ss_quantity between 41 and 60) + else (select avg(ss_net_profit) + from store_sales + where ss_quantity between 41 and 60) end bucket3, + case when (select count(*) + from store_sales + where ss_quantity between 61 and 80) > 96251173 + then (select avg(ss_ext_discount_amt) + from store_sales + where ss_quantity between 61 and 80) + else (select avg(ss_net_profit) + from store_sales + where ss_quantity between 61 and 80) end bucket4, + case when (select count(*) + from store_sales + where ss_quantity between 81 and 100) > 80049606 + then (select avg(ss_ext_discount_amt) + from store_sales + where ss_quantity between 81 and 100) + else (select avg(ss_net_profit) + from store_sales + where ss_quantity between 81 and 100) end bucket5 +from reason +where r_reason_sk = 1 + + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query90.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query90.groovy new file mode 100644 index 00000000000000..d23f0714d0da97 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query90.groovy @@ -0,0 +1,67 @@ +/* + * 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. + */ + +suite("query90") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_90 ''' + explain shape plan + select cast(amc as decimal(15,4))/cast(pmc as decimal(15,4)) am_pm_ratio + from ( select count(*) amc + from web_sales, household_demographics , time_dim, web_page + where ws_sold_time_sk = time_dim.t_time_sk + and ws_ship_hdemo_sk = household_demographics.hd_demo_sk + and ws_web_page_sk = web_page.wp_web_page_sk + and time_dim.t_hour between 9 and 9+1 + and household_demographics.hd_dep_count = 3 + and web_page.wp_char_count between 5000 and 5200) at, + ( select count(*) pmc + from web_sales, household_demographics , time_dim, web_page + where ws_sold_time_sk = time_dim.t_time_sk + and ws_ship_hdemo_sk = household_demographics.hd_demo_sk + and ws_web_page_sk = web_page.wp_web_page_sk + and time_dim.t_hour between 16 and 16+1 + and household_demographics.hd_dep_count = 3 + and web_page.wp_char_count between 5000 and 5200) pt + order by am_pm_ratio + limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query91.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query91.groovy new file mode 100644 index 00000000000000..bad3d75039816d --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query91.groovy @@ -0,0 +1,76 @@ +/* + * 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. + */ + +suite("query91") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_91 ''' + explain shape plan + select + cc_call_center_id Call_Center, + cc_name Call_Center_Name, + cc_manager Manager, + sum(cr_net_loss) Returns_Loss +from + call_center, + catalog_returns, + date_dim, + customer, + customer_address, + customer_demographics, + household_demographics +where + cr_call_center_sk = cc_call_center_sk +and cr_returned_date_sk = d_date_sk +and cr_returning_customer_sk= c_customer_sk +and cd_demo_sk = c_current_cdemo_sk +and hd_demo_sk = c_current_hdemo_sk +and ca_address_sk = c_current_addr_sk +and d_year = 2000 +and d_moy = 12 +and ( (cd_marital_status = 'M' and cd_education_status = 'Unknown') + or(cd_marital_status = 'W' and cd_education_status = 'Advanced Degree')) +and hd_buy_potential like 'Unknown%' +and ca_gmt_offset = -7 +group by cc_call_center_id,cc_name,cc_manager,cd_marital_status,cd_education_status +order by sum(cr_net_loss) desc + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query92.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query92.groovy new file mode 100644 index 00000000000000..56e470d1652394 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query92.groovy @@ -0,0 +1,75 @@ +/* + * 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. + */ + +suite("query92") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_92 ''' + explain shape plan + select + sum(ws_ext_discount_amt) as "Excess Discount Amount" +from + web_sales + ,item + ,date_dim +where +i_manufact_id = 356 +and i_item_sk = ws_item_sk +and d_date between '2001-03-12' and + (cast('2001-03-12' as date) + interval 90 day) +and d_date_sk = ws_sold_date_sk +and ws_ext_discount_amt + > ( + SELECT + 1.3 * avg(ws_ext_discount_amt) + FROM + web_sales + ,date_dim + WHERE + ws_item_sk = i_item_sk + and d_date between '2001-03-12' and + (cast('2001-03-12' as date) + interval 90 day) + and d_date_sk = ws_sold_date_sk + ) +order by sum(ws_ext_discount_amt) +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query93.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query93.groovy new file mode 100644 index 00000000000000..a1074c8ea52cdd --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query93.groovy @@ -0,0 +1,63 @@ +/* + * 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. + */ + +suite("query93") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_93 ''' + explain shape plan + select ss_customer_sk + ,sum(act_sales) sumsales + from (select ss_item_sk + ,ss_ticket_number + ,ss_customer_sk + ,case when sr_return_quantity is not null then (ss_quantity-sr_return_quantity)*ss_sales_price + else (ss_quantity*ss_sales_price) end act_sales + from store_sales left outer join store_returns on (sr_item_sk = ss_item_sk + and sr_ticket_number = ss_ticket_number) + ,reason + where sr_reason_sk = r_reason_sk + and r_reason_desc = 'reason 66') t + group by ss_customer_sk + order by sumsales, ss_customer_sk +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query94.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query94.groovy new file mode 100644 index 00000000000000..48ff5e3da213e4 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query94.groovy @@ -0,0 +1,74 @@ +/* + * 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. + */ + +suite("query94") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_94 ''' + explain shape plan + select + count(distinct ws_order_number) as "order count" + ,sum(ws_ext_ship_cost) as "total shipping cost" + ,sum(ws_net_profit) as "total net profit" +from + web_sales ws1 + ,date_dim + ,customer_address + ,web_site +where + d_date between '1999-4-01' and + (cast('1999-4-01' as date) + interval 60 day) +and ws1.ws_ship_date_sk = d_date_sk +and ws1.ws_ship_addr_sk = ca_address_sk +and ca_state = 'NE' +and ws1.ws_web_site_sk = web_site_sk +and web_company_name = 'pri' +and exists (select * + from web_sales ws2 + where ws1.ws_order_number = ws2.ws_order_number + and ws1.ws_warehouse_sk <> ws2.ws_warehouse_sk) +and not exists(select * + from web_returns wr1 + where ws1.ws_order_number = wr1.wr_order_number) +order by count(distinct ws_order_number) +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query95.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query95.groovy new file mode 100644 index 00000000000000..78c4d0e81df3dd --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query95.groovy @@ -0,0 +1,77 @@ +/* + * 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. + */ + +suite("query95") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_95 ''' + explain shape plan + with ws_wh as +(select ws1.ws_order_number,ws1.ws_warehouse_sk wh1,ws2.ws_warehouse_sk wh2 + from web_sales ws1,web_sales ws2 + where ws1.ws_order_number = ws2.ws_order_number + and ws1.ws_warehouse_sk <> ws2.ws_warehouse_sk) + select + count(distinct ws_order_number) as "order count" + ,sum(ws_ext_ship_cost) as "total shipping cost" + ,sum(ws_net_profit) as "total net profit" +from + web_sales ws1 + ,date_dim + ,customer_address + ,web_site +where + d_date between '2002-4-01' and + (cast('2002-4-01' as date) + interval 60 day) +and ws1.ws_ship_date_sk = d_date_sk +and ws1.ws_ship_addr_sk = ca_address_sk +and ca_state = 'AL' +and ws1.ws_web_site_sk = web_site_sk +and web_company_name = 'pri' +and ws1.ws_order_number in (select ws_order_number + from ws_wh) +and ws1.ws_order_number in (select wr_order_number + from web_returns,ws_wh + where wr_order_number = ws_wh.ws_order_number) +order by count(distinct ws_order_number) +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query96.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query96.groovy new file mode 100644 index 00000000000000..148908951723b3 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query96.groovy @@ -0,0 +1,61 @@ +/* + * 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. + */ + +suite("query96") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_96 ''' + explain shape plan + select count(*) +from store_sales + ,household_demographics + ,time_dim, store +where ss_sold_time_sk = time_dim.t_time_sk + and ss_hdemo_sk = household_demographics.hd_demo_sk + and ss_store_sk = s_store_sk + and time_dim.t_hour = 16 + and time_dim.t_minute >= 30 + and household_demographics.hd_dep_count = 6 + and store.s_store_name = 'ese' +order by count(*) +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query97.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query97.groovy new file mode 100644 index 00000000000000..10dd934df3fa0a --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query97.groovy @@ -0,0 +1,70 @@ +/* + * 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. + */ + +suite("query97") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_97 ''' + explain shape plan + with ssci as ( +select ss_customer_sk customer_sk + ,ss_item_sk item_sk +from store_sales,date_dim +where ss_sold_date_sk = d_date_sk + and d_month_seq between 1190 and 1190 + 11 +group by ss_customer_sk + ,ss_item_sk), +csci as( + select cs_bill_customer_sk customer_sk + ,cs_item_sk item_sk +from catalog_sales,date_dim +where cs_sold_date_sk = d_date_sk + and d_month_seq between 1190 and 1190 + 11 +group by cs_bill_customer_sk + ,cs_item_sk) + select sum(case when ssci.customer_sk is not null and csci.customer_sk is null then 1 else 0 end) store_only + ,sum(case when ssci.customer_sk is null and csci.customer_sk is not null then 1 else 0 end) catalog_only + ,sum(case when ssci.customer_sk is not null and csci.customer_sk is not null then 1 else 0 end) store_and_catalog +from ssci full outer join csci on (ssci.customer_sk=csci.customer_sk + and ssci.item_sk = csci.item_sk) +limit 100 + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query98.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query98.groovy new file mode 100644 index 00000000000000..be1b13c320a7bd --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query98.groovy @@ -0,0 +1,78 @@ +/* + * 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. + */ + +suite("query98") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_98 ''' + explain shape plan + select i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price + ,sum(ss_ext_sales_price) as itemrevenue + ,sum(ss_ext_sales_price)*100/sum(sum(ss_ext_sales_price)) over + (partition by i_class) as revenueratio +from + store_sales + ,item + ,date_dim +where + ss_item_sk = i_item_sk + and i_category in ('Home', 'Sports', 'Men') + and ss_sold_date_sk = d_date_sk + and d_date between cast('2002-01-05' as date) + and (cast('2002-01-05' as date) + interval 30 day) +group by + i_item_id + ,i_item_desc + ,i_category + ,i_class + ,i_current_price +order by + i_category + ,i_class + ,i_item_id + ,i_item_desc + ,revenueratio + ''' +} diff --git a/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query99.groovy b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query99.groovy new file mode 100644 index 00000000000000..fe6a2ea601ca61 --- /dev/null +++ b/regression-test/suites/nereids_tpcds_shape_sf10t_orc/shape/query99.groovy @@ -0,0 +1,80 @@ +/* + * 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. + */ + +suite("query99") { + String db = context.config.getDbNameByFile(new File(context.file.parent)) + if (isCloudMode()) { + return + } + sql """ + use ${db}; + set enable_nereids_planner=true; + set enable_nereids_distribute_planner=false; + set enable_fallback_to_original_planner=false; + set exec_mem_limit=21G; + set be_number_for_test=3; + set parallel_fragment_exec_instance_num=8; ; + set parallel_pipeline_task_num=8; + set forbid_unknown_col_stats=true; + set enable_nereids_timeout = false; + set enable_runtime_filter_prune=false; + set runtime_filter_type=8; + set dump_nereids_memo=false; + set disable_nereids_rules='PRUNE_EMPTY_PARTITION'; + set enable_fold_constant_by_be = false; + set push_topn_to_agg = true; + set TOPN_OPT_LIMIT_THRESHOLD = 1024; + set enable_parallel_result_sink=true; + """ + qt_ds_shape_99 ''' + explain shape plan + select + substr(w_warehouse_name,1,20) + ,sm_type + ,cc_name + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk <= 30 ) then 1 else 0 end) as "30 days" + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 30) and + (cs_ship_date_sk - cs_sold_date_sk <= 60) then 1 else 0 end ) as "31-60 days" + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 60) and + (cs_ship_date_sk - cs_sold_date_sk <= 90) then 1 else 0 end) as "61-90 days" + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 90) and + (cs_ship_date_sk - cs_sold_date_sk <= 120) then 1 else 0 end) as "91-120 days" + ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 120) then 1 else 0 end) as ">120 days" +from + catalog_sales + ,warehouse + ,ship_mode + ,call_center + ,date_dim +where + d_month_seq between 1178 and 1178 + 11 +and cs_ship_date_sk = d_date_sk +and cs_warehouse_sk = w_warehouse_sk +and cs_ship_mode_sk = sm_ship_mode_sk +and cs_call_center_sk = cc_call_center_sk +group by + substr(w_warehouse_name,1,20) + ,sm_type + ,cc_name +order by substr(w_warehouse_name,1,20) + ,sm_type + ,cc_name +limit 100 + ''' +} From 0c97747823749c6a12ddf81c639ba9efa718c789 Mon Sep 17 00:00:00 2001 From: yujun Date: Wed, 2 Oct 2024 18:46:07 +0800 Subject: [PATCH 10/12] [fix](regression test) fix test_abort_txn_by_fe (#41382) 1. fix regression test test_abort_txn_by_fe; 2. delete duplicated suites which just diff ClusterOptions.cloudMode = true/false, no needn't. ClusterOptions.cloudMode = null always support both mode; 3. improvement: when run a docker suite with ClusterOptions.cloudMode == null, if there's no an external doris cluster, it will run both in cloud and not_cloud mode; --- be/src/cloud/cloud_stream_load_executor.cpp | 2 + .../org/apache/doris/regression/Config.groovy | 7 + .../doris/regression/suite/Suite.groovy | 28 +-- .../regression/suite/SuiteCluster.groovy | 7 + ...ud1.groovy => test_abort_txn_by_be.groovy} | 35 ++-- .../test_abort_txn_by_be_cloud2.groovy | 164 ------------------ .../test_abort_txn_by_be_local5.groovy | 164 ------------------ .../test_abort_txn_by_be_local6.groovy | 164 ------------------ ...ud4.groovy => test_abort_txn_by_fe.groovy} | 42 +++-- .../test_abort_txn_by_fe_local3.groovy | 104 ----------- 10 files changed, 85 insertions(+), 632 deletions(-) rename regression-test/suites/schema_change_p0/{test_abort_txn_by_be_cloud1.groovy => test_abort_txn_by_be.groovy} (88%) delete mode 100644 regression-test/suites/schema_change_p0/test_abort_txn_by_be_cloud2.groovy delete mode 100644 regression-test/suites/schema_change_p0/test_abort_txn_by_be_local5.groovy delete mode 100644 regression-test/suites/schema_change_p0/test_abort_txn_by_be_local6.groovy rename regression-test/suites/schema_change_p0/{test_abort_txn_by_fe_cloud4.groovy => test_abort_txn_by_fe.groovy} (75%) delete mode 100644 regression-test/suites/schema_change_p0/test_abort_txn_by_fe_local3.groovy diff --git a/be/src/cloud/cloud_stream_load_executor.cpp b/be/src/cloud/cloud_stream_load_executor.cpp index 1352b4aac81a5f..46ceca851e2b4d 100644 --- a/be/src/cloud/cloud_stream_load_executor.cpp +++ b/be/src/cloud/cloud_stream_load_executor.cpp @@ -23,6 +23,7 @@ #include "common/logging.h" #include "common/status.h" #include "runtime/stream_load/stream_load_context.h" +#include "util/debug_points.h" namespace doris { @@ -96,6 +97,7 @@ Status CloudStreamLoadExecutor::operate_txn_2pc(StreamLoadContext* ctx) { } Status CloudStreamLoadExecutor::commit_txn(StreamLoadContext* ctx) { + DBUG_EXECUTE_IF("StreamLoadExecutor.commit_txn.block", DBUG_BLOCK); // forward to fe to excute commit transaction for MoW table if (ctx->is_mow_table() || !config::enable_stream_load_commit_txn_on_be || ctx->load_type == TLoadType::ROUTINE_LOAD) { diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy index 5e79ccef21dc24..4487d76beaaf41 100644 --- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy +++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/Config.groovy @@ -518,6 +518,13 @@ class Config { // mainly auth_xxx cases use defaultDb, these suites better not use defaultDb config.createDefaultDb() + try { + config.fetchCloudMode() + } catch (Exception e) { + // docker suite no need external cluster. + // so can ignore error here. + } + return config } diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy index 869d4afa486a47..099799ed8d6eaa 100644 --- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy +++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy @@ -290,17 +290,13 @@ class Suite implements GroovyInterceptable { + "see example demo_p0/docker_action.groovy") } - try { - context.config.fetchCloudMode() - } catch (Exception e) { - } - - boolean dockerIsCloud = false if (options.cloudMode == null) { if (context.config.runMode == RunMode.UNKNOWN) { - throw new Exception("Bad run mode, cloud or not_cloud is unknown") + dockerImpl(options, false, actionSupplier) + dockerImpl(options, true, actionSupplier) + } else { + dockerImpl(options, context.config.runMode == RunMode.CLOUD, actionSupplier) } - dockerIsCloud = context.config.runMode == RunMode.CLOUD } else { if (options.cloudMode == true && context.config.runMode == RunMode.NOT_CLOUD) { return @@ -308,12 +304,16 @@ class Suite implements GroovyInterceptable { if (options.cloudMode == false && context.config.runMode == RunMode.CLOUD) { return } - dockerIsCloud = options.cloudMode + dockerImpl(options, options.cloudMode, actionSupplier) } + } + + private void dockerImpl(ClusterOptions options, boolean isCloud, Closure actionSupplier) throws Exception { + logger.info("=== start run suite {} in {} mode. ===", name, (isCloud ? "cloud" : "not_cloud")) try { cluster.destroy(true) - cluster.init(options, dockerIsCloud) + cluster.init(options, isCloud) def user = context.config.jdbcUser def password = context.config.jdbcPassword @@ -329,7 +329,7 @@ class Suite implements GroovyInterceptable { logger.info("get fe {}", fe) assertNotNull(fe) - if (!dockerIsCloud) { + if (!isCloud) { for (def be : cluster.getAllBackends()) { be_report_disk(be.host, be.httpPort) } @@ -1478,7 +1478,11 @@ class Suite implements GroovyInterceptable { } boolean isCloudMode() { - return context.config.isCloudMode() + if (cluster.isRunning()) { + return cluster.isCloudMode() + } else { + return context.config.isCloudMode() + } } boolean enableStoragevault() { diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SuiteCluster.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SuiteCluster.groovy index c272be390513bb..2aaece2c6785b1 100644 --- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SuiteCluster.groovy +++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/SuiteCluster.groovy @@ -270,6 +270,7 @@ class SuiteCluster { final Config config private boolean running private boolean sqlModeNodeMgr = false + private boolean isCloudMode = false SuiteCluster(String name, Config config) { this.name = name @@ -282,6 +283,8 @@ class SuiteCluster { assert options.feNum > 0 || options.beNum > 0 assert config.image != null && config.image != '' + this.isCloudMode = isCloud + def cmd = [ 'up', name, config.image ] @@ -515,6 +518,10 @@ class SuiteCluster { return running } + boolean isCloudMode() { + return this.isCloudMode + } + // if not specific fe indices, then start all frontends void startFrontends(int... indices) { runFrontendsCmd('start', indices) diff --git a/regression-test/suites/schema_change_p0/test_abort_txn_by_be_cloud1.groovy b/regression-test/suites/schema_change_p0/test_abort_txn_by_be.groovy similarity index 88% rename from regression-test/suites/schema_change_p0/test_abort_txn_by_be_cloud1.groovy rename to regression-test/suites/schema_change_p0/test_abort_txn_by_be.groovy index f2d0b767eb89fe..b1af2b1fcad76d 100644 --- a/regression-test/suites/schema_change_p0/test_abort_txn_by_be_cloud1.groovy +++ b/regression-test/suites/schema_change_p0/test_abort_txn_by_be.groovy @@ -18,13 +18,15 @@ import org.apache.doris.regression.suite.ClusterOptions import org.apache.http.NoHttpResponseException -suite('test_abort_txn_by_be_cloud1', 'docker') { +suite('test_abort_txn_by_be', 'docker') { + + def run_test = { enable_abort_txn_by_checking_coordinator_be, enable_abort_txn_by_checking_conflict_txn -> def options = new ClusterOptions() - options.cloudMode = true + options.cloudMode = null options.enableDebugPoints() options.beConfigs += [ "enable_java_support=false" ] - options.feConfigs += [ "enable_abort_txn_by_checking_coordinator_be=true" ] - options.feConfigs += [ "enable_abort_txn_by_checking_conflict_txn=false" ] + options.feConfigs += [ "enable_abort_txn_by_checking_coordinator_be=${enable_abort_txn_by_checking_coordinator_be}" ] + options.feConfigs += [ "enable_abort_txn_by_checking_conflict_txn=${enable_abort_txn_by_checking_conflict_txn}" ] options.beNum = 1 docker(options) { @@ -59,6 +61,8 @@ suite('test_abort_txn_by_be_cloud1', 'docker') { lo_shippriority,lo_quantity,lo_extendedprice,lo_ordtotalprice,lo_discount, lo_revenue,lo_supplycost,lo_tax,lo_commitdate,lo_shipmode,lo_dummy""" + GetDebugPoint().enableDebugPointForAllBEs('StreamLoadExecutor.commit_txn.block') + thread { streamLoad { // a default db 'regression_test' is specified in @@ -86,22 +90,21 @@ suite('test_abort_txn_by_be_cloud1', 'docker') { // if declared a check callback, the default check condition will ignore. // So you must check all condition check { result, exception, startTime, endTime -> - if (exception != null) { - throw exception - } - log.info("Stream load result: ${result}".toString()) - def json = parseJson(result) - assertEquals("success", json.Status.toLowerCase()) - assertEquals(json.NumberTotalRows, json.NumberLoadedRows) - assertTrue(json.NumberLoadedRows > 0 && json.LoadBytes > 0) } } } - sleep(10000) + if (isCloudMode()) { + sleep 3000 + } else { + def dbId = getDbId() + dockerAwaitUntil(20, { + def txns = sql_return_maparray("show proc '/transactions/${dbId}/running'") + txns.size() > 0 + }) + } sql """ alter table ${tableName} modify column lo_suppkey bigint NULL """ - String result = "" int max_try_time = 3000 while (max_try_time--){ @@ -161,4 +164,8 @@ suite('test_abort_txn_by_be_cloud1', 'docker') { } } } + } + + run_test(true, false) + run_test(false, true) } diff --git a/regression-test/suites/schema_change_p0/test_abort_txn_by_be_cloud2.groovy b/regression-test/suites/schema_change_p0/test_abort_txn_by_be_cloud2.groovy deleted file mode 100644 index 7264ac7f90a9f4..00000000000000 --- a/regression-test/suites/schema_change_p0/test_abort_txn_by_be_cloud2.groovy +++ /dev/null @@ -1,164 +0,0 @@ -// 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. - -import org.apache.doris.regression.suite.ClusterOptions -import org.apache.http.NoHttpResponseException - -suite('test_abort_txn_by_be_cloud2', 'docker') { - def options = new ClusterOptions() - options.cloudMode = true - options.enableDebugPoints() - options.beConfigs += [ "enable_java_support=false" ] - options.feConfigs += [ "enable_abort_txn_by_checking_coordinator_be=false" ] - options.feConfigs += [ "enable_abort_txn_by_checking_conflict_txn=true" ] - options.beNum = 1 - - docker(options) { - def getJobState = { tableName -> - def jobStateResult = sql """ SHOW ALTER TABLE COLUMN WHERE IndexName='${tableName}' ORDER BY createtime DESC LIMIT 1 """ - return jobStateResult[0][9] - } - - def s3BucketName = getS3BucketName() - def s3WithProperties = """WITH S3 ( - |"AWS_ACCESS_KEY" = "${getS3AK()}", - |"AWS_SECRET_KEY" = "${getS3SK()}", - |"AWS_ENDPOINT" = "${getS3Endpoint()}", - |"AWS_REGION" = "${getS3Region()}", - |"provider" = "${getS3Provider()}") - |PROPERTIES( - |"exec_mem_limit" = "8589934592", - |"load_parallelism" = "3")""".stripMargin() - - // set fe configuration - sql "ADMIN SET FRONTEND CONFIG ('max_bytes_per_broker_scanner' = '161061273600')" - - def tableName = "lineorder" - // create table if not exists - sql new File("""${context.file.parent}/ddl/lineorder_delete.sql""").text - sql new File("""${context.file.parent}/ddl/lineorder_create.sql""").text - - def coordinatorBe = cluster.getAllBackends().get(0) - def coordinatorBeHost = coordinatorBe.host - - def column = """lo_orderkey,lo_linenumber,lo_custkey,lo_partkey,lo_suppkey,lo_orderdate,lo_orderpriority, - lo_shippriority,lo_quantity,lo_extendedprice,lo_ordtotalprice,lo_discount, - lo_revenue,lo_supplycost,lo_tax,lo_commitdate,lo_shipmode,lo_dummy""" - - thread { - streamLoad { - // a default db 'regression_test' is specified in - // ${DORIS_HOME}/conf/regression-conf.groovy - table tableName - - // default label is UUID: - // set 'label' UUID.randomUUID().toString() - - // default column_separator is specify in doris fe config, usually is '\t'. - // this line change to ',' - set 'column_separator', '|' - set 'compress_type', 'GZ' - set 'columns', column - - - // relate to ${DORIS_HOME}/regression-test/data/demo/streamload_input.csv. - // also, you can stream load a http stream, e.g. http://xxx/some.csv - file """${getS3Url()}/regression/ssb/sf100/lineorder.tbl.1.gz""" - - time 600 * 1000 - - // stream load action will check result, include Success status, and NumberTotalRows == NumberLoadedRows - - // if declared a check callback, the default check condition will ignore. - // So you must check all condition - check { result, exception, startTime, endTime -> - if (exception != null) { - throw exception - } - log.info("Stream load result: ${result}".toString()) - def json = parseJson(result) - assertEquals("success", json.Status.toLowerCase()) - assertEquals(json.NumberTotalRows, json.NumberLoadedRows) - assertTrue(json.NumberLoadedRows > 0 && json.LoadBytes > 0) - } - } - } - - sleep(10000) - - sql """ alter table ${tableName} modify column lo_suppkey bigint NULL """ - - String result = "" - int max_try_time = 3000 - while (max_try_time--){ - result = getJobState(tableName) - if (result == "PENDING") { - sleep(3000) - } else { - break; - } - } - if (max_try_time < 1){ - assertEquals(1,2) - } - assertEquals(result, "WAITING_TXN"); - - cluster.stopBackends(coordinatorBe.index) - def isDead = false - for (def i = 0; i < 10; i++) { - def be = sql_return_maparray('show backends').find { it.Host == coordinatorBeHost } - if (!be.Alive.toBoolean()) { - isDead = true - break - } - sleep 1000 - } - assertTrue(isDead) - sleep 10000 - - result = getJobState(tableName) - assertEquals(result, "WAITING_TXN"); - - // coordinatorBe restart, abort txn on it - cluster.startBackends(coordinatorBe.index) - def isAlive = false - for (def i = 0; i < 20; i++) { - def be = sql_return_maparray('show backends').find { it.Host == coordinatorBeHost } - if (be.Alive.toBoolean()) { - isAlive = true - break - } - sleep 1000 - } - assertTrue(isAlive) - sleep 5000 - - max_try_time = 3000 - while (max_try_time--){ - result = getJobState(tableName) - if (result == "FINISHED") { - sleep(3000) - break - } else { - sleep(100) - if (max_try_time < 1){ - assertEquals(1,2) - } - } - } - } -} diff --git a/regression-test/suites/schema_change_p0/test_abort_txn_by_be_local5.groovy b/regression-test/suites/schema_change_p0/test_abort_txn_by_be_local5.groovy deleted file mode 100644 index 3835da4ccb2dd9..00000000000000 --- a/regression-test/suites/schema_change_p0/test_abort_txn_by_be_local5.groovy +++ /dev/null @@ -1,164 +0,0 @@ -// 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. - -import org.apache.doris.regression.suite.ClusterOptions -import org.apache.http.NoHttpResponseException - -suite('test_abort_txn_by_be_local5', 'docker') { - def options = new ClusterOptions() - options.cloudMode = false - options.enableDebugPoints() - options.beConfigs += [ "enable_java_support=false" ] - options.feConfigs += [ "enable_abort_txn_by_checking_coordinator_be=true" ] - options.feConfigs += [ "enable_abort_txn_by_checking_conflict_txn=false" ] - options.beNum = 1 - - docker(options) { - def getJobState = { tableName -> - def jobStateResult = sql """ SHOW ALTER TABLE COLUMN WHERE IndexName='${tableName}' ORDER BY createtime DESC LIMIT 1 """ - return jobStateResult[0][9] - } - - def s3BucketName = getS3BucketName() - def s3WithProperties = """WITH S3 ( - |"AWS_ACCESS_KEY" = "${getS3AK()}", - |"AWS_SECRET_KEY" = "${getS3SK()}", - |"AWS_ENDPOINT" = "${getS3Endpoint()}", - |"AWS_REGION" = "${getS3Region()}", - |"provider" = "${getS3Provider()}") - |PROPERTIES( - |"exec_mem_limit" = "8589934592", - |"load_parallelism" = "3")""".stripMargin() - - // set fe configuration - sql "ADMIN SET FRONTEND CONFIG ('max_bytes_per_broker_scanner' = '161061273600')" - - def tableName = "lineorder" - // create table if not exists - sql new File("""${context.file.parent}/ddl/lineorder_delete.sql""").text - sql new File("""${context.file.parent}/ddl/lineorder_create.sql""").text - - def coordinatorBe = cluster.getAllBackends().get(0) - def coordinatorBeHost = coordinatorBe.host - - def column = """lo_orderkey,lo_linenumber,lo_custkey,lo_partkey,lo_suppkey,lo_orderdate,lo_orderpriority, - lo_shippriority,lo_quantity,lo_extendedprice,lo_ordtotalprice,lo_discount, - lo_revenue,lo_supplycost,lo_tax,lo_commitdate,lo_shipmode,lo_dummy""" - - thread { - streamLoad { - // a default db 'regression_test' is specified in - // ${DORIS_HOME}/conf/regression-conf.groovy - table tableName - - // default label is UUID: - // set 'label' UUID.randomUUID().toString() - - // default column_separator is specify in doris fe config, usually is '\t'. - // this line change to ',' - set 'column_separator', '|' - set 'compress_type', 'GZ' - set 'columns', column - - - // relate to ${DORIS_HOME}/regression-test/data/demo/streamload_input.csv. - // also, you can stream load a http stream, e.g. http://xxx/some.csv - file """${getS3Url()}/regression/ssb/sf100/lineorder.tbl.1.gz""" - - time 600 * 1000 - - // stream load action will check result, include Success status, and NumberTotalRows == NumberLoadedRows - - // if declared a check callback, the default check condition will ignore. - // So you must check all condition - check { result, exception, startTime, endTime -> - if (exception != null) { - throw exception - } - log.info("Stream load result: ${result}".toString()) - def json = parseJson(result) - assertEquals("success", json.Status.toLowerCase()) - assertEquals(json.NumberTotalRows, json.NumberLoadedRows) - assertTrue(json.NumberLoadedRows > 0 && json.LoadBytes > 0) - } - } - } - - sleep(10000) - - sql """ alter table ${tableName} modify column lo_suppkey bigint NULL """ - - String result = "" - int max_try_time = 3000 - while (max_try_time--){ - result = getJobState(tableName) - if (result == "PENDING") { - sleep(3000) - } else { - break; - } - } - if (max_try_time < 1){ - assertEquals(1,2) - } - assertEquals(result, "WAITING_TXN"); - - cluster.stopBackends(coordinatorBe.index) - def isDead = false - for (def i = 0; i < 10; i++) { - def be = sql_return_maparray('show backends').find { it.Host == coordinatorBeHost } - if (!be.Alive.toBoolean()) { - isDead = true - break - } - sleep 1000 - } - assertTrue(isDead) - sleep 10000 - - result = getJobState(tableName) - assertEquals(result, "WAITING_TXN"); - - // coordinatorBe restart, abort txn on it - cluster.startBackends(coordinatorBe.index) - def isAlive = false - for (def i = 0; i < 20; i++) { - def be = sql_return_maparray('show backends').find { it.Host == coordinatorBeHost } - if (be.Alive.toBoolean()) { - isAlive = true - break - } - sleep 1000 - } - assertTrue(isAlive) - sleep 20000 - - max_try_time = 3000 - while (max_try_time--){ - result = getJobState(tableName) - if (result == "FINISHED") { - sleep(3000) - break - } else { - sleep(100) - if (max_try_time < 1){ - assertEquals(1,2) - } - } - } - } -} diff --git a/regression-test/suites/schema_change_p0/test_abort_txn_by_be_local6.groovy b/regression-test/suites/schema_change_p0/test_abort_txn_by_be_local6.groovy deleted file mode 100644 index ff53c41259058a..00000000000000 --- a/regression-test/suites/schema_change_p0/test_abort_txn_by_be_local6.groovy +++ /dev/null @@ -1,164 +0,0 @@ -// 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. - -import org.apache.doris.regression.suite.ClusterOptions -import org.apache.http.NoHttpResponseException - -suite('test_abort_txn_by_be_local6', 'docker') { - def options = new ClusterOptions() - options.cloudMode = false - options.enableDebugPoints() - options.beConfigs += [ "enable_java_support=false" ] - options.feConfigs += [ "enable_abort_txn_by_checking_coordinator_be=false" ] - options.feConfigs += [ "enable_abort_txn_by_checking_conflict_txn=true" ] - options.beNum = 1 - - docker(options) { - def getJobState = { tableName -> - def jobStateResult = sql """ SHOW ALTER TABLE COLUMN WHERE IndexName='${tableName}' ORDER BY createtime DESC LIMIT 1 """ - return jobStateResult[0][9] - } - - def s3BucketName = getS3BucketName() - def s3WithProperties = """WITH S3 ( - |"AWS_ACCESS_KEY" = "${getS3AK()}", - |"AWS_SECRET_KEY" = "${getS3SK()}", - |"AWS_ENDPOINT" = "${getS3Endpoint()}", - |"AWS_REGION" = "${getS3Region()}", - |"provider" = "${getS3Provider()}") - |PROPERTIES( - |"exec_mem_limit" = "8589934592", - |"load_parallelism" = "3")""".stripMargin() - - // set fe configuration - sql "ADMIN SET FRONTEND CONFIG ('max_bytes_per_broker_scanner' = '161061273600')" - - def tableName = "lineorder" - // create table if not exists - sql new File("""${context.file.parent}/ddl/lineorder_delete.sql""").text - sql new File("""${context.file.parent}/ddl/lineorder_create.sql""").text - - def coordinatorBe = cluster.getAllBackends().get(0) - def coordinatorBeHost = coordinatorBe.host - - def column = """lo_orderkey,lo_linenumber,lo_custkey,lo_partkey,lo_suppkey,lo_orderdate,lo_orderpriority, - lo_shippriority,lo_quantity,lo_extendedprice,lo_ordtotalprice,lo_discount, - lo_revenue,lo_supplycost,lo_tax,lo_commitdate,lo_shipmode,lo_dummy""" - - thread { - streamLoad { - // a default db 'regression_test' is specified in - // ${DORIS_HOME}/conf/regression-conf.groovy - table tableName - - // default label is UUID: - // set 'label' UUID.randomUUID().toString() - - // default column_separator is specify in doris fe config, usually is '\t'. - // this line change to ',' - set 'column_separator', '|' - set 'compress_type', 'GZ' - set 'columns', column - - - // relate to ${DORIS_HOME}/regression-test/data/demo/streamload_input.csv. - // also, you can stream load a http stream, e.g. http://xxx/some.csv - file """${getS3Url()}/regression/ssb/sf100/lineorder.tbl.1.gz""" - - time 600 * 1000 - - // stream load action will check result, include Success status, and NumberTotalRows == NumberLoadedRows - - // if declared a check callback, the default check condition will ignore. - // So you must check all condition - check { result, exception, startTime, endTime -> - if (exception != null) { - throw exception - } - log.info("Stream load result: ${result}".toString()) - def json = parseJson(result) - assertEquals("success", json.Status.toLowerCase()) - assertEquals(json.NumberTotalRows, json.NumberLoadedRows) - assertTrue(json.NumberLoadedRows > 0 && json.LoadBytes > 0) - } - } - } - - sleep(10000) - - sql """ alter table ${tableName} modify column lo_suppkey bigint NULL """ - - String result = "" - int max_try_time = 3000 - while (max_try_time--){ - result = getJobState(tableName) - if (result == "PENDING") { - sleep(3000) - } else { - break; - } - } - if (max_try_time < 1){ - assertEquals(1,2) - } - assertEquals(result, "WAITING_TXN"); - - cluster.stopBackends(coordinatorBe.index) - def isDead = false - for (def i = 0; i < 10; i++) { - def be = sql_return_maparray('show backends').find { it.Host == coordinatorBeHost } - if (!be.Alive.toBoolean()) { - isDead = true - break - } - sleep 1000 - } - assertTrue(isDead) - sleep 10000 - - result = getJobState(tableName) - assertEquals(result, "WAITING_TXN"); - - // coordinatorBe restart, abort txn on it - cluster.startBackends(coordinatorBe.index) - def isAlive = false - for (def i = 0; i < 20; i++) { - def be = sql_return_maparray('show backends').find { it.Host == coordinatorBeHost } - if (be.Alive.toBoolean()) { - isAlive = true - break - } - sleep 1000 - } - assertTrue(isAlive) - sleep 5000 - - max_try_time = 3000 - while (max_try_time--){ - result = getJobState(tableName) - if (result == "FINISHED") { - sleep(3000) - break - } else { - sleep(100) - if (max_try_time < 1){ - assertEquals(1,2) - } - } - } - } -} diff --git a/regression-test/suites/schema_change_p0/test_abort_txn_by_fe_cloud4.groovy b/regression-test/suites/schema_change_p0/test_abort_txn_by_fe.groovy similarity index 75% rename from regression-test/suites/schema_change_p0/test_abort_txn_by_fe_cloud4.groovy rename to regression-test/suites/schema_change_p0/test_abort_txn_by_fe.groovy index 80b61e16efd3b0..d93e8a203e300e 100644 --- a/regression-test/suites/schema_change_p0/test_abort_txn_by_fe_cloud4.groovy +++ b/regression-test/suites/schema_change_p0/test_abort_txn_by_fe.groovy @@ -18,13 +18,17 @@ import org.apache.doris.regression.suite.ClusterOptions import org.apache.http.NoHttpResponseException -suite('test_abort_txn_by_fe_cloud4', 'docker') { +suite('test_abort_txn_by_fe', 'docker') { def options = new ClusterOptions() - options.cloudMode = true + options.cloudMode = null options.enableDebugPoints() options.beConfigs += [ "enable_java_support=false" ] - options.feConfigs += [ "enable_abort_txn_by_checking_coordinator_be=false" ] - options.feConfigs += [ "enable_abort_txn_by_checking_conflict_txn=true" ] + options.feConfigs += [ + "load_checker_interval_second=2", + "enable_abort_txn_by_checking_coordinator_be=false", + "enable_abort_txn_by_checking_conflict_txn=true", + ] + options.feNum = 3 options.beNum = 1 docker(options) { @@ -59,10 +63,15 @@ suite('test_abort_txn_by_fe_cloud4', 'docker') { loadSql = loadSql.replaceAll("\\\$\\{loadLabel\\}", loadLabel) + s3WithProperties sql loadSql - def coordinatorFe = cluster.getAllFrontends().get(0) - def coordinatorFeHost = coordinatorFe.host - - sleep(5000) + if (isCloudMode()) { + sleep 6000 + } else { + def dbId = getDbId() + dockerAwaitUntil(20, { + def txns = sql_return_maparray("show proc '/transactions/${dbId}/running'") + txns.any { it.Label == loadLabel } + }) + } sql """ alter table ${table} modify column lo_suppkey bigint NULL """ @@ -82,9 +91,22 @@ suite('test_abort_txn_by_fe_cloud4', 'docker') { sleep 10000 assertEquals(result, "WAITING_TXN"); - cluster.restartFrontends() - sleep(30000) + def oldMasterFe = cluster.getMasterFe() + cluster.restartFrontends(oldMasterFe.index) + boolean hasRestart = false + for (int i = 0; i < 30; i++) { + if (cluster.getFeByIndex(oldMasterFe.index).alive) { + hasRestart = true + break + } + sleep 1000 + } + assertTrue(hasRestart) context.reconnectFe() + if (!isCloudMode()) { + def newMasterFe = cluster.getMasterFe() + assertTrue(oldMasterFe.index != newMasterFe.index) + } max_try_time = 3000 while (max_try_time--){ diff --git a/regression-test/suites/schema_change_p0/test_abort_txn_by_fe_local3.groovy b/regression-test/suites/schema_change_p0/test_abort_txn_by_fe_local3.groovy deleted file mode 100644 index 32cd9d0eba781b..00000000000000 --- a/regression-test/suites/schema_change_p0/test_abort_txn_by_fe_local3.groovy +++ /dev/null @@ -1,104 +0,0 @@ -// 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. - -import org.apache.doris.regression.suite.ClusterOptions -import org.apache.http.NoHttpResponseException - -suite('test_abort_txn_by_fe_local3', 'docker') { - def options = new ClusterOptions() - options.cloudMode = false - options.enableDebugPoints() - options.beConfigs += [ "enable_java_support=false" ] - options.feConfigs += [ "enable_abort_txn_by_checking_coordinator_be=false" ] - options.feConfigs += [ "enable_abort_txn_by_checking_conflict_txn=true" ] - options.beNum = 1 - - docker(options) { - def getJobState = { tableName -> - def jobStateResult = sql """ SHOW ALTER TABLE COLUMN WHERE IndexName='${tableName}' ORDER BY createtime DESC LIMIT 1 """ - return jobStateResult[0][9] - } - - def s3BucketName = getS3BucketName() - def s3WithProperties = """WITH S3 ( - |"AWS_ACCESS_KEY" = "${getS3AK()}", - |"AWS_SECRET_KEY" = "${getS3SK()}", - |"AWS_ENDPOINT" = "${getS3Endpoint()}", - |"AWS_REGION" = "${getS3Region()}", - |"provider" = "${getS3Provider()}") - |PROPERTIES( - |"exec_mem_limit" = "8589934592", - |"load_parallelism" = "3")""".stripMargin() - - // set fe configuration - sql "ADMIN SET FRONTEND CONFIG ('max_bytes_per_broker_scanner' = '161061273600')" - - def table= "lineorder" - // create table if not exists - sql new File("""${context.file.parent}/ddl/lineorder_delete.sql""").text - sql new File("""${context.file.parent}/ddl/lineorder_create.sql""").text - def uniqueID = Math.abs(UUID.randomUUID().hashCode()).toString() - def loadLabel = table + '_' + uniqueID - - // load data from cos - def loadSql = new File("""${context.file.parent}/ddl/${table}_load.sql""").text.replaceAll("\\\$\\{s3BucketName\\}", s3BucketName) - loadSql = loadSql.replaceAll("\\\$\\{loadLabel\\}", loadLabel) + s3WithProperties - sql loadSql - - def coordinatorFe = cluster.getAllFrontends().get(0) - def coordinatorFeHost = coordinatorFe.host - - sleep(5000) - - sql """ alter table ${table} modify column lo_suppkey bigint NULL """ - - String result = "" - int max_try_time = 3000 - while (max_try_time--){ - result = getJobState(table) - if (result == "PENDING") { - sleep(3000) - } else { - break; - } - } - if (max_try_time < 1){ - assertEquals(1,2) - } - sleep 10000 - assertEquals(result, "WAITING_TXN"); - - cluster.restartFrontends() - sleep(30000) - context.reconnectFe() - - max_try_time = 3000 - while (max_try_time--){ - result = getJobState(table) - System.out.println(result) - if (result == "FINISHED") { - sleep(3000) - break - } else { - sleep(100) - if (max_try_time < 1){ - assertEquals(1,2) - } - } - } - } -} From e93587aff479c75d4066e38cca45873a9c1d7ce8 Mon Sep 17 00:00:00 2001 From: yiguolei <676222867@qq.com> Date: Wed, 2 Oct 2024 19:14:05 +0800 Subject: [PATCH 11/12] [bugfix](brpc) Should use status to generate protobuf message, because it will encoding Backend Info (#41515) Should use status to generate protobuf message, because it will encoding Backend Info --- be/src/service/internal_service.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/be/src/service/internal_service.h b/be/src/service/internal_service.h index 04c0a86ef046eb..b3ab1c5a6474c0 100644 --- a/be/src/service/internal_service.h +++ b/be/src/service/internal_service.h @@ -50,9 +50,11 @@ void offer_failed(T* response, google::protobuf::Closure* done, const FifoThread template void offer_failed(T* response, google::protobuf::Closure* done, const FifoThreadPool& pool) { brpc::ClosureGuard closure_guard(done); - response->mutable_status()->set_status_code(TStatusCode::CANCELLED); - response->mutable_status()->add_error_msgs("fail to offer request to the work pool, pool=" + - pool.get_info()); + // Should use status to generate protobuf message, because it will encoding Backend Info + // into the error message and then we could know which backend's pool is full. + Status st = Status::Error( + "fail to offer request to the work pool, pool={}", pool.get_info()); + st.to_protobuf(response->mutable_status()); LOG(WARNING) << "cancelled due to fail to offer request to the work pool, pool=" << pool.get_info(); } From 9b8e65b294c443d50e2745fdbc9f9a9aadef68ba Mon Sep 17 00:00:00 2001 From: Calvin Kirs Date: Sat, 5 Oct 2024 20:02:01 +0800 Subject: [PATCH 12/12] [chore](test)Print docker-related process information when executing kerbreos-related cases (#41517) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …kerbreos-related cases ## Proposed changes Issue Number: close #xxx --- .../kerberos/test_single_hive_kerberos.groovy | 8 ++++++++ .../kerberos/test_two_hive_kerberos.groovy | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/regression-test/suites/external_table_p0/kerberos/test_single_hive_kerberos.groovy b/regression-test/suites/external_table_p0/kerberos/test_single_hive_kerberos.groovy index dfe5532fefdb44..505c5208c9988c 100644 --- a/regression-test/suites/external_table_p0/kerberos/test_single_hive_kerberos.groovy +++ b/regression-test/suites/external_table_p0/kerberos/test_single_hive_kerberos.groovy @@ -16,6 +16,14 @@ // under the License. suite("test_single_hive_kerberos", "p0,external,kerberos,external_docker,external_docker_kerberos") { + def command = "sudo docker ps" + def process = command.execute() + process.waitFor() + + def output = process.in.text + + println "Docker containers:" + println output String enabled = context.config.otherConfigs.get("enableKerberosTest") if (enabled != null && enabled.equalsIgnoreCase("true")) { String hms_catalog_name = "test_single_hive_kerberos" diff --git a/regression-test/suites/external_table_p0/kerberos/test_two_hive_kerberos.groovy b/regression-test/suites/external_table_p0/kerberos/test_two_hive_kerberos.groovy index 2c94c08a6ed29c..29b0cb2cd7e9c6 100644 --- a/regression-test/suites/external_table_p0/kerberos/test_two_hive_kerberos.groovy +++ b/regression-test/suites/external_table_p0/kerberos/test_two_hive_kerberos.groovy @@ -20,6 +20,14 @@ import groovyjarjarantlr4.v4.codegen.model.ExceptionClause import org.junit.Assert; suite("test_two_hive_kerberos", "p0,external,kerberos,external_docker,external_docker_kerberos") { + def command = "sudo docker ps" + def process = command.execute() + process.waitFor() + + def output = process.in.text + + println "Docker containers:" + println output String enabled = context.config.otherConfigs.get("enableKerberosTest") if (enabled != null && enabled.equalsIgnoreCase("true")) { String hms_catalog_name = "test_two_hive_kerberos"