diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/NormalizeToSlot.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/NormalizeToSlot.java index 0e1fba1fc44920..85367107a2c52a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/NormalizeToSlot.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/NormalizeToSlot.java @@ -125,6 +125,14 @@ public List normalizeToUseSlotRef(Collection expres NormalizeToSlotTriplet normalizeToSlotTriplet = normalizeToSlotMap.get(child); return normalizeToSlotTriplet == null ? child : normalizeToSlotTriplet.remainExpr; }); + if (rewriteExpr instanceof Alias) { + Alias alias = (Alias) rewriteExpr; + if (alias.child() instanceof SlotReference + && alias.getExprId().equals(((SlotReference) alias.child()).getExprId())) { + // alias k1#1 as k1#1 --> k1#1 + rewriteExpr = alias.child(); + } + } result.add((E) rewriteExpr); } return result.build(); diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/ExtractAndNormalizeWindowExpressionTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/ExtractAndNormalizeWindowExpressionTest.java index 476131e6b068b1..a3527f5d501763 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/ExtractAndNormalizeWindowExpressionTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/ExtractAndNormalizeWindowExpressionTest.java @@ -90,7 +90,7 @@ public void testSimpleWindowFunction() { ).when(project -> { List projects = project.getProjects(); return projects.get(0).equals(id) - && projects.get(1) instanceof Alias; + && projects.get(1) instanceof SlotReference && projects.get(1).equals(windowAlias.toSlot()); }) ); } @@ -147,7 +147,7 @@ public void testComplexWindowFunction() { ).when(project -> { List projects = project.getProjects(); return projects.get(0) instanceof SlotReference - && projects.get(1) instanceof Alias; + && projects.get(1) instanceof SlotReference && projects.get(1).equals(windowAlias.toSlot()); }) ); } @@ -226,8 +226,7 @@ public void testComplexWindowFunctionTogetherWithAggregateFunction() { List projects = project.getProjects(); return projects.get(0).equals(gender) && projects.get(1) instanceof SlotReference - && projects.get(2) instanceof Alias - && projects.get(2).child(0) instanceof SlotReference; + && projects.get(2) instanceof SlotReference && projects.get(2).equals(windowAlias.toSlot()); }) ); } diff --git a/regression-test/data/nereids_rules_p0/push_down_filter/push_down_filter_through_window.out b/regression-test/data/nereids_rules_p0/push_down_filter/push_down_filter_through_window.out index 9ecb96e1fc0b74..6efd09e5d1deec 100644 --- a/regression-test/data/nereids_rules_p0/push_down_filter/push_down_filter_through_window.out +++ b/regression-test/data/nereids_rules_p0/push_down_filter/push_down_filter_through_window.out @@ -1,7 +1,7 @@ -- This file is automatically generated. You should know what you did if you want to edit this -- !multi_column_predicate_push_down_window_shape -- PhysicalResultSink ---filter((num <= 2)) +--filter((t.num <= 2)) ----PhysicalWindow ------PhysicalQuickSort[LOCAL_SORT] --------PhysicalPartitionTopN @@ -15,7 +15,7 @@ PhysicalResultSink -- !multi_column_or_predicate_push_down_window_shape -- PhysicalResultSink ---filter((rc < 2)) +--filter((t.rc < 2)) ----PhysicalWindow ------PhysicalQuickSort[LOCAL_SORT] --------PhysicalPartitionTopN diff --git a/regression-test/data/nereids_syntax_p0/push_filter_through_ptopn.out b/regression-test/data/nereids_syntax_p0/push_filter_through_ptopn.out index dd23fd8ea500f2..49e5abb8c5f35a 100644 --- a/regression-test/data/nereids_syntax_p0/push_filter_through_ptopn.out +++ b/regression-test/data/nereids_syntax_p0/push_filter_through_ptopn.out @@ -6,7 +6,7 @@ -- !shape_1 -- PhysicalResultSink --PhysicalDistribute[DistributionSpecGather] -----filter((rn <= 2)) +----filter((T.rn <= 2)) ------PhysicalWindow --------PhysicalQuickSort[LOCAL_SORT] ----------PhysicalPartitionTopN @@ -22,7 +22,7 @@ PhysicalResultSink PhysicalResultSink --PhysicalDistribute[DistributionSpecGather] ----PhysicalProject -------filter((rn <= 2)) +------filter((T.rn <= 2)) --------PhysicalWindow ----------PhysicalQuickSort[LOCAL_SORT] ------------PhysicalPartitionTopN @@ -32,7 +32,7 @@ PhysicalResultSink -- !3 -- PhysicalResultSink --PhysicalDistribute[DistributionSpecGather] -----filter((T.b = 2) and (rn <= 2)) +----filter((T.b = 2) and (T.rn <= 2)) ------PhysicalWindow --------PhysicalQuickSort[LOCAL_SORT] ----------PhysicalPartitionTopN @@ -42,7 +42,7 @@ PhysicalResultSink PhysicalResultSink --PhysicalDistribute[DistributionSpecGather] ----PhysicalProject -------filter((T.b = 2) and (rn <= 2)) +------filter((T.b = 2) and (T.rn <= 2)) --------PhysicalWindow ----------PhysicalQuickSort[LOCAL_SORT] ------------PhysicalDistribute[DistributionSpecHash] diff --git a/regression-test/data/nonConcurrent/hint_tpcds_p0/shape/query44.out b/regression-test/data/nonConcurrent/hint_tpcds_p0/shape/query44.out index 46c087a578793d..28ec1ba2f6f97c 100644 --- a/regression-test/data/nonConcurrent/hint_tpcds_p0/shape/query44.out +++ b/regression-test/data/nonConcurrent/hint_tpcds_p0/shape/query44.out @@ -13,7 +13,7 @@ PhysicalResultSink --------------------PhysicalOlapScan[item] apply RFs: RF1 ------------------PhysicalDistribute[DistributionSpecHash] --------------------PhysicalProject -----------------------filter((rnk < 11)) +----------------------filter((V11.rnk < 11)) ------------------------PhysicalWindow --------------------------PhysicalQuickSort[MERGE_SORT] ----------------------------PhysicalDistribute[DistributionSpecGather] @@ -46,7 +46,7 @@ PhysicalResultSink --------------------PhysicalOlapScan[item] apply RFs: RF0 ------------------PhysicalDistribute[DistributionSpecHash] --------------------PhysicalProject -----------------------filter((rnk < 11)) +----------------------filter((V21.rnk < 11)) ------------------------PhysicalWindow --------------------------PhysicalQuickSort[MERGE_SORT] ----------------------------PhysicalDistribute[DistributionSpecGather] diff --git a/regression-test/data/nonConcurrent/hint_tpcds_p0/shape/query49.out b/regression-test/data/nonConcurrent/hint_tpcds_p0/shape/query49.out index 76b88bd85d5496..7bd9127746c823 100644 --- a/regression-test/data/nonConcurrent/hint_tpcds_p0/shape/query49.out +++ b/regression-test/data/nonConcurrent/hint_tpcds_p0/shape/query49.out @@ -16,7 +16,7 @@ PhysicalResultSink --------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------hashAgg[LOCAL] ------------------------------PhysicalProject ---------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +--------------------------------filter(((web.return_rank <= 10) OR (web.currency_rank <= 10))) ----------------------------------PhysicalWindow ------------------------------------PhysicalQuickSort[LOCAL_SORT] --------------------------------------PhysicalWindow @@ -48,7 +48,7 @@ PhysicalResultSink --------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------hashAgg[LOCAL] ------------------------------PhysicalProject ---------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +--------------------------------filter(((catalog.return_rank <= 10) OR (catalog.currency_rank <= 10))) ----------------------------------PhysicalWindow ------------------------------------PhysicalQuickSort[LOCAL_SORT] --------------------------------------PhysicalWindow @@ -80,7 +80,7 @@ PhysicalResultSink --------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------hashAgg[LOCAL] ------------------------------PhysicalProject ---------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +--------------------------------filter(((store.return_rank <= 10) OR (store.currency_rank <= 10))) ----------------------------------PhysicalWindow ------------------------------------PhysicalQuickSort[LOCAL_SORT] --------------------------------------PhysicalWindow diff --git a/regression-test/data/nonConcurrent/hint_tpcds_p0/shape/query51.out b/regression-test/data/nonConcurrent/hint_tpcds_p0/shape/query51.out index a118ffcd777d42..976b1664aec53f 100644 --- a/regression-test/data/nonConcurrent/hint_tpcds_p0/shape/query51.out +++ b/regression-test/data/nonConcurrent/hint_tpcds_p0/shape/query51.out @@ -5,7 +5,7 @@ PhysicalResultSink ----PhysicalDistribute[DistributionSpecGather] ------PhysicalTopN[LOCAL_SORT] --------PhysicalProject -----------filter((web_cumulative > store_cumulative)) +----------filter((y.web_cumulative > y.store_cumulative)) ------------PhysicalWindow --------------PhysicalQuickSort[LOCAL_SORT] ----------------PhysicalDistribute[DistributionSpecHash] diff --git a/regression-test/data/nonConcurrent/hint_tpcds_p0/shape/query67.out b/regression-test/data/nonConcurrent/hint_tpcds_p0/shape/query67.out index 50487a4a3c15d1..417a640b8eabd6 100644 --- a/regression-test/data/nonConcurrent/hint_tpcds_p0/shape/query67.out +++ b/regression-test/data/nonConcurrent/hint_tpcds_p0/shape/query67.out @@ -4,7 +4,7 @@ PhysicalResultSink --PhysicalTopN[MERGE_SORT] ----PhysicalDistribute[DistributionSpecGather] ------PhysicalTopN[LOCAL_SORT] ---------filter((rk <= 100)) +--------filter((dw2.rk <= 100)) ----------PhysicalWindow ------------PhysicalPartitionTopN --------------PhysicalDistribute[DistributionSpecHash] diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf1000_p0/b/query44_bs_downgrade_shape.out b/regression-test/data/nonConcurrent/tpcds_shape_sf1000_p0/b/query44_bs_downgrade_shape.out index 4f1a1be1c254be..55f915657f77b3 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf1000_p0/b/query44_bs_downgrade_shape.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf1000_p0/b/query44_bs_downgrade_shape.out @@ -13,7 +13,7 @@ PhysicalResultSink --------------------PhysicalOlapScan[item] apply RFs: RF1 ------------------PhysicalDistribute[DistributionSpecHash] --------------------PhysicalProject -----------------------filter((rnk < 11)) +----------------------filter((V11.rnk < 11)) ------------------------PhysicalWindow --------------------------PhysicalQuickSort[MERGE_SORT] ----------------------------PhysicalDistribute[DistributionSpecGather] @@ -46,7 +46,7 @@ PhysicalResultSink --------------------PhysicalOlapScan[item] apply RFs: RF0 ------------------PhysicalDistribute[DistributionSpecHash] --------------------PhysicalProject -----------------------filter((rnk < 11)) +----------------------filter((V21.rnk < 11)) ------------------------PhysicalWindow --------------------------PhysicalQuickSort[MERGE_SORT] ----------------------------PhysicalDistribute[DistributionSpecGather] diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf1000_p0/shape/query44.out b/regression-test/data/nonConcurrent/tpcds_shape_sf1000_p0/shape/query44.out index 4f1a1be1c254be..55f915657f77b3 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf1000_p0/shape/query44.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf1000_p0/shape/query44.out @@ -13,7 +13,7 @@ PhysicalResultSink --------------------PhysicalOlapScan[item] apply RFs: RF1 ------------------PhysicalDistribute[DistributionSpecHash] --------------------PhysicalProject -----------------------filter((rnk < 11)) +----------------------filter((V11.rnk < 11)) ------------------------PhysicalWindow --------------------------PhysicalQuickSort[MERGE_SORT] ----------------------------PhysicalDistribute[DistributionSpecGather] @@ -46,7 +46,7 @@ PhysicalResultSink --------------------PhysicalOlapScan[item] apply RFs: RF0 ------------------PhysicalDistribute[DistributionSpecHash] --------------------PhysicalProject -----------------------filter((rnk < 11)) +----------------------filter((V21.rnk < 11)) ------------------------PhysicalWindow --------------------------PhysicalQuickSort[MERGE_SORT] ----------------------------PhysicalDistribute[DistributionSpecGather] diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf1000_p0/shape/query49.out b/regression-test/data/nonConcurrent/tpcds_shape_sf1000_p0/shape/query49.out index 76b88bd85d5496..7bd9127746c823 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf1000_p0/shape/query49.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf1000_p0/shape/query49.out @@ -16,7 +16,7 @@ PhysicalResultSink --------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------hashAgg[LOCAL] ------------------------------PhysicalProject ---------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +--------------------------------filter(((web.return_rank <= 10) OR (web.currency_rank <= 10))) ----------------------------------PhysicalWindow ------------------------------------PhysicalQuickSort[LOCAL_SORT] --------------------------------------PhysicalWindow @@ -48,7 +48,7 @@ PhysicalResultSink --------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------hashAgg[LOCAL] ------------------------------PhysicalProject ---------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +--------------------------------filter(((catalog.return_rank <= 10) OR (catalog.currency_rank <= 10))) ----------------------------------PhysicalWindow ------------------------------------PhysicalQuickSort[LOCAL_SORT] --------------------------------------PhysicalWindow @@ -80,7 +80,7 @@ PhysicalResultSink --------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------hashAgg[LOCAL] ------------------------------PhysicalProject ---------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +--------------------------------filter(((store.return_rank <= 10) OR (store.currency_rank <= 10))) ----------------------------------PhysicalWindow ------------------------------------PhysicalQuickSort[LOCAL_SORT] --------------------------------------PhysicalWindow diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf1000_p0/shape/query51.out b/regression-test/data/nonConcurrent/tpcds_shape_sf1000_p0/shape/query51.out index 715ffb8960a48c..e91d43590ca2a9 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf1000_p0/shape/query51.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf1000_p0/shape/query51.out @@ -5,7 +5,7 @@ PhysicalResultSink ----PhysicalDistribute[DistributionSpecGather] ------PhysicalTopN[LOCAL_SORT] --------PhysicalProject -----------filter((web_cumulative > store_cumulative)) +----------filter((y.web_cumulative > y.store_cumulative)) ------------PhysicalWindow --------------PhysicalQuickSort[LOCAL_SORT] ----------------PhysicalDistribute[DistributionSpecHash] diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf1000_p0/shape/query67.out b/regression-test/data/nonConcurrent/tpcds_shape_sf1000_p0/shape/query67.out index 8704ff806ed1af..f0660a82c9115a 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf1000_p0/shape/query67.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf1000_p0/shape/query67.out @@ -4,7 +4,7 @@ PhysicalResultSink --PhysicalTopN[MERGE_SORT] ----PhysicalDistribute[DistributionSpecGather] ------PhysicalTopN[LOCAL_SORT] ---------filter((rk <= 100)) +--------filter((dw2.rk <= 100)) ----------PhysicalWindow ------------PhysicalPartitionTopN --------------PhysicalDistribute[DistributionSpecHash] diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/n/query44_no_stats_shape.out b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/n/query44_no_stats_shape.out index 0c8451a1e7978f..6273f16b2c5bfa 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/n/query44_no_stats_shape.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/n/query44_no_stats_shape.out @@ -17,7 +17,7 @@ PhysicalResultSink --------------------hashJoin[INNER_JOIN] hashCondition=((asceding.rnk = descending.rnk)) otherCondition=() ----------------------PhysicalDistribute[DistributionSpecHash] ------------------------PhysicalProject ---------------------------filter((rnk < 11)) +--------------------------filter((V11.rnk < 11)) ----------------------------PhysicalWindow ------------------------------PhysicalQuickSort[MERGE_SORT] --------------------------------PhysicalDistribute[DistributionSpecGather] @@ -45,7 +45,7 @@ PhysicalResultSink --------------------------------------------------------------PhysicalOlapScan[store_sales] ----------------------PhysicalDistribute[DistributionSpecHash] ------------------------PhysicalProject ---------------------------filter((rnk < 11)) +--------------------------filter((V21.rnk < 11)) ----------------------------PhysicalWindow ------------------------------PhysicalQuickSort[MERGE_SORT] --------------------------------PhysicalDistribute[DistributionSpecGather] diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/n/query49_no_stats_shape.out b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/n/query49_no_stats_shape.out index 4edce3d0ff64ae..8f170d9a28f432 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/n/query49_no_stats_shape.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/n/query49_no_stats_shape.out @@ -16,7 +16,7 @@ PhysicalResultSink --------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------hashAgg[LOCAL] ------------------------------PhysicalProject ---------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +--------------------------------filter(((web.return_rank <= 10) OR (web.currency_rank <= 10))) ----------------------------------PhysicalWindow ------------------------------------PhysicalQuickSort[LOCAL_SORT] --------------------------------------PhysicalWindow @@ -49,7 +49,7 @@ PhysicalResultSink --------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------hashAgg[LOCAL] ------------------------------PhysicalProject ---------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +--------------------------------filter(((catalog.return_rank <= 10) OR (catalog.currency_rank <= 10))) ----------------------------------PhysicalWindow ------------------------------------PhysicalQuickSort[LOCAL_SORT] --------------------------------------PhysicalWindow @@ -82,7 +82,7 @@ PhysicalResultSink --------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------hashAgg[LOCAL] ------------------------------PhysicalProject ---------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +--------------------------------filter(((store.return_rank <= 10) OR (store.currency_rank <= 10))) ----------------------------------PhysicalWindow ------------------------------------PhysicalQuickSort[LOCAL_SORT] --------------------------------------PhysicalWindow diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/n/query51_no_stats_shape.out b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/n/query51_no_stats_shape.out index 8158a7de1810fb..547325462c23dc 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/n/query51_no_stats_shape.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/n/query51_no_stats_shape.out @@ -5,7 +5,7 @@ PhysicalResultSink ----PhysicalDistribute[DistributionSpecGather] ------PhysicalTopN[LOCAL_SORT] --------PhysicalProject -----------filter((web_cumulative > store_cumulative)) +----------filter((y.web_cumulative > y.store_cumulative)) ------------PhysicalWindow --------------PhysicalQuickSort[LOCAL_SORT] ----------------PhysicalDistribute[DistributionSpecHash] diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/n/query67_no_stats_shape.out b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/n/query67_no_stats_shape.out index 900fe97ff054de..6604a6cd5779ca 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/n/query67_no_stats_shape.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/n/query67_no_stats_shape.out @@ -4,7 +4,7 @@ PhysicalResultSink --PhysicalTopN[MERGE_SORT] ----PhysicalDistribute[DistributionSpecGather] ------PhysicalTopN[LOCAL_SORT] ---------filter((rk <= 100)) +--------filter((dw2.rk <= 100)) ----------PhysicalWindow ------------PhysicalQuickSort[LOCAL_SORT] --------------PhysicalDistribute[DistributionSpecHash] diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/ns/query44_noStatsRfPrune.out b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/ns/query44_noStatsRfPrune.out index 0c8451a1e7978f..6273f16b2c5bfa 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/ns/query44_noStatsRfPrune.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/ns/query44_noStatsRfPrune.out @@ -17,7 +17,7 @@ PhysicalResultSink --------------------hashJoin[INNER_JOIN] hashCondition=((asceding.rnk = descending.rnk)) otherCondition=() ----------------------PhysicalDistribute[DistributionSpecHash] ------------------------PhysicalProject ---------------------------filter((rnk < 11)) +--------------------------filter((V11.rnk < 11)) ----------------------------PhysicalWindow ------------------------------PhysicalQuickSort[MERGE_SORT] --------------------------------PhysicalDistribute[DistributionSpecGather] @@ -45,7 +45,7 @@ PhysicalResultSink --------------------------------------------------------------PhysicalOlapScan[store_sales] ----------------------PhysicalDistribute[DistributionSpecHash] ------------------------PhysicalProject ---------------------------filter((rnk < 11)) +--------------------------filter((V21.rnk < 11)) ----------------------------PhysicalWindow ------------------------------PhysicalQuickSort[MERGE_SORT] --------------------------------PhysicalDistribute[DistributionSpecGather] diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/ns/query49_noStatsRfPrune.out b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/ns/query49_noStatsRfPrune.out index 4edce3d0ff64ae..8f170d9a28f432 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/ns/query49_noStatsRfPrune.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/ns/query49_noStatsRfPrune.out @@ -16,7 +16,7 @@ PhysicalResultSink --------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------hashAgg[LOCAL] ------------------------------PhysicalProject ---------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +--------------------------------filter(((web.return_rank <= 10) OR (web.currency_rank <= 10))) ----------------------------------PhysicalWindow ------------------------------------PhysicalQuickSort[LOCAL_SORT] --------------------------------------PhysicalWindow @@ -49,7 +49,7 @@ PhysicalResultSink --------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------hashAgg[LOCAL] ------------------------------PhysicalProject ---------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +--------------------------------filter(((catalog.return_rank <= 10) OR (catalog.currency_rank <= 10))) ----------------------------------PhysicalWindow ------------------------------------PhysicalQuickSort[LOCAL_SORT] --------------------------------------PhysicalWindow @@ -82,7 +82,7 @@ PhysicalResultSink --------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------hashAgg[LOCAL] ------------------------------PhysicalProject ---------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +--------------------------------filter(((store.return_rank <= 10) OR (store.currency_rank <= 10))) ----------------------------------PhysicalWindow ------------------------------------PhysicalQuickSort[LOCAL_SORT] --------------------------------------PhysicalWindow diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/ns/query51_noStatsRfPrune.out b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/ns/query51_noStatsRfPrune.out index 8158a7de1810fb..547325462c23dc 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/ns/query51_noStatsRfPrune.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/ns/query51_noStatsRfPrune.out @@ -5,7 +5,7 @@ PhysicalResultSink ----PhysicalDistribute[DistributionSpecGather] ------PhysicalTopN[LOCAL_SORT] --------PhysicalProject -----------filter((web_cumulative > store_cumulative)) +----------filter((y.web_cumulative > y.store_cumulative)) ------------PhysicalWindow --------------PhysicalQuickSort[LOCAL_SORT] ----------------PhysicalDistribute[DistributionSpecHash] diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/ns/query67_noStatsRfPrune.out b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/ns/query67_noStatsRfPrune.out index 246d2337283193..9d9a5550f3a7fd 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/ns/query67_noStatsRfPrune.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/ns/query67_noStatsRfPrune.out @@ -4,7 +4,7 @@ PhysicalResultSink --PhysicalTopN[MERGE_SORT] ----PhysicalDistribute[DistributionSpecGather] ------PhysicalTopN[LOCAL_SORT] ---------filter((rk <= 100)) +--------filter((dw2.rk <= 100)) ----------PhysicalWindow ------------PhysicalQuickSort[LOCAL_SORT] --------------PhysicalDistribute[DistributionSpecHash] diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/rf_prune/query44.out b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/rf_prune/query44.out index 7d9cf4de279184..923ccad80c7d85 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/rf_prune/query44.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/rf_prune/query44.out @@ -13,7 +13,7 @@ PhysicalResultSink --------------------PhysicalOlapScan[item] apply RFs: RF1 ------------------PhysicalDistribute[DistributionSpecHash] --------------------PhysicalProject -----------------------filter((rnk < 11)) +----------------------filter((V11.rnk < 11)) ------------------------PhysicalWindow --------------------------PhysicalQuickSort[MERGE_SORT] ----------------------------PhysicalDistribute[DistributionSpecGather] @@ -46,7 +46,7 @@ PhysicalResultSink --------------------PhysicalOlapScan[item] apply RFs: RF0 ------------------PhysicalDistribute[DistributionSpecHash] --------------------PhysicalProject -----------------------filter((rnk < 11)) +----------------------filter((V21.rnk < 11)) ------------------------PhysicalWindow --------------------------PhysicalQuickSort[MERGE_SORT] ----------------------------PhysicalDistribute[DistributionSpecGather] diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/rf_prune/query49.out b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/rf_prune/query49.out index a52f8f454fd002..e14d114ce17a28 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/rf_prune/query49.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/rf_prune/query49.out @@ -16,7 +16,7 @@ PhysicalResultSink --------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------hashAgg[LOCAL] ------------------------------PhysicalProject ---------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +--------------------------------filter(((web.return_rank <= 10) OR (web.currency_rank <= 10))) ----------------------------------PhysicalWindow ------------------------------------PhysicalQuickSort[LOCAL_SORT] --------------------------------------PhysicalWindow @@ -48,7 +48,7 @@ PhysicalResultSink --------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------hashAgg[LOCAL] ------------------------------PhysicalProject ---------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +--------------------------------filter(((catalog.return_rank <= 10) OR (catalog.currency_rank <= 10))) ----------------------------------PhysicalWindow ------------------------------------PhysicalQuickSort[LOCAL_SORT] --------------------------------------PhysicalWindow @@ -80,7 +80,7 @@ PhysicalResultSink --------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------hashAgg[LOCAL] ------------------------------PhysicalProject ---------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +--------------------------------filter(((store.return_rank <= 10) OR (store.currency_rank <= 10))) ----------------------------------PhysicalWindow ------------------------------------PhysicalQuickSort[LOCAL_SORT] --------------------------------------PhysicalWindow diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/rf_prune/query51.out b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/rf_prune/query51.out index 8158a7de1810fb..547325462c23dc 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/rf_prune/query51.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/rf_prune/query51.out @@ -5,7 +5,7 @@ PhysicalResultSink ----PhysicalDistribute[DistributionSpecGather] ------PhysicalTopN[LOCAL_SORT] --------PhysicalProject -----------filter((web_cumulative > store_cumulative)) +----------filter((y.web_cumulative > y.store_cumulative)) ------------PhysicalWindow --------------PhysicalQuickSort[LOCAL_SORT] ----------------PhysicalDistribute[DistributionSpecHash] diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/rf_prune/query67.out b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/rf_prune/query67.out index bd3f6458a3ccbe..c8915eba210f79 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/rf_prune/query67.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/rf_prune/query67.out @@ -4,7 +4,7 @@ PhysicalResultSink --PhysicalTopN[MERGE_SORT] ----PhysicalDistribute[DistributionSpecGather] ------PhysicalTopN[LOCAL_SORT] ---------filter((rk <= 100)) +--------filter((dw2.rk <= 100)) ----------PhysicalWindow ------------PhysicalPartitionTopN --------------PhysicalDistribute[DistributionSpecHash] diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/shape/query44.out b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/shape/query44.out index 7d9cf4de279184..923ccad80c7d85 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/shape/query44.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/shape/query44.out @@ -13,7 +13,7 @@ PhysicalResultSink --------------------PhysicalOlapScan[item] apply RFs: RF1 ------------------PhysicalDistribute[DistributionSpecHash] --------------------PhysicalProject -----------------------filter((rnk < 11)) +----------------------filter((V11.rnk < 11)) ------------------------PhysicalWindow --------------------------PhysicalQuickSort[MERGE_SORT] ----------------------------PhysicalDistribute[DistributionSpecGather] @@ -46,7 +46,7 @@ PhysicalResultSink --------------------PhysicalOlapScan[item] apply RFs: RF0 ------------------PhysicalDistribute[DistributionSpecHash] --------------------PhysicalProject -----------------------filter((rnk < 11)) +----------------------filter((V21.rnk < 11)) ------------------------PhysicalWindow --------------------------PhysicalQuickSort[MERGE_SORT] ----------------------------PhysicalDistribute[DistributionSpecGather] diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/shape/query49.out b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/shape/query49.out index a52f8f454fd002..e14d114ce17a28 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/shape/query49.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/shape/query49.out @@ -16,7 +16,7 @@ PhysicalResultSink --------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------hashAgg[LOCAL] ------------------------------PhysicalProject ---------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +--------------------------------filter(((web.return_rank <= 10) OR (web.currency_rank <= 10))) ----------------------------------PhysicalWindow ------------------------------------PhysicalQuickSort[LOCAL_SORT] --------------------------------------PhysicalWindow @@ -48,7 +48,7 @@ PhysicalResultSink --------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------hashAgg[LOCAL] ------------------------------PhysicalProject ---------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +--------------------------------filter(((catalog.return_rank <= 10) OR (catalog.currency_rank <= 10))) ----------------------------------PhysicalWindow ------------------------------------PhysicalQuickSort[LOCAL_SORT] --------------------------------------PhysicalWindow @@ -80,7 +80,7 @@ PhysicalResultSink --------------------------PhysicalDistribute[DistributionSpecHash] ----------------------------hashAgg[LOCAL] ------------------------------PhysicalProject ---------------------------------filter(((return_rank <= 10) OR (currency_rank <= 10))) +--------------------------------filter(((store.return_rank <= 10) OR (store.currency_rank <= 10))) ----------------------------------PhysicalWindow ------------------------------------PhysicalQuickSort[LOCAL_SORT] --------------------------------------PhysicalWindow diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/shape/query51.out b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/shape/query51.out index 8158a7de1810fb..547325462c23dc 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/shape/query51.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/shape/query51.out @@ -5,7 +5,7 @@ PhysicalResultSink ----PhysicalDistribute[DistributionSpecGather] ------PhysicalTopN[LOCAL_SORT] --------PhysicalProject -----------filter((web_cumulative > store_cumulative)) +----------filter((y.web_cumulative > y.store_cumulative)) ------------PhysicalWindow --------------PhysicalQuickSort[LOCAL_SORT] ----------------PhysicalDistribute[DistributionSpecHash] diff --git a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/shape/query67.out b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/shape/query67.out index d069db662b3a82..10bfc19cec4d26 100644 --- a/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/shape/query67.out +++ b/regression-test/data/nonConcurrent/tpcds_shape_sf100_p0/shape/query67.out @@ -4,7 +4,7 @@ PhysicalResultSink --PhysicalTopN[MERGE_SORT] ----PhysicalDistribute[DistributionSpecGather] ------PhysicalTopN[LOCAL_SORT] ---------filter((rk <= 100)) +--------filter((dw2.rk <= 100)) ----------PhysicalWindow ------------PhysicalPartitionTopN --------------PhysicalDistribute[DistributionSpecHash] diff --git a/regression-test/data/variant_p0/test_sub_path_pruning.out b/regression-test/data/variant_p0/test_sub_path_pruning.out index 16328739167099..13cd70dba08b99 100644 --- a/regression-test/data/variant_p0/test_sub_path_pruning.out +++ b/regression-test/data/variant_p0/test_sub_path_pruning.out @@ -314,3 +314,6 @@ -- !sql -- 1 2 +-- !sql_no_dead_loop -- +{"b":{"c":{"d":{"e":11}}},"c":{"d":{"e":12}},"d":{"e":13},"e":14} + diff --git a/regression-test/suites/variant_p0/test_sub_path_pruning.groovy b/regression-test/suites/variant_p0/test_sub_path_pruning.groovy index bd819934910366..76d0deb4e2ade3 100644 --- a/regression-test/suites/variant_p0/test_sub_path_pruning.groovy +++ b/regression-test/suites/variant_p0/test_sub_path_pruning.groovy @@ -216,4 +216,10 @@ suite("variant_sub_path_pruning", "variant_type"){ order_qt_sql """select c1['a'] as c2, c1['b'] as c3 from (select 1 as id, cast('{"a":1, "b":2}' as variant) as c1 order by id limit 100) tmp;""" order_qt_sql """select c1['a'] from (select 1 as id, cast('{"b":{"a":1}}' as variant)["b"] as c1 order by id limit 100) tmp;""" order_qt_sql """select c1['a'] as c2, c1['b'] as c3 from (select 1 as id, cast('{"b":{"a":1, "b":2}}' as variant)["b"] as c1 order by id limit 100) tmp;""" -} \ No newline at end of file + + order_qt_sql_no_dead_loop """ + select + FIRST_VALUE(dt['a']) over (PARTITION by id) A12708 + FROM pruning_test + """ +}