From 4a6afb4875d86ef1f1985521b254ac00ffa85ab2 Mon Sep 17 00:00:00 2001 From: Yuming Wang Date: Tue, 3 Aug 2021 13:56:59 -0700 Subject: [PATCH] [SPARK-36280][SQL] Remove redundant aliases after RewritePredicateSubquery ### What changes were proposed in this pull request? Remove redundant aliases after `RewritePredicateSubquery`. For example: ```scala sql("CREATE TABLE t1 USING parquet AS SELECT id AS a, id AS b, id AS c FROM range(10)") sql("CREATE TABLE t2 USING parquet AS SELECT id AS x, id AS y FROM range(8)") sql( """ |SELECT * |FROM t1 |WHERE a IN (SELECT x | FROM (SELECT x AS x, | Rank() OVER (partition BY x ORDER BY Sum(y) DESC) AS ranking | FROM t2 | GROUP BY x) tmp1 | WHERE ranking <= 5) |""".stripMargin).explain ``` Before this PR: ``` == Physical Plan == AdaptiveSparkPlan isFinalPlan=false +- BroadcastHashJoin [a#10L], [x#7L], LeftSemi, BuildRight, false :- FileScan parquet default.t1[a#10L,b#11L,c#12L] +- BroadcastExchange HashedRelationBroadcastMode(List(input[0, bigint, true]),false), [id=#68] +- Project [x#7L] +- Filter (ranking#8 <= 5) +- Window [rank(_w2#25L) windowspecdefinition(x#15L, _w2#25L DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS ranking#8], [x#15L], [_w2#25L DESC NULLS LAST] +- Sort [x#15L ASC NULLS FIRST, _w2#25L DESC NULLS LAST], false, 0 +- Exchange hashpartitioning(x#15L, 5), ENSURE_REQUIREMENTS, [id=#62] +- HashAggregate(keys=[x#15L], functions=[sum(y#16L)]) +- Exchange hashpartitioning(x#15L, 5), ENSURE_REQUIREMENTS, [id=#59] +- HashAggregate(keys=[x#15L], functions=[partial_sum(y#16L)]) +- FileScan parquet default.t2[x#15L,y#16L] ``` After this PR: ``` == Physical Plan == AdaptiveSparkPlan isFinalPlan=false +- BroadcastHashJoin [a#10L], [x#15L], LeftSemi, BuildRight, false :- FileScan parquet default.t1[a#10L,b#11L,c#12L] +- BroadcastExchange HashedRelationBroadcastMode(List(input[0, bigint, true]),false), [id=#67] +- Project [x#15L] +- Filter (ranking#8 <= 5) +- Window [rank(_w2#25L) windowspecdefinition(x#15L, _w2#25L DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS ranking#8], [x#15L], [_w2#25L DESC NULLS LAST] +- Sort [x#15L ASC NULLS FIRST, _w2#25L DESC NULLS LAST], false, 0 +- HashAggregate(keys=[x#15L], functions=[sum(y#16L)]) +- Exchange hashpartitioning(x#15L, 5), ENSURE_REQUIREMENTS, [id=#59] +- HashAggregate(keys=[x#15L], functions=[partial_sum(y#16L)]) +- FileScan parquet default.t2[x#15L,y#16L] ``` ### Why are the changes needed? Reduce shuffle to improve query performance. This change can benefit TPC-DS q70. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Unit test. Closes #33509 from wangyum/SPARK-36280. Authored-by: Yuming Wang Signed-off-by: Dongjoon Hyun --- .../sql/catalyst/optimizer/Optimizer.scala | 1 + .../approved-plans-v1_4/q11.sf100/explain.txt | 281 ++++---- .../q11.sf100/simplified.txt | 57 +- .../approved-plans-v1_4/q11/explain.txt | 261 ++++---- .../approved-plans-v1_4/q11/simplified.txt | 49 +- .../approved-plans-v1_4/q4.sf100/explain.txt | 626 +++++++++--------- .../q4.sf100/simplified.txt | 114 ++-- .../approved-plans-v1_4/q4/explain.txt | 594 ++++++++--------- .../approved-plans-v1_4/q4/simplified.txt | 98 ++- .../approved-plans-v1_4/q70.sf100/explain.txt | 223 +++---- .../q70.sf100/simplified.txt | 61 +- .../approved-plans-v1_4/q70/explain.txt | 223 +++---- .../approved-plans-v1_4/q70/simplified.txt | 59 +- .../approved-plans-v2_7/q11.sf100/explain.txt | 281 ++++---- .../q11.sf100/simplified.txt | 57 +- .../approved-plans-v2_7/q11/explain.txt | 261 ++++---- .../approved-plans-v2_7/q11/simplified.txt | 49 +- .../q70a.sf100/explain.txt | 367 +++++----- .../q70a.sf100/simplified.txt | 77 ++- .../approved-plans-v2_7/q70a/explain.txt | 367 +++++----- .../approved-plans-v2_7/q70a/simplified.txt | 75 +-- .../approved-plans-v2_7/q74.sf100/explain.txt | 281 ++++---- .../q74.sf100/simplified.txt | 57 +- .../approved-plans-v2_7/q74/explain.txt | 261 ++++---- .../approved-plans-v2_7/q74/simplified.txt | 49 +- .../org/apache/spark/sql/SubquerySuite.scala | 25 + 26 files changed, 2394 insertions(+), 2460 deletions(-) diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala index bcf18b2140492..b6c89d484ce5e 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala @@ -234,6 +234,7 @@ abstract class Optimizer(catalogManager: CatalogManager) RewritePredicateSubquery, ColumnPruning, CollapseProject, + RemoveRedundantAliases, RemoveNoopOperators) :+ // This batch must be executed after the `RewriteSubquery` batch, which creates joins. Batch("NormalizeFloatingNumbers", Once, NormalizeFloatingNumbers) :+ diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q11.sf100/explain.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q11.sf100/explain.txt index fa8839240f91e..bbf7196929d52 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q11.sf100/explain.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q11.sf100/explain.txt @@ -1,9 +1,9 @@ == Physical Plan == -TakeOrderedAndProject (81) -+- * Project (80) - +- * SortMergeJoin Inner (79) - :- * Project (61) - : +- * SortMergeJoin Inner (60) +TakeOrderedAndProject (80) ++- * Project (79) + +- * SortMergeJoin Inner (78) + :- * Project (60) + : +- * SortMergeJoin Inner (59) : :- * Project (40) : : +- * SortMergeJoin Inner (39) : : :- * Sort (21) @@ -44,42 +44,41 @@ TakeOrderedAndProject (81) : : : +- ReusedExchange (25) : : +- * Sort (31) : : +- ReusedExchange (30) - : +- * Sort (59) - : +- Exchange (58) - : +- * Project (57) - : +- * Filter (56) - : +- * HashAggregate (55) - : +- Exchange (54) - : +- * HashAggregate (53) - : +- * Project (52) - : +- * SortMergeJoin Inner (51) - : :- * Sort (48) - : : +- Exchange (47) - : : +- * Project (46) - : : +- * BroadcastHashJoin Inner BuildRight (45) - : : :- * Filter (43) - : : : +- * ColumnarToRow (42) - : : : +- Scan parquet default.web_sales (41) - : : +- ReusedExchange (44) - : +- * Sort (50) - : +- ReusedExchange (49) - +- * Sort (78) - +- Exchange (77) - +- * HashAggregate (76) - +- Exchange (75) - +- * HashAggregate (74) - +- * Project (73) - +- * SortMergeJoin Inner (72) - :- * Sort (69) - : +- Exchange (68) - : +- * Project (67) - : +- * BroadcastHashJoin Inner BuildRight (66) - : :- * Filter (64) - : : +- * ColumnarToRow (63) - : : +- Scan parquet default.web_sales (62) - : +- ReusedExchange (65) - +- * Sort (71) - +- ReusedExchange (70) + : +- * Sort (58) + : +- Exchange (57) + : +- * Filter (56) + : +- * HashAggregate (55) + : +- Exchange (54) + : +- * HashAggregate (53) + : +- * Project (52) + : +- * SortMergeJoin Inner (51) + : :- * Sort (48) + : : +- Exchange (47) + : : +- * Project (46) + : : +- * BroadcastHashJoin Inner BuildRight (45) + : : :- * Filter (43) + : : : +- * ColumnarToRow (42) + : : : +- Scan parquet default.web_sales (41) + : : +- ReusedExchange (44) + : +- * Sort (50) + : +- ReusedExchange (49) + +- * Sort (77) + +- Exchange (76) + +- * HashAggregate (75) + +- Exchange (74) + +- * HashAggregate (73) + +- * Project (72) + +- * SortMergeJoin Inner (71) + :- * Sort (68) + : +- Exchange (67) + : +- * Project (66) + : +- * BroadcastHashJoin Inner BuildRight (65) + : :- * Filter (63) + : : +- * ColumnarToRow (62) + : : +- Scan parquet default.web_sales (61) + : +- ReusedExchange (64) + +- * Sort (70) + +- ReusedExchange (69) (1) Scan parquet default.store_sales @@ -97,7 +96,7 @@ Input [4]: [ss_customer_sk#1, ss_ext_discount_amt#2, ss_ext_list_price#3, ss_sol Input [4]: [ss_customer_sk#1, ss_ext_discount_amt#2, ss_ext_list_price#3, ss_sold_date_sk#4] Condition : isnotnull(ss_customer_sk#1) -(4) ReusedExchange [Reuses operator id: 85] +(4) ReusedExchange [Reuses operator id: 84] Output [2]: [d_date_sk#6, d_year#7] (5) BroadcastHashJoin [codegen id : 2] @@ -193,7 +192,7 @@ Input [4]: [ss_customer_sk#25, ss_ext_discount_amt#26, ss_ext_list_price#27, ss_ Input [4]: [ss_customer_sk#25, ss_ext_discount_amt#26, ss_ext_list_price#27, ss_sold_date_sk#28] Condition : isnotnull(ss_customer_sk#25) -(25) ReusedExchange [Reuses operator id: 89] +(25) ReusedExchange [Reuses operator id: 88] Output [2]: [d_date_sk#30, d_year#31] (26) BroadcastHashJoin [codegen id : 10] @@ -279,7 +278,7 @@ Input [4]: [ws_bill_customer_sk#49, ws_ext_discount_amt#50, ws_ext_list_price#51 Input [4]: [ws_bill_customer_sk#49, ws_ext_discount_amt#50, ws_ext_list_price#51, ws_sold_date_sk#52] Condition : isnotnull(ws_bill_customer_sk#49) -(44) ReusedExchange [Reuses operator id: 85] +(44) ReusedExchange [Reuses operator id: 84] Output [2]: [d_date_sk#53, d_year#54] (45) BroadcastHashJoin [codegen id : 19] @@ -337,171 +336,167 @@ Results [2]: [c_customer_id#57 AS customer_id#68, MakeDecimal(sum(UnscaledValue( Input [2]: [customer_id#68, year_total#69] Condition : (isnotnull(year_total#69) AND (year_total#69 > 0.00)) -(57) Project [codegen id : 24] -Output [2]: [customer_id#68 AS customer_id#70, year_total#69 AS year_total#71] +(57) Exchange Input [2]: [customer_id#68, year_total#69] +Arguments: hashpartitioning(customer_id#68, 5), ENSURE_REQUIREMENTS, [id=#70] -(58) Exchange -Input [2]: [customer_id#70, year_total#71] -Arguments: hashpartitioning(customer_id#70, 5), ENSURE_REQUIREMENTS, [id=#72] - -(59) Sort [codegen id : 25] -Input [2]: [customer_id#70, year_total#71] -Arguments: [customer_id#70 ASC NULLS FIRST], false, 0 +(58) Sort [codegen id : 25] +Input [2]: [customer_id#68, year_total#69] +Arguments: [customer_id#68 ASC NULLS FIRST], false, 0 -(60) SortMergeJoin [codegen id : 26] +(59) SortMergeJoin [codegen id : 26] Left keys [1]: [customer_id#22] -Right keys [1]: [customer_id#70] +Right keys [1]: [customer_id#68] Join condition: None -(61) Project [codegen id : 26] -Output [5]: [customer_id#22, year_total#23, customer_preferred_cust_flag#46, year_total#47, year_total#71] -Input [6]: [customer_id#22, year_total#23, customer_preferred_cust_flag#46, year_total#47, customer_id#70, year_total#71] +(60) Project [codegen id : 26] +Output [5]: [customer_id#22, year_total#23, customer_preferred_cust_flag#46, year_total#47, year_total#69] +Input [6]: [customer_id#22, year_total#23, customer_preferred_cust_flag#46, year_total#47, customer_id#68, year_total#69] -(62) Scan parquet default.web_sales -Output [4]: [ws_bill_customer_sk#73, ws_ext_discount_amt#74, ws_ext_list_price#75, ws_sold_date_sk#76] +(61) Scan parquet default.web_sales +Output [4]: [ws_bill_customer_sk#71, ws_ext_discount_amt#72, ws_ext_list_price#73, ws_sold_date_sk#74] Batched: true Location: InMemoryFileIndex [] -PartitionFilters: [isnotnull(ws_sold_date_sk#76), dynamicpruningexpression(ws_sold_date_sk#76 IN dynamicpruning#29)] +PartitionFilters: [isnotnull(ws_sold_date_sk#74), dynamicpruningexpression(ws_sold_date_sk#74 IN dynamicpruning#29)] PushedFilters: [IsNotNull(ws_bill_customer_sk)] ReadSchema: struct -(63) ColumnarToRow [codegen id : 28] -Input [4]: [ws_bill_customer_sk#73, ws_ext_discount_amt#74, ws_ext_list_price#75, ws_sold_date_sk#76] +(62) ColumnarToRow [codegen id : 28] +Input [4]: [ws_bill_customer_sk#71, ws_ext_discount_amt#72, ws_ext_list_price#73, ws_sold_date_sk#74] -(64) Filter [codegen id : 28] -Input [4]: [ws_bill_customer_sk#73, ws_ext_discount_amt#74, ws_ext_list_price#75, ws_sold_date_sk#76] -Condition : isnotnull(ws_bill_customer_sk#73) +(63) Filter [codegen id : 28] +Input [4]: [ws_bill_customer_sk#71, ws_ext_discount_amt#72, ws_ext_list_price#73, ws_sold_date_sk#74] +Condition : isnotnull(ws_bill_customer_sk#71) -(65) ReusedExchange [Reuses operator id: 89] -Output [2]: [d_date_sk#77, d_year#78] +(64) ReusedExchange [Reuses operator id: 88] +Output [2]: [d_date_sk#75, d_year#76] -(66) BroadcastHashJoin [codegen id : 28] -Left keys [1]: [ws_sold_date_sk#76] -Right keys [1]: [d_date_sk#77] +(65) BroadcastHashJoin [codegen id : 28] +Left keys [1]: [ws_sold_date_sk#74] +Right keys [1]: [d_date_sk#75] Join condition: None -(67) Project [codegen id : 28] -Output [4]: [ws_bill_customer_sk#73, ws_ext_discount_amt#74, ws_ext_list_price#75, d_year#78] -Input [6]: [ws_bill_customer_sk#73, ws_ext_discount_amt#74, ws_ext_list_price#75, ws_sold_date_sk#76, d_date_sk#77, d_year#78] +(66) Project [codegen id : 28] +Output [4]: [ws_bill_customer_sk#71, ws_ext_discount_amt#72, ws_ext_list_price#73, d_year#76] +Input [6]: [ws_bill_customer_sk#71, ws_ext_discount_amt#72, ws_ext_list_price#73, ws_sold_date_sk#74, d_date_sk#75, d_year#76] -(68) Exchange -Input [4]: [ws_bill_customer_sk#73, ws_ext_discount_amt#74, ws_ext_list_price#75, d_year#78] -Arguments: hashpartitioning(ws_bill_customer_sk#73, 5), ENSURE_REQUIREMENTS, [id=#79] +(67) Exchange +Input [4]: [ws_bill_customer_sk#71, ws_ext_discount_amt#72, ws_ext_list_price#73, d_year#76] +Arguments: hashpartitioning(ws_bill_customer_sk#71, 5), ENSURE_REQUIREMENTS, [id=#77] -(69) Sort [codegen id : 29] -Input [4]: [ws_bill_customer_sk#73, ws_ext_discount_amt#74, ws_ext_list_price#75, d_year#78] -Arguments: [ws_bill_customer_sk#73 ASC NULLS FIRST], false, 0 +(68) Sort [codegen id : 29] +Input [4]: [ws_bill_customer_sk#71, ws_ext_discount_amt#72, ws_ext_list_price#73, d_year#76] +Arguments: [ws_bill_customer_sk#71 ASC NULLS FIRST], false, 0 -(70) ReusedExchange [Reuses operator id: 12] -Output [8]: [c_customer_sk#80, c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87] +(69) ReusedExchange [Reuses operator id: 12] +Output [8]: [c_customer_sk#78, c_customer_id#79, c_first_name#80, c_last_name#81, c_preferred_cust_flag#82, c_birth_country#83, c_login#84, c_email_address#85] -(71) Sort [codegen id : 31] -Input [8]: [c_customer_sk#80, c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87] -Arguments: [c_customer_sk#80 ASC NULLS FIRST], false, 0 +(70) Sort [codegen id : 31] +Input [8]: [c_customer_sk#78, c_customer_id#79, c_first_name#80, c_last_name#81, c_preferred_cust_flag#82, c_birth_country#83, c_login#84, c_email_address#85] +Arguments: [c_customer_sk#78 ASC NULLS FIRST], false, 0 -(72) SortMergeJoin [codegen id : 32] -Left keys [1]: [ws_bill_customer_sk#73] -Right keys [1]: [c_customer_sk#80] +(71) SortMergeJoin [codegen id : 32] +Left keys [1]: [ws_bill_customer_sk#71] +Right keys [1]: [c_customer_sk#78] Join condition: None -(73) Project [codegen id : 32] -Output [10]: [c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87, ws_ext_discount_amt#74, ws_ext_list_price#75, d_year#78] -Input [12]: [ws_bill_customer_sk#73, ws_ext_discount_amt#74, ws_ext_list_price#75, d_year#78, c_customer_sk#80, c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87] - -(74) HashAggregate [codegen id : 32] -Input [10]: [c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87, ws_ext_discount_amt#74, ws_ext_list_price#75, d_year#78] -Keys [8]: [c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87, d_year#78] -Functions [1]: [partial_sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#75 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#74 as decimal(8,2)))), DecimalType(8,2), true)))] -Aggregate Attributes [1]: [sum#88] -Results [9]: [c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87, d_year#78, sum#89] - -(75) Exchange -Input [9]: [c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87, d_year#78, sum#89] -Arguments: hashpartitioning(c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87, d_year#78, 5), ENSURE_REQUIREMENTS, [id=#90] - -(76) HashAggregate [codegen id : 33] -Input [9]: [c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87, d_year#78, sum#89] -Keys [8]: [c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87, d_year#78] -Functions [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#75 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#74 as decimal(8,2)))), DecimalType(8,2), true)))] -Aggregate Attributes [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#75 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#74 as decimal(8,2)))), DecimalType(8,2), true)))#91] -Results [2]: [c_customer_id#81 AS customer_id#92, MakeDecimal(sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#75 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#74 as decimal(8,2)))), DecimalType(8,2), true)))#91,18,2) AS year_total#93] - -(77) Exchange -Input [2]: [customer_id#92, year_total#93] -Arguments: hashpartitioning(customer_id#92, 5), ENSURE_REQUIREMENTS, [id=#94] - -(78) Sort [codegen id : 34] -Input [2]: [customer_id#92, year_total#93] -Arguments: [customer_id#92 ASC NULLS FIRST], false, 0 - -(79) SortMergeJoin [codegen id : 35] +(72) Project [codegen id : 32] +Output [10]: [c_customer_id#79, c_first_name#80, c_last_name#81, c_preferred_cust_flag#82, c_birth_country#83, c_login#84, c_email_address#85, ws_ext_discount_amt#72, ws_ext_list_price#73, d_year#76] +Input [12]: [ws_bill_customer_sk#71, ws_ext_discount_amt#72, ws_ext_list_price#73, d_year#76, c_customer_sk#78, c_customer_id#79, c_first_name#80, c_last_name#81, c_preferred_cust_flag#82, c_birth_country#83, c_login#84, c_email_address#85] + +(73) HashAggregate [codegen id : 32] +Input [10]: [c_customer_id#79, c_first_name#80, c_last_name#81, c_preferred_cust_flag#82, c_birth_country#83, c_login#84, c_email_address#85, ws_ext_discount_amt#72, ws_ext_list_price#73, d_year#76] +Keys [8]: [c_customer_id#79, c_first_name#80, c_last_name#81, c_preferred_cust_flag#82, c_birth_country#83, c_login#84, c_email_address#85, d_year#76] +Functions [1]: [partial_sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#73 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#72 as decimal(8,2)))), DecimalType(8,2), true)))] +Aggregate Attributes [1]: [sum#86] +Results [9]: [c_customer_id#79, c_first_name#80, c_last_name#81, c_preferred_cust_flag#82, c_birth_country#83, c_login#84, c_email_address#85, d_year#76, sum#87] + +(74) Exchange +Input [9]: [c_customer_id#79, c_first_name#80, c_last_name#81, c_preferred_cust_flag#82, c_birth_country#83, c_login#84, c_email_address#85, d_year#76, sum#87] +Arguments: hashpartitioning(c_customer_id#79, c_first_name#80, c_last_name#81, c_preferred_cust_flag#82, c_birth_country#83, c_login#84, c_email_address#85, d_year#76, 5), ENSURE_REQUIREMENTS, [id=#88] + +(75) HashAggregate [codegen id : 33] +Input [9]: [c_customer_id#79, c_first_name#80, c_last_name#81, c_preferred_cust_flag#82, c_birth_country#83, c_login#84, c_email_address#85, d_year#76, sum#87] +Keys [8]: [c_customer_id#79, c_first_name#80, c_last_name#81, c_preferred_cust_flag#82, c_birth_country#83, c_login#84, c_email_address#85, d_year#76] +Functions [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#73 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#72 as decimal(8,2)))), DecimalType(8,2), true)))] +Aggregate Attributes [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#73 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#72 as decimal(8,2)))), DecimalType(8,2), true)))#89] +Results [2]: [c_customer_id#79 AS customer_id#90, MakeDecimal(sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#73 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#72 as decimal(8,2)))), DecimalType(8,2), true)))#89,18,2) AS year_total#91] + +(76) Exchange +Input [2]: [customer_id#90, year_total#91] +Arguments: hashpartitioning(customer_id#90, 5), ENSURE_REQUIREMENTS, [id=#92] + +(77) Sort [codegen id : 34] +Input [2]: [customer_id#90, year_total#91] +Arguments: [customer_id#90 ASC NULLS FIRST], false, 0 + +(78) SortMergeJoin [codegen id : 35] Left keys [1]: [customer_id#22] -Right keys [1]: [customer_id#92] -Join condition: (CASE WHEN (year_total#71 > 0.00) THEN CheckOverflow((promote_precision(year_total#93) / promote_precision(year_total#71)), DecimalType(38,20), true) ELSE null END > CASE WHEN (year_total#23 > 0.00) THEN CheckOverflow((promote_precision(year_total#47) / promote_precision(year_total#23)), DecimalType(38,20), true) ELSE null END) +Right keys [1]: [customer_id#90] +Join condition: (CASE WHEN (year_total#69 > 0.00) THEN CheckOverflow((promote_precision(year_total#91) / promote_precision(year_total#69)), DecimalType(38,20), true) ELSE null END > CASE WHEN (year_total#23 > 0.00) THEN CheckOverflow((promote_precision(year_total#47) / promote_precision(year_total#23)), DecimalType(38,20), true) ELSE null END) -(80) Project [codegen id : 35] +(79) Project [codegen id : 35] Output [1]: [customer_preferred_cust_flag#46] -Input [7]: [customer_id#22, year_total#23, customer_preferred_cust_flag#46, year_total#47, year_total#71, customer_id#92, year_total#93] +Input [7]: [customer_id#22, year_total#23, customer_preferred_cust_flag#46, year_total#47, year_total#69, customer_id#90, year_total#91] -(81) TakeOrderedAndProject +(80) TakeOrderedAndProject Input [1]: [customer_preferred_cust_flag#46] Arguments: 100, [customer_preferred_cust_flag#46 ASC NULLS FIRST], [customer_preferred_cust_flag#46] ===== Subqueries ===== Subquery:1 Hosting operator id = 1 Hosting Expression = ss_sold_date_sk#4 IN dynamicpruning#5 -BroadcastExchange (85) -+- * Filter (84) - +- * ColumnarToRow (83) - +- Scan parquet default.date_dim (82) +BroadcastExchange (84) ++- * Filter (83) + +- * ColumnarToRow (82) + +- Scan parquet default.date_dim (81) -(82) Scan parquet default.date_dim +(81) Scan parquet default.date_dim Output [2]: [d_date_sk#6, d_year#7] Batched: true Location [not included in comparison]/{warehouse_dir}/date_dim] PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2001), IsNotNull(d_date_sk)] ReadSchema: struct -(83) ColumnarToRow [codegen id : 1] +(82) ColumnarToRow [codegen id : 1] Input [2]: [d_date_sk#6, d_year#7] -(84) Filter [codegen id : 1] +(83) Filter [codegen id : 1] Input [2]: [d_date_sk#6, d_year#7] Condition : ((isnotnull(d_year#7) AND (d_year#7 = 2001)) AND isnotnull(d_date_sk#6)) -(85) BroadcastExchange +(84) BroadcastExchange Input [2]: [d_date_sk#6, d_year#7] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#95] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#93] Subquery:2 Hosting operator id = 22 Hosting Expression = ss_sold_date_sk#28 IN dynamicpruning#29 -BroadcastExchange (89) -+- * Filter (88) - +- * ColumnarToRow (87) - +- Scan parquet default.date_dim (86) +BroadcastExchange (88) ++- * Filter (87) + +- * ColumnarToRow (86) + +- Scan parquet default.date_dim (85) -(86) Scan parquet default.date_dim +(85) Scan parquet default.date_dim Output [2]: [d_date_sk#30, d_year#31] Batched: true Location [not included in comparison]/{warehouse_dir}/date_dim] PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2002), IsNotNull(d_date_sk)] ReadSchema: struct -(87) ColumnarToRow [codegen id : 1] +(86) ColumnarToRow [codegen id : 1] Input [2]: [d_date_sk#30, d_year#31] -(88) Filter [codegen id : 1] +(87) Filter [codegen id : 1] Input [2]: [d_date_sk#30, d_year#31] Condition : ((isnotnull(d_year#31) AND (d_year#31 = 2002)) AND isnotnull(d_date_sk#30)) -(89) BroadcastExchange +(88) BroadcastExchange Input [2]: [d_date_sk#30, d_year#31] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#96] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#94] Subquery:3 Hosting operator id = 41 Hosting Expression = ws_sold_date_sk#52 IN dynamicpruning#5 -Subquery:4 Hosting operator id = 62 Hosting Expression = ws_sold_date_sk#76 IN dynamicpruning#29 +Subquery:4 Hosting operator id = 61 Hosting Expression = ws_sold_date_sk#74 IN dynamicpruning#29 diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q11.sf100/simplified.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q11.sf100/simplified.txt index 889fc666bd810..eed9d7158c108 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q11.sf100/simplified.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q11.sf100/simplified.txt @@ -100,35 +100,34 @@ TakeOrderedAndProject [customer_preferred_cust_flag] InputAdapter Exchange [customer_id] #10 WholeStageCodegen (24) - Project [customer_id,year_total] - Filter [year_total] - HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum] [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt as decimal(8,2)))), DecimalType(8,2), true))),customer_id,year_total,sum] - InputAdapter - Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #11 - WholeStageCodegen (23) - HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,ws_ext_list_price,ws_ext_discount_amt] [sum,sum] - Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ws_ext_discount_amt,ws_ext_list_price,d_year] - SortMergeJoin [ws_bill_customer_sk,c_customer_sk] - InputAdapter - WholeStageCodegen (20) - Sort [ws_bill_customer_sk] - InputAdapter - Exchange [ws_bill_customer_sk] #12 - WholeStageCodegen (19) - Project [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_list_price,d_year] - BroadcastHashJoin [ws_sold_date_sk,d_date_sk] - Filter [ws_bill_customer_sk] - ColumnarToRow - InputAdapter - Scan parquet default.web_sales [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_list_price,ws_sold_date_sk] - ReusedSubquery [d_date_sk] #1 - InputAdapter - ReusedExchange [d_date_sk,d_year] #4 - InputAdapter - WholeStageCodegen (22) - Sort [c_customer_sk] - InputAdapter - ReusedExchange [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] #5 + Filter [year_total] + HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum] [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt as decimal(8,2)))), DecimalType(8,2), true))),customer_id,year_total,sum] + InputAdapter + Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #11 + WholeStageCodegen (23) + HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,ws_ext_list_price,ws_ext_discount_amt] [sum,sum] + Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ws_ext_discount_amt,ws_ext_list_price,d_year] + SortMergeJoin [ws_bill_customer_sk,c_customer_sk] + InputAdapter + WholeStageCodegen (20) + Sort [ws_bill_customer_sk] + InputAdapter + Exchange [ws_bill_customer_sk] #12 + WholeStageCodegen (19) + Project [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_list_price,d_year] + BroadcastHashJoin [ws_sold_date_sk,d_date_sk] + Filter [ws_bill_customer_sk] + ColumnarToRow + InputAdapter + Scan parquet default.web_sales [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_list_price,ws_sold_date_sk] + ReusedSubquery [d_date_sk] #1 + InputAdapter + ReusedExchange [d_date_sk,d_year] #4 + InputAdapter + WholeStageCodegen (22) + Sort [c_customer_sk] + InputAdapter + ReusedExchange [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] #5 InputAdapter WholeStageCodegen (34) Sort [customer_id] diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q11/explain.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q11/explain.txt index 3f9a0cb61ea1a..f18f0b69b44fd 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q11/explain.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q11/explain.txt @@ -1,9 +1,9 @@ == Physical Plan == -TakeOrderedAndProject (73) -+- * Project (72) - +- * BroadcastHashJoin Inner BuildRight (71) - :- * Project (54) - : +- * BroadcastHashJoin Inner BuildRight (53) +TakeOrderedAndProject (72) ++- * Project (71) + +- * BroadcastHashJoin Inner BuildRight (70) + :- * Project (53) + : +- * BroadcastHashJoin Inner BuildRight (52) : :- * Project (34) : : +- * BroadcastHashJoin Inner BuildRight (33) : : :- * Filter (16) @@ -38,40 +38,39 @@ TakeOrderedAndProject (73) : : : +- * ColumnarToRow (21) : : : +- Scan parquet default.store_sales (20) : : +- ReusedExchange (26) - : +- BroadcastExchange (52) - : +- * Project (51) - : +- * Filter (50) - : +- * HashAggregate (49) - : +- Exchange (48) - : +- * HashAggregate (47) - : +- * Project (46) - : +- * BroadcastHashJoin Inner BuildRight (45) - : :- * Project (43) - : : +- * BroadcastHashJoin Inner BuildRight (42) - : : :- * Filter (37) - : : : +- * ColumnarToRow (36) - : : : +- Scan parquet default.customer (35) - : : +- BroadcastExchange (41) - : : +- * Filter (40) - : : +- * ColumnarToRow (39) - : : +- Scan parquet default.web_sales (38) - : +- ReusedExchange (44) - +- BroadcastExchange (70) - +- * HashAggregate (69) - +- Exchange (68) - +- * HashAggregate (67) - +- * Project (66) - +- * BroadcastHashJoin Inner BuildRight (65) - :- * Project (63) - : +- * BroadcastHashJoin Inner BuildRight (62) - : :- * Filter (57) - : : +- * ColumnarToRow (56) - : : +- Scan parquet default.customer (55) - : +- BroadcastExchange (61) - : +- * Filter (60) - : +- * ColumnarToRow (59) - : +- Scan parquet default.web_sales (58) - +- ReusedExchange (64) + : +- BroadcastExchange (51) + : +- * Filter (50) + : +- * HashAggregate (49) + : +- Exchange (48) + : +- * HashAggregate (47) + : +- * Project (46) + : +- * BroadcastHashJoin Inner BuildRight (45) + : :- * Project (43) + : : +- * BroadcastHashJoin Inner BuildRight (42) + : : :- * Filter (37) + : : : +- * ColumnarToRow (36) + : : : +- Scan parquet default.customer (35) + : : +- BroadcastExchange (41) + : : +- * Filter (40) + : : +- * ColumnarToRow (39) + : : +- Scan parquet default.web_sales (38) + : +- ReusedExchange (44) + +- BroadcastExchange (69) + +- * HashAggregate (68) + +- Exchange (67) + +- * HashAggregate (66) + +- * Project (65) + +- * BroadcastHashJoin Inner BuildRight (64) + :- * Project (62) + : +- * BroadcastHashJoin Inner BuildRight (61) + : :- * Filter (56) + : : +- * ColumnarToRow (55) + : : +- Scan parquet default.customer (54) + : +- BroadcastExchange (60) + : +- * Filter (59) + : +- * ColumnarToRow (58) + : +- Scan parquet default.web_sales (57) + +- ReusedExchange (63) (1) Scan parquet default.customer @@ -116,7 +115,7 @@ Join condition: None Output [10]: [c_customer_id#2, c_first_name#3, c_last_name#4, c_preferred_cust_flag#5, c_birth_country#6, c_login#7, c_email_address#8, ss_ext_discount_amt#10, ss_ext_list_price#11, ss_sold_date_sk#12] Input [12]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4, c_preferred_cust_flag#5, c_birth_country#6, c_login#7, c_email_address#8, ss_customer_sk#9, ss_ext_discount_amt#10, ss_ext_list_price#11, ss_sold_date_sk#12] -(10) ReusedExchange [Reuses operator id: 77] +(10) ReusedExchange [Reuses operator id: 76] Output [2]: [d_date_sk#15, d_year#16] (11) BroadcastHashJoin [codegen id : 3] @@ -192,7 +191,7 @@ Join condition: None Output [10]: [c_customer_id#24, c_first_name#25, c_last_name#26, c_preferred_cust_flag#27, c_birth_country#28, c_login#29, c_email_address#30, ss_ext_discount_amt#32, ss_ext_list_price#33, ss_sold_date_sk#34] Input [12]: [c_customer_sk#23, c_customer_id#24, c_first_name#25, c_last_name#26, c_preferred_cust_flag#27, c_birth_country#28, c_login#29, c_email_address#30, ss_customer_sk#31, ss_ext_discount_amt#32, ss_ext_list_price#33, ss_sold_date_sk#34] -(26) ReusedExchange [Reuses operator id: 81] +(26) ReusedExchange [Reuses operator id: 80] Output [2]: [d_date_sk#37, d_year#38] (27) BroadcastHashJoin [codegen id : 6] @@ -277,7 +276,7 @@ Join condition: None Output [10]: [c_customer_id#48, c_first_name#49, c_last_name#50, c_preferred_cust_flag#51, c_birth_country#52, c_login#53, c_email_address#54, ws_ext_discount_amt#56, ws_ext_list_price#57, ws_sold_date_sk#58] Input [12]: [c_customer_sk#47, c_customer_id#48, c_first_name#49, c_last_name#50, c_preferred_cust_flag#51, c_birth_country#52, c_login#53, c_email_address#54, ws_bill_customer_sk#55, ws_ext_discount_amt#56, ws_ext_list_price#57, ws_sold_date_sk#58] -(44) ReusedExchange [Reuses operator id: 77] +(44) ReusedExchange [Reuses operator id: 76] Output [2]: [d_date_sk#60, d_year#61] (45) BroadcastHashJoin [codegen id : 10] @@ -311,166 +310,162 @@ Results [2]: [c_customer_id#48 AS customer_id#66, MakeDecimal(sum(UnscaledValue( Input [2]: [customer_id#66, year_total#67] Condition : (isnotnull(year_total#67) AND (year_total#67 > 0.00)) -(51) Project [codegen id : 11] -Output [2]: [customer_id#66 AS customer_id#68, year_total#67 AS year_total#69] +(51) BroadcastExchange Input [2]: [customer_id#66, year_total#67] +Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#68] -(52) BroadcastExchange -Input [2]: [customer_id#68, year_total#69] -Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#70] - -(53) BroadcastHashJoin [codegen id : 16] +(52) BroadcastHashJoin [codegen id : 16] Left keys [1]: [customer_id#21] -Right keys [1]: [customer_id#68] +Right keys [1]: [customer_id#66] Join condition: None -(54) Project [codegen id : 16] -Output [5]: [customer_id#21, year_total#22, customer_preferred_cust_flag#44, year_total#45, year_total#69] -Input [6]: [customer_id#21, year_total#22, customer_preferred_cust_flag#44, year_total#45, customer_id#68, year_total#69] +(53) Project [codegen id : 16] +Output [5]: [customer_id#21, year_total#22, customer_preferred_cust_flag#44, year_total#45, year_total#67] +Input [6]: [customer_id#21, year_total#22, customer_preferred_cust_flag#44, year_total#45, customer_id#66, year_total#67] -(55) Scan parquet default.customer -Output [8]: [c_customer_sk#71, c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78] +(54) Scan parquet default.customer +Output [8]: [c_customer_sk#69, c_customer_id#70, c_first_name#71, c_last_name#72, c_preferred_cust_flag#73, c_birth_country#74, c_login#75, c_email_address#76] Batched: true Location [not included in comparison]/{warehouse_dir}/customer] PushedFilters: [IsNotNull(c_customer_sk), IsNotNull(c_customer_id)] ReadSchema: struct -(56) ColumnarToRow [codegen id : 14] -Input [8]: [c_customer_sk#71, c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78] +(55) ColumnarToRow [codegen id : 14] +Input [8]: [c_customer_sk#69, c_customer_id#70, c_first_name#71, c_last_name#72, c_preferred_cust_flag#73, c_birth_country#74, c_login#75, c_email_address#76] -(57) Filter [codegen id : 14] -Input [8]: [c_customer_sk#71, c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78] -Condition : (isnotnull(c_customer_sk#71) AND isnotnull(c_customer_id#72)) +(56) Filter [codegen id : 14] +Input [8]: [c_customer_sk#69, c_customer_id#70, c_first_name#71, c_last_name#72, c_preferred_cust_flag#73, c_birth_country#74, c_login#75, c_email_address#76] +Condition : (isnotnull(c_customer_sk#69) AND isnotnull(c_customer_id#70)) -(58) Scan parquet default.web_sales -Output [4]: [ws_bill_customer_sk#79, ws_ext_discount_amt#80, ws_ext_list_price#81, ws_sold_date_sk#82] +(57) Scan parquet default.web_sales +Output [4]: [ws_bill_customer_sk#77, ws_ext_discount_amt#78, ws_ext_list_price#79, ws_sold_date_sk#80] Batched: true Location: InMemoryFileIndex [] -PartitionFilters: [isnotnull(ws_sold_date_sk#82), dynamicpruningexpression(ws_sold_date_sk#82 IN dynamicpruning#35)] +PartitionFilters: [isnotnull(ws_sold_date_sk#80), dynamicpruningexpression(ws_sold_date_sk#80 IN dynamicpruning#35)] PushedFilters: [IsNotNull(ws_bill_customer_sk)] ReadSchema: struct -(59) ColumnarToRow [codegen id : 12] -Input [4]: [ws_bill_customer_sk#79, ws_ext_discount_amt#80, ws_ext_list_price#81, ws_sold_date_sk#82] +(58) ColumnarToRow [codegen id : 12] +Input [4]: [ws_bill_customer_sk#77, ws_ext_discount_amt#78, ws_ext_list_price#79, ws_sold_date_sk#80] -(60) Filter [codegen id : 12] -Input [4]: [ws_bill_customer_sk#79, ws_ext_discount_amt#80, ws_ext_list_price#81, ws_sold_date_sk#82] -Condition : isnotnull(ws_bill_customer_sk#79) +(59) Filter [codegen id : 12] +Input [4]: [ws_bill_customer_sk#77, ws_ext_discount_amt#78, ws_ext_list_price#79, ws_sold_date_sk#80] +Condition : isnotnull(ws_bill_customer_sk#77) -(61) BroadcastExchange -Input [4]: [ws_bill_customer_sk#79, ws_ext_discount_amt#80, ws_ext_list_price#81, ws_sold_date_sk#82] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#83] +(60) BroadcastExchange +Input [4]: [ws_bill_customer_sk#77, ws_ext_discount_amt#78, ws_ext_list_price#79, ws_sold_date_sk#80] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#81] -(62) BroadcastHashJoin [codegen id : 14] -Left keys [1]: [c_customer_sk#71] -Right keys [1]: [ws_bill_customer_sk#79] +(61) BroadcastHashJoin [codegen id : 14] +Left keys [1]: [c_customer_sk#69] +Right keys [1]: [ws_bill_customer_sk#77] Join condition: None -(63) Project [codegen id : 14] -Output [10]: [c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, ws_ext_discount_amt#80, ws_ext_list_price#81, ws_sold_date_sk#82] -Input [12]: [c_customer_sk#71, c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, ws_bill_customer_sk#79, ws_ext_discount_amt#80, ws_ext_list_price#81, ws_sold_date_sk#82] +(62) Project [codegen id : 14] +Output [10]: [c_customer_id#70, c_first_name#71, c_last_name#72, c_preferred_cust_flag#73, c_birth_country#74, c_login#75, c_email_address#76, ws_ext_discount_amt#78, ws_ext_list_price#79, ws_sold_date_sk#80] +Input [12]: [c_customer_sk#69, c_customer_id#70, c_first_name#71, c_last_name#72, c_preferred_cust_flag#73, c_birth_country#74, c_login#75, c_email_address#76, ws_bill_customer_sk#77, ws_ext_discount_amt#78, ws_ext_list_price#79, ws_sold_date_sk#80] -(64) ReusedExchange [Reuses operator id: 81] -Output [2]: [d_date_sk#84, d_year#85] +(63) ReusedExchange [Reuses operator id: 80] +Output [2]: [d_date_sk#82, d_year#83] -(65) BroadcastHashJoin [codegen id : 14] -Left keys [1]: [ws_sold_date_sk#82] -Right keys [1]: [d_date_sk#84] +(64) BroadcastHashJoin [codegen id : 14] +Left keys [1]: [ws_sold_date_sk#80] +Right keys [1]: [d_date_sk#82] Join condition: None -(66) Project [codegen id : 14] -Output [10]: [c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, ws_ext_discount_amt#80, ws_ext_list_price#81, d_year#85] -Input [12]: [c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, ws_ext_discount_amt#80, ws_ext_list_price#81, ws_sold_date_sk#82, d_date_sk#84, d_year#85] - -(67) HashAggregate [codegen id : 14] -Input [10]: [c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, ws_ext_discount_amt#80, ws_ext_list_price#81, d_year#85] -Keys [8]: [c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, d_year#85] -Functions [1]: [partial_sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#81 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#80 as decimal(8,2)))), DecimalType(8,2), true)))] -Aggregate Attributes [1]: [sum#86] -Results [9]: [c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, d_year#85, sum#87] - -(68) Exchange -Input [9]: [c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, d_year#85, sum#87] -Arguments: hashpartitioning(c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, d_year#85, 5), ENSURE_REQUIREMENTS, [id=#88] - -(69) HashAggregate [codegen id : 15] -Input [9]: [c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, d_year#85, sum#87] -Keys [8]: [c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, d_year#85] -Functions [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#81 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#80 as decimal(8,2)))), DecimalType(8,2), true)))] -Aggregate Attributes [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#81 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#80 as decimal(8,2)))), DecimalType(8,2), true)))#89] -Results [2]: [c_customer_id#72 AS customer_id#90, MakeDecimal(sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#81 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#80 as decimal(8,2)))), DecimalType(8,2), true)))#89,18,2) AS year_total#91] - -(70) BroadcastExchange -Input [2]: [customer_id#90, year_total#91] -Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#92] - -(71) BroadcastHashJoin [codegen id : 16] +(65) Project [codegen id : 14] +Output [10]: [c_customer_id#70, c_first_name#71, c_last_name#72, c_preferred_cust_flag#73, c_birth_country#74, c_login#75, c_email_address#76, ws_ext_discount_amt#78, ws_ext_list_price#79, d_year#83] +Input [12]: [c_customer_id#70, c_first_name#71, c_last_name#72, c_preferred_cust_flag#73, c_birth_country#74, c_login#75, c_email_address#76, ws_ext_discount_amt#78, ws_ext_list_price#79, ws_sold_date_sk#80, d_date_sk#82, d_year#83] + +(66) HashAggregate [codegen id : 14] +Input [10]: [c_customer_id#70, c_first_name#71, c_last_name#72, c_preferred_cust_flag#73, c_birth_country#74, c_login#75, c_email_address#76, ws_ext_discount_amt#78, ws_ext_list_price#79, d_year#83] +Keys [8]: [c_customer_id#70, c_first_name#71, c_last_name#72, c_preferred_cust_flag#73, c_birth_country#74, c_login#75, c_email_address#76, d_year#83] +Functions [1]: [partial_sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#79 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#78 as decimal(8,2)))), DecimalType(8,2), true)))] +Aggregate Attributes [1]: [sum#84] +Results [9]: [c_customer_id#70, c_first_name#71, c_last_name#72, c_preferred_cust_flag#73, c_birth_country#74, c_login#75, c_email_address#76, d_year#83, sum#85] + +(67) Exchange +Input [9]: [c_customer_id#70, c_first_name#71, c_last_name#72, c_preferred_cust_flag#73, c_birth_country#74, c_login#75, c_email_address#76, d_year#83, sum#85] +Arguments: hashpartitioning(c_customer_id#70, c_first_name#71, c_last_name#72, c_preferred_cust_flag#73, c_birth_country#74, c_login#75, c_email_address#76, d_year#83, 5), ENSURE_REQUIREMENTS, [id=#86] + +(68) HashAggregate [codegen id : 15] +Input [9]: [c_customer_id#70, c_first_name#71, c_last_name#72, c_preferred_cust_flag#73, c_birth_country#74, c_login#75, c_email_address#76, d_year#83, sum#85] +Keys [8]: [c_customer_id#70, c_first_name#71, c_last_name#72, c_preferred_cust_flag#73, c_birth_country#74, c_login#75, c_email_address#76, d_year#83] +Functions [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#79 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#78 as decimal(8,2)))), DecimalType(8,2), true)))] +Aggregate Attributes [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#79 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#78 as decimal(8,2)))), DecimalType(8,2), true)))#87] +Results [2]: [c_customer_id#70 AS customer_id#88, MakeDecimal(sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#79 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#78 as decimal(8,2)))), DecimalType(8,2), true)))#87,18,2) AS year_total#89] + +(69) BroadcastExchange +Input [2]: [customer_id#88, year_total#89] +Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#90] + +(70) BroadcastHashJoin [codegen id : 16] Left keys [1]: [customer_id#21] -Right keys [1]: [customer_id#90] -Join condition: (CASE WHEN (year_total#69 > 0.00) THEN CheckOverflow((promote_precision(year_total#91) / promote_precision(year_total#69)), DecimalType(38,20), true) ELSE null END > CASE WHEN (year_total#22 > 0.00) THEN CheckOverflow((promote_precision(year_total#45) / promote_precision(year_total#22)), DecimalType(38,20), true) ELSE null END) +Right keys [1]: [customer_id#88] +Join condition: (CASE WHEN (year_total#67 > 0.00) THEN CheckOverflow((promote_precision(year_total#89) / promote_precision(year_total#67)), DecimalType(38,20), true) ELSE null END > CASE WHEN (year_total#22 > 0.00) THEN CheckOverflow((promote_precision(year_total#45) / promote_precision(year_total#22)), DecimalType(38,20), true) ELSE null END) -(72) Project [codegen id : 16] +(71) Project [codegen id : 16] Output [1]: [customer_preferred_cust_flag#44] -Input [7]: [customer_id#21, year_total#22, customer_preferred_cust_flag#44, year_total#45, year_total#69, customer_id#90, year_total#91] +Input [7]: [customer_id#21, year_total#22, customer_preferred_cust_flag#44, year_total#45, year_total#67, customer_id#88, year_total#89] -(73) TakeOrderedAndProject +(72) TakeOrderedAndProject Input [1]: [customer_preferred_cust_flag#44] Arguments: 100, [customer_preferred_cust_flag#44 ASC NULLS FIRST], [customer_preferred_cust_flag#44] ===== Subqueries ===== Subquery:1 Hosting operator id = 4 Hosting Expression = ss_sold_date_sk#12 IN dynamicpruning#13 -BroadcastExchange (77) -+- * Filter (76) - +- * ColumnarToRow (75) - +- Scan parquet default.date_dim (74) +BroadcastExchange (76) ++- * Filter (75) + +- * ColumnarToRow (74) + +- Scan parquet default.date_dim (73) -(74) Scan parquet default.date_dim +(73) Scan parquet default.date_dim Output [2]: [d_date_sk#15, d_year#16] Batched: true Location [not included in comparison]/{warehouse_dir}/date_dim] PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2001), IsNotNull(d_date_sk)] ReadSchema: struct -(75) ColumnarToRow [codegen id : 1] +(74) ColumnarToRow [codegen id : 1] Input [2]: [d_date_sk#15, d_year#16] -(76) Filter [codegen id : 1] +(75) Filter [codegen id : 1] Input [2]: [d_date_sk#15, d_year#16] Condition : ((isnotnull(d_year#16) AND (d_year#16 = 2001)) AND isnotnull(d_date_sk#15)) -(77) BroadcastExchange +(76) BroadcastExchange Input [2]: [d_date_sk#15, d_year#16] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#93] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#91] Subquery:2 Hosting operator id = 20 Hosting Expression = ss_sold_date_sk#34 IN dynamicpruning#35 -BroadcastExchange (81) -+- * Filter (80) - +- * ColumnarToRow (79) - +- Scan parquet default.date_dim (78) +BroadcastExchange (80) ++- * Filter (79) + +- * ColumnarToRow (78) + +- Scan parquet default.date_dim (77) -(78) Scan parquet default.date_dim +(77) Scan parquet default.date_dim Output [2]: [d_date_sk#37, d_year#38] Batched: true Location [not included in comparison]/{warehouse_dir}/date_dim] PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2002), IsNotNull(d_date_sk)] ReadSchema: struct -(79) ColumnarToRow [codegen id : 1] +(78) ColumnarToRow [codegen id : 1] Input [2]: [d_date_sk#37, d_year#38] -(80) Filter [codegen id : 1] +(79) Filter [codegen id : 1] Input [2]: [d_date_sk#37, d_year#38] Condition : ((isnotnull(d_year#38) AND (d_year#38 = 2002)) AND isnotnull(d_date_sk#37)) -(81) BroadcastExchange +(80) BroadcastExchange Input [2]: [d_date_sk#37, d_year#38] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#94] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#92] Subquery:3 Hosting operator id = 38 Hosting Expression = ws_sold_date_sk#58 IN dynamicpruning#13 -Subquery:4 Hosting operator id = 58 Hosting Expression = ws_sold_date_sk#82 IN dynamicpruning#35 +Subquery:4 Hosting operator id = 57 Hosting Expression = ws_sold_date_sk#80 IN dynamicpruning#35 diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q11/simplified.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q11/simplified.txt index f860a9b8280a8..e9c0faa7491a0 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q11/simplified.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q11/simplified.txt @@ -71,31 +71,30 @@ TakeOrderedAndProject [customer_preferred_cust_flag] InputAdapter BroadcastExchange #8 WholeStageCodegen (11) - Project [customer_id,year_total] - Filter [year_total] - HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum] [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt as decimal(8,2)))), DecimalType(8,2), true))),customer_id,year_total,sum] - InputAdapter - Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #9 - WholeStageCodegen (10) - HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,ws_ext_list_price,ws_ext_discount_amt] [sum,sum] - Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ws_ext_discount_amt,ws_ext_list_price,d_year] - BroadcastHashJoin [ws_sold_date_sk,d_date_sk] - Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ws_ext_discount_amt,ws_ext_list_price,ws_sold_date_sk] - BroadcastHashJoin [c_customer_sk,ws_bill_customer_sk] - Filter [c_customer_sk,c_customer_id] - ColumnarToRow - InputAdapter - Scan parquet default.customer [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] - InputAdapter - BroadcastExchange #10 - WholeStageCodegen (8) - Filter [ws_bill_customer_sk] - ColumnarToRow - InputAdapter - Scan parquet default.web_sales [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_list_price,ws_sold_date_sk] - ReusedSubquery [d_date_sk] #1 - InputAdapter - ReusedExchange [d_date_sk,d_year] #3 + Filter [year_total] + HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum] [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt as decimal(8,2)))), DecimalType(8,2), true))),customer_id,year_total,sum] + InputAdapter + Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #9 + WholeStageCodegen (10) + HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,ws_ext_list_price,ws_ext_discount_amt] [sum,sum] + Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ws_ext_discount_amt,ws_ext_list_price,d_year] + BroadcastHashJoin [ws_sold_date_sk,d_date_sk] + Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ws_ext_discount_amt,ws_ext_list_price,ws_sold_date_sk] + BroadcastHashJoin [c_customer_sk,ws_bill_customer_sk] + Filter [c_customer_sk,c_customer_id] + ColumnarToRow + InputAdapter + Scan parquet default.customer [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] + InputAdapter + BroadcastExchange #10 + WholeStageCodegen (8) + Filter [ws_bill_customer_sk] + ColumnarToRow + InputAdapter + Scan parquet default.web_sales [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_list_price,ws_sold_date_sk] + ReusedSubquery [d_date_sk] #1 + InputAdapter + ReusedExchange [d_date_sk,d_year] #3 InputAdapter BroadcastExchange #11 WholeStageCodegen (15) diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q4.sf100/explain.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q4.sf100/explain.txt index 4e4dd9555c718..a311bec3c313b 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q4.sf100/explain.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q4.sf100/explain.txt @@ -1,13 +1,13 @@ == Physical Plan == -TakeOrderedAndProject (120) -+- * Project (119) - +- * SortMergeJoin Inner (118) - :- * Project (100) - : +- * SortMergeJoin Inner (99) - : :- * Project (79) - : : +- * SortMergeJoin Inner (78) - : : :- * Project (60) - : : : +- * SortMergeJoin Inner (59) +TakeOrderedAndProject (118) ++- * Project (117) + +- * SortMergeJoin Inner (116) + :- * Project (98) + : +- * SortMergeJoin Inner (97) + : :- * Project (78) + : : +- * SortMergeJoin Inner (77) + : : :- * Project (59) + : : : +- * SortMergeJoin Inner (58) : : : :- * SortMergeJoin Inner (39) : : : : :- * Sort (21) : : : : : +- Exchange (20) @@ -47,78 +47,76 @@ TakeOrderedAndProject (120) : : : : : +- ReusedExchange (25) : : : : +- * Sort (31) : : : : +- ReusedExchange (30) - : : : +- * Sort (58) - : : : +- Exchange (57) - : : : +- * Project (56) - : : : +- * Filter (55) - : : : +- * HashAggregate (54) - : : : +- Exchange (53) - : : : +- * HashAggregate (52) - : : : +- * Project (51) - : : : +- * SortMergeJoin Inner (50) - : : : :- * Sort (47) - : : : : +- Exchange (46) - : : : : +- * Project (45) - : : : : +- * BroadcastHashJoin Inner BuildRight (44) - : : : : :- * Filter (42) - : : : : : +- * ColumnarToRow (41) - : : : : : +- Scan parquet default.catalog_sales (40) - : : : : +- ReusedExchange (43) - : : : +- * Sort (49) - : : : +- ReusedExchange (48) - : : +- * Sort (77) - : : +- Exchange (76) - : : +- * HashAggregate (75) - : : +- Exchange (74) - : : +- * HashAggregate (73) - : : +- * Project (72) - : : +- * SortMergeJoin Inner (71) - : : :- * Sort (68) - : : : +- Exchange (67) - : : : +- * Project (66) - : : : +- * BroadcastHashJoin Inner BuildRight (65) - : : : :- * Filter (63) - : : : : +- * ColumnarToRow (62) - : : : : +- Scan parquet default.catalog_sales (61) - : : : +- ReusedExchange (64) - : : +- * Sort (70) - : : +- ReusedExchange (69) - : +- * Sort (98) - : +- Exchange (97) - : +- * Project (96) - : +- * Filter (95) - : +- * HashAggregate (94) - : +- Exchange (93) - : +- * HashAggregate (92) - : +- * Project (91) - : +- * SortMergeJoin Inner (90) - : :- * Sort (87) - : : +- Exchange (86) - : : +- * Project (85) - : : +- * BroadcastHashJoin Inner BuildRight (84) - : : :- * Filter (82) - : : : +- * ColumnarToRow (81) - : : : +- Scan parquet default.web_sales (80) - : : +- ReusedExchange (83) - : +- * Sort (89) - : +- ReusedExchange (88) - +- * Sort (117) - +- Exchange (116) - +- * HashAggregate (115) - +- Exchange (114) - +- * HashAggregate (113) - +- * Project (112) - +- * SortMergeJoin Inner (111) - :- * Sort (108) - : +- Exchange (107) - : +- * Project (106) - : +- * BroadcastHashJoin Inner BuildRight (105) - : :- * Filter (103) - : : +- * ColumnarToRow (102) - : : +- Scan parquet default.web_sales (101) - : +- ReusedExchange (104) - +- * Sort (110) - +- ReusedExchange (109) + : : : +- * Sort (57) + : : : +- Exchange (56) + : : : +- * Filter (55) + : : : +- * HashAggregate (54) + : : : +- Exchange (53) + : : : +- * HashAggregate (52) + : : : +- * Project (51) + : : : +- * SortMergeJoin Inner (50) + : : : :- * Sort (47) + : : : : +- Exchange (46) + : : : : +- * Project (45) + : : : : +- * BroadcastHashJoin Inner BuildRight (44) + : : : : :- * Filter (42) + : : : : : +- * ColumnarToRow (41) + : : : : : +- Scan parquet default.catalog_sales (40) + : : : : +- ReusedExchange (43) + : : : +- * Sort (49) + : : : +- ReusedExchange (48) + : : +- * Sort (76) + : : +- Exchange (75) + : : +- * HashAggregate (74) + : : +- Exchange (73) + : : +- * HashAggregate (72) + : : +- * Project (71) + : : +- * SortMergeJoin Inner (70) + : : :- * Sort (67) + : : : +- Exchange (66) + : : : +- * Project (65) + : : : +- * BroadcastHashJoin Inner BuildRight (64) + : : : :- * Filter (62) + : : : : +- * ColumnarToRow (61) + : : : : +- Scan parquet default.catalog_sales (60) + : : : +- ReusedExchange (63) + : : +- * Sort (69) + : : +- ReusedExchange (68) + : +- * Sort (96) + : +- Exchange (95) + : +- * Filter (94) + : +- * HashAggregate (93) + : +- Exchange (92) + : +- * HashAggregate (91) + : +- * Project (90) + : +- * SortMergeJoin Inner (89) + : :- * Sort (86) + : : +- Exchange (85) + : : +- * Project (84) + : : +- * BroadcastHashJoin Inner BuildRight (83) + : : :- * Filter (81) + : : : +- * ColumnarToRow (80) + : : : +- Scan parquet default.web_sales (79) + : : +- ReusedExchange (82) + : +- * Sort (88) + : +- ReusedExchange (87) + +- * Sort (115) + +- Exchange (114) + +- * HashAggregate (113) + +- Exchange (112) + +- * HashAggregate (111) + +- * Project (110) + +- * SortMergeJoin Inner (109) + :- * Sort (106) + : +- Exchange (105) + : +- * Project (104) + : +- * BroadcastHashJoin Inner BuildRight (103) + : :- * Filter (101) + : : +- * ColumnarToRow (100) + : : +- Scan parquet default.web_sales (99) + : +- ReusedExchange (102) + +- * Sort (108) + +- ReusedExchange (107) (1) Scan parquet default.store_sales @@ -136,7 +134,7 @@ Input [6]: [ss_customer_sk#1, ss_ext_discount_amt#2, ss_ext_sales_price#3, ss_ex Input [6]: [ss_customer_sk#1, ss_ext_discount_amt#2, ss_ext_sales_price#3, ss_ext_wholesale_cost#4, ss_ext_list_price#5, ss_sold_date_sk#6] Condition : isnotnull(ss_customer_sk#1) -(4) ReusedExchange [Reuses operator id: 124] +(4) ReusedExchange [Reuses operator id: 122] Output [2]: [d_date_sk#8, d_year#9] (5) BroadcastHashJoin [codegen id : 2] @@ -232,7 +230,7 @@ Input [6]: [ss_customer_sk#29, ss_ext_discount_amt#30, ss_ext_sales_price#31, ss Input [6]: [ss_customer_sk#29, ss_ext_discount_amt#30, ss_ext_sales_price#31, ss_ext_wholesale_cost#32, ss_ext_list_price#33, ss_sold_date_sk#34] Condition : isnotnull(ss_customer_sk#29) -(25) ReusedExchange [Reuses operator id: 128] +(25) ReusedExchange [Reuses operator id: 126] Output [2]: [d_date_sk#36, d_year#37] (26) BroadcastHashJoin [codegen id : 10] @@ -314,7 +312,7 @@ Input [6]: [cs_bill_customer_sk#62, cs_ext_discount_amt#63, cs_ext_sales_price#6 Input [6]: [cs_bill_customer_sk#62, cs_ext_discount_amt#63, cs_ext_sales_price#64, cs_ext_wholesale_cost#65, cs_ext_list_price#66, cs_sold_date_sk#67] Condition : isnotnull(cs_bill_customer_sk#62) -(43) ReusedExchange [Reuses operator id: 124] +(43) ReusedExchange [Reuses operator id: 122] Output [2]: [d_date_sk#68, d_year#69] (44) BroadcastHashJoin [codegen id : 19] @@ -372,355 +370,347 @@ Results [2]: [c_customer_id#72 AS customer_id#85, sum(CheckOverflow((promote_pre Input [2]: [customer_id#85, year_total#86] Condition : (isnotnull(year_total#86) AND (year_total#86 > 0.000000)) -(56) Project [codegen id : 24] -Output [2]: [customer_id#85 AS customer_id#87, year_total#86 AS year_total#88] +(56) Exchange Input [2]: [customer_id#85, year_total#86] +Arguments: hashpartitioning(customer_id#85, 5), ENSURE_REQUIREMENTS, [id=#87] -(57) Exchange -Input [2]: [customer_id#87, year_total#88] -Arguments: hashpartitioning(customer_id#87, 5), ENSURE_REQUIREMENTS, [id=#89] - -(58) Sort [codegen id : 25] -Input [2]: [customer_id#87, year_total#88] -Arguments: [customer_id#87 ASC NULLS FIRST], false, 0 +(57) Sort [codegen id : 25] +Input [2]: [customer_id#85, year_total#86] +Arguments: [customer_id#85 ASC NULLS FIRST], false, 0 -(59) SortMergeJoin [codegen id : 26] +(58) SortMergeJoin [codegen id : 26] Left keys [1]: [customer_id#26] -Right keys [1]: [customer_id#87] +Right keys [1]: [customer_id#85] Join condition: None -(60) Project [codegen id : 26] -Output [11]: [customer_id#26, year_total#27, customer_id#53, customer_first_name#54, customer_last_name#55, customer_preferred_cust_flag#56, customer_birth_country#57, customer_login#58, customer_email_address#59, year_total#60, year_total#88] -Input [12]: [customer_id#26, year_total#27, customer_id#53, customer_first_name#54, customer_last_name#55, customer_preferred_cust_flag#56, customer_birth_country#57, customer_login#58, customer_email_address#59, year_total#60, customer_id#87, year_total#88] +(59) Project [codegen id : 26] +Output [11]: [customer_id#26, year_total#27, customer_id#53, customer_first_name#54, customer_last_name#55, customer_preferred_cust_flag#56, customer_birth_country#57, customer_login#58, customer_email_address#59, year_total#60, year_total#86] +Input [12]: [customer_id#26, year_total#27, customer_id#53, customer_first_name#54, customer_last_name#55, customer_preferred_cust_flag#56, customer_birth_country#57, customer_login#58, customer_email_address#59, year_total#60, customer_id#85, year_total#86] -(61) Scan parquet default.catalog_sales -Output [6]: [cs_bill_customer_sk#90, cs_ext_discount_amt#91, cs_ext_sales_price#92, cs_ext_wholesale_cost#93, cs_ext_list_price#94, cs_sold_date_sk#95] +(60) Scan parquet default.catalog_sales +Output [6]: [cs_bill_customer_sk#88, cs_ext_discount_amt#89, cs_ext_sales_price#90, cs_ext_wholesale_cost#91, cs_ext_list_price#92, cs_sold_date_sk#93] Batched: true Location: InMemoryFileIndex [] -PartitionFilters: [isnotnull(cs_sold_date_sk#95), dynamicpruningexpression(cs_sold_date_sk#95 IN dynamicpruning#35)] +PartitionFilters: [isnotnull(cs_sold_date_sk#93), dynamicpruningexpression(cs_sold_date_sk#93 IN dynamicpruning#35)] PushedFilters: [IsNotNull(cs_bill_customer_sk)] ReadSchema: struct -(62) ColumnarToRow [codegen id : 28] -Input [6]: [cs_bill_customer_sk#90, cs_ext_discount_amt#91, cs_ext_sales_price#92, cs_ext_wholesale_cost#93, cs_ext_list_price#94, cs_sold_date_sk#95] +(61) ColumnarToRow [codegen id : 28] +Input [6]: [cs_bill_customer_sk#88, cs_ext_discount_amt#89, cs_ext_sales_price#90, cs_ext_wholesale_cost#91, cs_ext_list_price#92, cs_sold_date_sk#93] -(63) Filter [codegen id : 28] -Input [6]: [cs_bill_customer_sk#90, cs_ext_discount_amt#91, cs_ext_sales_price#92, cs_ext_wholesale_cost#93, cs_ext_list_price#94, cs_sold_date_sk#95] -Condition : isnotnull(cs_bill_customer_sk#90) +(62) Filter [codegen id : 28] +Input [6]: [cs_bill_customer_sk#88, cs_ext_discount_amt#89, cs_ext_sales_price#90, cs_ext_wholesale_cost#91, cs_ext_list_price#92, cs_sold_date_sk#93] +Condition : isnotnull(cs_bill_customer_sk#88) -(64) ReusedExchange [Reuses operator id: 128] -Output [2]: [d_date_sk#96, d_year#97] +(63) ReusedExchange [Reuses operator id: 126] +Output [2]: [d_date_sk#94, d_year#95] -(65) BroadcastHashJoin [codegen id : 28] -Left keys [1]: [cs_sold_date_sk#95] -Right keys [1]: [d_date_sk#96] +(64) BroadcastHashJoin [codegen id : 28] +Left keys [1]: [cs_sold_date_sk#93] +Right keys [1]: [d_date_sk#94] Join condition: None -(66) Project [codegen id : 28] -Output [6]: [cs_bill_customer_sk#90, cs_ext_discount_amt#91, cs_ext_sales_price#92, cs_ext_wholesale_cost#93, cs_ext_list_price#94, d_year#97] -Input [8]: [cs_bill_customer_sk#90, cs_ext_discount_amt#91, cs_ext_sales_price#92, cs_ext_wholesale_cost#93, cs_ext_list_price#94, cs_sold_date_sk#95, d_date_sk#96, d_year#97] +(65) Project [codegen id : 28] +Output [6]: [cs_bill_customer_sk#88, cs_ext_discount_amt#89, cs_ext_sales_price#90, cs_ext_wholesale_cost#91, cs_ext_list_price#92, d_year#95] +Input [8]: [cs_bill_customer_sk#88, cs_ext_discount_amt#89, cs_ext_sales_price#90, cs_ext_wholesale_cost#91, cs_ext_list_price#92, cs_sold_date_sk#93, d_date_sk#94, d_year#95] -(67) Exchange -Input [6]: [cs_bill_customer_sk#90, cs_ext_discount_amt#91, cs_ext_sales_price#92, cs_ext_wholesale_cost#93, cs_ext_list_price#94, d_year#97] -Arguments: hashpartitioning(cs_bill_customer_sk#90, 5), ENSURE_REQUIREMENTS, [id=#98] +(66) Exchange +Input [6]: [cs_bill_customer_sk#88, cs_ext_discount_amt#89, cs_ext_sales_price#90, cs_ext_wholesale_cost#91, cs_ext_list_price#92, d_year#95] +Arguments: hashpartitioning(cs_bill_customer_sk#88, 5), ENSURE_REQUIREMENTS, [id=#96] -(68) Sort [codegen id : 29] -Input [6]: [cs_bill_customer_sk#90, cs_ext_discount_amt#91, cs_ext_sales_price#92, cs_ext_wholesale_cost#93, cs_ext_list_price#94, d_year#97] -Arguments: [cs_bill_customer_sk#90 ASC NULLS FIRST], false, 0 +(67) Sort [codegen id : 29] +Input [6]: [cs_bill_customer_sk#88, cs_ext_discount_amt#89, cs_ext_sales_price#90, cs_ext_wholesale_cost#91, cs_ext_list_price#92, d_year#95] +Arguments: [cs_bill_customer_sk#88 ASC NULLS FIRST], false, 0 -(69) ReusedExchange [Reuses operator id: 12] -Output [8]: [c_customer_sk#99, c_customer_id#100, c_first_name#101, c_last_name#102, c_preferred_cust_flag#103, c_birth_country#104, c_login#105, c_email_address#106] +(68) ReusedExchange [Reuses operator id: 12] +Output [8]: [c_customer_sk#97, c_customer_id#98, c_first_name#99, c_last_name#100, c_preferred_cust_flag#101, c_birth_country#102, c_login#103, c_email_address#104] -(70) Sort [codegen id : 31] -Input [8]: [c_customer_sk#99, c_customer_id#100, c_first_name#101, c_last_name#102, c_preferred_cust_flag#103, c_birth_country#104, c_login#105, c_email_address#106] -Arguments: [c_customer_sk#99 ASC NULLS FIRST], false, 0 +(69) Sort [codegen id : 31] +Input [8]: [c_customer_sk#97, c_customer_id#98, c_first_name#99, c_last_name#100, c_preferred_cust_flag#101, c_birth_country#102, c_login#103, c_email_address#104] +Arguments: [c_customer_sk#97 ASC NULLS FIRST], false, 0 -(71) SortMergeJoin [codegen id : 32] -Left keys [1]: [cs_bill_customer_sk#90] -Right keys [1]: [c_customer_sk#99] +(70) SortMergeJoin [codegen id : 32] +Left keys [1]: [cs_bill_customer_sk#88] +Right keys [1]: [c_customer_sk#97] Join condition: None -(72) Project [codegen id : 32] -Output [12]: [c_customer_id#100, c_first_name#101, c_last_name#102, c_preferred_cust_flag#103, c_birth_country#104, c_login#105, c_email_address#106, cs_ext_discount_amt#91, cs_ext_sales_price#92, cs_ext_wholesale_cost#93, cs_ext_list_price#94, d_year#97] -Input [14]: [cs_bill_customer_sk#90, cs_ext_discount_amt#91, cs_ext_sales_price#92, cs_ext_wholesale_cost#93, cs_ext_list_price#94, d_year#97, c_customer_sk#99, c_customer_id#100, c_first_name#101, c_last_name#102, c_preferred_cust_flag#103, c_birth_country#104, c_login#105, c_email_address#106] - -(73) HashAggregate [codegen id : 32] -Input [12]: [c_customer_id#100, c_first_name#101, c_last_name#102, c_preferred_cust_flag#103, c_birth_country#104, c_login#105, c_email_address#106, cs_ext_discount_amt#91, cs_ext_sales_price#92, cs_ext_wholesale_cost#93, cs_ext_list_price#94, d_year#97] -Keys [8]: [c_customer_id#100, c_first_name#101, c_last_name#102, c_preferred_cust_flag#103, c_birth_country#104, c_login#105, c_email_address#106, d_year#97] -Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#94 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#93 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#91 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#92 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] -Aggregate Attributes [2]: [sum#107, isEmpty#108] -Results [10]: [c_customer_id#100, c_first_name#101, c_last_name#102, c_preferred_cust_flag#103, c_birth_country#104, c_login#105, c_email_address#106, d_year#97, sum#109, isEmpty#110] - -(74) Exchange -Input [10]: [c_customer_id#100, c_first_name#101, c_last_name#102, c_preferred_cust_flag#103, c_birth_country#104, c_login#105, c_email_address#106, d_year#97, sum#109, isEmpty#110] -Arguments: hashpartitioning(c_customer_id#100, c_first_name#101, c_last_name#102, c_preferred_cust_flag#103, c_birth_country#104, c_login#105, c_email_address#106, d_year#97, 5), ENSURE_REQUIREMENTS, [id=#111] - -(75) HashAggregate [codegen id : 33] -Input [10]: [c_customer_id#100, c_first_name#101, c_last_name#102, c_preferred_cust_flag#103, c_birth_country#104, c_login#105, c_email_address#106, d_year#97, sum#109, isEmpty#110] -Keys [8]: [c_customer_id#100, c_first_name#101, c_last_name#102, c_preferred_cust_flag#103, c_birth_country#104, c_login#105, c_email_address#106, d_year#97] -Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#94 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#93 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#91 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#92 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] -Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#94 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#93 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#91 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#92 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#112] -Results [2]: [c_customer_id#100 AS customer_id#113, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#94 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#93 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#91 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#92 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#112 AS year_total#114] - -(76) Exchange -Input [2]: [customer_id#113, year_total#114] -Arguments: hashpartitioning(customer_id#113, 5), ENSURE_REQUIREMENTS, [id=#115] - -(77) Sort [codegen id : 34] -Input [2]: [customer_id#113, year_total#114] -Arguments: [customer_id#113 ASC NULLS FIRST], false, 0 - -(78) SortMergeJoin [codegen id : 35] +(71) Project [codegen id : 32] +Output [12]: [c_customer_id#98, c_first_name#99, c_last_name#100, c_preferred_cust_flag#101, c_birth_country#102, c_login#103, c_email_address#104, cs_ext_discount_amt#89, cs_ext_sales_price#90, cs_ext_wholesale_cost#91, cs_ext_list_price#92, d_year#95] +Input [14]: [cs_bill_customer_sk#88, cs_ext_discount_amt#89, cs_ext_sales_price#90, cs_ext_wholesale_cost#91, cs_ext_list_price#92, d_year#95, c_customer_sk#97, c_customer_id#98, c_first_name#99, c_last_name#100, c_preferred_cust_flag#101, c_birth_country#102, c_login#103, c_email_address#104] + +(72) HashAggregate [codegen id : 32] +Input [12]: [c_customer_id#98, c_first_name#99, c_last_name#100, c_preferred_cust_flag#101, c_birth_country#102, c_login#103, c_email_address#104, cs_ext_discount_amt#89, cs_ext_sales_price#90, cs_ext_wholesale_cost#91, cs_ext_list_price#92, d_year#95] +Keys [8]: [c_customer_id#98, c_first_name#99, c_last_name#100, c_preferred_cust_flag#101, c_birth_country#102, c_login#103, c_email_address#104, d_year#95] +Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#92 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#91 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#89 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#90 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] +Aggregate Attributes [2]: [sum#105, isEmpty#106] +Results [10]: [c_customer_id#98, c_first_name#99, c_last_name#100, c_preferred_cust_flag#101, c_birth_country#102, c_login#103, c_email_address#104, d_year#95, sum#107, isEmpty#108] + +(73) Exchange +Input [10]: [c_customer_id#98, c_first_name#99, c_last_name#100, c_preferred_cust_flag#101, c_birth_country#102, c_login#103, c_email_address#104, d_year#95, sum#107, isEmpty#108] +Arguments: hashpartitioning(c_customer_id#98, c_first_name#99, c_last_name#100, c_preferred_cust_flag#101, c_birth_country#102, c_login#103, c_email_address#104, d_year#95, 5), ENSURE_REQUIREMENTS, [id=#109] + +(74) HashAggregate [codegen id : 33] +Input [10]: [c_customer_id#98, c_first_name#99, c_last_name#100, c_preferred_cust_flag#101, c_birth_country#102, c_login#103, c_email_address#104, d_year#95, sum#107, isEmpty#108] +Keys [8]: [c_customer_id#98, c_first_name#99, c_last_name#100, c_preferred_cust_flag#101, c_birth_country#102, c_login#103, c_email_address#104, d_year#95] +Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#92 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#91 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#89 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#90 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] +Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#92 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#91 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#89 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#90 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#110] +Results [2]: [c_customer_id#98 AS customer_id#111, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#92 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#91 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#89 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#90 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#110 AS year_total#112] + +(75) Exchange +Input [2]: [customer_id#111, year_total#112] +Arguments: hashpartitioning(customer_id#111, 5), ENSURE_REQUIREMENTS, [id=#113] + +(76) Sort [codegen id : 34] +Input [2]: [customer_id#111, year_total#112] +Arguments: [customer_id#111 ASC NULLS FIRST], false, 0 + +(77) SortMergeJoin [codegen id : 35] Left keys [1]: [customer_id#26] -Right keys [1]: [customer_id#113] -Join condition: (CASE WHEN (year_total#88 > 0.000000) THEN CheckOverflow((promote_precision(year_total#114) / promote_precision(year_total#88)), DecimalType(38,14), true) ELSE null END > CASE WHEN (year_total#27 > 0.000000) THEN CheckOverflow((promote_precision(year_total#60) / promote_precision(year_total#27)), DecimalType(38,14), true) ELSE null END) +Right keys [1]: [customer_id#111] +Join condition: (CASE WHEN (year_total#86 > 0.000000) THEN CheckOverflow((promote_precision(year_total#112) / promote_precision(year_total#86)), DecimalType(38,14), true) ELSE null END > CASE WHEN (year_total#27 > 0.000000) THEN CheckOverflow((promote_precision(year_total#60) / promote_precision(year_total#27)), DecimalType(38,14), true) ELSE null END) -(79) Project [codegen id : 35] -Output [10]: [customer_id#26, customer_id#53, customer_first_name#54, customer_last_name#55, customer_preferred_cust_flag#56, customer_birth_country#57, customer_login#58, customer_email_address#59, year_total#88, year_total#114] -Input [13]: [customer_id#26, year_total#27, customer_id#53, customer_first_name#54, customer_last_name#55, customer_preferred_cust_flag#56, customer_birth_country#57, customer_login#58, customer_email_address#59, year_total#60, year_total#88, customer_id#113, year_total#114] +(78) Project [codegen id : 35] +Output [10]: [customer_id#26, customer_id#53, customer_first_name#54, customer_last_name#55, customer_preferred_cust_flag#56, customer_birth_country#57, customer_login#58, customer_email_address#59, year_total#86, year_total#112] +Input [13]: [customer_id#26, year_total#27, customer_id#53, customer_first_name#54, customer_last_name#55, customer_preferred_cust_flag#56, customer_birth_country#57, customer_login#58, customer_email_address#59, year_total#60, year_total#86, customer_id#111, year_total#112] -(80) Scan parquet default.web_sales -Output [6]: [ws_bill_customer_sk#116, ws_ext_discount_amt#117, ws_ext_sales_price#118, ws_ext_wholesale_cost#119, ws_ext_list_price#120, ws_sold_date_sk#121] +(79) Scan parquet default.web_sales +Output [6]: [ws_bill_customer_sk#114, ws_ext_discount_amt#115, ws_ext_sales_price#116, ws_ext_wholesale_cost#117, ws_ext_list_price#118, ws_sold_date_sk#119] Batched: true Location: InMemoryFileIndex [] -PartitionFilters: [isnotnull(ws_sold_date_sk#121), dynamicpruningexpression(ws_sold_date_sk#121 IN dynamicpruning#7)] +PartitionFilters: [isnotnull(ws_sold_date_sk#119), dynamicpruningexpression(ws_sold_date_sk#119 IN dynamicpruning#7)] PushedFilters: [IsNotNull(ws_bill_customer_sk)] ReadSchema: struct -(81) ColumnarToRow [codegen id : 37] -Input [6]: [ws_bill_customer_sk#116, ws_ext_discount_amt#117, ws_ext_sales_price#118, ws_ext_wholesale_cost#119, ws_ext_list_price#120, ws_sold_date_sk#121] +(80) ColumnarToRow [codegen id : 37] +Input [6]: [ws_bill_customer_sk#114, ws_ext_discount_amt#115, ws_ext_sales_price#116, ws_ext_wholesale_cost#117, ws_ext_list_price#118, ws_sold_date_sk#119] -(82) Filter [codegen id : 37] -Input [6]: [ws_bill_customer_sk#116, ws_ext_discount_amt#117, ws_ext_sales_price#118, ws_ext_wholesale_cost#119, ws_ext_list_price#120, ws_sold_date_sk#121] -Condition : isnotnull(ws_bill_customer_sk#116) +(81) Filter [codegen id : 37] +Input [6]: [ws_bill_customer_sk#114, ws_ext_discount_amt#115, ws_ext_sales_price#116, ws_ext_wholesale_cost#117, ws_ext_list_price#118, ws_sold_date_sk#119] +Condition : isnotnull(ws_bill_customer_sk#114) -(83) ReusedExchange [Reuses operator id: 124] -Output [2]: [d_date_sk#122, d_year#123] +(82) ReusedExchange [Reuses operator id: 122] +Output [2]: [d_date_sk#120, d_year#121] -(84) BroadcastHashJoin [codegen id : 37] -Left keys [1]: [ws_sold_date_sk#121] -Right keys [1]: [d_date_sk#122] +(83) BroadcastHashJoin [codegen id : 37] +Left keys [1]: [ws_sold_date_sk#119] +Right keys [1]: [d_date_sk#120] Join condition: None -(85) Project [codegen id : 37] -Output [6]: [ws_bill_customer_sk#116, ws_ext_discount_amt#117, ws_ext_sales_price#118, ws_ext_wholesale_cost#119, ws_ext_list_price#120, d_year#123] -Input [8]: [ws_bill_customer_sk#116, ws_ext_discount_amt#117, ws_ext_sales_price#118, ws_ext_wholesale_cost#119, ws_ext_list_price#120, ws_sold_date_sk#121, d_date_sk#122, d_year#123] +(84) Project [codegen id : 37] +Output [6]: [ws_bill_customer_sk#114, ws_ext_discount_amt#115, ws_ext_sales_price#116, ws_ext_wholesale_cost#117, ws_ext_list_price#118, d_year#121] +Input [8]: [ws_bill_customer_sk#114, ws_ext_discount_amt#115, ws_ext_sales_price#116, ws_ext_wholesale_cost#117, ws_ext_list_price#118, ws_sold_date_sk#119, d_date_sk#120, d_year#121] -(86) Exchange -Input [6]: [ws_bill_customer_sk#116, ws_ext_discount_amt#117, ws_ext_sales_price#118, ws_ext_wholesale_cost#119, ws_ext_list_price#120, d_year#123] -Arguments: hashpartitioning(ws_bill_customer_sk#116, 5), ENSURE_REQUIREMENTS, [id=#124] +(85) Exchange +Input [6]: [ws_bill_customer_sk#114, ws_ext_discount_amt#115, ws_ext_sales_price#116, ws_ext_wholesale_cost#117, ws_ext_list_price#118, d_year#121] +Arguments: hashpartitioning(ws_bill_customer_sk#114, 5), ENSURE_REQUIREMENTS, [id=#122] -(87) Sort [codegen id : 38] -Input [6]: [ws_bill_customer_sk#116, ws_ext_discount_amt#117, ws_ext_sales_price#118, ws_ext_wholesale_cost#119, ws_ext_list_price#120, d_year#123] -Arguments: [ws_bill_customer_sk#116 ASC NULLS FIRST], false, 0 +(86) Sort [codegen id : 38] +Input [6]: [ws_bill_customer_sk#114, ws_ext_discount_amt#115, ws_ext_sales_price#116, ws_ext_wholesale_cost#117, ws_ext_list_price#118, d_year#121] +Arguments: [ws_bill_customer_sk#114 ASC NULLS FIRST], false, 0 -(88) ReusedExchange [Reuses operator id: 12] -Output [8]: [c_customer_sk#125, c_customer_id#126, c_first_name#127, c_last_name#128, c_preferred_cust_flag#129, c_birth_country#130, c_login#131, c_email_address#132] +(87) ReusedExchange [Reuses operator id: 12] +Output [8]: [c_customer_sk#123, c_customer_id#124, c_first_name#125, c_last_name#126, c_preferred_cust_flag#127, c_birth_country#128, c_login#129, c_email_address#130] -(89) Sort [codegen id : 40] -Input [8]: [c_customer_sk#125, c_customer_id#126, c_first_name#127, c_last_name#128, c_preferred_cust_flag#129, c_birth_country#130, c_login#131, c_email_address#132] -Arguments: [c_customer_sk#125 ASC NULLS FIRST], false, 0 +(88) Sort [codegen id : 40] +Input [8]: [c_customer_sk#123, c_customer_id#124, c_first_name#125, c_last_name#126, c_preferred_cust_flag#127, c_birth_country#128, c_login#129, c_email_address#130] +Arguments: [c_customer_sk#123 ASC NULLS FIRST], false, 0 -(90) SortMergeJoin [codegen id : 41] -Left keys [1]: [ws_bill_customer_sk#116] -Right keys [1]: [c_customer_sk#125] +(89) SortMergeJoin [codegen id : 41] +Left keys [1]: [ws_bill_customer_sk#114] +Right keys [1]: [c_customer_sk#123] Join condition: None -(91) Project [codegen id : 41] -Output [12]: [c_customer_id#126, c_first_name#127, c_last_name#128, c_preferred_cust_flag#129, c_birth_country#130, c_login#131, c_email_address#132, ws_ext_discount_amt#117, ws_ext_sales_price#118, ws_ext_wholesale_cost#119, ws_ext_list_price#120, d_year#123] -Input [14]: [ws_bill_customer_sk#116, ws_ext_discount_amt#117, ws_ext_sales_price#118, ws_ext_wholesale_cost#119, ws_ext_list_price#120, d_year#123, c_customer_sk#125, c_customer_id#126, c_first_name#127, c_last_name#128, c_preferred_cust_flag#129, c_birth_country#130, c_login#131, c_email_address#132] - -(92) HashAggregate [codegen id : 41] -Input [12]: [c_customer_id#126, c_first_name#127, c_last_name#128, c_preferred_cust_flag#129, c_birth_country#130, c_login#131, c_email_address#132, ws_ext_discount_amt#117, ws_ext_sales_price#118, ws_ext_wholesale_cost#119, ws_ext_list_price#120, d_year#123] -Keys [8]: [c_customer_id#126, c_first_name#127, c_last_name#128, c_preferred_cust_flag#129, c_birth_country#130, c_login#131, c_email_address#132, d_year#123] -Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#120 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#119 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#117 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#118 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] -Aggregate Attributes [2]: [sum#133, isEmpty#134] -Results [10]: [c_customer_id#126, c_first_name#127, c_last_name#128, c_preferred_cust_flag#129, c_birth_country#130, c_login#131, c_email_address#132, d_year#123, sum#135, isEmpty#136] - -(93) Exchange -Input [10]: [c_customer_id#126, c_first_name#127, c_last_name#128, c_preferred_cust_flag#129, c_birth_country#130, c_login#131, c_email_address#132, d_year#123, sum#135, isEmpty#136] -Arguments: hashpartitioning(c_customer_id#126, c_first_name#127, c_last_name#128, c_preferred_cust_flag#129, c_birth_country#130, c_login#131, c_email_address#132, d_year#123, 5), ENSURE_REQUIREMENTS, [id=#137] - -(94) HashAggregate [codegen id : 42] -Input [10]: [c_customer_id#126, c_first_name#127, c_last_name#128, c_preferred_cust_flag#129, c_birth_country#130, c_login#131, c_email_address#132, d_year#123, sum#135, isEmpty#136] -Keys [8]: [c_customer_id#126, c_first_name#127, c_last_name#128, c_preferred_cust_flag#129, c_birth_country#130, c_login#131, c_email_address#132, d_year#123] -Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#120 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#119 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#117 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#118 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] -Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#120 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#119 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#117 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#118 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#138] -Results [2]: [c_customer_id#126 AS customer_id#139, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#120 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#119 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#117 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#118 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#138 AS year_total#140] - -(95) Filter [codegen id : 42] -Input [2]: [customer_id#139, year_total#140] -Condition : (isnotnull(year_total#140) AND (year_total#140 > 0.000000)) - -(96) Project [codegen id : 42] -Output [2]: [customer_id#139 AS customer_id#141, year_total#140 AS year_total#142] -Input [2]: [customer_id#139, year_total#140] - -(97) Exchange -Input [2]: [customer_id#141, year_total#142] -Arguments: hashpartitioning(customer_id#141, 5), ENSURE_REQUIREMENTS, [id=#143] - -(98) Sort [codegen id : 43] -Input [2]: [customer_id#141, year_total#142] -Arguments: [customer_id#141 ASC NULLS FIRST], false, 0 - -(99) SortMergeJoin [codegen id : 44] +(90) Project [codegen id : 41] +Output [12]: [c_customer_id#124, c_first_name#125, c_last_name#126, c_preferred_cust_flag#127, c_birth_country#128, c_login#129, c_email_address#130, ws_ext_discount_amt#115, ws_ext_sales_price#116, ws_ext_wholesale_cost#117, ws_ext_list_price#118, d_year#121] +Input [14]: [ws_bill_customer_sk#114, ws_ext_discount_amt#115, ws_ext_sales_price#116, ws_ext_wholesale_cost#117, ws_ext_list_price#118, d_year#121, c_customer_sk#123, c_customer_id#124, c_first_name#125, c_last_name#126, c_preferred_cust_flag#127, c_birth_country#128, c_login#129, c_email_address#130] + +(91) HashAggregate [codegen id : 41] +Input [12]: [c_customer_id#124, c_first_name#125, c_last_name#126, c_preferred_cust_flag#127, c_birth_country#128, c_login#129, c_email_address#130, ws_ext_discount_amt#115, ws_ext_sales_price#116, ws_ext_wholesale_cost#117, ws_ext_list_price#118, d_year#121] +Keys [8]: [c_customer_id#124, c_first_name#125, c_last_name#126, c_preferred_cust_flag#127, c_birth_country#128, c_login#129, c_email_address#130, d_year#121] +Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#118 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#117 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#115 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#116 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] +Aggregate Attributes [2]: [sum#131, isEmpty#132] +Results [10]: [c_customer_id#124, c_first_name#125, c_last_name#126, c_preferred_cust_flag#127, c_birth_country#128, c_login#129, c_email_address#130, d_year#121, sum#133, isEmpty#134] + +(92) Exchange +Input [10]: [c_customer_id#124, c_first_name#125, c_last_name#126, c_preferred_cust_flag#127, c_birth_country#128, c_login#129, c_email_address#130, d_year#121, sum#133, isEmpty#134] +Arguments: hashpartitioning(c_customer_id#124, c_first_name#125, c_last_name#126, c_preferred_cust_flag#127, c_birth_country#128, c_login#129, c_email_address#130, d_year#121, 5), ENSURE_REQUIREMENTS, [id=#135] + +(93) HashAggregate [codegen id : 42] +Input [10]: [c_customer_id#124, c_first_name#125, c_last_name#126, c_preferred_cust_flag#127, c_birth_country#128, c_login#129, c_email_address#130, d_year#121, sum#133, isEmpty#134] +Keys [8]: [c_customer_id#124, c_first_name#125, c_last_name#126, c_preferred_cust_flag#127, c_birth_country#128, c_login#129, c_email_address#130, d_year#121] +Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#118 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#117 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#115 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#116 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] +Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#118 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#117 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#115 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#116 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#136] +Results [2]: [c_customer_id#124 AS customer_id#137, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#118 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#117 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#115 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#116 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#136 AS year_total#138] + +(94) Filter [codegen id : 42] +Input [2]: [customer_id#137, year_total#138] +Condition : (isnotnull(year_total#138) AND (year_total#138 > 0.000000)) + +(95) Exchange +Input [2]: [customer_id#137, year_total#138] +Arguments: hashpartitioning(customer_id#137, 5), ENSURE_REQUIREMENTS, [id=#139] + +(96) Sort [codegen id : 43] +Input [2]: [customer_id#137, year_total#138] +Arguments: [customer_id#137 ASC NULLS FIRST], false, 0 + +(97) SortMergeJoin [codegen id : 44] Left keys [1]: [customer_id#26] -Right keys [1]: [customer_id#141] +Right keys [1]: [customer_id#137] Join condition: None -(100) Project [codegen id : 44] -Output [11]: [customer_id#26, customer_id#53, customer_first_name#54, customer_last_name#55, customer_preferred_cust_flag#56, customer_birth_country#57, customer_login#58, customer_email_address#59, year_total#88, year_total#114, year_total#142] -Input [12]: [customer_id#26, customer_id#53, customer_first_name#54, customer_last_name#55, customer_preferred_cust_flag#56, customer_birth_country#57, customer_login#58, customer_email_address#59, year_total#88, year_total#114, customer_id#141, year_total#142] +(98) Project [codegen id : 44] +Output [11]: [customer_id#26, customer_id#53, customer_first_name#54, customer_last_name#55, customer_preferred_cust_flag#56, customer_birth_country#57, customer_login#58, customer_email_address#59, year_total#86, year_total#112, year_total#138] +Input [12]: [customer_id#26, customer_id#53, customer_first_name#54, customer_last_name#55, customer_preferred_cust_flag#56, customer_birth_country#57, customer_login#58, customer_email_address#59, year_total#86, year_total#112, customer_id#137, year_total#138] -(101) Scan parquet default.web_sales -Output [6]: [ws_bill_customer_sk#144, ws_ext_discount_amt#145, ws_ext_sales_price#146, ws_ext_wholesale_cost#147, ws_ext_list_price#148, ws_sold_date_sk#149] +(99) Scan parquet default.web_sales +Output [6]: [ws_bill_customer_sk#140, ws_ext_discount_amt#141, ws_ext_sales_price#142, ws_ext_wholesale_cost#143, ws_ext_list_price#144, ws_sold_date_sk#145] Batched: true Location: InMemoryFileIndex [] -PartitionFilters: [isnotnull(ws_sold_date_sk#149), dynamicpruningexpression(ws_sold_date_sk#149 IN dynamicpruning#35)] +PartitionFilters: [isnotnull(ws_sold_date_sk#145), dynamicpruningexpression(ws_sold_date_sk#145 IN dynamicpruning#35)] PushedFilters: [IsNotNull(ws_bill_customer_sk)] ReadSchema: struct -(102) ColumnarToRow [codegen id : 46] -Input [6]: [ws_bill_customer_sk#144, ws_ext_discount_amt#145, ws_ext_sales_price#146, ws_ext_wholesale_cost#147, ws_ext_list_price#148, ws_sold_date_sk#149] +(100) ColumnarToRow [codegen id : 46] +Input [6]: [ws_bill_customer_sk#140, ws_ext_discount_amt#141, ws_ext_sales_price#142, ws_ext_wholesale_cost#143, ws_ext_list_price#144, ws_sold_date_sk#145] -(103) Filter [codegen id : 46] -Input [6]: [ws_bill_customer_sk#144, ws_ext_discount_amt#145, ws_ext_sales_price#146, ws_ext_wholesale_cost#147, ws_ext_list_price#148, ws_sold_date_sk#149] -Condition : isnotnull(ws_bill_customer_sk#144) +(101) Filter [codegen id : 46] +Input [6]: [ws_bill_customer_sk#140, ws_ext_discount_amt#141, ws_ext_sales_price#142, ws_ext_wholesale_cost#143, ws_ext_list_price#144, ws_sold_date_sk#145] +Condition : isnotnull(ws_bill_customer_sk#140) -(104) ReusedExchange [Reuses operator id: 128] -Output [2]: [d_date_sk#150, d_year#151] +(102) ReusedExchange [Reuses operator id: 126] +Output [2]: [d_date_sk#146, d_year#147] -(105) BroadcastHashJoin [codegen id : 46] -Left keys [1]: [ws_sold_date_sk#149] -Right keys [1]: [d_date_sk#150] +(103) BroadcastHashJoin [codegen id : 46] +Left keys [1]: [ws_sold_date_sk#145] +Right keys [1]: [d_date_sk#146] Join condition: None -(106) Project [codegen id : 46] -Output [6]: [ws_bill_customer_sk#144, ws_ext_discount_amt#145, ws_ext_sales_price#146, ws_ext_wholesale_cost#147, ws_ext_list_price#148, d_year#151] -Input [8]: [ws_bill_customer_sk#144, ws_ext_discount_amt#145, ws_ext_sales_price#146, ws_ext_wholesale_cost#147, ws_ext_list_price#148, ws_sold_date_sk#149, d_date_sk#150, d_year#151] +(104) Project [codegen id : 46] +Output [6]: [ws_bill_customer_sk#140, ws_ext_discount_amt#141, ws_ext_sales_price#142, ws_ext_wholesale_cost#143, ws_ext_list_price#144, d_year#147] +Input [8]: [ws_bill_customer_sk#140, ws_ext_discount_amt#141, ws_ext_sales_price#142, ws_ext_wholesale_cost#143, ws_ext_list_price#144, ws_sold_date_sk#145, d_date_sk#146, d_year#147] -(107) Exchange -Input [6]: [ws_bill_customer_sk#144, ws_ext_discount_amt#145, ws_ext_sales_price#146, ws_ext_wholesale_cost#147, ws_ext_list_price#148, d_year#151] -Arguments: hashpartitioning(ws_bill_customer_sk#144, 5), ENSURE_REQUIREMENTS, [id=#152] +(105) Exchange +Input [6]: [ws_bill_customer_sk#140, ws_ext_discount_amt#141, ws_ext_sales_price#142, ws_ext_wholesale_cost#143, ws_ext_list_price#144, d_year#147] +Arguments: hashpartitioning(ws_bill_customer_sk#140, 5), ENSURE_REQUIREMENTS, [id=#148] -(108) Sort [codegen id : 47] -Input [6]: [ws_bill_customer_sk#144, ws_ext_discount_amt#145, ws_ext_sales_price#146, ws_ext_wholesale_cost#147, ws_ext_list_price#148, d_year#151] -Arguments: [ws_bill_customer_sk#144 ASC NULLS FIRST], false, 0 +(106) Sort [codegen id : 47] +Input [6]: [ws_bill_customer_sk#140, ws_ext_discount_amt#141, ws_ext_sales_price#142, ws_ext_wholesale_cost#143, ws_ext_list_price#144, d_year#147] +Arguments: [ws_bill_customer_sk#140 ASC NULLS FIRST], false, 0 -(109) ReusedExchange [Reuses operator id: 12] -Output [8]: [c_customer_sk#153, c_customer_id#154, c_first_name#155, c_last_name#156, c_preferred_cust_flag#157, c_birth_country#158, c_login#159, c_email_address#160] +(107) ReusedExchange [Reuses operator id: 12] +Output [8]: [c_customer_sk#149, c_customer_id#150, c_first_name#151, c_last_name#152, c_preferred_cust_flag#153, c_birth_country#154, c_login#155, c_email_address#156] -(110) Sort [codegen id : 49] -Input [8]: [c_customer_sk#153, c_customer_id#154, c_first_name#155, c_last_name#156, c_preferred_cust_flag#157, c_birth_country#158, c_login#159, c_email_address#160] -Arguments: [c_customer_sk#153 ASC NULLS FIRST], false, 0 +(108) Sort [codegen id : 49] +Input [8]: [c_customer_sk#149, c_customer_id#150, c_first_name#151, c_last_name#152, c_preferred_cust_flag#153, c_birth_country#154, c_login#155, c_email_address#156] +Arguments: [c_customer_sk#149 ASC NULLS FIRST], false, 0 -(111) SortMergeJoin [codegen id : 50] -Left keys [1]: [ws_bill_customer_sk#144] -Right keys [1]: [c_customer_sk#153] +(109) SortMergeJoin [codegen id : 50] +Left keys [1]: [ws_bill_customer_sk#140] +Right keys [1]: [c_customer_sk#149] Join condition: None -(112) Project [codegen id : 50] -Output [12]: [c_customer_id#154, c_first_name#155, c_last_name#156, c_preferred_cust_flag#157, c_birth_country#158, c_login#159, c_email_address#160, ws_ext_discount_amt#145, ws_ext_sales_price#146, ws_ext_wholesale_cost#147, ws_ext_list_price#148, d_year#151] -Input [14]: [ws_bill_customer_sk#144, ws_ext_discount_amt#145, ws_ext_sales_price#146, ws_ext_wholesale_cost#147, ws_ext_list_price#148, d_year#151, c_customer_sk#153, c_customer_id#154, c_first_name#155, c_last_name#156, c_preferred_cust_flag#157, c_birth_country#158, c_login#159, c_email_address#160] +(110) Project [codegen id : 50] +Output [12]: [c_customer_id#150, c_first_name#151, c_last_name#152, c_preferred_cust_flag#153, c_birth_country#154, c_login#155, c_email_address#156, ws_ext_discount_amt#141, ws_ext_sales_price#142, ws_ext_wholesale_cost#143, ws_ext_list_price#144, d_year#147] +Input [14]: [ws_bill_customer_sk#140, ws_ext_discount_amt#141, ws_ext_sales_price#142, ws_ext_wholesale_cost#143, ws_ext_list_price#144, d_year#147, c_customer_sk#149, c_customer_id#150, c_first_name#151, c_last_name#152, c_preferred_cust_flag#153, c_birth_country#154, c_login#155, c_email_address#156] -(113) HashAggregate [codegen id : 50] -Input [12]: [c_customer_id#154, c_first_name#155, c_last_name#156, c_preferred_cust_flag#157, c_birth_country#158, c_login#159, c_email_address#160, ws_ext_discount_amt#145, ws_ext_sales_price#146, ws_ext_wholesale_cost#147, ws_ext_list_price#148, d_year#151] -Keys [8]: [c_customer_id#154, c_first_name#155, c_last_name#156, c_preferred_cust_flag#157, c_birth_country#158, c_login#159, c_email_address#160, d_year#151] -Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#148 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#147 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#145 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#146 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] -Aggregate Attributes [2]: [sum#161, isEmpty#162] -Results [10]: [c_customer_id#154, c_first_name#155, c_last_name#156, c_preferred_cust_flag#157, c_birth_country#158, c_login#159, c_email_address#160, d_year#151, sum#163, isEmpty#164] +(111) HashAggregate [codegen id : 50] +Input [12]: [c_customer_id#150, c_first_name#151, c_last_name#152, c_preferred_cust_flag#153, c_birth_country#154, c_login#155, c_email_address#156, ws_ext_discount_amt#141, ws_ext_sales_price#142, ws_ext_wholesale_cost#143, ws_ext_list_price#144, d_year#147] +Keys [8]: [c_customer_id#150, c_first_name#151, c_last_name#152, c_preferred_cust_flag#153, c_birth_country#154, c_login#155, c_email_address#156, d_year#147] +Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#144 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#143 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#141 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#142 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] +Aggregate Attributes [2]: [sum#157, isEmpty#158] +Results [10]: [c_customer_id#150, c_first_name#151, c_last_name#152, c_preferred_cust_flag#153, c_birth_country#154, c_login#155, c_email_address#156, d_year#147, sum#159, isEmpty#160] -(114) Exchange -Input [10]: [c_customer_id#154, c_first_name#155, c_last_name#156, c_preferred_cust_flag#157, c_birth_country#158, c_login#159, c_email_address#160, d_year#151, sum#163, isEmpty#164] -Arguments: hashpartitioning(c_customer_id#154, c_first_name#155, c_last_name#156, c_preferred_cust_flag#157, c_birth_country#158, c_login#159, c_email_address#160, d_year#151, 5), ENSURE_REQUIREMENTS, [id=#165] +(112) Exchange +Input [10]: [c_customer_id#150, c_first_name#151, c_last_name#152, c_preferred_cust_flag#153, c_birth_country#154, c_login#155, c_email_address#156, d_year#147, sum#159, isEmpty#160] +Arguments: hashpartitioning(c_customer_id#150, c_first_name#151, c_last_name#152, c_preferred_cust_flag#153, c_birth_country#154, c_login#155, c_email_address#156, d_year#147, 5), ENSURE_REQUIREMENTS, [id=#161] -(115) HashAggregate [codegen id : 51] -Input [10]: [c_customer_id#154, c_first_name#155, c_last_name#156, c_preferred_cust_flag#157, c_birth_country#158, c_login#159, c_email_address#160, d_year#151, sum#163, isEmpty#164] -Keys [8]: [c_customer_id#154, c_first_name#155, c_last_name#156, c_preferred_cust_flag#157, c_birth_country#158, c_login#159, c_email_address#160, d_year#151] -Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#148 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#147 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#145 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#146 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] -Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#148 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#147 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#145 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#146 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#166] -Results [2]: [c_customer_id#154 AS customer_id#167, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#148 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#147 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#145 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#146 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#166 AS year_total#168] +(113) HashAggregate [codegen id : 51] +Input [10]: [c_customer_id#150, c_first_name#151, c_last_name#152, c_preferred_cust_flag#153, c_birth_country#154, c_login#155, c_email_address#156, d_year#147, sum#159, isEmpty#160] +Keys [8]: [c_customer_id#150, c_first_name#151, c_last_name#152, c_preferred_cust_flag#153, c_birth_country#154, c_login#155, c_email_address#156, d_year#147] +Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#144 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#143 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#141 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#142 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] +Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#144 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#143 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#141 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#142 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#162] +Results [2]: [c_customer_id#150 AS customer_id#163, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#144 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#143 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#141 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#142 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#162 AS year_total#164] -(116) Exchange -Input [2]: [customer_id#167, year_total#168] -Arguments: hashpartitioning(customer_id#167, 5), ENSURE_REQUIREMENTS, [id=#169] +(114) Exchange +Input [2]: [customer_id#163, year_total#164] +Arguments: hashpartitioning(customer_id#163, 5), ENSURE_REQUIREMENTS, [id=#165] -(117) Sort [codegen id : 52] -Input [2]: [customer_id#167, year_total#168] -Arguments: [customer_id#167 ASC NULLS FIRST], false, 0 +(115) Sort [codegen id : 52] +Input [2]: [customer_id#163, year_total#164] +Arguments: [customer_id#163 ASC NULLS FIRST], false, 0 -(118) SortMergeJoin [codegen id : 53] +(116) SortMergeJoin [codegen id : 53] Left keys [1]: [customer_id#26] -Right keys [1]: [customer_id#167] -Join condition: (CASE WHEN (year_total#88 > 0.000000) THEN CheckOverflow((promote_precision(year_total#114) / promote_precision(year_total#88)), DecimalType(38,14), true) ELSE null END > CASE WHEN (year_total#142 > 0.000000) THEN CheckOverflow((promote_precision(year_total#168) / promote_precision(year_total#142)), DecimalType(38,14), true) ELSE null END) +Right keys [1]: [customer_id#163] +Join condition: (CASE WHEN (year_total#86 > 0.000000) THEN CheckOverflow((promote_precision(year_total#112) / promote_precision(year_total#86)), DecimalType(38,14), true) ELSE null END > CASE WHEN (year_total#138 > 0.000000) THEN CheckOverflow((promote_precision(year_total#164) / promote_precision(year_total#138)), DecimalType(38,14), true) ELSE null END) -(119) Project [codegen id : 53] +(117) Project [codegen id : 53] Output [7]: [customer_id#53, customer_first_name#54, customer_last_name#55, customer_preferred_cust_flag#56, customer_birth_country#57, customer_login#58, customer_email_address#59] -Input [13]: [customer_id#26, customer_id#53, customer_first_name#54, customer_last_name#55, customer_preferred_cust_flag#56, customer_birth_country#57, customer_login#58, customer_email_address#59, year_total#88, year_total#114, year_total#142, customer_id#167, year_total#168] +Input [13]: [customer_id#26, customer_id#53, customer_first_name#54, customer_last_name#55, customer_preferred_cust_flag#56, customer_birth_country#57, customer_login#58, customer_email_address#59, year_total#86, year_total#112, year_total#138, customer_id#163, year_total#164] -(120) TakeOrderedAndProject +(118) TakeOrderedAndProject Input [7]: [customer_id#53, customer_first_name#54, customer_last_name#55, customer_preferred_cust_flag#56, customer_birth_country#57, customer_login#58, customer_email_address#59] Arguments: 100, [customer_id#53 ASC NULLS FIRST, customer_first_name#54 ASC NULLS FIRST, customer_last_name#55 ASC NULLS FIRST, customer_preferred_cust_flag#56 ASC NULLS FIRST, customer_birth_country#57 ASC NULLS FIRST, customer_login#58 ASC NULLS FIRST, customer_email_address#59 ASC NULLS FIRST], [customer_id#53, customer_first_name#54, customer_last_name#55, customer_preferred_cust_flag#56, customer_birth_country#57, customer_login#58, customer_email_address#59] ===== Subqueries ===== Subquery:1 Hosting operator id = 1 Hosting Expression = ss_sold_date_sk#6 IN dynamicpruning#7 -BroadcastExchange (124) -+- * Filter (123) - +- * ColumnarToRow (122) - +- Scan parquet default.date_dim (121) +BroadcastExchange (122) ++- * Filter (121) + +- * ColumnarToRow (120) + +- Scan parquet default.date_dim (119) -(121) Scan parquet default.date_dim +(119) Scan parquet default.date_dim Output [2]: [d_date_sk#8, d_year#9] Batched: true Location [not included in comparison]/{warehouse_dir}/date_dim] PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2001), IsNotNull(d_date_sk)] ReadSchema: struct -(122) ColumnarToRow [codegen id : 1] +(120) ColumnarToRow [codegen id : 1] Input [2]: [d_date_sk#8, d_year#9] -(123) Filter [codegen id : 1] +(121) Filter [codegen id : 1] Input [2]: [d_date_sk#8, d_year#9] Condition : ((isnotnull(d_year#9) AND (d_year#9 = 2001)) AND isnotnull(d_date_sk#8)) -(124) BroadcastExchange +(122) BroadcastExchange Input [2]: [d_date_sk#8, d_year#9] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#170] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#166] Subquery:2 Hosting operator id = 22 Hosting Expression = ss_sold_date_sk#34 IN dynamicpruning#35 -BroadcastExchange (128) -+- * Filter (127) - +- * ColumnarToRow (126) - +- Scan parquet default.date_dim (125) +BroadcastExchange (126) ++- * Filter (125) + +- * ColumnarToRow (124) + +- Scan parquet default.date_dim (123) -(125) Scan parquet default.date_dim +(123) Scan parquet default.date_dim Output [2]: [d_date_sk#36, d_year#37] Batched: true Location [not included in comparison]/{warehouse_dir}/date_dim] PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2002), IsNotNull(d_date_sk)] ReadSchema: struct -(126) ColumnarToRow [codegen id : 1] +(124) ColumnarToRow [codegen id : 1] Input [2]: [d_date_sk#36, d_year#37] -(127) Filter [codegen id : 1] +(125) Filter [codegen id : 1] Input [2]: [d_date_sk#36, d_year#37] Condition : ((isnotnull(d_year#37) AND (d_year#37 = 2002)) AND isnotnull(d_date_sk#36)) -(128) BroadcastExchange +(126) BroadcastExchange Input [2]: [d_date_sk#36, d_year#37] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#171] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#167] Subquery:3 Hosting operator id = 40 Hosting Expression = cs_sold_date_sk#67 IN dynamicpruning#7 -Subquery:4 Hosting operator id = 61 Hosting Expression = cs_sold_date_sk#95 IN dynamicpruning#35 +Subquery:4 Hosting operator id = 60 Hosting Expression = cs_sold_date_sk#93 IN dynamicpruning#35 -Subquery:5 Hosting operator id = 80 Hosting Expression = ws_sold_date_sk#121 IN dynamicpruning#7 +Subquery:5 Hosting operator id = 79 Hosting Expression = ws_sold_date_sk#119 IN dynamicpruning#7 -Subquery:6 Hosting operator id = 101 Hosting Expression = ws_sold_date_sk#149 IN dynamicpruning#35 +Subquery:6 Hosting operator id = 99 Hosting Expression = ws_sold_date_sk#145 IN dynamicpruning#35 diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q4.sf100/simplified.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q4.sf100/simplified.txt index d7e0a660bab5b..cb2e3432e4ab2 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q4.sf100/simplified.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q4.sf100/simplified.txt @@ -107,35 +107,34 @@ TakeOrderedAndProject [customer_id,customer_first_name,customer_last_name,custom InputAdapter Exchange [customer_id] #10 WholeStageCodegen (24) - Project [customer_id,year_total] - Filter [year_total] - HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum,isEmpty] [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true)),customer_id,year_total,sum,isEmpty] - InputAdapter - Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #11 - WholeStageCodegen (23) - HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,cs_ext_list_price,cs_ext_wholesale_cost,cs_ext_discount_amt,cs_ext_sales_price] [sum,isEmpty,sum,isEmpty] - Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,cs_ext_discount_amt,cs_ext_sales_price,cs_ext_wholesale_cost,cs_ext_list_price,d_year] - SortMergeJoin [cs_bill_customer_sk,c_customer_sk] - InputAdapter - WholeStageCodegen (20) - Sort [cs_bill_customer_sk] - InputAdapter - Exchange [cs_bill_customer_sk] #12 - WholeStageCodegen (19) - Project [cs_bill_customer_sk,cs_ext_discount_amt,cs_ext_sales_price,cs_ext_wholesale_cost,cs_ext_list_price,d_year] - BroadcastHashJoin [cs_sold_date_sk,d_date_sk] - Filter [cs_bill_customer_sk] - ColumnarToRow - InputAdapter - Scan parquet default.catalog_sales [cs_bill_customer_sk,cs_ext_discount_amt,cs_ext_sales_price,cs_ext_wholesale_cost,cs_ext_list_price,cs_sold_date_sk] - ReusedSubquery [d_date_sk] #1 - InputAdapter - ReusedExchange [d_date_sk,d_year] #4 - InputAdapter - WholeStageCodegen (22) - Sort [c_customer_sk] - InputAdapter - ReusedExchange [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] #5 + Filter [year_total] + HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum,isEmpty] [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true)),customer_id,year_total,sum,isEmpty] + InputAdapter + Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #11 + WholeStageCodegen (23) + HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,cs_ext_list_price,cs_ext_wholesale_cost,cs_ext_discount_amt,cs_ext_sales_price] [sum,isEmpty,sum,isEmpty] + Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,cs_ext_discount_amt,cs_ext_sales_price,cs_ext_wholesale_cost,cs_ext_list_price,d_year] + SortMergeJoin [cs_bill_customer_sk,c_customer_sk] + InputAdapter + WholeStageCodegen (20) + Sort [cs_bill_customer_sk] + InputAdapter + Exchange [cs_bill_customer_sk] #12 + WholeStageCodegen (19) + Project [cs_bill_customer_sk,cs_ext_discount_amt,cs_ext_sales_price,cs_ext_wholesale_cost,cs_ext_list_price,d_year] + BroadcastHashJoin [cs_sold_date_sk,d_date_sk] + Filter [cs_bill_customer_sk] + ColumnarToRow + InputAdapter + Scan parquet default.catalog_sales [cs_bill_customer_sk,cs_ext_discount_amt,cs_ext_sales_price,cs_ext_wholesale_cost,cs_ext_list_price,cs_sold_date_sk] + ReusedSubquery [d_date_sk] #1 + InputAdapter + ReusedExchange [d_date_sk,d_year] #4 + InputAdapter + WholeStageCodegen (22) + Sort [c_customer_sk] + InputAdapter + ReusedExchange [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] #5 InputAdapter WholeStageCodegen (34) Sort [customer_id] @@ -175,35 +174,34 @@ TakeOrderedAndProject [customer_id,customer_first_name,customer_last_name,custom InputAdapter Exchange [customer_id] #16 WholeStageCodegen (42) - Project [customer_id,year_total] - Filter [year_total] - HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum,isEmpty] [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true)),customer_id,year_total,sum,isEmpty] - InputAdapter - Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #17 - WholeStageCodegen (41) - HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,ws_ext_list_price,ws_ext_wholesale_cost,ws_ext_discount_amt,ws_ext_sales_price] [sum,isEmpty,sum,isEmpty] - Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ws_ext_discount_amt,ws_ext_sales_price,ws_ext_wholesale_cost,ws_ext_list_price,d_year] - SortMergeJoin [ws_bill_customer_sk,c_customer_sk] - InputAdapter - WholeStageCodegen (38) - Sort [ws_bill_customer_sk] - InputAdapter - Exchange [ws_bill_customer_sk] #18 - WholeStageCodegen (37) - Project [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_sales_price,ws_ext_wholesale_cost,ws_ext_list_price,d_year] - BroadcastHashJoin [ws_sold_date_sk,d_date_sk] - Filter [ws_bill_customer_sk] - ColumnarToRow - InputAdapter - Scan parquet default.web_sales [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_sales_price,ws_ext_wholesale_cost,ws_ext_list_price,ws_sold_date_sk] - ReusedSubquery [d_date_sk] #1 - InputAdapter - ReusedExchange [d_date_sk,d_year] #4 - InputAdapter - WholeStageCodegen (40) - Sort [c_customer_sk] - InputAdapter - ReusedExchange [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] #5 + Filter [year_total] + HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum,isEmpty] [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true)),customer_id,year_total,sum,isEmpty] + InputAdapter + Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #17 + WholeStageCodegen (41) + HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,ws_ext_list_price,ws_ext_wholesale_cost,ws_ext_discount_amt,ws_ext_sales_price] [sum,isEmpty,sum,isEmpty] + Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ws_ext_discount_amt,ws_ext_sales_price,ws_ext_wholesale_cost,ws_ext_list_price,d_year] + SortMergeJoin [ws_bill_customer_sk,c_customer_sk] + InputAdapter + WholeStageCodegen (38) + Sort [ws_bill_customer_sk] + InputAdapter + Exchange [ws_bill_customer_sk] #18 + WholeStageCodegen (37) + Project [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_sales_price,ws_ext_wholesale_cost,ws_ext_list_price,d_year] + BroadcastHashJoin [ws_sold_date_sk,d_date_sk] + Filter [ws_bill_customer_sk] + ColumnarToRow + InputAdapter + Scan parquet default.web_sales [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_sales_price,ws_ext_wholesale_cost,ws_ext_list_price,ws_sold_date_sk] + ReusedSubquery [d_date_sk] #1 + InputAdapter + ReusedExchange [d_date_sk,d_year] #4 + InputAdapter + WholeStageCodegen (40) + Sort [c_customer_sk] + InputAdapter + ReusedExchange [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] #5 InputAdapter WholeStageCodegen (52) Sort [customer_id] diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q4/explain.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q4/explain.txt index d6b8e5110ca95..b95940f0c6292 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q4/explain.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q4/explain.txt @@ -1,13 +1,13 @@ == Physical Plan == -TakeOrderedAndProject (110) -+- * Project (109) - +- * BroadcastHashJoin Inner BuildRight (108) - :- * Project (91) - : +- * BroadcastHashJoin Inner BuildRight (90) - : :- * Project (71) - : : +- * BroadcastHashJoin Inner BuildRight (70) - : : :- * Project (53) - : : : +- * BroadcastHashJoin Inner BuildRight (52) +TakeOrderedAndProject (108) ++- * Project (107) + +- * BroadcastHashJoin Inner BuildRight (106) + :- * Project (89) + : +- * BroadcastHashJoin Inner BuildRight (88) + : :- * Project (70) + : : +- * BroadcastHashJoin Inner BuildRight (69) + : : :- * Project (52) + : : : +- * BroadcastHashJoin Inner BuildRight (51) : : : :- * BroadcastHashJoin Inner BuildRight (33) : : : : :- * Filter (16) : : : : : +- * HashAggregate (15) @@ -41,74 +41,72 @@ TakeOrderedAndProject (110) : : : : : +- * ColumnarToRow (21) : : : : : +- Scan parquet default.store_sales (20) : : : : +- ReusedExchange (26) - : : : +- BroadcastExchange (51) - : : : +- * Project (50) - : : : +- * Filter (49) - : : : +- * HashAggregate (48) - : : : +- Exchange (47) - : : : +- * HashAggregate (46) - : : : +- * Project (45) - : : : +- * BroadcastHashJoin Inner BuildRight (44) - : : : :- * Project (42) - : : : : +- * BroadcastHashJoin Inner BuildRight (41) - : : : : :- * Filter (36) - : : : : : +- * ColumnarToRow (35) - : : : : : +- Scan parquet default.customer (34) - : : : : +- BroadcastExchange (40) - : : : : +- * Filter (39) - : : : : +- * ColumnarToRow (38) - : : : : +- Scan parquet default.catalog_sales (37) - : : : +- ReusedExchange (43) - : : +- BroadcastExchange (69) - : : +- * HashAggregate (68) - : : +- Exchange (67) - : : +- * HashAggregate (66) - : : +- * Project (65) - : : +- * BroadcastHashJoin Inner BuildRight (64) - : : :- * Project (62) - : : : +- * BroadcastHashJoin Inner BuildRight (61) - : : : :- * Filter (56) - : : : : +- * ColumnarToRow (55) - : : : : +- Scan parquet default.customer (54) - : : : +- BroadcastExchange (60) - : : : +- * Filter (59) - : : : +- * ColumnarToRow (58) - : : : +- Scan parquet default.catalog_sales (57) - : : +- ReusedExchange (63) - : +- BroadcastExchange (89) - : +- * Project (88) - : +- * Filter (87) - : +- * HashAggregate (86) - : +- Exchange (85) - : +- * HashAggregate (84) - : +- * Project (83) - : +- * BroadcastHashJoin Inner BuildRight (82) - : :- * Project (80) - : : +- * BroadcastHashJoin Inner BuildRight (79) - : : :- * Filter (74) - : : : +- * ColumnarToRow (73) - : : : +- Scan parquet default.customer (72) - : : +- BroadcastExchange (78) - : : +- * Filter (77) - : : +- * ColumnarToRow (76) - : : +- Scan parquet default.web_sales (75) - : +- ReusedExchange (81) - +- BroadcastExchange (107) - +- * HashAggregate (106) - +- Exchange (105) - +- * HashAggregate (104) - +- * Project (103) - +- * BroadcastHashJoin Inner BuildRight (102) - :- * Project (100) - : +- * BroadcastHashJoin Inner BuildRight (99) - : :- * Filter (94) - : : +- * ColumnarToRow (93) - : : +- Scan parquet default.customer (92) - : +- BroadcastExchange (98) - : +- * Filter (97) - : +- * ColumnarToRow (96) - : +- Scan parquet default.web_sales (95) - +- ReusedExchange (101) + : : : +- BroadcastExchange (50) + : : : +- * Filter (49) + : : : +- * HashAggregate (48) + : : : +- Exchange (47) + : : : +- * HashAggregate (46) + : : : +- * Project (45) + : : : +- * BroadcastHashJoin Inner BuildRight (44) + : : : :- * Project (42) + : : : : +- * BroadcastHashJoin Inner BuildRight (41) + : : : : :- * Filter (36) + : : : : : +- * ColumnarToRow (35) + : : : : : +- Scan parquet default.customer (34) + : : : : +- BroadcastExchange (40) + : : : : +- * Filter (39) + : : : : +- * ColumnarToRow (38) + : : : : +- Scan parquet default.catalog_sales (37) + : : : +- ReusedExchange (43) + : : +- BroadcastExchange (68) + : : +- * HashAggregate (67) + : : +- Exchange (66) + : : +- * HashAggregate (65) + : : +- * Project (64) + : : +- * BroadcastHashJoin Inner BuildRight (63) + : : :- * Project (61) + : : : +- * BroadcastHashJoin Inner BuildRight (60) + : : : :- * Filter (55) + : : : : +- * ColumnarToRow (54) + : : : : +- Scan parquet default.customer (53) + : : : +- BroadcastExchange (59) + : : : +- * Filter (58) + : : : +- * ColumnarToRow (57) + : : : +- Scan parquet default.catalog_sales (56) + : : +- ReusedExchange (62) + : +- BroadcastExchange (87) + : +- * Filter (86) + : +- * HashAggregate (85) + : +- Exchange (84) + : +- * HashAggregate (83) + : +- * Project (82) + : +- * BroadcastHashJoin Inner BuildRight (81) + : :- * Project (79) + : : +- * BroadcastHashJoin Inner BuildRight (78) + : : :- * Filter (73) + : : : +- * ColumnarToRow (72) + : : : +- Scan parquet default.customer (71) + : : +- BroadcastExchange (77) + : : +- * Filter (76) + : : +- * ColumnarToRow (75) + : : +- Scan parquet default.web_sales (74) + : +- ReusedExchange (80) + +- BroadcastExchange (105) + +- * HashAggregate (104) + +- Exchange (103) + +- * HashAggregate (102) + +- * Project (101) + +- * BroadcastHashJoin Inner BuildRight (100) + :- * Project (98) + : +- * BroadcastHashJoin Inner BuildRight (97) + : :- * Filter (92) + : : +- * ColumnarToRow (91) + : : +- Scan parquet default.customer (90) + : +- BroadcastExchange (96) + : +- * Filter (95) + : +- * ColumnarToRow (94) + : +- Scan parquet default.web_sales (93) + +- ReusedExchange (99) (1) Scan parquet default.customer @@ -153,7 +151,7 @@ Join condition: None Output [12]: [c_customer_id#2, c_first_name#3, c_last_name#4, c_preferred_cust_flag#5, c_birth_country#6, c_login#7, c_email_address#8, ss_ext_discount_amt#10, ss_ext_sales_price#11, ss_ext_wholesale_cost#12, ss_ext_list_price#13, ss_sold_date_sk#14] Input [14]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4, c_preferred_cust_flag#5, c_birth_country#6, c_login#7, c_email_address#8, ss_customer_sk#9, ss_ext_discount_amt#10, ss_ext_sales_price#11, ss_ext_wholesale_cost#12, ss_ext_list_price#13, ss_sold_date_sk#14] -(10) ReusedExchange [Reuses operator id: 114] +(10) ReusedExchange [Reuses operator id: 112] Output [2]: [d_date_sk#17, d_year#18] (11) BroadcastHashJoin [codegen id : 3] @@ -229,7 +227,7 @@ Join condition: None Output [12]: [c_customer_id#28, c_first_name#29, c_last_name#30, c_preferred_cust_flag#31, c_birth_country#32, c_login#33, c_email_address#34, ss_ext_discount_amt#36, ss_ext_sales_price#37, ss_ext_wholesale_cost#38, ss_ext_list_price#39, ss_sold_date_sk#40] Input [14]: [c_customer_sk#27, c_customer_id#28, c_first_name#29, c_last_name#30, c_preferred_cust_flag#31, c_birth_country#32, c_login#33, c_email_address#34, ss_customer_sk#35, ss_ext_discount_amt#36, ss_ext_sales_price#37, ss_ext_wholesale_cost#38, ss_ext_list_price#39, ss_sold_date_sk#40] -(26) ReusedExchange [Reuses operator id: 118] +(26) ReusedExchange [Reuses operator id: 116] Output [2]: [d_date_sk#43, d_year#44] (27) BroadcastHashJoin [codegen id : 6] @@ -310,7 +308,7 @@ Join condition: None Output [12]: [c_customer_id#61, c_first_name#62, c_last_name#63, c_preferred_cust_flag#64, c_birth_country#65, c_login#66, c_email_address#67, cs_ext_discount_amt#69, cs_ext_sales_price#70, cs_ext_wholesale_cost#71, cs_ext_list_price#72, cs_sold_date_sk#73] Input [14]: [c_customer_sk#60, c_customer_id#61, c_first_name#62, c_last_name#63, c_preferred_cust_flag#64, c_birth_country#65, c_login#66, c_email_address#67, cs_bill_customer_sk#68, cs_ext_discount_amt#69, cs_ext_sales_price#70, cs_ext_wholesale_cost#71, cs_ext_list_price#72, cs_sold_date_sk#73] -(43) ReusedExchange [Reuses operator id: 114] +(43) ReusedExchange [Reuses operator id: 112] Output [2]: [d_date_sk#75, d_year#76] (44) BroadcastHashJoin [codegen id : 10] @@ -344,348 +342,340 @@ Results [2]: [c_customer_id#61 AS customer_id#83, sum(CheckOverflow((promote_pre Input [2]: [customer_id#83, year_total#84] Condition : (isnotnull(year_total#84) AND (year_total#84 > 0.000000)) -(50) Project [codegen id : 11] -Output [2]: [customer_id#83 AS customer_id#85, year_total#84 AS year_total#86] +(50) BroadcastExchange Input [2]: [customer_id#83, year_total#84] +Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#85] -(51) BroadcastExchange -Input [2]: [customer_id#85, year_total#86] -Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#87] - -(52) BroadcastHashJoin [codegen id : 24] +(51) BroadcastHashJoin [codegen id : 24] Left keys [1]: [customer_id#25] -Right keys [1]: [customer_id#85] +Right keys [1]: [customer_id#83] Join condition: None -(53) Project [codegen id : 24] -Output [11]: [customer_id#25, year_total#26, customer_id#51, customer_first_name#52, customer_last_name#53, customer_preferred_cust_flag#54, customer_birth_country#55, customer_login#56, customer_email_address#57, year_total#58, year_total#86] -Input [12]: [customer_id#25, year_total#26, customer_id#51, customer_first_name#52, customer_last_name#53, customer_preferred_cust_flag#54, customer_birth_country#55, customer_login#56, customer_email_address#57, year_total#58, customer_id#85, year_total#86] +(52) Project [codegen id : 24] +Output [11]: [customer_id#25, year_total#26, customer_id#51, customer_first_name#52, customer_last_name#53, customer_preferred_cust_flag#54, customer_birth_country#55, customer_login#56, customer_email_address#57, year_total#58, year_total#84] +Input [12]: [customer_id#25, year_total#26, customer_id#51, customer_first_name#52, customer_last_name#53, customer_preferred_cust_flag#54, customer_birth_country#55, customer_login#56, customer_email_address#57, year_total#58, customer_id#83, year_total#84] -(54) Scan parquet default.customer -Output [8]: [c_customer_sk#88, c_customer_id#89, c_first_name#90, c_last_name#91, c_preferred_cust_flag#92, c_birth_country#93, c_login#94, c_email_address#95] +(53) Scan parquet default.customer +Output [8]: [c_customer_sk#86, c_customer_id#87, c_first_name#88, c_last_name#89, c_preferred_cust_flag#90, c_birth_country#91, c_login#92, c_email_address#93] Batched: true Location [not included in comparison]/{warehouse_dir}/customer] PushedFilters: [IsNotNull(c_customer_sk), IsNotNull(c_customer_id)] ReadSchema: struct -(55) ColumnarToRow [codegen id : 14] -Input [8]: [c_customer_sk#88, c_customer_id#89, c_first_name#90, c_last_name#91, c_preferred_cust_flag#92, c_birth_country#93, c_login#94, c_email_address#95] +(54) ColumnarToRow [codegen id : 14] +Input [8]: [c_customer_sk#86, c_customer_id#87, c_first_name#88, c_last_name#89, c_preferred_cust_flag#90, c_birth_country#91, c_login#92, c_email_address#93] -(56) Filter [codegen id : 14] -Input [8]: [c_customer_sk#88, c_customer_id#89, c_first_name#90, c_last_name#91, c_preferred_cust_flag#92, c_birth_country#93, c_login#94, c_email_address#95] -Condition : (isnotnull(c_customer_sk#88) AND isnotnull(c_customer_id#89)) +(55) Filter [codegen id : 14] +Input [8]: [c_customer_sk#86, c_customer_id#87, c_first_name#88, c_last_name#89, c_preferred_cust_flag#90, c_birth_country#91, c_login#92, c_email_address#93] +Condition : (isnotnull(c_customer_sk#86) AND isnotnull(c_customer_id#87)) -(57) Scan parquet default.catalog_sales -Output [6]: [cs_bill_customer_sk#96, cs_ext_discount_amt#97, cs_ext_sales_price#98, cs_ext_wholesale_cost#99, cs_ext_list_price#100, cs_sold_date_sk#101] +(56) Scan parquet default.catalog_sales +Output [6]: [cs_bill_customer_sk#94, cs_ext_discount_amt#95, cs_ext_sales_price#96, cs_ext_wholesale_cost#97, cs_ext_list_price#98, cs_sold_date_sk#99] Batched: true Location: InMemoryFileIndex [] -PartitionFilters: [isnotnull(cs_sold_date_sk#101), dynamicpruningexpression(cs_sold_date_sk#101 IN dynamicpruning#41)] +PartitionFilters: [isnotnull(cs_sold_date_sk#99), dynamicpruningexpression(cs_sold_date_sk#99 IN dynamicpruning#41)] PushedFilters: [IsNotNull(cs_bill_customer_sk)] ReadSchema: struct -(58) ColumnarToRow [codegen id : 12] -Input [6]: [cs_bill_customer_sk#96, cs_ext_discount_amt#97, cs_ext_sales_price#98, cs_ext_wholesale_cost#99, cs_ext_list_price#100, cs_sold_date_sk#101] +(57) ColumnarToRow [codegen id : 12] +Input [6]: [cs_bill_customer_sk#94, cs_ext_discount_amt#95, cs_ext_sales_price#96, cs_ext_wholesale_cost#97, cs_ext_list_price#98, cs_sold_date_sk#99] -(59) Filter [codegen id : 12] -Input [6]: [cs_bill_customer_sk#96, cs_ext_discount_amt#97, cs_ext_sales_price#98, cs_ext_wholesale_cost#99, cs_ext_list_price#100, cs_sold_date_sk#101] -Condition : isnotnull(cs_bill_customer_sk#96) +(58) Filter [codegen id : 12] +Input [6]: [cs_bill_customer_sk#94, cs_ext_discount_amt#95, cs_ext_sales_price#96, cs_ext_wholesale_cost#97, cs_ext_list_price#98, cs_sold_date_sk#99] +Condition : isnotnull(cs_bill_customer_sk#94) -(60) BroadcastExchange -Input [6]: [cs_bill_customer_sk#96, cs_ext_discount_amt#97, cs_ext_sales_price#98, cs_ext_wholesale_cost#99, cs_ext_list_price#100, cs_sold_date_sk#101] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#102] +(59) BroadcastExchange +Input [6]: [cs_bill_customer_sk#94, cs_ext_discount_amt#95, cs_ext_sales_price#96, cs_ext_wholesale_cost#97, cs_ext_list_price#98, cs_sold_date_sk#99] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#100] -(61) BroadcastHashJoin [codegen id : 14] -Left keys [1]: [c_customer_sk#88] -Right keys [1]: [cs_bill_customer_sk#96] +(60) BroadcastHashJoin [codegen id : 14] +Left keys [1]: [c_customer_sk#86] +Right keys [1]: [cs_bill_customer_sk#94] Join condition: None -(62) Project [codegen id : 14] -Output [12]: [c_customer_id#89, c_first_name#90, c_last_name#91, c_preferred_cust_flag#92, c_birth_country#93, c_login#94, c_email_address#95, cs_ext_discount_amt#97, cs_ext_sales_price#98, cs_ext_wholesale_cost#99, cs_ext_list_price#100, cs_sold_date_sk#101] -Input [14]: [c_customer_sk#88, c_customer_id#89, c_first_name#90, c_last_name#91, c_preferred_cust_flag#92, c_birth_country#93, c_login#94, c_email_address#95, cs_bill_customer_sk#96, cs_ext_discount_amt#97, cs_ext_sales_price#98, cs_ext_wholesale_cost#99, cs_ext_list_price#100, cs_sold_date_sk#101] +(61) Project [codegen id : 14] +Output [12]: [c_customer_id#87, c_first_name#88, c_last_name#89, c_preferred_cust_flag#90, c_birth_country#91, c_login#92, c_email_address#93, cs_ext_discount_amt#95, cs_ext_sales_price#96, cs_ext_wholesale_cost#97, cs_ext_list_price#98, cs_sold_date_sk#99] +Input [14]: [c_customer_sk#86, c_customer_id#87, c_first_name#88, c_last_name#89, c_preferred_cust_flag#90, c_birth_country#91, c_login#92, c_email_address#93, cs_bill_customer_sk#94, cs_ext_discount_amt#95, cs_ext_sales_price#96, cs_ext_wholesale_cost#97, cs_ext_list_price#98, cs_sold_date_sk#99] -(63) ReusedExchange [Reuses operator id: 118] -Output [2]: [d_date_sk#103, d_year#104] +(62) ReusedExchange [Reuses operator id: 116] +Output [2]: [d_date_sk#101, d_year#102] -(64) BroadcastHashJoin [codegen id : 14] -Left keys [1]: [cs_sold_date_sk#101] -Right keys [1]: [d_date_sk#103] +(63) BroadcastHashJoin [codegen id : 14] +Left keys [1]: [cs_sold_date_sk#99] +Right keys [1]: [d_date_sk#101] Join condition: None -(65) Project [codegen id : 14] -Output [12]: [c_customer_id#89, c_first_name#90, c_last_name#91, c_preferred_cust_flag#92, c_birth_country#93, c_login#94, c_email_address#95, cs_ext_discount_amt#97, cs_ext_sales_price#98, cs_ext_wholesale_cost#99, cs_ext_list_price#100, d_year#104] -Input [14]: [c_customer_id#89, c_first_name#90, c_last_name#91, c_preferred_cust_flag#92, c_birth_country#93, c_login#94, c_email_address#95, cs_ext_discount_amt#97, cs_ext_sales_price#98, cs_ext_wholesale_cost#99, cs_ext_list_price#100, cs_sold_date_sk#101, d_date_sk#103, d_year#104] - -(66) HashAggregate [codegen id : 14] -Input [12]: [c_customer_id#89, c_first_name#90, c_last_name#91, c_preferred_cust_flag#92, c_birth_country#93, c_login#94, c_email_address#95, cs_ext_discount_amt#97, cs_ext_sales_price#98, cs_ext_wholesale_cost#99, cs_ext_list_price#100, d_year#104] -Keys [8]: [c_customer_id#89, c_first_name#90, c_last_name#91, c_preferred_cust_flag#92, c_birth_country#93, c_login#94, c_email_address#95, d_year#104] -Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#100 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#99 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#97 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#98 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] -Aggregate Attributes [2]: [sum#105, isEmpty#106] -Results [10]: [c_customer_id#89, c_first_name#90, c_last_name#91, c_preferred_cust_flag#92, c_birth_country#93, c_login#94, c_email_address#95, d_year#104, sum#107, isEmpty#108] - -(67) Exchange -Input [10]: [c_customer_id#89, c_first_name#90, c_last_name#91, c_preferred_cust_flag#92, c_birth_country#93, c_login#94, c_email_address#95, d_year#104, sum#107, isEmpty#108] -Arguments: hashpartitioning(c_customer_id#89, c_first_name#90, c_last_name#91, c_preferred_cust_flag#92, c_birth_country#93, c_login#94, c_email_address#95, d_year#104, 5), ENSURE_REQUIREMENTS, [id=#109] - -(68) HashAggregate [codegen id : 15] -Input [10]: [c_customer_id#89, c_first_name#90, c_last_name#91, c_preferred_cust_flag#92, c_birth_country#93, c_login#94, c_email_address#95, d_year#104, sum#107, isEmpty#108] -Keys [8]: [c_customer_id#89, c_first_name#90, c_last_name#91, c_preferred_cust_flag#92, c_birth_country#93, c_login#94, c_email_address#95, d_year#104] -Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#100 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#99 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#97 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#98 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] -Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#100 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#99 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#97 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#98 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#110] -Results [2]: [c_customer_id#89 AS customer_id#111, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#100 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#99 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#97 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#98 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#110 AS year_total#112] - -(69) BroadcastExchange -Input [2]: [customer_id#111, year_total#112] -Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#113] - -(70) BroadcastHashJoin [codegen id : 24] +(64) Project [codegen id : 14] +Output [12]: [c_customer_id#87, c_first_name#88, c_last_name#89, c_preferred_cust_flag#90, c_birth_country#91, c_login#92, c_email_address#93, cs_ext_discount_amt#95, cs_ext_sales_price#96, cs_ext_wholesale_cost#97, cs_ext_list_price#98, d_year#102] +Input [14]: [c_customer_id#87, c_first_name#88, c_last_name#89, c_preferred_cust_flag#90, c_birth_country#91, c_login#92, c_email_address#93, cs_ext_discount_amt#95, cs_ext_sales_price#96, cs_ext_wholesale_cost#97, cs_ext_list_price#98, cs_sold_date_sk#99, d_date_sk#101, d_year#102] + +(65) HashAggregate [codegen id : 14] +Input [12]: [c_customer_id#87, c_first_name#88, c_last_name#89, c_preferred_cust_flag#90, c_birth_country#91, c_login#92, c_email_address#93, cs_ext_discount_amt#95, cs_ext_sales_price#96, cs_ext_wholesale_cost#97, cs_ext_list_price#98, d_year#102] +Keys [8]: [c_customer_id#87, c_first_name#88, c_last_name#89, c_preferred_cust_flag#90, c_birth_country#91, c_login#92, c_email_address#93, d_year#102] +Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#98 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#97 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#95 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#96 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] +Aggregate Attributes [2]: [sum#103, isEmpty#104] +Results [10]: [c_customer_id#87, c_first_name#88, c_last_name#89, c_preferred_cust_flag#90, c_birth_country#91, c_login#92, c_email_address#93, d_year#102, sum#105, isEmpty#106] + +(66) Exchange +Input [10]: [c_customer_id#87, c_first_name#88, c_last_name#89, c_preferred_cust_flag#90, c_birth_country#91, c_login#92, c_email_address#93, d_year#102, sum#105, isEmpty#106] +Arguments: hashpartitioning(c_customer_id#87, c_first_name#88, c_last_name#89, c_preferred_cust_flag#90, c_birth_country#91, c_login#92, c_email_address#93, d_year#102, 5), ENSURE_REQUIREMENTS, [id=#107] + +(67) HashAggregate [codegen id : 15] +Input [10]: [c_customer_id#87, c_first_name#88, c_last_name#89, c_preferred_cust_flag#90, c_birth_country#91, c_login#92, c_email_address#93, d_year#102, sum#105, isEmpty#106] +Keys [8]: [c_customer_id#87, c_first_name#88, c_last_name#89, c_preferred_cust_flag#90, c_birth_country#91, c_login#92, c_email_address#93, d_year#102] +Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#98 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#97 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#95 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#96 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] +Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#98 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#97 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#95 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#96 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#108] +Results [2]: [c_customer_id#87 AS customer_id#109, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#98 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#97 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#95 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#96 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#108 AS year_total#110] + +(68) BroadcastExchange +Input [2]: [customer_id#109, year_total#110] +Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#111] + +(69) BroadcastHashJoin [codegen id : 24] Left keys [1]: [customer_id#25] -Right keys [1]: [customer_id#111] -Join condition: (CASE WHEN (year_total#86 > 0.000000) THEN CheckOverflow((promote_precision(year_total#112) / promote_precision(year_total#86)), DecimalType(38,14), true) ELSE null END > CASE WHEN (year_total#26 > 0.000000) THEN CheckOverflow((promote_precision(year_total#58) / promote_precision(year_total#26)), DecimalType(38,14), true) ELSE null END) +Right keys [1]: [customer_id#109] +Join condition: (CASE WHEN (year_total#84 > 0.000000) THEN CheckOverflow((promote_precision(year_total#110) / promote_precision(year_total#84)), DecimalType(38,14), true) ELSE null END > CASE WHEN (year_total#26 > 0.000000) THEN CheckOverflow((promote_precision(year_total#58) / promote_precision(year_total#26)), DecimalType(38,14), true) ELSE null END) -(71) Project [codegen id : 24] -Output [10]: [customer_id#25, customer_id#51, customer_first_name#52, customer_last_name#53, customer_preferred_cust_flag#54, customer_birth_country#55, customer_login#56, customer_email_address#57, year_total#86, year_total#112] -Input [13]: [customer_id#25, year_total#26, customer_id#51, customer_first_name#52, customer_last_name#53, customer_preferred_cust_flag#54, customer_birth_country#55, customer_login#56, customer_email_address#57, year_total#58, year_total#86, customer_id#111, year_total#112] +(70) Project [codegen id : 24] +Output [10]: [customer_id#25, customer_id#51, customer_first_name#52, customer_last_name#53, customer_preferred_cust_flag#54, customer_birth_country#55, customer_login#56, customer_email_address#57, year_total#84, year_total#110] +Input [13]: [customer_id#25, year_total#26, customer_id#51, customer_first_name#52, customer_last_name#53, customer_preferred_cust_flag#54, customer_birth_country#55, customer_login#56, customer_email_address#57, year_total#58, year_total#84, customer_id#109, year_total#110] -(72) Scan parquet default.customer -Output [8]: [c_customer_sk#114, c_customer_id#115, c_first_name#116, c_last_name#117, c_preferred_cust_flag#118, c_birth_country#119, c_login#120, c_email_address#121] +(71) Scan parquet default.customer +Output [8]: [c_customer_sk#112, c_customer_id#113, c_first_name#114, c_last_name#115, c_preferred_cust_flag#116, c_birth_country#117, c_login#118, c_email_address#119] Batched: true Location [not included in comparison]/{warehouse_dir}/customer] PushedFilters: [IsNotNull(c_customer_sk), IsNotNull(c_customer_id)] ReadSchema: struct -(73) ColumnarToRow [codegen id : 18] -Input [8]: [c_customer_sk#114, c_customer_id#115, c_first_name#116, c_last_name#117, c_preferred_cust_flag#118, c_birth_country#119, c_login#120, c_email_address#121] +(72) ColumnarToRow [codegen id : 18] +Input [8]: [c_customer_sk#112, c_customer_id#113, c_first_name#114, c_last_name#115, c_preferred_cust_flag#116, c_birth_country#117, c_login#118, c_email_address#119] -(74) Filter [codegen id : 18] -Input [8]: [c_customer_sk#114, c_customer_id#115, c_first_name#116, c_last_name#117, c_preferred_cust_flag#118, c_birth_country#119, c_login#120, c_email_address#121] -Condition : (isnotnull(c_customer_sk#114) AND isnotnull(c_customer_id#115)) +(73) Filter [codegen id : 18] +Input [8]: [c_customer_sk#112, c_customer_id#113, c_first_name#114, c_last_name#115, c_preferred_cust_flag#116, c_birth_country#117, c_login#118, c_email_address#119] +Condition : (isnotnull(c_customer_sk#112) AND isnotnull(c_customer_id#113)) -(75) Scan parquet default.web_sales -Output [6]: [ws_bill_customer_sk#122, ws_ext_discount_amt#123, ws_ext_sales_price#124, ws_ext_wholesale_cost#125, ws_ext_list_price#126, ws_sold_date_sk#127] +(74) Scan parquet default.web_sales +Output [6]: [ws_bill_customer_sk#120, ws_ext_discount_amt#121, ws_ext_sales_price#122, ws_ext_wholesale_cost#123, ws_ext_list_price#124, ws_sold_date_sk#125] Batched: true Location: InMemoryFileIndex [] -PartitionFilters: [isnotnull(ws_sold_date_sk#127), dynamicpruningexpression(ws_sold_date_sk#127 IN dynamicpruning#15)] +PartitionFilters: [isnotnull(ws_sold_date_sk#125), dynamicpruningexpression(ws_sold_date_sk#125 IN dynamicpruning#15)] PushedFilters: [IsNotNull(ws_bill_customer_sk)] ReadSchema: struct -(76) ColumnarToRow [codegen id : 16] -Input [6]: [ws_bill_customer_sk#122, ws_ext_discount_amt#123, ws_ext_sales_price#124, ws_ext_wholesale_cost#125, ws_ext_list_price#126, ws_sold_date_sk#127] +(75) ColumnarToRow [codegen id : 16] +Input [6]: [ws_bill_customer_sk#120, ws_ext_discount_amt#121, ws_ext_sales_price#122, ws_ext_wholesale_cost#123, ws_ext_list_price#124, ws_sold_date_sk#125] -(77) Filter [codegen id : 16] -Input [6]: [ws_bill_customer_sk#122, ws_ext_discount_amt#123, ws_ext_sales_price#124, ws_ext_wholesale_cost#125, ws_ext_list_price#126, ws_sold_date_sk#127] -Condition : isnotnull(ws_bill_customer_sk#122) +(76) Filter [codegen id : 16] +Input [6]: [ws_bill_customer_sk#120, ws_ext_discount_amt#121, ws_ext_sales_price#122, ws_ext_wholesale_cost#123, ws_ext_list_price#124, ws_sold_date_sk#125] +Condition : isnotnull(ws_bill_customer_sk#120) -(78) BroadcastExchange -Input [6]: [ws_bill_customer_sk#122, ws_ext_discount_amt#123, ws_ext_sales_price#124, ws_ext_wholesale_cost#125, ws_ext_list_price#126, ws_sold_date_sk#127] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#128] +(77) BroadcastExchange +Input [6]: [ws_bill_customer_sk#120, ws_ext_discount_amt#121, ws_ext_sales_price#122, ws_ext_wholesale_cost#123, ws_ext_list_price#124, ws_sold_date_sk#125] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#126] -(79) BroadcastHashJoin [codegen id : 18] -Left keys [1]: [c_customer_sk#114] -Right keys [1]: [ws_bill_customer_sk#122] +(78) BroadcastHashJoin [codegen id : 18] +Left keys [1]: [c_customer_sk#112] +Right keys [1]: [ws_bill_customer_sk#120] Join condition: None -(80) Project [codegen id : 18] -Output [12]: [c_customer_id#115, c_first_name#116, c_last_name#117, c_preferred_cust_flag#118, c_birth_country#119, c_login#120, c_email_address#121, ws_ext_discount_amt#123, ws_ext_sales_price#124, ws_ext_wholesale_cost#125, ws_ext_list_price#126, ws_sold_date_sk#127] -Input [14]: [c_customer_sk#114, c_customer_id#115, c_first_name#116, c_last_name#117, c_preferred_cust_flag#118, c_birth_country#119, c_login#120, c_email_address#121, ws_bill_customer_sk#122, ws_ext_discount_amt#123, ws_ext_sales_price#124, ws_ext_wholesale_cost#125, ws_ext_list_price#126, ws_sold_date_sk#127] +(79) Project [codegen id : 18] +Output [12]: [c_customer_id#113, c_first_name#114, c_last_name#115, c_preferred_cust_flag#116, c_birth_country#117, c_login#118, c_email_address#119, ws_ext_discount_amt#121, ws_ext_sales_price#122, ws_ext_wholesale_cost#123, ws_ext_list_price#124, ws_sold_date_sk#125] +Input [14]: [c_customer_sk#112, c_customer_id#113, c_first_name#114, c_last_name#115, c_preferred_cust_flag#116, c_birth_country#117, c_login#118, c_email_address#119, ws_bill_customer_sk#120, ws_ext_discount_amt#121, ws_ext_sales_price#122, ws_ext_wholesale_cost#123, ws_ext_list_price#124, ws_sold_date_sk#125] -(81) ReusedExchange [Reuses operator id: 114] -Output [2]: [d_date_sk#129, d_year#130] +(80) ReusedExchange [Reuses operator id: 112] +Output [2]: [d_date_sk#127, d_year#128] -(82) BroadcastHashJoin [codegen id : 18] -Left keys [1]: [ws_sold_date_sk#127] -Right keys [1]: [d_date_sk#129] +(81) BroadcastHashJoin [codegen id : 18] +Left keys [1]: [ws_sold_date_sk#125] +Right keys [1]: [d_date_sk#127] Join condition: None -(83) Project [codegen id : 18] -Output [12]: [c_customer_id#115, c_first_name#116, c_last_name#117, c_preferred_cust_flag#118, c_birth_country#119, c_login#120, c_email_address#121, ws_ext_discount_amt#123, ws_ext_sales_price#124, ws_ext_wholesale_cost#125, ws_ext_list_price#126, d_year#130] -Input [14]: [c_customer_id#115, c_first_name#116, c_last_name#117, c_preferred_cust_flag#118, c_birth_country#119, c_login#120, c_email_address#121, ws_ext_discount_amt#123, ws_ext_sales_price#124, ws_ext_wholesale_cost#125, ws_ext_list_price#126, ws_sold_date_sk#127, d_date_sk#129, d_year#130] - -(84) HashAggregate [codegen id : 18] -Input [12]: [c_customer_id#115, c_first_name#116, c_last_name#117, c_preferred_cust_flag#118, c_birth_country#119, c_login#120, c_email_address#121, ws_ext_discount_amt#123, ws_ext_sales_price#124, ws_ext_wholesale_cost#125, ws_ext_list_price#126, d_year#130] -Keys [8]: [c_customer_id#115, c_first_name#116, c_last_name#117, c_preferred_cust_flag#118, c_birth_country#119, c_login#120, c_email_address#121, d_year#130] -Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#126 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#125 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#123 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#124 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] -Aggregate Attributes [2]: [sum#131, isEmpty#132] -Results [10]: [c_customer_id#115, c_first_name#116, c_last_name#117, c_preferred_cust_flag#118, c_birth_country#119, c_login#120, c_email_address#121, d_year#130, sum#133, isEmpty#134] - -(85) Exchange -Input [10]: [c_customer_id#115, c_first_name#116, c_last_name#117, c_preferred_cust_flag#118, c_birth_country#119, c_login#120, c_email_address#121, d_year#130, sum#133, isEmpty#134] -Arguments: hashpartitioning(c_customer_id#115, c_first_name#116, c_last_name#117, c_preferred_cust_flag#118, c_birth_country#119, c_login#120, c_email_address#121, d_year#130, 5), ENSURE_REQUIREMENTS, [id=#135] - -(86) HashAggregate [codegen id : 19] -Input [10]: [c_customer_id#115, c_first_name#116, c_last_name#117, c_preferred_cust_flag#118, c_birth_country#119, c_login#120, c_email_address#121, d_year#130, sum#133, isEmpty#134] -Keys [8]: [c_customer_id#115, c_first_name#116, c_last_name#117, c_preferred_cust_flag#118, c_birth_country#119, c_login#120, c_email_address#121, d_year#130] -Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#126 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#125 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#123 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#124 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] -Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#126 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#125 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#123 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#124 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#136] -Results [2]: [c_customer_id#115 AS customer_id#137, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#126 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#125 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#123 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#124 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#136 AS year_total#138] - -(87) Filter [codegen id : 19] -Input [2]: [customer_id#137, year_total#138] -Condition : (isnotnull(year_total#138) AND (year_total#138 > 0.000000)) - -(88) Project [codegen id : 19] -Output [2]: [customer_id#137 AS customer_id#139, year_total#138 AS year_total#140] -Input [2]: [customer_id#137, year_total#138] - -(89) BroadcastExchange -Input [2]: [customer_id#139, year_total#140] -Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#141] - -(90) BroadcastHashJoin [codegen id : 24] +(82) Project [codegen id : 18] +Output [12]: [c_customer_id#113, c_first_name#114, c_last_name#115, c_preferred_cust_flag#116, c_birth_country#117, c_login#118, c_email_address#119, ws_ext_discount_amt#121, ws_ext_sales_price#122, ws_ext_wholesale_cost#123, ws_ext_list_price#124, d_year#128] +Input [14]: [c_customer_id#113, c_first_name#114, c_last_name#115, c_preferred_cust_flag#116, c_birth_country#117, c_login#118, c_email_address#119, ws_ext_discount_amt#121, ws_ext_sales_price#122, ws_ext_wholesale_cost#123, ws_ext_list_price#124, ws_sold_date_sk#125, d_date_sk#127, d_year#128] + +(83) HashAggregate [codegen id : 18] +Input [12]: [c_customer_id#113, c_first_name#114, c_last_name#115, c_preferred_cust_flag#116, c_birth_country#117, c_login#118, c_email_address#119, ws_ext_discount_amt#121, ws_ext_sales_price#122, ws_ext_wholesale_cost#123, ws_ext_list_price#124, d_year#128] +Keys [8]: [c_customer_id#113, c_first_name#114, c_last_name#115, c_preferred_cust_flag#116, c_birth_country#117, c_login#118, c_email_address#119, d_year#128] +Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#124 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#123 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#121 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#122 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] +Aggregate Attributes [2]: [sum#129, isEmpty#130] +Results [10]: [c_customer_id#113, c_first_name#114, c_last_name#115, c_preferred_cust_flag#116, c_birth_country#117, c_login#118, c_email_address#119, d_year#128, sum#131, isEmpty#132] + +(84) Exchange +Input [10]: [c_customer_id#113, c_first_name#114, c_last_name#115, c_preferred_cust_flag#116, c_birth_country#117, c_login#118, c_email_address#119, d_year#128, sum#131, isEmpty#132] +Arguments: hashpartitioning(c_customer_id#113, c_first_name#114, c_last_name#115, c_preferred_cust_flag#116, c_birth_country#117, c_login#118, c_email_address#119, d_year#128, 5), ENSURE_REQUIREMENTS, [id=#133] + +(85) HashAggregate [codegen id : 19] +Input [10]: [c_customer_id#113, c_first_name#114, c_last_name#115, c_preferred_cust_flag#116, c_birth_country#117, c_login#118, c_email_address#119, d_year#128, sum#131, isEmpty#132] +Keys [8]: [c_customer_id#113, c_first_name#114, c_last_name#115, c_preferred_cust_flag#116, c_birth_country#117, c_login#118, c_email_address#119, d_year#128] +Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#124 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#123 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#121 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#122 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] +Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#124 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#123 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#121 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#122 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#134] +Results [2]: [c_customer_id#113 AS customer_id#135, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#124 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#123 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#121 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#122 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#134 AS year_total#136] + +(86) Filter [codegen id : 19] +Input [2]: [customer_id#135, year_total#136] +Condition : (isnotnull(year_total#136) AND (year_total#136 > 0.000000)) + +(87) BroadcastExchange +Input [2]: [customer_id#135, year_total#136] +Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#137] + +(88) BroadcastHashJoin [codegen id : 24] Left keys [1]: [customer_id#25] -Right keys [1]: [customer_id#139] +Right keys [1]: [customer_id#135] Join condition: None -(91) Project [codegen id : 24] -Output [11]: [customer_id#25, customer_id#51, customer_first_name#52, customer_last_name#53, customer_preferred_cust_flag#54, customer_birth_country#55, customer_login#56, customer_email_address#57, year_total#86, year_total#112, year_total#140] -Input [12]: [customer_id#25, customer_id#51, customer_first_name#52, customer_last_name#53, customer_preferred_cust_flag#54, customer_birth_country#55, customer_login#56, customer_email_address#57, year_total#86, year_total#112, customer_id#139, year_total#140] +(89) Project [codegen id : 24] +Output [11]: [customer_id#25, customer_id#51, customer_first_name#52, customer_last_name#53, customer_preferred_cust_flag#54, customer_birth_country#55, customer_login#56, customer_email_address#57, year_total#84, year_total#110, year_total#136] +Input [12]: [customer_id#25, customer_id#51, customer_first_name#52, customer_last_name#53, customer_preferred_cust_flag#54, customer_birth_country#55, customer_login#56, customer_email_address#57, year_total#84, year_total#110, customer_id#135, year_total#136] -(92) Scan parquet default.customer -Output [8]: [c_customer_sk#142, c_customer_id#143, c_first_name#144, c_last_name#145, c_preferred_cust_flag#146, c_birth_country#147, c_login#148, c_email_address#149] +(90) Scan parquet default.customer +Output [8]: [c_customer_sk#138, c_customer_id#139, c_first_name#140, c_last_name#141, c_preferred_cust_flag#142, c_birth_country#143, c_login#144, c_email_address#145] Batched: true Location [not included in comparison]/{warehouse_dir}/customer] PushedFilters: [IsNotNull(c_customer_sk), IsNotNull(c_customer_id)] ReadSchema: struct -(93) ColumnarToRow [codegen id : 22] -Input [8]: [c_customer_sk#142, c_customer_id#143, c_first_name#144, c_last_name#145, c_preferred_cust_flag#146, c_birth_country#147, c_login#148, c_email_address#149] +(91) ColumnarToRow [codegen id : 22] +Input [8]: [c_customer_sk#138, c_customer_id#139, c_first_name#140, c_last_name#141, c_preferred_cust_flag#142, c_birth_country#143, c_login#144, c_email_address#145] -(94) Filter [codegen id : 22] -Input [8]: [c_customer_sk#142, c_customer_id#143, c_first_name#144, c_last_name#145, c_preferred_cust_flag#146, c_birth_country#147, c_login#148, c_email_address#149] -Condition : (isnotnull(c_customer_sk#142) AND isnotnull(c_customer_id#143)) +(92) Filter [codegen id : 22] +Input [8]: [c_customer_sk#138, c_customer_id#139, c_first_name#140, c_last_name#141, c_preferred_cust_flag#142, c_birth_country#143, c_login#144, c_email_address#145] +Condition : (isnotnull(c_customer_sk#138) AND isnotnull(c_customer_id#139)) -(95) Scan parquet default.web_sales -Output [6]: [ws_bill_customer_sk#150, ws_ext_discount_amt#151, ws_ext_sales_price#152, ws_ext_wholesale_cost#153, ws_ext_list_price#154, ws_sold_date_sk#155] +(93) Scan parquet default.web_sales +Output [6]: [ws_bill_customer_sk#146, ws_ext_discount_amt#147, ws_ext_sales_price#148, ws_ext_wholesale_cost#149, ws_ext_list_price#150, ws_sold_date_sk#151] Batched: true Location: InMemoryFileIndex [] -PartitionFilters: [isnotnull(ws_sold_date_sk#155), dynamicpruningexpression(ws_sold_date_sk#155 IN dynamicpruning#41)] +PartitionFilters: [isnotnull(ws_sold_date_sk#151), dynamicpruningexpression(ws_sold_date_sk#151 IN dynamicpruning#41)] PushedFilters: [IsNotNull(ws_bill_customer_sk)] ReadSchema: struct -(96) ColumnarToRow [codegen id : 20] -Input [6]: [ws_bill_customer_sk#150, ws_ext_discount_amt#151, ws_ext_sales_price#152, ws_ext_wholesale_cost#153, ws_ext_list_price#154, ws_sold_date_sk#155] +(94) ColumnarToRow [codegen id : 20] +Input [6]: [ws_bill_customer_sk#146, ws_ext_discount_amt#147, ws_ext_sales_price#148, ws_ext_wholesale_cost#149, ws_ext_list_price#150, ws_sold_date_sk#151] -(97) Filter [codegen id : 20] -Input [6]: [ws_bill_customer_sk#150, ws_ext_discount_amt#151, ws_ext_sales_price#152, ws_ext_wholesale_cost#153, ws_ext_list_price#154, ws_sold_date_sk#155] -Condition : isnotnull(ws_bill_customer_sk#150) +(95) Filter [codegen id : 20] +Input [6]: [ws_bill_customer_sk#146, ws_ext_discount_amt#147, ws_ext_sales_price#148, ws_ext_wholesale_cost#149, ws_ext_list_price#150, ws_sold_date_sk#151] +Condition : isnotnull(ws_bill_customer_sk#146) -(98) BroadcastExchange -Input [6]: [ws_bill_customer_sk#150, ws_ext_discount_amt#151, ws_ext_sales_price#152, ws_ext_wholesale_cost#153, ws_ext_list_price#154, ws_sold_date_sk#155] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#156] +(96) BroadcastExchange +Input [6]: [ws_bill_customer_sk#146, ws_ext_discount_amt#147, ws_ext_sales_price#148, ws_ext_wholesale_cost#149, ws_ext_list_price#150, ws_sold_date_sk#151] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#152] -(99) BroadcastHashJoin [codegen id : 22] -Left keys [1]: [c_customer_sk#142] -Right keys [1]: [ws_bill_customer_sk#150] +(97) BroadcastHashJoin [codegen id : 22] +Left keys [1]: [c_customer_sk#138] +Right keys [1]: [ws_bill_customer_sk#146] Join condition: None -(100) Project [codegen id : 22] -Output [12]: [c_customer_id#143, c_first_name#144, c_last_name#145, c_preferred_cust_flag#146, c_birth_country#147, c_login#148, c_email_address#149, ws_ext_discount_amt#151, ws_ext_sales_price#152, ws_ext_wholesale_cost#153, ws_ext_list_price#154, ws_sold_date_sk#155] -Input [14]: [c_customer_sk#142, c_customer_id#143, c_first_name#144, c_last_name#145, c_preferred_cust_flag#146, c_birth_country#147, c_login#148, c_email_address#149, ws_bill_customer_sk#150, ws_ext_discount_amt#151, ws_ext_sales_price#152, ws_ext_wholesale_cost#153, ws_ext_list_price#154, ws_sold_date_sk#155] +(98) Project [codegen id : 22] +Output [12]: [c_customer_id#139, c_first_name#140, c_last_name#141, c_preferred_cust_flag#142, c_birth_country#143, c_login#144, c_email_address#145, ws_ext_discount_amt#147, ws_ext_sales_price#148, ws_ext_wholesale_cost#149, ws_ext_list_price#150, ws_sold_date_sk#151] +Input [14]: [c_customer_sk#138, c_customer_id#139, c_first_name#140, c_last_name#141, c_preferred_cust_flag#142, c_birth_country#143, c_login#144, c_email_address#145, ws_bill_customer_sk#146, ws_ext_discount_amt#147, ws_ext_sales_price#148, ws_ext_wholesale_cost#149, ws_ext_list_price#150, ws_sold_date_sk#151] -(101) ReusedExchange [Reuses operator id: 118] -Output [2]: [d_date_sk#157, d_year#158] +(99) ReusedExchange [Reuses operator id: 116] +Output [2]: [d_date_sk#153, d_year#154] -(102) BroadcastHashJoin [codegen id : 22] -Left keys [1]: [ws_sold_date_sk#155] -Right keys [1]: [d_date_sk#157] +(100) BroadcastHashJoin [codegen id : 22] +Left keys [1]: [ws_sold_date_sk#151] +Right keys [1]: [d_date_sk#153] Join condition: None -(103) Project [codegen id : 22] -Output [12]: [c_customer_id#143, c_first_name#144, c_last_name#145, c_preferred_cust_flag#146, c_birth_country#147, c_login#148, c_email_address#149, ws_ext_discount_amt#151, ws_ext_sales_price#152, ws_ext_wholesale_cost#153, ws_ext_list_price#154, d_year#158] -Input [14]: [c_customer_id#143, c_first_name#144, c_last_name#145, c_preferred_cust_flag#146, c_birth_country#147, c_login#148, c_email_address#149, ws_ext_discount_amt#151, ws_ext_sales_price#152, ws_ext_wholesale_cost#153, ws_ext_list_price#154, ws_sold_date_sk#155, d_date_sk#157, d_year#158] - -(104) HashAggregate [codegen id : 22] -Input [12]: [c_customer_id#143, c_first_name#144, c_last_name#145, c_preferred_cust_flag#146, c_birth_country#147, c_login#148, c_email_address#149, ws_ext_discount_amt#151, ws_ext_sales_price#152, ws_ext_wholesale_cost#153, ws_ext_list_price#154, d_year#158] -Keys [8]: [c_customer_id#143, c_first_name#144, c_last_name#145, c_preferred_cust_flag#146, c_birth_country#147, c_login#148, c_email_address#149, d_year#158] -Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#154 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#153 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#151 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#152 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] -Aggregate Attributes [2]: [sum#159, isEmpty#160] -Results [10]: [c_customer_id#143, c_first_name#144, c_last_name#145, c_preferred_cust_flag#146, c_birth_country#147, c_login#148, c_email_address#149, d_year#158, sum#161, isEmpty#162] - -(105) Exchange -Input [10]: [c_customer_id#143, c_first_name#144, c_last_name#145, c_preferred_cust_flag#146, c_birth_country#147, c_login#148, c_email_address#149, d_year#158, sum#161, isEmpty#162] -Arguments: hashpartitioning(c_customer_id#143, c_first_name#144, c_last_name#145, c_preferred_cust_flag#146, c_birth_country#147, c_login#148, c_email_address#149, d_year#158, 5), ENSURE_REQUIREMENTS, [id=#163] - -(106) HashAggregate [codegen id : 23] -Input [10]: [c_customer_id#143, c_first_name#144, c_last_name#145, c_preferred_cust_flag#146, c_birth_country#147, c_login#148, c_email_address#149, d_year#158, sum#161, isEmpty#162] -Keys [8]: [c_customer_id#143, c_first_name#144, c_last_name#145, c_preferred_cust_flag#146, c_birth_country#147, c_login#148, c_email_address#149, d_year#158] -Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#154 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#153 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#151 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#152 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] -Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#154 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#153 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#151 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#152 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#164] -Results [2]: [c_customer_id#143 AS customer_id#165, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#154 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#153 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#151 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#152 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#164 AS year_total#166] - -(107) BroadcastExchange -Input [2]: [customer_id#165, year_total#166] -Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#167] - -(108) BroadcastHashJoin [codegen id : 24] +(101) Project [codegen id : 22] +Output [12]: [c_customer_id#139, c_first_name#140, c_last_name#141, c_preferred_cust_flag#142, c_birth_country#143, c_login#144, c_email_address#145, ws_ext_discount_amt#147, ws_ext_sales_price#148, ws_ext_wholesale_cost#149, ws_ext_list_price#150, d_year#154] +Input [14]: [c_customer_id#139, c_first_name#140, c_last_name#141, c_preferred_cust_flag#142, c_birth_country#143, c_login#144, c_email_address#145, ws_ext_discount_amt#147, ws_ext_sales_price#148, ws_ext_wholesale_cost#149, ws_ext_list_price#150, ws_sold_date_sk#151, d_date_sk#153, d_year#154] + +(102) HashAggregate [codegen id : 22] +Input [12]: [c_customer_id#139, c_first_name#140, c_last_name#141, c_preferred_cust_flag#142, c_birth_country#143, c_login#144, c_email_address#145, ws_ext_discount_amt#147, ws_ext_sales_price#148, ws_ext_wholesale_cost#149, ws_ext_list_price#150, d_year#154] +Keys [8]: [c_customer_id#139, c_first_name#140, c_last_name#141, c_preferred_cust_flag#142, c_birth_country#143, c_login#144, c_email_address#145, d_year#154] +Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#150 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#149 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#147 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#148 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] +Aggregate Attributes [2]: [sum#155, isEmpty#156] +Results [10]: [c_customer_id#139, c_first_name#140, c_last_name#141, c_preferred_cust_flag#142, c_birth_country#143, c_login#144, c_email_address#145, d_year#154, sum#157, isEmpty#158] + +(103) Exchange +Input [10]: [c_customer_id#139, c_first_name#140, c_last_name#141, c_preferred_cust_flag#142, c_birth_country#143, c_login#144, c_email_address#145, d_year#154, sum#157, isEmpty#158] +Arguments: hashpartitioning(c_customer_id#139, c_first_name#140, c_last_name#141, c_preferred_cust_flag#142, c_birth_country#143, c_login#144, c_email_address#145, d_year#154, 5), ENSURE_REQUIREMENTS, [id=#159] + +(104) HashAggregate [codegen id : 23] +Input [10]: [c_customer_id#139, c_first_name#140, c_last_name#141, c_preferred_cust_flag#142, c_birth_country#143, c_login#144, c_email_address#145, d_year#154, sum#157, isEmpty#158] +Keys [8]: [c_customer_id#139, c_first_name#140, c_last_name#141, c_preferred_cust_flag#142, c_birth_country#143, c_login#144, c_email_address#145, d_year#154] +Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#150 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#149 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#147 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#148 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))] +Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#150 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#149 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#147 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#148 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#160] +Results [2]: [c_customer_id#139 AS customer_id#161, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#150 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#149 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#147 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#148 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#160 AS year_total#162] + +(105) BroadcastExchange +Input [2]: [customer_id#161, year_total#162] +Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#163] + +(106) BroadcastHashJoin [codegen id : 24] Left keys [1]: [customer_id#25] -Right keys [1]: [customer_id#165] -Join condition: (CASE WHEN (year_total#86 > 0.000000) THEN CheckOverflow((promote_precision(year_total#112) / promote_precision(year_total#86)), DecimalType(38,14), true) ELSE null END > CASE WHEN (year_total#140 > 0.000000) THEN CheckOverflow((promote_precision(year_total#166) / promote_precision(year_total#140)), DecimalType(38,14), true) ELSE null END) +Right keys [1]: [customer_id#161] +Join condition: (CASE WHEN (year_total#84 > 0.000000) THEN CheckOverflow((promote_precision(year_total#110) / promote_precision(year_total#84)), DecimalType(38,14), true) ELSE null END > CASE WHEN (year_total#136 > 0.000000) THEN CheckOverflow((promote_precision(year_total#162) / promote_precision(year_total#136)), DecimalType(38,14), true) ELSE null END) -(109) Project [codegen id : 24] +(107) Project [codegen id : 24] Output [7]: [customer_id#51, customer_first_name#52, customer_last_name#53, customer_preferred_cust_flag#54, customer_birth_country#55, customer_login#56, customer_email_address#57] -Input [13]: [customer_id#25, customer_id#51, customer_first_name#52, customer_last_name#53, customer_preferred_cust_flag#54, customer_birth_country#55, customer_login#56, customer_email_address#57, year_total#86, year_total#112, year_total#140, customer_id#165, year_total#166] +Input [13]: [customer_id#25, customer_id#51, customer_first_name#52, customer_last_name#53, customer_preferred_cust_flag#54, customer_birth_country#55, customer_login#56, customer_email_address#57, year_total#84, year_total#110, year_total#136, customer_id#161, year_total#162] -(110) TakeOrderedAndProject +(108) TakeOrderedAndProject Input [7]: [customer_id#51, customer_first_name#52, customer_last_name#53, customer_preferred_cust_flag#54, customer_birth_country#55, customer_login#56, customer_email_address#57] Arguments: 100, [customer_id#51 ASC NULLS FIRST, customer_first_name#52 ASC NULLS FIRST, customer_last_name#53 ASC NULLS FIRST, customer_preferred_cust_flag#54 ASC NULLS FIRST, customer_birth_country#55 ASC NULLS FIRST, customer_login#56 ASC NULLS FIRST, customer_email_address#57 ASC NULLS FIRST], [customer_id#51, customer_first_name#52, customer_last_name#53, customer_preferred_cust_flag#54, customer_birth_country#55, customer_login#56, customer_email_address#57] ===== Subqueries ===== Subquery:1 Hosting operator id = 4 Hosting Expression = ss_sold_date_sk#14 IN dynamicpruning#15 -BroadcastExchange (114) -+- * Filter (113) - +- * ColumnarToRow (112) - +- Scan parquet default.date_dim (111) +BroadcastExchange (112) ++- * Filter (111) + +- * ColumnarToRow (110) + +- Scan parquet default.date_dim (109) -(111) Scan parquet default.date_dim +(109) Scan parquet default.date_dim Output [2]: [d_date_sk#17, d_year#18] Batched: true Location [not included in comparison]/{warehouse_dir}/date_dim] PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2001), IsNotNull(d_date_sk)] ReadSchema: struct -(112) ColumnarToRow [codegen id : 1] +(110) ColumnarToRow [codegen id : 1] Input [2]: [d_date_sk#17, d_year#18] -(113) Filter [codegen id : 1] +(111) Filter [codegen id : 1] Input [2]: [d_date_sk#17, d_year#18] Condition : ((isnotnull(d_year#18) AND (d_year#18 = 2001)) AND isnotnull(d_date_sk#17)) -(114) BroadcastExchange +(112) BroadcastExchange Input [2]: [d_date_sk#17, d_year#18] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#168] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#164] Subquery:2 Hosting operator id = 20 Hosting Expression = ss_sold_date_sk#40 IN dynamicpruning#41 -BroadcastExchange (118) -+- * Filter (117) - +- * ColumnarToRow (116) - +- Scan parquet default.date_dim (115) +BroadcastExchange (116) ++- * Filter (115) + +- * ColumnarToRow (114) + +- Scan parquet default.date_dim (113) -(115) Scan parquet default.date_dim +(113) Scan parquet default.date_dim Output [2]: [d_date_sk#43, d_year#44] Batched: true Location [not included in comparison]/{warehouse_dir}/date_dim] PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2002), IsNotNull(d_date_sk)] ReadSchema: struct -(116) ColumnarToRow [codegen id : 1] +(114) ColumnarToRow [codegen id : 1] Input [2]: [d_date_sk#43, d_year#44] -(117) Filter [codegen id : 1] +(115) Filter [codegen id : 1] Input [2]: [d_date_sk#43, d_year#44] Condition : ((isnotnull(d_year#44) AND (d_year#44 = 2002)) AND isnotnull(d_date_sk#43)) -(118) BroadcastExchange +(116) BroadcastExchange Input [2]: [d_date_sk#43, d_year#44] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#169] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#165] Subquery:3 Hosting operator id = 37 Hosting Expression = cs_sold_date_sk#73 IN dynamicpruning#15 -Subquery:4 Hosting operator id = 57 Hosting Expression = cs_sold_date_sk#101 IN dynamicpruning#41 +Subquery:4 Hosting operator id = 56 Hosting Expression = cs_sold_date_sk#99 IN dynamicpruning#41 -Subquery:5 Hosting operator id = 75 Hosting Expression = ws_sold_date_sk#127 IN dynamicpruning#15 +Subquery:5 Hosting operator id = 74 Hosting Expression = ws_sold_date_sk#125 IN dynamicpruning#15 -Subquery:6 Hosting operator id = 95 Hosting Expression = ws_sold_date_sk#155 IN dynamicpruning#41 +Subquery:6 Hosting operator id = 93 Hosting Expression = ws_sold_date_sk#151 IN dynamicpruning#41 diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q4/simplified.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q4/simplified.txt index 16a3e25049bcc..68d4f3219238a 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q4/simplified.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q4/simplified.txt @@ -74,31 +74,30 @@ TakeOrderedAndProject [customer_id,customer_first_name,customer_last_name,custom InputAdapter BroadcastExchange #8 WholeStageCodegen (11) - Project [customer_id,year_total] - Filter [year_total] - HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum,isEmpty] [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true)),customer_id,year_total,sum,isEmpty] - InputAdapter - Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #9 - WholeStageCodegen (10) - HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,cs_ext_list_price,cs_ext_wholesale_cost,cs_ext_discount_amt,cs_ext_sales_price] [sum,isEmpty,sum,isEmpty] - Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,cs_ext_discount_amt,cs_ext_sales_price,cs_ext_wholesale_cost,cs_ext_list_price,d_year] - BroadcastHashJoin [cs_sold_date_sk,d_date_sk] - Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,cs_ext_discount_amt,cs_ext_sales_price,cs_ext_wholesale_cost,cs_ext_list_price,cs_sold_date_sk] - BroadcastHashJoin [c_customer_sk,cs_bill_customer_sk] - Filter [c_customer_sk,c_customer_id] - ColumnarToRow - InputAdapter - Scan parquet default.customer [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] - InputAdapter - BroadcastExchange #10 - WholeStageCodegen (8) - Filter [cs_bill_customer_sk] - ColumnarToRow - InputAdapter - Scan parquet default.catalog_sales [cs_bill_customer_sk,cs_ext_discount_amt,cs_ext_sales_price,cs_ext_wholesale_cost,cs_ext_list_price,cs_sold_date_sk] - ReusedSubquery [d_date_sk] #1 - InputAdapter - ReusedExchange [d_date_sk,d_year] #3 + Filter [year_total] + HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum,isEmpty] [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true)),customer_id,year_total,sum,isEmpty] + InputAdapter + Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #9 + WholeStageCodegen (10) + HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,cs_ext_list_price,cs_ext_wholesale_cost,cs_ext_discount_amt,cs_ext_sales_price] [sum,isEmpty,sum,isEmpty] + Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,cs_ext_discount_amt,cs_ext_sales_price,cs_ext_wholesale_cost,cs_ext_list_price,d_year] + BroadcastHashJoin [cs_sold_date_sk,d_date_sk] + Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,cs_ext_discount_amt,cs_ext_sales_price,cs_ext_wholesale_cost,cs_ext_list_price,cs_sold_date_sk] + BroadcastHashJoin [c_customer_sk,cs_bill_customer_sk] + Filter [c_customer_sk,c_customer_id] + ColumnarToRow + InputAdapter + Scan parquet default.customer [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] + InputAdapter + BroadcastExchange #10 + WholeStageCodegen (8) + Filter [cs_bill_customer_sk] + ColumnarToRow + InputAdapter + Scan parquet default.catalog_sales [cs_bill_customer_sk,cs_ext_discount_amt,cs_ext_sales_price,cs_ext_wholesale_cost,cs_ext_list_price,cs_sold_date_sk] + ReusedSubquery [d_date_sk] #1 + InputAdapter + ReusedExchange [d_date_sk,d_year] #3 InputAdapter BroadcastExchange #11 WholeStageCodegen (15) @@ -128,31 +127,30 @@ TakeOrderedAndProject [customer_id,customer_first_name,customer_last_name,custom InputAdapter BroadcastExchange #14 WholeStageCodegen (19) - Project [customer_id,year_total] - Filter [year_total] - HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum,isEmpty] [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true)),customer_id,year_total,sum,isEmpty] - InputAdapter - Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #15 - WholeStageCodegen (18) - HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,ws_ext_list_price,ws_ext_wholesale_cost,ws_ext_discount_amt,ws_ext_sales_price] [sum,isEmpty,sum,isEmpty] - Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ws_ext_discount_amt,ws_ext_sales_price,ws_ext_wholesale_cost,ws_ext_list_price,d_year] - BroadcastHashJoin [ws_sold_date_sk,d_date_sk] - Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ws_ext_discount_amt,ws_ext_sales_price,ws_ext_wholesale_cost,ws_ext_list_price,ws_sold_date_sk] - BroadcastHashJoin [c_customer_sk,ws_bill_customer_sk] - Filter [c_customer_sk,c_customer_id] - ColumnarToRow - InputAdapter - Scan parquet default.customer [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] - InputAdapter - BroadcastExchange #16 - WholeStageCodegen (16) - Filter [ws_bill_customer_sk] - ColumnarToRow - InputAdapter - Scan parquet default.web_sales [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_sales_price,ws_ext_wholesale_cost,ws_ext_list_price,ws_sold_date_sk] - ReusedSubquery [d_date_sk] #1 - InputAdapter - ReusedExchange [d_date_sk,d_year] #3 + Filter [year_total] + HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum,isEmpty] [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true)),customer_id,year_total,sum,isEmpty] + InputAdapter + Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #15 + WholeStageCodegen (18) + HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,ws_ext_list_price,ws_ext_wholesale_cost,ws_ext_discount_amt,ws_ext_sales_price] [sum,isEmpty,sum,isEmpty] + Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ws_ext_discount_amt,ws_ext_sales_price,ws_ext_wholesale_cost,ws_ext_list_price,d_year] + BroadcastHashJoin [ws_sold_date_sk,d_date_sk] + Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ws_ext_discount_amt,ws_ext_sales_price,ws_ext_wholesale_cost,ws_ext_list_price,ws_sold_date_sk] + BroadcastHashJoin [c_customer_sk,ws_bill_customer_sk] + Filter [c_customer_sk,c_customer_id] + ColumnarToRow + InputAdapter + Scan parquet default.customer [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] + InputAdapter + BroadcastExchange #16 + WholeStageCodegen (16) + Filter [ws_bill_customer_sk] + ColumnarToRow + InputAdapter + Scan parquet default.web_sales [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_sales_price,ws_ext_wholesale_cost,ws_ext_list_price,ws_sold_date_sk] + ReusedSubquery [d_date_sk] #1 + InputAdapter + ReusedExchange [d_date_sk,d_year] #3 InputAdapter BroadcastExchange #17 WholeStageCodegen (23) diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q70.sf100/explain.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q70.sf100/explain.txt index bb0ceeabca2ac..f18d02d50e0af 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q70.sf100/explain.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q70.sf100/explain.txt @@ -1,47 +1,46 @@ == Physical Plan == -TakeOrderedAndProject (43) -+- * Project (42) - +- Window (41) - +- * Sort (40) - +- Exchange (39) - +- * HashAggregate (38) - +- Exchange (37) - +- * HashAggregate (36) - +- * Expand (35) - +- * Project (34) - +- * BroadcastHashJoin Inner BuildRight (33) +TakeOrderedAndProject (42) ++- * Project (41) + +- Window (40) + +- * Sort (39) + +- Exchange (38) + +- * HashAggregate (37) + +- Exchange (36) + +- * HashAggregate (35) + +- * Expand (34) + +- * Project (33) + +- * BroadcastHashJoin Inner BuildRight (32) :- * Project (6) : +- * BroadcastHashJoin Inner BuildRight (5) : :- * Filter (3) : : +- * ColumnarToRow (2) : : +- Scan parquet default.store_sales (1) : +- ReusedExchange (4) - +- BroadcastExchange (32) - +- * BroadcastHashJoin LeftSemi BuildRight (31) + +- BroadcastExchange (31) + +- * BroadcastHashJoin LeftSemi BuildRight (30) :- * Filter (9) : +- * ColumnarToRow (8) : +- Scan parquet default.store (7) - +- BroadcastExchange (30) - +- * Project (29) - +- * Filter (28) - +- Window (27) - +- * Sort (26) - +- Exchange (25) - +- * HashAggregate (24) - +- Exchange (23) - +- * HashAggregate (22) - +- * Project (21) - +- * BroadcastHashJoin Inner BuildRight (20) - :- * Project (15) - : +- * BroadcastHashJoin Inner BuildRight (14) - : :- * Filter (12) - : : +- * ColumnarToRow (11) - : : +- Scan parquet default.store_sales (10) - : +- ReusedExchange (13) - +- BroadcastExchange (19) - +- * Filter (18) - +- * ColumnarToRow (17) - +- Scan parquet default.store (16) + +- BroadcastExchange (29) + +- * Project (28) + +- * Filter (27) + +- Window (26) + +- * Sort (25) + +- * HashAggregate (24) + +- Exchange (23) + +- * HashAggregate (22) + +- * Project (21) + +- * BroadcastHashJoin Inner BuildRight (20) + :- * Project (15) + : +- * BroadcastHashJoin Inner BuildRight (14) + : :- * Filter (12) + : : +- * ColumnarToRow (11) + : : +- Scan parquet default.store_sales (10) + : +- ReusedExchange (13) + +- BroadcastExchange (19) + +- * Filter (18) + +- * ColumnarToRow (17) + +- Scan parquet default.store (16) (1) Scan parquet default.store_sales @@ -52,22 +51,22 @@ PartitionFilters: [isnotnull(ss_sold_date_sk#3), dynamicpruningexpression(ss_sol PushedFilters: [IsNotNull(ss_store_sk)] ReadSchema: struct -(2) ColumnarToRow [codegen id : 9] +(2) ColumnarToRow [codegen id : 8] Input [3]: [ss_store_sk#1, ss_net_profit#2, ss_sold_date_sk#3] -(3) Filter [codegen id : 9] +(3) Filter [codegen id : 8] Input [3]: [ss_store_sk#1, ss_net_profit#2, ss_sold_date_sk#3] Condition : isnotnull(ss_store_sk#1) -(4) ReusedExchange [Reuses operator id: 48] +(4) ReusedExchange [Reuses operator id: 47] Output [1]: [d_date_sk#5] -(5) BroadcastHashJoin [codegen id : 9] +(5) BroadcastHashJoin [codegen id : 8] Left keys [1]: [ss_sold_date_sk#3] Right keys [1]: [d_date_sk#5] Join condition: None -(6) Project [codegen id : 9] +(6) Project [codegen id : 8] Output [2]: [ss_store_sk#1, ss_net_profit#2] Input [4]: [ss_store_sk#1, ss_net_profit#2, ss_sold_date_sk#3, d_date_sk#5] @@ -78,10 +77,10 @@ Location [not included in comparison]/{warehouse_dir}/store] PushedFilters: [IsNotNull(s_store_sk)] ReadSchema: struct -(8) ColumnarToRow [codegen id : 8] +(8) ColumnarToRow [codegen id : 7] Input [3]: [s_store_sk#6, s_county#7, s_state#8] -(9) Filter [codegen id : 8] +(9) Filter [codegen id : 7] Input [3]: [s_store_sk#6, s_county#7, s_state#8] Condition : isnotnull(s_store_sk#6) @@ -100,7 +99,7 @@ Input [3]: [ss_store_sk#9, ss_net_profit#10, ss_sold_date_sk#11] Input [3]: [ss_store_sk#9, ss_net_profit#10, ss_sold_date_sk#11] Condition : isnotnull(ss_store_sk#9) -(13) ReusedExchange [Reuses operator id: 48] +(13) ReusedExchange [Reuses operator id: 47] Output [1]: [d_date_sk#12] (14) BroadcastHashJoin [codegen id : 4] @@ -155,123 +154,119 @@ Input [2]: [s_state#14, sum#17] Keys [1]: [s_state#14] Functions [1]: [sum(UnscaledValue(ss_net_profit#10))] Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_profit#10))#19] -Results [3]: [s_state#14 AS s_state#20, s_state#14, MakeDecimal(sum(UnscaledValue(ss_net_profit#10))#19,17,2) AS _w2#21] +Results [3]: [s_state#14, s_state#14, MakeDecimal(sum(UnscaledValue(ss_net_profit#10))#19,17,2) AS _w2#20] -(25) Exchange -Input [3]: [s_state#20, s_state#14, _w2#21] -Arguments: hashpartitioning(s_state#14, 5), ENSURE_REQUIREMENTS, [id=#22] +(25) Sort [codegen id : 5] +Input [3]: [s_state#14, s_state#14, _w2#20] +Arguments: [s_state#14 ASC NULLS FIRST, _w2#20 DESC NULLS LAST], false, 0 -(26) Sort [codegen id : 6] -Input [3]: [s_state#20, s_state#14, _w2#21] -Arguments: [s_state#14 ASC NULLS FIRST, _w2#21 DESC NULLS LAST], false, 0 +(26) Window +Input [3]: [s_state#14, s_state#14, _w2#20] +Arguments: [rank(_w2#20) windowspecdefinition(s_state#14, _w2#20 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS ranking#21], [s_state#14], [_w2#20 DESC NULLS LAST] -(27) Window -Input [3]: [s_state#20, s_state#14, _w2#21] -Arguments: [rank(_w2#21) windowspecdefinition(s_state#14, _w2#21 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS ranking#23], [s_state#14], [_w2#21 DESC NULLS LAST] +(27) Filter [codegen id : 6] +Input [4]: [s_state#14, s_state#14, _w2#20, ranking#21] +Condition : (ranking#21 <= 5) -(28) Filter [codegen id : 7] -Input [4]: [s_state#20, s_state#14, _w2#21, ranking#23] -Condition : (ranking#23 <= 5) +(28) Project [codegen id : 6] +Output [1]: [s_state#14] +Input [4]: [s_state#14, s_state#14, _w2#20, ranking#21] -(29) Project [codegen id : 7] -Output [1]: [s_state#20] -Input [4]: [s_state#20, s_state#14, _w2#21, ranking#23] +(29) BroadcastExchange +Input [1]: [s_state#14] +Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#22] -(30) BroadcastExchange -Input [1]: [s_state#20] -Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#24] - -(31) BroadcastHashJoin [codegen id : 8] +(30) BroadcastHashJoin [codegen id : 7] Left keys [1]: [s_state#8] -Right keys [1]: [s_state#20] +Right keys [1]: [s_state#14] Join condition: None -(32) BroadcastExchange +(31) BroadcastExchange Input [3]: [s_store_sk#6, s_county#7, s_state#8] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#25] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#23] -(33) BroadcastHashJoin [codegen id : 9] +(32) BroadcastHashJoin [codegen id : 8] Left keys [1]: [ss_store_sk#1] Right keys [1]: [s_store_sk#6] Join condition: None -(34) Project [codegen id : 9] +(33) Project [codegen id : 8] Output [3]: [ss_net_profit#2, s_state#8, s_county#7] Input [5]: [ss_store_sk#1, ss_net_profit#2, s_store_sk#6, s_county#7, s_state#8] -(35) Expand [codegen id : 9] +(34) Expand [codegen id : 8] Input [3]: [ss_net_profit#2, s_state#8, s_county#7] -Arguments: [[ss_net_profit#2, s_state#8, s_county#7, 0], [ss_net_profit#2, s_state#8, null, 1], [ss_net_profit#2, null, null, 3]], [ss_net_profit#2, s_state#26, s_county#27, spark_grouping_id#28] +Arguments: [[ss_net_profit#2, s_state#8, s_county#7, 0], [ss_net_profit#2, s_state#8, null, 1], [ss_net_profit#2, null, null, 3]], [ss_net_profit#2, s_state#24, s_county#25, spark_grouping_id#26] -(36) HashAggregate [codegen id : 9] -Input [4]: [ss_net_profit#2, s_state#26, s_county#27, spark_grouping_id#28] -Keys [3]: [s_state#26, s_county#27, spark_grouping_id#28] +(35) HashAggregate [codegen id : 8] +Input [4]: [ss_net_profit#2, s_state#24, s_county#25, spark_grouping_id#26] +Keys [3]: [s_state#24, s_county#25, spark_grouping_id#26] Functions [1]: [partial_sum(UnscaledValue(ss_net_profit#2))] -Aggregate Attributes [1]: [sum#29] -Results [4]: [s_state#26, s_county#27, spark_grouping_id#28, sum#30] +Aggregate Attributes [1]: [sum#27] +Results [4]: [s_state#24, s_county#25, spark_grouping_id#26, sum#28] -(37) Exchange -Input [4]: [s_state#26, s_county#27, spark_grouping_id#28, sum#30] -Arguments: hashpartitioning(s_state#26, s_county#27, spark_grouping_id#28, 5), ENSURE_REQUIREMENTS, [id=#31] +(36) Exchange +Input [4]: [s_state#24, s_county#25, spark_grouping_id#26, sum#28] +Arguments: hashpartitioning(s_state#24, s_county#25, spark_grouping_id#26, 5), ENSURE_REQUIREMENTS, [id=#29] -(38) HashAggregate [codegen id : 10] -Input [4]: [s_state#26, s_county#27, spark_grouping_id#28, sum#30] -Keys [3]: [s_state#26, s_county#27, spark_grouping_id#28] +(37) HashAggregate [codegen id : 9] +Input [4]: [s_state#24, s_county#25, spark_grouping_id#26, sum#28] +Keys [3]: [s_state#24, s_county#25, spark_grouping_id#26] Functions [1]: [sum(UnscaledValue(ss_net_profit#2))] -Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_profit#2))#32] -Results [7]: [MakeDecimal(sum(UnscaledValue(ss_net_profit#2))#32,17,2) AS total_sum#33, s_state#26, s_county#27, (cast((shiftright(spark_grouping_id#28, 1) & 1) as tinyint) + cast((shiftright(spark_grouping_id#28, 0) & 1) as tinyint)) AS lochierarchy#34, (cast((shiftright(spark_grouping_id#28, 1) & 1) as tinyint) + cast((shiftright(spark_grouping_id#28, 0) & 1) as tinyint)) AS _w1#35, CASE WHEN (cast((shiftright(spark_grouping_id#28, 0) & 1) as tinyint) = 0) THEN s_state#26 END AS _w2#36, MakeDecimal(sum(UnscaledValue(ss_net_profit#2))#32,17,2) AS _w3#37] +Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_profit#2))#30] +Results [7]: [MakeDecimal(sum(UnscaledValue(ss_net_profit#2))#30,17,2) AS total_sum#31, s_state#24, s_county#25, (cast((shiftright(spark_grouping_id#26, 1) & 1) as tinyint) + cast((shiftright(spark_grouping_id#26, 0) & 1) as tinyint)) AS lochierarchy#32, (cast((shiftright(spark_grouping_id#26, 1) & 1) as tinyint) + cast((shiftright(spark_grouping_id#26, 0) & 1) as tinyint)) AS _w1#33, CASE WHEN (cast((shiftright(spark_grouping_id#26, 0) & 1) as tinyint) = 0) THEN s_state#24 END AS _w2#34, MakeDecimal(sum(UnscaledValue(ss_net_profit#2))#30,17,2) AS _w3#35] -(39) Exchange -Input [7]: [total_sum#33, s_state#26, s_county#27, lochierarchy#34, _w1#35, _w2#36, _w3#37] -Arguments: hashpartitioning(_w1#35, _w2#36, 5), ENSURE_REQUIREMENTS, [id=#38] +(38) Exchange +Input [7]: [total_sum#31, s_state#24, s_county#25, lochierarchy#32, _w1#33, _w2#34, _w3#35] +Arguments: hashpartitioning(_w1#33, _w2#34, 5), ENSURE_REQUIREMENTS, [id=#36] -(40) Sort [codegen id : 11] -Input [7]: [total_sum#33, s_state#26, s_county#27, lochierarchy#34, _w1#35, _w2#36, _w3#37] -Arguments: [_w1#35 ASC NULLS FIRST, _w2#36 ASC NULLS FIRST, _w3#37 DESC NULLS LAST], false, 0 +(39) Sort [codegen id : 10] +Input [7]: [total_sum#31, s_state#24, s_county#25, lochierarchy#32, _w1#33, _w2#34, _w3#35] +Arguments: [_w1#33 ASC NULLS FIRST, _w2#34 ASC NULLS FIRST, _w3#35 DESC NULLS LAST], false, 0 -(41) Window -Input [7]: [total_sum#33, s_state#26, s_county#27, lochierarchy#34, _w1#35, _w2#36, _w3#37] -Arguments: [rank(_w3#37) windowspecdefinition(_w1#35, _w2#36, _w3#37 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS rank_within_parent#39], [_w1#35, _w2#36], [_w3#37 DESC NULLS LAST] +(40) Window +Input [7]: [total_sum#31, s_state#24, s_county#25, lochierarchy#32, _w1#33, _w2#34, _w3#35] +Arguments: [rank(_w3#35) windowspecdefinition(_w1#33, _w2#34, _w3#35 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS rank_within_parent#37], [_w1#33, _w2#34], [_w3#35 DESC NULLS LAST] -(42) Project [codegen id : 12] -Output [5]: [total_sum#33, s_state#26, s_county#27, lochierarchy#34, rank_within_parent#39] -Input [8]: [total_sum#33, s_state#26, s_county#27, lochierarchy#34, _w1#35, _w2#36, _w3#37, rank_within_parent#39] +(41) Project [codegen id : 11] +Output [5]: [total_sum#31, s_state#24, s_county#25, lochierarchy#32, rank_within_parent#37] +Input [8]: [total_sum#31, s_state#24, s_county#25, lochierarchy#32, _w1#33, _w2#34, _w3#35, rank_within_parent#37] -(43) TakeOrderedAndProject -Input [5]: [total_sum#33, s_state#26, s_county#27, lochierarchy#34, rank_within_parent#39] -Arguments: 100, [lochierarchy#34 DESC NULLS LAST, CASE WHEN (lochierarchy#34 = 0) THEN s_state#26 END ASC NULLS FIRST, rank_within_parent#39 ASC NULLS FIRST], [total_sum#33, s_state#26, s_county#27, lochierarchy#34, rank_within_parent#39] +(42) TakeOrderedAndProject +Input [5]: [total_sum#31, s_state#24, s_county#25, lochierarchy#32, rank_within_parent#37] +Arguments: 100, [lochierarchy#32 DESC NULLS LAST, CASE WHEN (lochierarchy#32 = 0) THEN s_state#24 END ASC NULLS FIRST, rank_within_parent#37 ASC NULLS FIRST], [total_sum#31, s_state#24, s_county#25, lochierarchy#32, rank_within_parent#37] ===== Subqueries ===== Subquery:1 Hosting operator id = 1 Hosting Expression = ss_sold_date_sk#3 IN dynamicpruning#4 -BroadcastExchange (48) -+- * Project (47) - +- * Filter (46) - +- * ColumnarToRow (45) - +- Scan parquet default.date_dim (44) +BroadcastExchange (47) ++- * Project (46) + +- * Filter (45) + +- * ColumnarToRow (44) + +- Scan parquet default.date_dim (43) -(44) Scan parquet default.date_dim -Output [2]: [d_date_sk#5, d_month_seq#40] +(43) Scan parquet default.date_dim +Output [2]: [d_date_sk#5, d_month_seq#38] Batched: true Location [not included in comparison]/{warehouse_dir}/date_dim] PushedFilters: [IsNotNull(d_month_seq), GreaterThanOrEqual(d_month_seq,1200), LessThanOrEqual(d_month_seq,1211), IsNotNull(d_date_sk)] ReadSchema: struct -(45) ColumnarToRow [codegen id : 1] -Input [2]: [d_date_sk#5, d_month_seq#40] +(44) ColumnarToRow [codegen id : 1] +Input [2]: [d_date_sk#5, d_month_seq#38] -(46) Filter [codegen id : 1] -Input [2]: [d_date_sk#5, d_month_seq#40] -Condition : (((isnotnull(d_month_seq#40) AND (d_month_seq#40 >= 1200)) AND (d_month_seq#40 <= 1211)) AND isnotnull(d_date_sk#5)) +(45) Filter [codegen id : 1] +Input [2]: [d_date_sk#5, d_month_seq#38] +Condition : (((isnotnull(d_month_seq#38) AND (d_month_seq#38 >= 1200)) AND (d_month_seq#38 <= 1211)) AND isnotnull(d_date_sk#5)) -(47) Project [codegen id : 1] +(46) Project [codegen id : 1] Output [1]: [d_date_sk#5] -Input [2]: [d_date_sk#5, d_month_seq#40] +Input [2]: [d_date_sk#5, d_month_seq#38] -(48) BroadcastExchange +(47) BroadcastExchange Input [1]: [d_date_sk#5] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [id=#41] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [id=#39] Subquery:2 Hosting operator id = 10 Hosting Expression = ss_sold_date_sk#11 IN dynamicpruning#4 diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q70.sf100/simplified.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q70.sf100/simplified.txt index ed4e7e72bd2b0..13d832c913449 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q70.sf100/simplified.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q70.sf100/simplified.txt @@ -1,17 +1,17 @@ TakeOrderedAndProject [lochierarchy,s_state,rank_within_parent,total_sum,s_county] - WholeStageCodegen (12) + WholeStageCodegen (11) Project [total_sum,s_state,s_county,lochierarchy,rank_within_parent] InputAdapter Window [_w3,_w1,_w2] - WholeStageCodegen (11) + WholeStageCodegen (10) Sort [_w1,_w2,_w3] InputAdapter Exchange [_w1,_w2] #1 - WholeStageCodegen (10) + WholeStageCodegen (9) HashAggregate [s_state,s_county,spark_grouping_id,sum] [sum(UnscaledValue(ss_net_profit)),total_sum,lochierarchy,_w1,_w2,_w3,sum] InputAdapter Exchange [s_state,s_county,spark_grouping_id] #2 - WholeStageCodegen (9) + WholeStageCodegen (8) HashAggregate [s_state,s_county,spark_grouping_id,ss_net_profit] [sum,sum] Expand [ss_net_profit,s_state,s_county] Project [ss_net_profit,s_state,s_county] @@ -34,7 +34,7 @@ TakeOrderedAndProject [lochierarchy,s_state,rank_within_parent,total_sum,s_count ReusedExchange [d_date_sk] #3 InputAdapter BroadcastExchange #4 - WholeStageCodegen (8) + WholeStageCodegen (7) BroadcastHashJoin [s_state,s_state] Filter [s_store_sk] ColumnarToRow @@ -42,36 +42,33 @@ TakeOrderedAndProject [lochierarchy,s_state,rank_within_parent,total_sum,s_count Scan parquet default.store [s_store_sk,s_county,s_state] InputAdapter BroadcastExchange #5 - WholeStageCodegen (7) + WholeStageCodegen (6) Project [s_state] Filter [ranking] InputAdapter Window [_w2,s_state] - WholeStageCodegen (6) + WholeStageCodegen (5) Sort [s_state,_w2] - InputAdapter - Exchange [s_state] #6 - WholeStageCodegen (5) - HashAggregate [s_state,sum] [sum(UnscaledValue(ss_net_profit)),s_state,_w2,sum] - InputAdapter - Exchange [s_state] #7 - WholeStageCodegen (4) - HashAggregate [s_state,ss_net_profit] [sum,sum] - Project [ss_net_profit,s_state] - BroadcastHashJoin [ss_store_sk,s_store_sk] - Project [ss_store_sk,ss_net_profit] - BroadcastHashJoin [ss_sold_date_sk,d_date_sk] - Filter [ss_store_sk] - ColumnarToRow - InputAdapter - Scan parquet default.store_sales [ss_store_sk,ss_net_profit,ss_sold_date_sk] - ReusedSubquery [d_date_sk] #1 + HashAggregate [sum] [sum(UnscaledValue(ss_net_profit)),s_state,_w2,sum] + InputAdapter + Exchange [s_state] #6 + WholeStageCodegen (4) + HashAggregate [s_state,ss_net_profit] [sum,sum] + Project [ss_net_profit,s_state] + BroadcastHashJoin [ss_store_sk,s_store_sk] + Project [ss_store_sk,ss_net_profit] + BroadcastHashJoin [ss_sold_date_sk,d_date_sk] + Filter [ss_store_sk] + ColumnarToRow + InputAdapter + Scan parquet default.store_sales [ss_store_sk,ss_net_profit,ss_sold_date_sk] + ReusedSubquery [d_date_sk] #1 + InputAdapter + ReusedExchange [d_date_sk] #3 + InputAdapter + BroadcastExchange #7 + WholeStageCodegen (3) + Filter [s_store_sk] + ColumnarToRow InputAdapter - ReusedExchange [d_date_sk] #3 - InputAdapter - BroadcastExchange #8 - WholeStageCodegen (3) - Filter [s_store_sk] - ColumnarToRow - InputAdapter - Scan parquet default.store [s_store_sk,s_state] + Scan parquet default.store [s_store_sk,s_state] diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q70/explain.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q70/explain.txt index a358870666530..482d7a3975c56 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q70/explain.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q70/explain.txt @@ -1,47 +1,46 @@ == Physical Plan == -TakeOrderedAndProject (43) -+- * Project (42) - +- Window (41) - +- * Sort (40) - +- Exchange (39) - +- * HashAggregate (38) - +- Exchange (37) - +- * HashAggregate (36) - +- * Expand (35) - +- * Project (34) - +- * BroadcastHashJoin Inner BuildRight (33) +TakeOrderedAndProject (42) ++- * Project (41) + +- Window (40) + +- * Sort (39) + +- Exchange (38) + +- * HashAggregate (37) + +- Exchange (36) + +- * HashAggregate (35) + +- * Expand (34) + +- * Project (33) + +- * BroadcastHashJoin Inner BuildRight (32) :- * Project (6) : +- * BroadcastHashJoin Inner BuildRight (5) : :- * Filter (3) : : +- * ColumnarToRow (2) : : +- Scan parquet default.store_sales (1) : +- ReusedExchange (4) - +- BroadcastExchange (32) - +- * BroadcastHashJoin LeftSemi BuildRight (31) + +- BroadcastExchange (31) + +- * BroadcastHashJoin LeftSemi BuildRight (30) :- * Filter (9) : +- * ColumnarToRow (8) : +- Scan parquet default.store (7) - +- BroadcastExchange (30) - +- * Project (29) - +- * Filter (28) - +- Window (27) - +- * Sort (26) - +- Exchange (25) - +- * HashAggregate (24) - +- Exchange (23) - +- * HashAggregate (22) - +- * Project (21) - +- * BroadcastHashJoin Inner BuildRight (20) - :- * Project (18) - : +- * BroadcastHashJoin Inner BuildRight (17) - : :- * Filter (12) - : : +- * ColumnarToRow (11) - : : +- Scan parquet default.store_sales (10) - : +- BroadcastExchange (16) - : +- * Filter (15) - : +- * ColumnarToRow (14) - : +- Scan parquet default.store (13) - +- ReusedExchange (19) + +- BroadcastExchange (29) + +- * Project (28) + +- * Filter (27) + +- Window (26) + +- * Sort (25) + +- * HashAggregate (24) + +- Exchange (23) + +- * HashAggregate (22) + +- * Project (21) + +- * BroadcastHashJoin Inner BuildRight (20) + :- * Project (18) + : +- * BroadcastHashJoin Inner BuildRight (17) + : :- * Filter (12) + : : +- * ColumnarToRow (11) + : : +- Scan parquet default.store_sales (10) + : +- BroadcastExchange (16) + : +- * Filter (15) + : +- * ColumnarToRow (14) + : +- Scan parquet default.store (13) + +- ReusedExchange (19) (1) Scan parquet default.store_sales @@ -52,22 +51,22 @@ PartitionFilters: [isnotnull(ss_sold_date_sk#3), dynamicpruningexpression(ss_sol PushedFilters: [IsNotNull(ss_store_sk)] ReadSchema: struct -(2) ColumnarToRow [codegen id : 9] +(2) ColumnarToRow [codegen id : 8] Input [3]: [ss_store_sk#1, ss_net_profit#2, ss_sold_date_sk#3] -(3) Filter [codegen id : 9] +(3) Filter [codegen id : 8] Input [3]: [ss_store_sk#1, ss_net_profit#2, ss_sold_date_sk#3] Condition : isnotnull(ss_store_sk#1) -(4) ReusedExchange [Reuses operator id: 48] +(4) ReusedExchange [Reuses operator id: 47] Output [1]: [d_date_sk#5] -(5) BroadcastHashJoin [codegen id : 9] +(5) BroadcastHashJoin [codegen id : 8] Left keys [1]: [ss_sold_date_sk#3] Right keys [1]: [d_date_sk#5] Join condition: None -(6) Project [codegen id : 9] +(6) Project [codegen id : 8] Output [2]: [ss_store_sk#1, ss_net_profit#2] Input [4]: [ss_store_sk#1, ss_net_profit#2, ss_sold_date_sk#3, d_date_sk#5] @@ -78,10 +77,10 @@ Location [not included in comparison]/{warehouse_dir}/store] PushedFilters: [IsNotNull(s_store_sk)] ReadSchema: struct -(8) ColumnarToRow [codegen id : 8] +(8) ColumnarToRow [codegen id : 7] Input [3]: [s_store_sk#6, s_county#7, s_state#8] -(9) Filter [codegen id : 8] +(9) Filter [codegen id : 7] Input [3]: [s_store_sk#6, s_county#7, s_state#8] Condition : isnotnull(s_store_sk#6) @@ -127,7 +126,7 @@ Join condition: None Output [3]: [ss_net_profit#10, ss_sold_date_sk#11, s_state#13] Input [5]: [ss_store_sk#9, ss_net_profit#10, ss_sold_date_sk#11, s_store_sk#12, s_state#13] -(19) ReusedExchange [Reuses operator id: 48] +(19) ReusedExchange [Reuses operator id: 47] Output [1]: [d_date_sk#15] (20) BroadcastHashJoin [codegen id : 4] @@ -155,123 +154,119 @@ Input [2]: [s_state#13, sum#17] Keys [1]: [s_state#13] Functions [1]: [sum(UnscaledValue(ss_net_profit#10))] Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_profit#10))#19] -Results [3]: [s_state#13 AS s_state#20, s_state#13, MakeDecimal(sum(UnscaledValue(ss_net_profit#10))#19,17,2) AS _w2#21] +Results [3]: [s_state#13, s_state#13, MakeDecimal(sum(UnscaledValue(ss_net_profit#10))#19,17,2) AS _w2#20] -(25) Exchange -Input [3]: [s_state#20, s_state#13, _w2#21] -Arguments: hashpartitioning(s_state#13, 5), ENSURE_REQUIREMENTS, [id=#22] +(25) Sort [codegen id : 5] +Input [3]: [s_state#13, s_state#13, _w2#20] +Arguments: [s_state#13 ASC NULLS FIRST, _w2#20 DESC NULLS LAST], false, 0 -(26) Sort [codegen id : 6] -Input [3]: [s_state#20, s_state#13, _w2#21] -Arguments: [s_state#13 ASC NULLS FIRST, _w2#21 DESC NULLS LAST], false, 0 +(26) Window +Input [3]: [s_state#13, s_state#13, _w2#20] +Arguments: [rank(_w2#20) windowspecdefinition(s_state#13, _w2#20 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS ranking#21], [s_state#13], [_w2#20 DESC NULLS LAST] -(27) Window -Input [3]: [s_state#20, s_state#13, _w2#21] -Arguments: [rank(_w2#21) windowspecdefinition(s_state#13, _w2#21 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS ranking#23], [s_state#13], [_w2#21 DESC NULLS LAST] +(27) Filter [codegen id : 6] +Input [4]: [s_state#13, s_state#13, _w2#20, ranking#21] +Condition : (ranking#21 <= 5) -(28) Filter [codegen id : 7] -Input [4]: [s_state#20, s_state#13, _w2#21, ranking#23] -Condition : (ranking#23 <= 5) +(28) Project [codegen id : 6] +Output [1]: [s_state#13] +Input [4]: [s_state#13, s_state#13, _w2#20, ranking#21] -(29) Project [codegen id : 7] -Output [1]: [s_state#20] -Input [4]: [s_state#20, s_state#13, _w2#21, ranking#23] +(29) BroadcastExchange +Input [1]: [s_state#13] +Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#22] -(30) BroadcastExchange -Input [1]: [s_state#20] -Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#24] - -(31) BroadcastHashJoin [codegen id : 8] +(30) BroadcastHashJoin [codegen id : 7] Left keys [1]: [s_state#8] -Right keys [1]: [s_state#20] +Right keys [1]: [s_state#13] Join condition: None -(32) BroadcastExchange +(31) BroadcastExchange Input [3]: [s_store_sk#6, s_county#7, s_state#8] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#25] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#23] -(33) BroadcastHashJoin [codegen id : 9] +(32) BroadcastHashJoin [codegen id : 8] Left keys [1]: [ss_store_sk#1] Right keys [1]: [s_store_sk#6] Join condition: None -(34) Project [codegen id : 9] +(33) Project [codegen id : 8] Output [3]: [ss_net_profit#2, s_state#8, s_county#7] Input [5]: [ss_store_sk#1, ss_net_profit#2, s_store_sk#6, s_county#7, s_state#8] -(35) Expand [codegen id : 9] +(34) Expand [codegen id : 8] Input [3]: [ss_net_profit#2, s_state#8, s_county#7] -Arguments: [[ss_net_profit#2, s_state#8, s_county#7, 0], [ss_net_profit#2, s_state#8, null, 1], [ss_net_profit#2, null, null, 3]], [ss_net_profit#2, s_state#26, s_county#27, spark_grouping_id#28] +Arguments: [[ss_net_profit#2, s_state#8, s_county#7, 0], [ss_net_profit#2, s_state#8, null, 1], [ss_net_profit#2, null, null, 3]], [ss_net_profit#2, s_state#24, s_county#25, spark_grouping_id#26] -(36) HashAggregate [codegen id : 9] -Input [4]: [ss_net_profit#2, s_state#26, s_county#27, spark_grouping_id#28] -Keys [3]: [s_state#26, s_county#27, spark_grouping_id#28] +(35) HashAggregate [codegen id : 8] +Input [4]: [ss_net_profit#2, s_state#24, s_county#25, spark_grouping_id#26] +Keys [3]: [s_state#24, s_county#25, spark_grouping_id#26] Functions [1]: [partial_sum(UnscaledValue(ss_net_profit#2))] -Aggregate Attributes [1]: [sum#29] -Results [4]: [s_state#26, s_county#27, spark_grouping_id#28, sum#30] +Aggregate Attributes [1]: [sum#27] +Results [4]: [s_state#24, s_county#25, spark_grouping_id#26, sum#28] -(37) Exchange -Input [4]: [s_state#26, s_county#27, spark_grouping_id#28, sum#30] -Arguments: hashpartitioning(s_state#26, s_county#27, spark_grouping_id#28, 5), ENSURE_REQUIREMENTS, [id=#31] +(36) Exchange +Input [4]: [s_state#24, s_county#25, spark_grouping_id#26, sum#28] +Arguments: hashpartitioning(s_state#24, s_county#25, spark_grouping_id#26, 5), ENSURE_REQUIREMENTS, [id=#29] -(38) HashAggregate [codegen id : 10] -Input [4]: [s_state#26, s_county#27, spark_grouping_id#28, sum#30] -Keys [3]: [s_state#26, s_county#27, spark_grouping_id#28] +(37) HashAggregate [codegen id : 9] +Input [4]: [s_state#24, s_county#25, spark_grouping_id#26, sum#28] +Keys [3]: [s_state#24, s_county#25, spark_grouping_id#26] Functions [1]: [sum(UnscaledValue(ss_net_profit#2))] -Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_profit#2))#32] -Results [7]: [MakeDecimal(sum(UnscaledValue(ss_net_profit#2))#32,17,2) AS total_sum#33, s_state#26, s_county#27, (cast((shiftright(spark_grouping_id#28, 1) & 1) as tinyint) + cast((shiftright(spark_grouping_id#28, 0) & 1) as tinyint)) AS lochierarchy#34, (cast((shiftright(spark_grouping_id#28, 1) & 1) as tinyint) + cast((shiftright(spark_grouping_id#28, 0) & 1) as tinyint)) AS _w1#35, CASE WHEN (cast((shiftright(spark_grouping_id#28, 0) & 1) as tinyint) = 0) THEN s_state#26 END AS _w2#36, MakeDecimal(sum(UnscaledValue(ss_net_profit#2))#32,17,2) AS _w3#37] +Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_profit#2))#30] +Results [7]: [MakeDecimal(sum(UnscaledValue(ss_net_profit#2))#30,17,2) AS total_sum#31, s_state#24, s_county#25, (cast((shiftright(spark_grouping_id#26, 1) & 1) as tinyint) + cast((shiftright(spark_grouping_id#26, 0) & 1) as tinyint)) AS lochierarchy#32, (cast((shiftright(spark_grouping_id#26, 1) & 1) as tinyint) + cast((shiftright(spark_grouping_id#26, 0) & 1) as tinyint)) AS _w1#33, CASE WHEN (cast((shiftright(spark_grouping_id#26, 0) & 1) as tinyint) = 0) THEN s_state#24 END AS _w2#34, MakeDecimal(sum(UnscaledValue(ss_net_profit#2))#30,17,2) AS _w3#35] -(39) Exchange -Input [7]: [total_sum#33, s_state#26, s_county#27, lochierarchy#34, _w1#35, _w2#36, _w3#37] -Arguments: hashpartitioning(_w1#35, _w2#36, 5), ENSURE_REQUIREMENTS, [id=#38] +(38) Exchange +Input [7]: [total_sum#31, s_state#24, s_county#25, lochierarchy#32, _w1#33, _w2#34, _w3#35] +Arguments: hashpartitioning(_w1#33, _w2#34, 5), ENSURE_REQUIREMENTS, [id=#36] -(40) Sort [codegen id : 11] -Input [7]: [total_sum#33, s_state#26, s_county#27, lochierarchy#34, _w1#35, _w2#36, _w3#37] -Arguments: [_w1#35 ASC NULLS FIRST, _w2#36 ASC NULLS FIRST, _w3#37 DESC NULLS LAST], false, 0 +(39) Sort [codegen id : 10] +Input [7]: [total_sum#31, s_state#24, s_county#25, lochierarchy#32, _w1#33, _w2#34, _w3#35] +Arguments: [_w1#33 ASC NULLS FIRST, _w2#34 ASC NULLS FIRST, _w3#35 DESC NULLS LAST], false, 0 -(41) Window -Input [7]: [total_sum#33, s_state#26, s_county#27, lochierarchy#34, _w1#35, _w2#36, _w3#37] -Arguments: [rank(_w3#37) windowspecdefinition(_w1#35, _w2#36, _w3#37 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS rank_within_parent#39], [_w1#35, _w2#36], [_w3#37 DESC NULLS LAST] +(40) Window +Input [7]: [total_sum#31, s_state#24, s_county#25, lochierarchy#32, _w1#33, _w2#34, _w3#35] +Arguments: [rank(_w3#35) windowspecdefinition(_w1#33, _w2#34, _w3#35 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS rank_within_parent#37], [_w1#33, _w2#34], [_w3#35 DESC NULLS LAST] -(42) Project [codegen id : 12] -Output [5]: [total_sum#33, s_state#26, s_county#27, lochierarchy#34, rank_within_parent#39] -Input [8]: [total_sum#33, s_state#26, s_county#27, lochierarchy#34, _w1#35, _w2#36, _w3#37, rank_within_parent#39] +(41) Project [codegen id : 11] +Output [5]: [total_sum#31, s_state#24, s_county#25, lochierarchy#32, rank_within_parent#37] +Input [8]: [total_sum#31, s_state#24, s_county#25, lochierarchy#32, _w1#33, _w2#34, _w3#35, rank_within_parent#37] -(43) TakeOrderedAndProject -Input [5]: [total_sum#33, s_state#26, s_county#27, lochierarchy#34, rank_within_parent#39] -Arguments: 100, [lochierarchy#34 DESC NULLS LAST, CASE WHEN (lochierarchy#34 = 0) THEN s_state#26 END ASC NULLS FIRST, rank_within_parent#39 ASC NULLS FIRST], [total_sum#33, s_state#26, s_county#27, lochierarchy#34, rank_within_parent#39] +(42) TakeOrderedAndProject +Input [5]: [total_sum#31, s_state#24, s_county#25, lochierarchy#32, rank_within_parent#37] +Arguments: 100, [lochierarchy#32 DESC NULLS LAST, CASE WHEN (lochierarchy#32 = 0) THEN s_state#24 END ASC NULLS FIRST, rank_within_parent#37 ASC NULLS FIRST], [total_sum#31, s_state#24, s_county#25, lochierarchy#32, rank_within_parent#37] ===== Subqueries ===== Subquery:1 Hosting operator id = 1 Hosting Expression = ss_sold_date_sk#3 IN dynamicpruning#4 -BroadcastExchange (48) -+- * Project (47) - +- * Filter (46) - +- * ColumnarToRow (45) - +- Scan parquet default.date_dim (44) +BroadcastExchange (47) ++- * Project (46) + +- * Filter (45) + +- * ColumnarToRow (44) + +- Scan parquet default.date_dim (43) -(44) Scan parquet default.date_dim -Output [2]: [d_date_sk#5, d_month_seq#40] +(43) Scan parquet default.date_dim +Output [2]: [d_date_sk#5, d_month_seq#38] Batched: true Location [not included in comparison]/{warehouse_dir}/date_dim] PushedFilters: [IsNotNull(d_month_seq), GreaterThanOrEqual(d_month_seq,1200), LessThanOrEqual(d_month_seq,1211), IsNotNull(d_date_sk)] ReadSchema: struct -(45) ColumnarToRow [codegen id : 1] -Input [2]: [d_date_sk#5, d_month_seq#40] +(44) ColumnarToRow [codegen id : 1] +Input [2]: [d_date_sk#5, d_month_seq#38] -(46) Filter [codegen id : 1] -Input [2]: [d_date_sk#5, d_month_seq#40] -Condition : (((isnotnull(d_month_seq#40) AND (d_month_seq#40 >= 1200)) AND (d_month_seq#40 <= 1211)) AND isnotnull(d_date_sk#5)) +(45) Filter [codegen id : 1] +Input [2]: [d_date_sk#5, d_month_seq#38] +Condition : (((isnotnull(d_month_seq#38) AND (d_month_seq#38 >= 1200)) AND (d_month_seq#38 <= 1211)) AND isnotnull(d_date_sk#5)) -(47) Project [codegen id : 1] +(46) Project [codegen id : 1] Output [1]: [d_date_sk#5] -Input [2]: [d_date_sk#5, d_month_seq#40] +Input [2]: [d_date_sk#5, d_month_seq#38] -(48) BroadcastExchange +(47) BroadcastExchange Input [1]: [d_date_sk#5] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [id=#41] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [id=#39] Subquery:2 Hosting operator id = 10 Hosting Expression = ss_sold_date_sk#11 IN dynamicpruning#4 diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q70/simplified.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q70/simplified.txt index b968ecc96d7c7..ca85c8faf4878 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q70/simplified.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v1_4/q70/simplified.txt @@ -1,17 +1,17 @@ TakeOrderedAndProject [lochierarchy,s_state,rank_within_parent,total_sum,s_county] - WholeStageCodegen (12) + WholeStageCodegen (11) Project [total_sum,s_state,s_county,lochierarchy,rank_within_parent] InputAdapter Window [_w3,_w1,_w2] - WholeStageCodegen (11) + WholeStageCodegen (10) Sort [_w1,_w2,_w3] InputAdapter Exchange [_w1,_w2] #1 - WholeStageCodegen (10) + WholeStageCodegen (9) HashAggregate [s_state,s_county,spark_grouping_id,sum] [sum(UnscaledValue(ss_net_profit)),total_sum,lochierarchy,_w1,_w2,_w3,sum] InputAdapter Exchange [s_state,s_county,spark_grouping_id] #2 - WholeStageCodegen (9) + WholeStageCodegen (8) HashAggregate [s_state,s_county,spark_grouping_id,ss_net_profit] [sum,sum] Expand [ss_net_profit,s_state,s_county] Project [ss_net_profit,s_state,s_county] @@ -34,7 +34,7 @@ TakeOrderedAndProject [lochierarchy,s_state,rank_within_parent,total_sum,s_count ReusedExchange [d_date_sk] #3 InputAdapter BroadcastExchange #4 - WholeStageCodegen (8) + WholeStageCodegen (7) BroadcastHashJoin [s_state,s_state] Filter [s_store_sk] ColumnarToRow @@ -42,36 +42,33 @@ TakeOrderedAndProject [lochierarchy,s_state,rank_within_parent,total_sum,s_count Scan parquet default.store [s_store_sk,s_county,s_state] InputAdapter BroadcastExchange #5 - WholeStageCodegen (7) + WholeStageCodegen (6) Project [s_state] Filter [ranking] InputAdapter Window [_w2,s_state] - WholeStageCodegen (6) + WholeStageCodegen (5) Sort [s_state,_w2] - InputAdapter - Exchange [s_state] #6 - WholeStageCodegen (5) - HashAggregate [s_state,sum] [sum(UnscaledValue(ss_net_profit)),s_state,_w2,sum] - InputAdapter - Exchange [s_state] #7 - WholeStageCodegen (4) - HashAggregate [s_state,ss_net_profit] [sum,sum] - Project [ss_net_profit,s_state] - BroadcastHashJoin [ss_sold_date_sk,d_date_sk] - Project [ss_net_profit,ss_sold_date_sk,s_state] - BroadcastHashJoin [ss_store_sk,s_store_sk] - Filter [ss_store_sk] + HashAggregate [sum] [sum(UnscaledValue(ss_net_profit)),s_state,_w2,sum] + InputAdapter + Exchange [s_state] #6 + WholeStageCodegen (4) + HashAggregate [s_state,ss_net_profit] [sum,sum] + Project [ss_net_profit,s_state] + BroadcastHashJoin [ss_sold_date_sk,d_date_sk] + Project [ss_net_profit,ss_sold_date_sk,s_state] + BroadcastHashJoin [ss_store_sk,s_store_sk] + Filter [ss_store_sk] + ColumnarToRow + InputAdapter + Scan parquet default.store_sales [ss_store_sk,ss_net_profit,ss_sold_date_sk] + ReusedSubquery [d_date_sk] #1 + InputAdapter + BroadcastExchange #7 + WholeStageCodegen (2) + Filter [s_store_sk] ColumnarToRow InputAdapter - Scan parquet default.store_sales [ss_store_sk,ss_net_profit,ss_sold_date_sk] - ReusedSubquery [d_date_sk] #1 - InputAdapter - BroadcastExchange #8 - WholeStageCodegen (2) - Filter [s_store_sk] - ColumnarToRow - InputAdapter - Scan parquet default.store [s_store_sk,s_state] - InputAdapter - ReusedExchange [d_date_sk] #3 + Scan parquet default.store [s_store_sk,s_state] + InputAdapter + ReusedExchange [d_date_sk] #3 diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q11.sf100/explain.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q11.sf100/explain.txt index 8e15a8b4c1e2a..9d018105c88af 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q11.sf100/explain.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q11.sf100/explain.txt @@ -1,9 +1,9 @@ == Physical Plan == -TakeOrderedAndProject (80) -+- * Project (79) - +- * SortMergeJoin Inner (78) - :- * Project (60) - : +- * SortMergeJoin Inner (59) +TakeOrderedAndProject (79) ++- * Project (78) + +- * SortMergeJoin Inner (77) + :- * Project (59) + : +- * SortMergeJoin Inner (58) : :- * SortMergeJoin Inner (39) : : :- * Sort (21) : : : +- Exchange (20) @@ -43,42 +43,41 @@ TakeOrderedAndProject (80) : : : +- ReusedExchange (25) : : +- * Sort (31) : : +- ReusedExchange (30) - : +- * Sort (58) - : +- Exchange (57) - : +- * Project (56) - : +- * Filter (55) - : +- * HashAggregate (54) - : +- Exchange (53) - : +- * HashAggregate (52) - : +- * Project (51) - : +- * SortMergeJoin Inner (50) - : :- * Sort (47) - : : +- Exchange (46) - : : +- * Project (45) - : : +- * BroadcastHashJoin Inner BuildRight (44) - : : :- * Filter (42) - : : : +- * ColumnarToRow (41) - : : : +- Scan parquet default.web_sales (40) - : : +- ReusedExchange (43) - : +- * Sort (49) - : +- ReusedExchange (48) - +- * Sort (77) - +- Exchange (76) - +- * HashAggregate (75) - +- Exchange (74) - +- * HashAggregate (73) - +- * Project (72) - +- * SortMergeJoin Inner (71) - :- * Sort (68) - : +- Exchange (67) - : +- * Project (66) - : +- * BroadcastHashJoin Inner BuildRight (65) - : :- * Filter (63) - : : +- * ColumnarToRow (62) - : : +- Scan parquet default.web_sales (61) - : +- ReusedExchange (64) - +- * Sort (70) - +- ReusedExchange (69) + : +- * Sort (57) + : +- Exchange (56) + : +- * Filter (55) + : +- * HashAggregate (54) + : +- Exchange (53) + : +- * HashAggregate (52) + : +- * Project (51) + : +- * SortMergeJoin Inner (50) + : :- * Sort (47) + : : +- Exchange (46) + : : +- * Project (45) + : : +- * BroadcastHashJoin Inner BuildRight (44) + : : :- * Filter (42) + : : : +- * ColumnarToRow (41) + : : : +- Scan parquet default.web_sales (40) + : : +- ReusedExchange (43) + : +- * Sort (49) + : +- ReusedExchange (48) + +- * Sort (76) + +- Exchange (75) + +- * HashAggregate (74) + +- Exchange (73) + +- * HashAggregate (72) + +- * Project (71) + +- * SortMergeJoin Inner (70) + :- * Sort (67) + : +- Exchange (66) + : +- * Project (65) + : +- * BroadcastHashJoin Inner BuildRight (64) + : :- * Filter (62) + : : +- * ColumnarToRow (61) + : : +- Scan parquet default.web_sales (60) + : +- ReusedExchange (63) + +- * Sort (69) + +- ReusedExchange (68) (1) Scan parquet default.store_sales @@ -96,7 +95,7 @@ Input [4]: [ss_customer_sk#1, ss_ext_discount_amt#2, ss_ext_list_price#3, ss_sol Input [4]: [ss_customer_sk#1, ss_ext_discount_amt#2, ss_ext_list_price#3, ss_sold_date_sk#4] Condition : isnotnull(ss_customer_sk#1) -(4) ReusedExchange [Reuses operator id: 84] +(4) ReusedExchange [Reuses operator id: 83] Output [2]: [d_date_sk#6, d_year#7] (5) BroadcastHashJoin [codegen id : 2] @@ -192,7 +191,7 @@ Input [4]: [ss_customer_sk#25, ss_ext_discount_amt#26, ss_ext_list_price#27, ss_ Input [4]: [ss_customer_sk#25, ss_ext_discount_amt#26, ss_ext_list_price#27, ss_sold_date_sk#28] Condition : isnotnull(ss_customer_sk#25) -(25) ReusedExchange [Reuses operator id: 88] +(25) ReusedExchange [Reuses operator id: 87] Output [2]: [d_date_sk#30, d_year#31] (26) BroadcastHashJoin [codegen id : 10] @@ -274,7 +273,7 @@ Input [4]: [ws_bill_customer_sk#51, ws_ext_discount_amt#52, ws_ext_list_price#53 Input [4]: [ws_bill_customer_sk#51, ws_ext_discount_amt#52, ws_ext_list_price#53, ws_sold_date_sk#54] Condition : isnotnull(ws_bill_customer_sk#51) -(43) ReusedExchange [Reuses operator id: 84] +(43) ReusedExchange [Reuses operator id: 83] Output [2]: [d_date_sk#55, d_year#56] (44) BroadcastHashJoin [codegen id : 19] @@ -332,171 +331,167 @@ Results [2]: [c_customer_id#59 AS customer_id#70, MakeDecimal(sum(UnscaledValue( Input [2]: [customer_id#70, year_total#71] Condition : (isnotnull(year_total#71) AND (year_total#71 > 0.00)) -(56) Project [codegen id : 24] -Output [2]: [customer_id#70 AS customer_id#72, year_total#71 AS year_total#73] +(56) Exchange Input [2]: [customer_id#70, year_total#71] +Arguments: hashpartitioning(customer_id#70, 5), ENSURE_REQUIREMENTS, [id=#72] -(57) Exchange -Input [2]: [customer_id#72, year_total#73] -Arguments: hashpartitioning(customer_id#72, 5), ENSURE_REQUIREMENTS, [id=#74] - -(58) Sort [codegen id : 25] -Input [2]: [customer_id#72, year_total#73] -Arguments: [customer_id#72 ASC NULLS FIRST], false, 0 +(57) Sort [codegen id : 25] +Input [2]: [customer_id#70, year_total#71] +Arguments: [customer_id#70 ASC NULLS FIRST], false, 0 -(59) SortMergeJoin [codegen id : 26] +(58) SortMergeJoin [codegen id : 26] Left keys [1]: [customer_id#22] -Right keys [1]: [customer_id#72] +Right keys [1]: [customer_id#70] Join condition: None -(60) Project [codegen id : 26] -Output [8]: [customer_id#22, year_total#23, customer_id#45, customer_first_name#46, customer_last_name#47, customer_email_address#48, year_total#49, year_total#73] -Input [9]: [customer_id#22, year_total#23, customer_id#45, customer_first_name#46, customer_last_name#47, customer_email_address#48, year_total#49, customer_id#72, year_total#73] +(59) Project [codegen id : 26] +Output [8]: [customer_id#22, year_total#23, customer_id#45, customer_first_name#46, customer_last_name#47, customer_email_address#48, year_total#49, year_total#71] +Input [9]: [customer_id#22, year_total#23, customer_id#45, customer_first_name#46, customer_last_name#47, customer_email_address#48, year_total#49, customer_id#70, year_total#71] -(61) Scan parquet default.web_sales -Output [4]: [ws_bill_customer_sk#75, ws_ext_discount_amt#76, ws_ext_list_price#77, ws_sold_date_sk#78] +(60) Scan parquet default.web_sales +Output [4]: [ws_bill_customer_sk#73, ws_ext_discount_amt#74, ws_ext_list_price#75, ws_sold_date_sk#76] Batched: true Location: InMemoryFileIndex [] -PartitionFilters: [isnotnull(ws_sold_date_sk#78), dynamicpruningexpression(ws_sold_date_sk#78 IN dynamicpruning#29)] +PartitionFilters: [isnotnull(ws_sold_date_sk#76), dynamicpruningexpression(ws_sold_date_sk#76 IN dynamicpruning#29)] PushedFilters: [IsNotNull(ws_bill_customer_sk)] ReadSchema: struct -(62) ColumnarToRow [codegen id : 28] -Input [4]: [ws_bill_customer_sk#75, ws_ext_discount_amt#76, ws_ext_list_price#77, ws_sold_date_sk#78] +(61) ColumnarToRow [codegen id : 28] +Input [4]: [ws_bill_customer_sk#73, ws_ext_discount_amt#74, ws_ext_list_price#75, ws_sold_date_sk#76] -(63) Filter [codegen id : 28] -Input [4]: [ws_bill_customer_sk#75, ws_ext_discount_amt#76, ws_ext_list_price#77, ws_sold_date_sk#78] -Condition : isnotnull(ws_bill_customer_sk#75) +(62) Filter [codegen id : 28] +Input [4]: [ws_bill_customer_sk#73, ws_ext_discount_amt#74, ws_ext_list_price#75, ws_sold_date_sk#76] +Condition : isnotnull(ws_bill_customer_sk#73) -(64) ReusedExchange [Reuses operator id: 88] -Output [2]: [d_date_sk#79, d_year#80] +(63) ReusedExchange [Reuses operator id: 87] +Output [2]: [d_date_sk#77, d_year#78] -(65) BroadcastHashJoin [codegen id : 28] -Left keys [1]: [ws_sold_date_sk#78] -Right keys [1]: [d_date_sk#79] +(64) BroadcastHashJoin [codegen id : 28] +Left keys [1]: [ws_sold_date_sk#76] +Right keys [1]: [d_date_sk#77] Join condition: None -(66) Project [codegen id : 28] -Output [4]: [ws_bill_customer_sk#75, ws_ext_discount_amt#76, ws_ext_list_price#77, d_year#80] -Input [6]: [ws_bill_customer_sk#75, ws_ext_discount_amt#76, ws_ext_list_price#77, ws_sold_date_sk#78, d_date_sk#79, d_year#80] +(65) Project [codegen id : 28] +Output [4]: [ws_bill_customer_sk#73, ws_ext_discount_amt#74, ws_ext_list_price#75, d_year#78] +Input [6]: [ws_bill_customer_sk#73, ws_ext_discount_amt#74, ws_ext_list_price#75, ws_sold_date_sk#76, d_date_sk#77, d_year#78] -(67) Exchange -Input [4]: [ws_bill_customer_sk#75, ws_ext_discount_amt#76, ws_ext_list_price#77, d_year#80] -Arguments: hashpartitioning(ws_bill_customer_sk#75, 5), ENSURE_REQUIREMENTS, [id=#81] +(66) Exchange +Input [4]: [ws_bill_customer_sk#73, ws_ext_discount_amt#74, ws_ext_list_price#75, d_year#78] +Arguments: hashpartitioning(ws_bill_customer_sk#73, 5), ENSURE_REQUIREMENTS, [id=#79] -(68) Sort [codegen id : 29] -Input [4]: [ws_bill_customer_sk#75, ws_ext_discount_amt#76, ws_ext_list_price#77, d_year#80] -Arguments: [ws_bill_customer_sk#75 ASC NULLS FIRST], false, 0 +(67) Sort [codegen id : 29] +Input [4]: [ws_bill_customer_sk#73, ws_ext_discount_amt#74, ws_ext_list_price#75, d_year#78] +Arguments: [ws_bill_customer_sk#73 ASC NULLS FIRST], false, 0 -(69) ReusedExchange [Reuses operator id: 12] -Output [8]: [c_customer_sk#82, c_customer_id#83, c_first_name#84, c_last_name#85, c_preferred_cust_flag#86, c_birth_country#87, c_login#88, c_email_address#89] +(68) ReusedExchange [Reuses operator id: 12] +Output [8]: [c_customer_sk#80, c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87] -(70) Sort [codegen id : 31] -Input [8]: [c_customer_sk#82, c_customer_id#83, c_first_name#84, c_last_name#85, c_preferred_cust_flag#86, c_birth_country#87, c_login#88, c_email_address#89] -Arguments: [c_customer_sk#82 ASC NULLS FIRST], false, 0 +(69) Sort [codegen id : 31] +Input [8]: [c_customer_sk#80, c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87] +Arguments: [c_customer_sk#80 ASC NULLS FIRST], false, 0 -(71) SortMergeJoin [codegen id : 32] -Left keys [1]: [ws_bill_customer_sk#75] -Right keys [1]: [c_customer_sk#82] +(70) SortMergeJoin [codegen id : 32] +Left keys [1]: [ws_bill_customer_sk#73] +Right keys [1]: [c_customer_sk#80] Join condition: None -(72) Project [codegen id : 32] -Output [10]: [c_customer_id#83, c_first_name#84, c_last_name#85, c_preferred_cust_flag#86, c_birth_country#87, c_login#88, c_email_address#89, ws_ext_discount_amt#76, ws_ext_list_price#77, d_year#80] -Input [12]: [ws_bill_customer_sk#75, ws_ext_discount_amt#76, ws_ext_list_price#77, d_year#80, c_customer_sk#82, c_customer_id#83, c_first_name#84, c_last_name#85, c_preferred_cust_flag#86, c_birth_country#87, c_login#88, c_email_address#89] - -(73) HashAggregate [codegen id : 32] -Input [10]: [c_customer_id#83, c_first_name#84, c_last_name#85, c_preferred_cust_flag#86, c_birth_country#87, c_login#88, c_email_address#89, ws_ext_discount_amt#76, ws_ext_list_price#77, d_year#80] -Keys [8]: [c_customer_id#83, c_first_name#84, c_last_name#85, c_preferred_cust_flag#86, c_birth_country#87, c_login#88, c_email_address#89, d_year#80] -Functions [1]: [partial_sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#77 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#76 as decimal(8,2)))), DecimalType(8,2), true)))] -Aggregate Attributes [1]: [sum#90] -Results [9]: [c_customer_id#83, c_first_name#84, c_last_name#85, c_preferred_cust_flag#86, c_birth_country#87, c_login#88, c_email_address#89, d_year#80, sum#91] - -(74) Exchange -Input [9]: [c_customer_id#83, c_first_name#84, c_last_name#85, c_preferred_cust_flag#86, c_birth_country#87, c_login#88, c_email_address#89, d_year#80, sum#91] -Arguments: hashpartitioning(c_customer_id#83, c_first_name#84, c_last_name#85, c_preferred_cust_flag#86, c_birth_country#87, c_login#88, c_email_address#89, d_year#80, 5), ENSURE_REQUIREMENTS, [id=#92] - -(75) HashAggregate [codegen id : 33] -Input [9]: [c_customer_id#83, c_first_name#84, c_last_name#85, c_preferred_cust_flag#86, c_birth_country#87, c_login#88, c_email_address#89, d_year#80, sum#91] -Keys [8]: [c_customer_id#83, c_first_name#84, c_last_name#85, c_preferred_cust_flag#86, c_birth_country#87, c_login#88, c_email_address#89, d_year#80] -Functions [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#77 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#76 as decimal(8,2)))), DecimalType(8,2), true)))] -Aggregate Attributes [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#77 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#76 as decimal(8,2)))), DecimalType(8,2), true)))#93] -Results [2]: [c_customer_id#83 AS customer_id#94, MakeDecimal(sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#77 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#76 as decimal(8,2)))), DecimalType(8,2), true)))#93,18,2) AS year_total#95] - -(76) Exchange -Input [2]: [customer_id#94, year_total#95] -Arguments: hashpartitioning(customer_id#94, 5), ENSURE_REQUIREMENTS, [id=#96] - -(77) Sort [codegen id : 34] -Input [2]: [customer_id#94, year_total#95] -Arguments: [customer_id#94 ASC NULLS FIRST], false, 0 - -(78) SortMergeJoin [codegen id : 35] +(71) Project [codegen id : 32] +Output [10]: [c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87, ws_ext_discount_amt#74, ws_ext_list_price#75, d_year#78] +Input [12]: [ws_bill_customer_sk#73, ws_ext_discount_amt#74, ws_ext_list_price#75, d_year#78, c_customer_sk#80, c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87] + +(72) HashAggregate [codegen id : 32] +Input [10]: [c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87, ws_ext_discount_amt#74, ws_ext_list_price#75, d_year#78] +Keys [8]: [c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87, d_year#78] +Functions [1]: [partial_sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#75 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#74 as decimal(8,2)))), DecimalType(8,2), true)))] +Aggregate Attributes [1]: [sum#88] +Results [9]: [c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87, d_year#78, sum#89] + +(73) Exchange +Input [9]: [c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87, d_year#78, sum#89] +Arguments: hashpartitioning(c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87, d_year#78, 5), ENSURE_REQUIREMENTS, [id=#90] + +(74) HashAggregate [codegen id : 33] +Input [9]: [c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87, d_year#78, sum#89] +Keys [8]: [c_customer_id#81, c_first_name#82, c_last_name#83, c_preferred_cust_flag#84, c_birth_country#85, c_login#86, c_email_address#87, d_year#78] +Functions [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#75 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#74 as decimal(8,2)))), DecimalType(8,2), true)))] +Aggregate Attributes [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#75 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#74 as decimal(8,2)))), DecimalType(8,2), true)))#91] +Results [2]: [c_customer_id#81 AS customer_id#92, MakeDecimal(sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#75 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#74 as decimal(8,2)))), DecimalType(8,2), true)))#91,18,2) AS year_total#93] + +(75) Exchange +Input [2]: [customer_id#92, year_total#93] +Arguments: hashpartitioning(customer_id#92, 5), ENSURE_REQUIREMENTS, [id=#94] + +(76) Sort [codegen id : 34] +Input [2]: [customer_id#92, year_total#93] +Arguments: [customer_id#92 ASC NULLS FIRST], false, 0 + +(77) SortMergeJoin [codegen id : 35] Left keys [1]: [customer_id#22] -Right keys [1]: [customer_id#94] -Join condition: (CASE WHEN (year_total#73 > 0.00) THEN CheckOverflow((promote_precision(year_total#95) / promote_precision(year_total#73)), DecimalType(38,20), true) ELSE 0E-20 END > CASE WHEN (year_total#23 > 0.00) THEN CheckOverflow((promote_precision(year_total#49) / promote_precision(year_total#23)), DecimalType(38,20), true) ELSE 0E-20 END) +Right keys [1]: [customer_id#92] +Join condition: (CASE WHEN (year_total#71 > 0.00) THEN CheckOverflow((promote_precision(year_total#93) / promote_precision(year_total#71)), DecimalType(38,20), true) ELSE 0E-20 END > CASE WHEN (year_total#23 > 0.00) THEN CheckOverflow((promote_precision(year_total#49) / promote_precision(year_total#23)), DecimalType(38,20), true) ELSE 0E-20 END) -(79) Project [codegen id : 35] +(78) Project [codegen id : 35] Output [4]: [customer_id#45, customer_first_name#46, customer_last_name#47, customer_email_address#48] -Input [10]: [customer_id#22, year_total#23, customer_id#45, customer_first_name#46, customer_last_name#47, customer_email_address#48, year_total#49, year_total#73, customer_id#94, year_total#95] +Input [10]: [customer_id#22, year_total#23, customer_id#45, customer_first_name#46, customer_last_name#47, customer_email_address#48, year_total#49, year_total#71, customer_id#92, year_total#93] -(80) TakeOrderedAndProject +(79) TakeOrderedAndProject Input [4]: [customer_id#45, customer_first_name#46, customer_last_name#47, customer_email_address#48] Arguments: 100, [customer_id#45 ASC NULLS FIRST, customer_first_name#46 ASC NULLS FIRST, customer_last_name#47 ASC NULLS FIRST, customer_email_address#48 ASC NULLS FIRST], [customer_id#45, customer_first_name#46, customer_last_name#47, customer_email_address#48] ===== Subqueries ===== Subquery:1 Hosting operator id = 1 Hosting Expression = ss_sold_date_sk#4 IN dynamicpruning#5 -BroadcastExchange (84) -+- * Filter (83) - +- * ColumnarToRow (82) - +- Scan parquet default.date_dim (81) +BroadcastExchange (83) ++- * Filter (82) + +- * ColumnarToRow (81) + +- Scan parquet default.date_dim (80) -(81) Scan parquet default.date_dim +(80) Scan parquet default.date_dim Output [2]: [d_date_sk#6, d_year#7] Batched: true Location [not included in comparison]/{warehouse_dir}/date_dim] PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2001), IsNotNull(d_date_sk)] ReadSchema: struct -(82) ColumnarToRow [codegen id : 1] +(81) ColumnarToRow [codegen id : 1] Input [2]: [d_date_sk#6, d_year#7] -(83) Filter [codegen id : 1] +(82) Filter [codegen id : 1] Input [2]: [d_date_sk#6, d_year#7] Condition : ((isnotnull(d_year#7) AND (d_year#7 = 2001)) AND isnotnull(d_date_sk#6)) -(84) BroadcastExchange +(83) BroadcastExchange Input [2]: [d_date_sk#6, d_year#7] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#97] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#95] Subquery:2 Hosting operator id = 22 Hosting Expression = ss_sold_date_sk#28 IN dynamicpruning#29 -BroadcastExchange (88) -+- * Filter (87) - +- * ColumnarToRow (86) - +- Scan parquet default.date_dim (85) +BroadcastExchange (87) ++- * Filter (86) + +- * ColumnarToRow (85) + +- Scan parquet default.date_dim (84) -(85) Scan parquet default.date_dim +(84) Scan parquet default.date_dim Output [2]: [d_date_sk#30, d_year#31] Batched: true Location [not included in comparison]/{warehouse_dir}/date_dim] PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2002), IsNotNull(d_date_sk)] ReadSchema: struct -(86) ColumnarToRow [codegen id : 1] +(85) ColumnarToRow [codegen id : 1] Input [2]: [d_date_sk#30, d_year#31] -(87) Filter [codegen id : 1] +(86) Filter [codegen id : 1] Input [2]: [d_date_sk#30, d_year#31] Condition : ((isnotnull(d_year#31) AND (d_year#31 = 2002)) AND isnotnull(d_date_sk#30)) -(88) BroadcastExchange +(87) BroadcastExchange Input [2]: [d_date_sk#30, d_year#31] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#98] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#96] Subquery:3 Hosting operator id = 40 Hosting Expression = ws_sold_date_sk#54 IN dynamicpruning#5 -Subquery:4 Hosting operator id = 61 Hosting Expression = ws_sold_date_sk#78 IN dynamicpruning#29 +Subquery:4 Hosting operator id = 60 Hosting Expression = ws_sold_date_sk#76 IN dynamicpruning#29 diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q11.sf100/simplified.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q11.sf100/simplified.txt index b3f8a57ba0f5b..cc47c3516b497 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q11.sf100/simplified.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q11.sf100/simplified.txt @@ -99,35 +99,34 @@ TakeOrderedAndProject [customer_id,customer_first_name,customer_last_name,custom InputAdapter Exchange [customer_id] #10 WholeStageCodegen (24) - Project [customer_id,year_total] - Filter [year_total] - HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum] [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt as decimal(8,2)))), DecimalType(8,2), true))),customer_id,year_total,sum] - InputAdapter - Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #11 - WholeStageCodegen (23) - HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,ws_ext_list_price,ws_ext_discount_amt] [sum,sum] - Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ws_ext_discount_amt,ws_ext_list_price,d_year] - SortMergeJoin [ws_bill_customer_sk,c_customer_sk] - InputAdapter - WholeStageCodegen (20) - Sort [ws_bill_customer_sk] - InputAdapter - Exchange [ws_bill_customer_sk] #12 - WholeStageCodegen (19) - Project [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_list_price,d_year] - BroadcastHashJoin [ws_sold_date_sk,d_date_sk] - Filter [ws_bill_customer_sk] - ColumnarToRow - InputAdapter - Scan parquet default.web_sales [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_list_price,ws_sold_date_sk] - ReusedSubquery [d_date_sk] #1 - InputAdapter - ReusedExchange [d_date_sk,d_year] #4 - InputAdapter - WholeStageCodegen (22) - Sort [c_customer_sk] - InputAdapter - ReusedExchange [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] #5 + Filter [year_total] + HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum] [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt as decimal(8,2)))), DecimalType(8,2), true))),customer_id,year_total,sum] + InputAdapter + Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #11 + WholeStageCodegen (23) + HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,ws_ext_list_price,ws_ext_discount_amt] [sum,sum] + Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ws_ext_discount_amt,ws_ext_list_price,d_year] + SortMergeJoin [ws_bill_customer_sk,c_customer_sk] + InputAdapter + WholeStageCodegen (20) + Sort [ws_bill_customer_sk] + InputAdapter + Exchange [ws_bill_customer_sk] #12 + WholeStageCodegen (19) + Project [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_list_price,d_year] + BroadcastHashJoin [ws_sold_date_sk,d_date_sk] + Filter [ws_bill_customer_sk] + ColumnarToRow + InputAdapter + Scan parquet default.web_sales [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_list_price,ws_sold_date_sk] + ReusedSubquery [d_date_sk] #1 + InputAdapter + ReusedExchange [d_date_sk,d_year] #4 + InputAdapter + WholeStageCodegen (22) + Sort [c_customer_sk] + InputAdapter + ReusedExchange [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] #5 InputAdapter WholeStageCodegen (34) Sort [customer_id] diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q11/explain.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q11/explain.txt index da1fd1cd155aa..b371e4a9c8135 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q11/explain.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q11/explain.txt @@ -1,9 +1,9 @@ == Physical Plan == -TakeOrderedAndProject (72) -+- * Project (71) - +- * BroadcastHashJoin Inner BuildRight (70) - :- * Project (53) - : +- * BroadcastHashJoin Inner BuildRight (52) +TakeOrderedAndProject (71) ++- * Project (70) + +- * BroadcastHashJoin Inner BuildRight (69) + :- * Project (52) + : +- * BroadcastHashJoin Inner BuildRight (51) : :- * BroadcastHashJoin Inner BuildRight (33) : : :- * Filter (16) : : : +- * HashAggregate (15) @@ -37,40 +37,39 @@ TakeOrderedAndProject (72) : : : +- * ColumnarToRow (21) : : : +- Scan parquet default.store_sales (20) : : +- ReusedExchange (26) - : +- BroadcastExchange (51) - : +- * Project (50) - : +- * Filter (49) - : +- * HashAggregate (48) - : +- Exchange (47) - : +- * HashAggregate (46) - : +- * Project (45) - : +- * BroadcastHashJoin Inner BuildRight (44) - : :- * Project (42) - : : +- * BroadcastHashJoin Inner BuildRight (41) - : : :- * Filter (36) - : : : +- * ColumnarToRow (35) - : : : +- Scan parquet default.customer (34) - : : +- BroadcastExchange (40) - : : +- * Filter (39) - : : +- * ColumnarToRow (38) - : : +- Scan parquet default.web_sales (37) - : +- ReusedExchange (43) - +- BroadcastExchange (69) - +- * HashAggregate (68) - +- Exchange (67) - +- * HashAggregate (66) - +- * Project (65) - +- * BroadcastHashJoin Inner BuildRight (64) - :- * Project (62) - : +- * BroadcastHashJoin Inner BuildRight (61) - : :- * Filter (56) - : : +- * ColumnarToRow (55) - : : +- Scan parquet default.customer (54) - : +- BroadcastExchange (60) - : +- * Filter (59) - : +- * ColumnarToRow (58) - : +- Scan parquet default.web_sales (57) - +- ReusedExchange (63) + : +- BroadcastExchange (50) + : +- * Filter (49) + : +- * HashAggregate (48) + : +- Exchange (47) + : +- * HashAggregate (46) + : +- * Project (45) + : +- * BroadcastHashJoin Inner BuildRight (44) + : :- * Project (42) + : : +- * BroadcastHashJoin Inner BuildRight (41) + : : :- * Filter (36) + : : : +- * ColumnarToRow (35) + : : : +- Scan parquet default.customer (34) + : : +- BroadcastExchange (40) + : : +- * Filter (39) + : : +- * ColumnarToRow (38) + : : +- Scan parquet default.web_sales (37) + : +- ReusedExchange (43) + +- BroadcastExchange (68) + +- * HashAggregate (67) + +- Exchange (66) + +- * HashAggregate (65) + +- * Project (64) + +- * BroadcastHashJoin Inner BuildRight (63) + :- * Project (61) + : +- * BroadcastHashJoin Inner BuildRight (60) + : :- * Filter (55) + : : +- * ColumnarToRow (54) + : : +- Scan parquet default.customer (53) + : +- BroadcastExchange (59) + : +- * Filter (58) + : +- * ColumnarToRow (57) + : +- Scan parquet default.web_sales (56) + +- ReusedExchange (62) (1) Scan parquet default.customer @@ -115,7 +114,7 @@ Join condition: None Output [10]: [c_customer_id#2, c_first_name#3, c_last_name#4, c_preferred_cust_flag#5, c_birth_country#6, c_login#7, c_email_address#8, ss_ext_discount_amt#10, ss_ext_list_price#11, ss_sold_date_sk#12] Input [12]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4, c_preferred_cust_flag#5, c_birth_country#6, c_login#7, c_email_address#8, ss_customer_sk#9, ss_ext_discount_amt#10, ss_ext_list_price#11, ss_sold_date_sk#12] -(10) ReusedExchange [Reuses operator id: 76] +(10) ReusedExchange [Reuses operator id: 75] Output [2]: [d_date_sk#15, d_year#16] (11) BroadcastHashJoin [codegen id : 3] @@ -191,7 +190,7 @@ Join condition: None Output [10]: [c_customer_id#24, c_first_name#25, c_last_name#26, c_preferred_cust_flag#27, c_birth_country#28, c_login#29, c_email_address#30, ss_ext_discount_amt#32, ss_ext_list_price#33, ss_sold_date_sk#34] Input [12]: [c_customer_sk#23, c_customer_id#24, c_first_name#25, c_last_name#26, c_preferred_cust_flag#27, c_birth_country#28, c_login#29, c_email_address#30, ss_customer_sk#31, ss_ext_discount_amt#32, ss_ext_list_price#33, ss_sold_date_sk#34] -(26) ReusedExchange [Reuses operator id: 80] +(26) ReusedExchange [Reuses operator id: 79] Output [2]: [d_date_sk#37, d_year#38] (27) BroadcastHashJoin [codegen id : 6] @@ -272,7 +271,7 @@ Join condition: None Output [10]: [c_customer_id#50, c_first_name#51, c_last_name#52, c_preferred_cust_flag#53, c_birth_country#54, c_login#55, c_email_address#56, ws_ext_discount_amt#58, ws_ext_list_price#59, ws_sold_date_sk#60] Input [12]: [c_customer_sk#49, c_customer_id#50, c_first_name#51, c_last_name#52, c_preferred_cust_flag#53, c_birth_country#54, c_login#55, c_email_address#56, ws_bill_customer_sk#57, ws_ext_discount_amt#58, ws_ext_list_price#59, ws_sold_date_sk#60] -(43) ReusedExchange [Reuses operator id: 76] +(43) ReusedExchange [Reuses operator id: 75] Output [2]: [d_date_sk#62, d_year#63] (44) BroadcastHashJoin [codegen id : 10] @@ -306,166 +305,162 @@ Results [2]: [c_customer_id#50 AS customer_id#68, MakeDecimal(sum(UnscaledValue( Input [2]: [customer_id#68, year_total#69] Condition : (isnotnull(year_total#69) AND (year_total#69 > 0.00)) -(50) Project [codegen id : 11] -Output [2]: [customer_id#68 AS customer_id#70, year_total#69 AS year_total#71] +(50) BroadcastExchange Input [2]: [customer_id#68, year_total#69] +Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#70] -(51) BroadcastExchange -Input [2]: [customer_id#70, year_total#71] -Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#72] - -(52) BroadcastHashJoin [codegen id : 16] +(51) BroadcastHashJoin [codegen id : 16] Left keys [1]: [customer_id#21] -Right keys [1]: [customer_id#70] +Right keys [1]: [customer_id#68] Join condition: None -(53) Project [codegen id : 16] -Output [8]: [customer_id#21, year_total#22, customer_id#43, customer_first_name#44, customer_last_name#45, customer_email_address#46, year_total#47, year_total#71] -Input [9]: [customer_id#21, year_total#22, customer_id#43, customer_first_name#44, customer_last_name#45, customer_email_address#46, year_total#47, customer_id#70, year_total#71] +(52) Project [codegen id : 16] +Output [8]: [customer_id#21, year_total#22, customer_id#43, customer_first_name#44, customer_last_name#45, customer_email_address#46, year_total#47, year_total#69] +Input [9]: [customer_id#21, year_total#22, customer_id#43, customer_first_name#44, customer_last_name#45, customer_email_address#46, year_total#47, customer_id#68, year_total#69] -(54) Scan parquet default.customer -Output [8]: [c_customer_sk#73, c_customer_id#74, c_first_name#75, c_last_name#76, c_preferred_cust_flag#77, c_birth_country#78, c_login#79, c_email_address#80] +(53) Scan parquet default.customer +Output [8]: [c_customer_sk#71, c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78] Batched: true Location [not included in comparison]/{warehouse_dir}/customer] PushedFilters: [IsNotNull(c_customer_sk), IsNotNull(c_customer_id)] ReadSchema: struct -(55) ColumnarToRow [codegen id : 14] -Input [8]: [c_customer_sk#73, c_customer_id#74, c_first_name#75, c_last_name#76, c_preferred_cust_flag#77, c_birth_country#78, c_login#79, c_email_address#80] +(54) ColumnarToRow [codegen id : 14] +Input [8]: [c_customer_sk#71, c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78] -(56) Filter [codegen id : 14] -Input [8]: [c_customer_sk#73, c_customer_id#74, c_first_name#75, c_last_name#76, c_preferred_cust_flag#77, c_birth_country#78, c_login#79, c_email_address#80] -Condition : (isnotnull(c_customer_sk#73) AND isnotnull(c_customer_id#74)) +(55) Filter [codegen id : 14] +Input [8]: [c_customer_sk#71, c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78] +Condition : (isnotnull(c_customer_sk#71) AND isnotnull(c_customer_id#72)) -(57) Scan parquet default.web_sales -Output [4]: [ws_bill_customer_sk#81, ws_ext_discount_amt#82, ws_ext_list_price#83, ws_sold_date_sk#84] +(56) Scan parquet default.web_sales +Output [4]: [ws_bill_customer_sk#79, ws_ext_discount_amt#80, ws_ext_list_price#81, ws_sold_date_sk#82] Batched: true Location: InMemoryFileIndex [] -PartitionFilters: [isnotnull(ws_sold_date_sk#84), dynamicpruningexpression(ws_sold_date_sk#84 IN dynamicpruning#35)] +PartitionFilters: [isnotnull(ws_sold_date_sk#82), dynamicpruningexpression(ws_sold_date_sk#82 IN dynamicpruning#35)] PushedFilters: [IsNotNull(ws_bill_customer_sk)] ReadSchema: struct -(58) ColumnarToRow [codegen id : 12] -Input [4]: [ws_bill_customer_sk#81, ws_ext_discount_amt#82, ws_ext_list_price#83, ws_sold_date_sk#84] +(57) ColumnarToRow [codegen id : 12] +Input [4]: [ws_bill_customer_sk#79, ws_ext_discount_amt#80, ws_ext_list_price#81, ws_sold_date_sk#82] -(59) Filter [codegen id : 12] -Input [4]: [ws_bill_customer_sk#81, ws_ext_discount_amt#82, ws_ext_list_price#83, ws_sold_date_sk#84] -Condition : isnotnull(ws_bill_customer_sk#81) +(58) Filter [codegen id : 12] +Input [4]: [ws_bill_customer_sk#79, ws_ext_discount_amt#80, ws_ext_list_price#81, ws_sold_date_sk#82] +Condition : isnotnull(ws_bill_customer_sk#79) -(60) BroadcastExchange -Input [4]: [ws_bill_customer_sk#81, ws_ext_discount_amt#82, ws_ext_list_price#83, ws_sold_date_sk#84] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#85] +(59) BroadcastExchange +Input [4]: [ws_bill_customer_sk#79, ws_ext_discount_amt#80, ws_ext_list_price#81, ws_sold_date_sk#82] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#83] -(61) BroadcastHashJoin [codegen id : 14] -Left keys [1]: [c_customer_sk#73] -Right keys [1]: [ws_bill_customer_sk#81] +(60) BroadcastHashJoin [codegen id : 14] +Left keys [1]: [c_customer_sk#71] +Right keys [1]: [ws_bill_customer_sk#79] Join condition: None -(62) Project [codegen id : 14] -Output [10]: [c_customer_id#74, c_first_name#75, c_last_name#76, c_preferred_cust_flag#77, c_birth_country#78, c_login#79, c_email_address#80, ws_ext_discount_amt#82, ws_ext_list_price#83, ws_sold_date_sk#84] -Input [12]: [c_customer_sk#73, c_customer_id#74, c_first_name#75, c_last_name#76, c_preferred_cust_flag#77, c_birth_country#78, c_login#79, c_email_address#80, ws_bill_customer_sk#81, ws_ext_discount_amt#82, ws_ext_list_price#83, ws_sold_date_sk#84] +(61) Project [codegen id : 14] +Output [10]: [c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, ws_ext_discount_amt#80, ws_ext_list_price#81, ws_sold_date_sk#82] +Input [12]: [c_customer_sk#71, c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, ws_bill_customer_sk#79, ws_ext_discount_amt#80, ws_ext_list_price#81, ws_sold_date_sk#82] -(63) ReusedExchange [Reuses operator id: 80] -Output [2]: [d_date_sk#86, d_year#87] +(62) ReusedExchange [Reuses operator id: 79] +Output [2]: [d_date_sk#84, d_year#85] -(64) BroadcastHashJoin [codegen id : 14] -Left keys [1]: [ws_sold_date_sk#84] -Right keys [1]: [d_date_sk#86] +(63) BroadcastHashJoin [codegen id : 14] +Left keys [1]: [ws_sold_date_sk#82] +Right keys [1]: [d_date_sk#84] Join condition: None -(65) Project [codegen id : 14] -Output [10]: [c_customer_id#74, c_first_name#75, c_last_name#76, c_preferred_cust_flag#77, c_birth_country#78, c_login#79, c_email_address#80, ws_ext_discount_amt#82, ws_ext_list_price#83, d_year#87] -Input [12]: [c_customer_id#74, c_first_name#75, c_last_name#76, c_preferred_cust_flag#77, c_birth_country#78, c_login#79, c_email_address#80, ws_ext_discount_amt#82, ws_ext_list_price#83, ws_sold_date_sk#84, d_date_sk#86, d_year#87] - -(66) HashAggregate [codegen id : 14] -Input [10]: [c_customer_id#74, c_first_name#75, c_last_name#76, c_preferred_cust_flag#77, c_birth_country#78, c_login#79, c_email_address#80, ws_ext_discount_amt#82, ws_ext_list_price#83, d_year#87] -Keys [8]: [c_customer_id#74, c_first_name#75, c_last_name#76, c_preferred_cust_flag#77, c_birth_country#78, c_login#79, c_email_address#80, d_year#87] -Functions [1]: [partial_sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#83 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#82 as decimal(8,2)))), DecimalType(8,2), true)))] -Aggregate Attributes [1]: [sum#88] -Results [9]: [c_customer_id#74, c_first_name#75, c_last_name#76, c_preferred_cust_flag#77, c_birth_country#78, c_login#79, c_email_address#80, d_year#87, sum#89] - -(67) Exchange -Input [9]: [c_customer_id#74, c_first_name#75, c_last_name#76, c_preferred_cust_flag#77, c_birth_country#78, c_login#79, c_email_address#80, d_year#87, sum#89] -Arguments: hashpartitioning(c_customer_id#74, c_first_name#75, c_last_name#76, c_preferred_cust_flag#77, c_birth_country#78, c_login#79, c_email_address#80, d_year#87, 5), ENSURE_REQUIREMENTS, [id=#90] - -(68) HashAggregate [codegen id : 15] -Input [9]: [c_customer_id#74, c_first_name#75, c_last_name#76, c_preferred_cust_flag#77, c_birth_country#78, c_login#79, c_email_address#80, d_year#87, sum#89] -Keys [8]: [c_customer_id#74, c_first_name#75, c_last_name#76, c_preferred_cust_flag#77, c_birth_country#78, c_login#79, c_email_address#80, d_year#87] -Functions [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#83 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#82 as decimal(8,2)))), DecimalType(8,2), true)))] -Aggregate Attributes [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#83 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#82 as decimal(8,2)))), DecimalType(8,2), true)))#91] -Results [2]: [c_customer_id#74 AS customer_id#92, MakeDecimal(sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#83 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#82 as decimal(8,2)))), DecimalType(8,2), true)))#91,18,2) AS year_total#93] - -(69) BroadcastExchange -Input [2]: [customer_id#92, year_total#93] -Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#94] - -(70) BroadcastHashJoin [codegen id : 16] +(64) Project [codegen id : 14] +Output [10]: [c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, ws_ext_discount_amt#80, ws_ext_list_price#81, d_year#85] +Input [12]: [c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, ws_ext_discount_amt#80, ws_ext_list_price#81, ws_sold_date_sk#82, d_date_sk#84, d_year#85] + +(65) HashAggregate [codegen id : 14] +Input [10]: [c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, ws_ext_discount_amt#80, ws_ext_list_price#81, d_year#85] +Keys [8]: [c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, d_year#85] +Functions [1]: [partial_sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#81 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#80 as decimal(8,2)))), DecimalType(8,2), true)))] +Aggregate Attributes [1]: [sum#86] +Results [9]: [c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, d_year#85, sum#87] + +(66) Exchange +Input [9]: [c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, d_year#85, sum#87] +Arguments: hashpartitioning(c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, d_year#85, 5), ENSURE_REQUIREMENTS, [id=#88] + +(67) HashAggregate [codegen id : 15] +Input [9]: [c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, d_year#85, sum#87] +Keys [8]: [c_customer_id#72, c_first_name#73, c_last_name#74, c_preferred_cust_flag#75, c_birth_country#76, c_login#77, c_email_address#78, d_year#85] +Functions [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#81 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#80 as decimal(8,2)))), DecimalType(8,2), true)))] +Aggregate Attributes [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#81 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#80 as decimal(8,2)))), DecimalType(8,2), true)))#89] +Results [2]: [c_customer_id#72 AS customer_id#90, MakeDecimal(sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#81 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#80 as decimal(8,2)))), DecimalType(8,2), true)))#89,18,2) AS year_total#91] + +(68) BroadcastExchange +Input [2]: [customer_id#90, year_total#91] +Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#92] + +(69) BroadcastHashJoin [codegen id : 16] Left keys [1]: [customer_id#21] -Right keys [1]: [customer_id#92] -Join condition: (CASE WHEN (year_total#71 > 0.00) THEN CheckOverflow((promote_precision(year_total#93) / promote_precision(year_total#71)), DecimalType(38,20), true) ELSE 0E-20 END > CASE WHEN (year_total#22 > 0.00) THEN CheckOverflow((promote_precision(year_total#47) / promote_precision(year_total#22)), DecimalType(38,20), true) ELSE 0E-20 END) +Right keys [1]: [customer_id#90] +Join condition: (CASE WHEN (year_total#69 > 0.00) THEN CheckOverflow((promote_precision(year_total#91) / promote_precision(year_total#69)), DecimalType(38,20), true) ELSE 0E-20 END > CASE WHEN (year_total#22 > 0.00) THEN CheckOverflow((promote_precision(year_total#47) / promote_precision(year_total#22)), DecimalType(38,20), true) ELSE 0E-20 END) -(71) Project [codegen id : 16] +(70) Project [codegen id : 16] Output [4]: [customer_id#43, customer_first_name#44, customer_last_name#45, customer_email_address#46] -Input [10]: [customer_id#21, year_total#22, customer_id#43, customer_first_name#44, customer_last_name#45, customer_email_address#46, year_total#47, year_total#71, customer_id#92, year_total#93] +Input [10]: [customer_id#21, year_total#22, customer_id#43, customer_first_name#44, customer_last_name#45, customer_email_address#46, year_total#47, year_total#69, customer_id#90, year_total#91] -(72) TakeOrderedAndProject +(71) TakeOrderedAndProject Input [4]: [customer_id#43, customer_first_name#44, customer_last_name#45, customer_email_address#46] Arguments: 100, [customer_id#43 ASC NULLS FIRST, customer_first_name#44 ASC NULLS FIRST, customer_last_name#45 ASC NULLS FIRST, customer_email_address#46 ASC NULLS FIRST], [customer_id#43, customer_first_name#44, customer_last_name#45, customer_email_address#46] ===== Subqueries ===== Subquery:1 Hosting operator id = 4 Hosting Expression = ss_sold_date_sk#12 IN dynamicpruning#13 -BroadcastExchange (76) -+- * Filter (75) - +- * ColumnarToRow (74) - +- Scan parquet default.date_dim (73) +BroadcastExchange (75) ++- * Filter (74) + +- * ColumnarToRow (73) + +- Scan parquet default.date_dim (72) -(73) Scan parquet default.date_dim +(72) Scan parquet default.date_dim Output [2]: [d_date_sk#15, d_year#16] Batched: true Location [not included in comparison]/{warehouse_dir}/date_dim] PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2001), IsNotNull(d_date_sk)] ReadSchema: struct -(74) ColumnarToRow [codegen id : 1] +(73) ColumnarToRow [codegen id : 1] Input [2]: [d_date_sk#15, d_year#16] -(75) Filter [codegen id : 1] +(74) Filter [codegen id : 1] Input [2]: [d_date_sk#15, d_year#16] Condition : ((isnotnull(d_year#16) AND (d_year#16 = 2001)) AND isnotnull(d_date_sk#15)) -(76) BroadcastExchange +(75) BroadcastExchange Input [2]: [d_date_sk#15, d_year#16] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#95] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#93] Subquery:2 Hosting operator id = 20 Hosting Expression = ss_sold_date_sk#34 IN dynamicpruning#35 -BroadcastExchange (80) -+- * Filter (79) - +- * ColumnarToRow (78) - +- Scan parquet default.date_dim (77) +BroadcastExchange (79) ++- * Filter (78) + +- * ColumnarToRow (77) + +- Scan parquet default.date_dim (76) -(77) Scan parquet default.date_dim +(76) Scan parquet default.date_dim Output [2]: [d_date_sk#37, d_year#38] Batched: true Location [not included in comparison]/{warehouse_dir}/date_dim] PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2002), IsNotNull(d_date_sk)] ReadSchema: struct -(78) ColumnarToRow [codegen id : 1] +(77) ColumnarToRow [codegen id : 1] Input [2]: [d_date_sk#37, d_year#38] -(79) Filter [codegen id : 1] +(78) Filter [codegen id : 1] Input [2]: [d_date_sk#37, d_year#38] Condition : ((isnotnull(d_year#38) AND (d_year#38 = 2002)) AND isnotnull(d_date_sk#37)) -(80) BroadcastExchange +(79) BroadcastExchange Input [2]: [d_date_sk#37, d_year#38] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#96] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#94] Subquery:3 Hosting operator id = 37 Hosting Expression = ws_sold_date_sk#60 IN dynamicpruning#13 -Subquery:4 Hosting operator id = 57 Hosting Expression = ws_sold_date_sk#84 IN dynamicpruning#35 +Subquery:4 Hosting operator id = 56 Hosting Expression = ws_sold_date_sk#82 IN dynamicpruning#35 diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q11/simplified.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q11/simplified.txt index 6ebf857eba13a..5fc4dacd55273 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q11/simplified.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q11/simplified.txt @@ -70,31 +70,30 @@ TakeOrderedAndProject [customer_id,customer_first_name,customer_last_name,custom InputAdapter BroadcastExchange #8 WholeStageCodegen (11) - Project [customer_id,year_total] - Filter [year_total] - HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum] [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt as decimal(8,2)))), DecimalType(8,2), true))),customer_id,year_total,sum] - InputAdapter - Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #9 - WholeStageCodegen (10) - HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,ws_ext_list_price,ws_ext_discount_amt] [sum,sum] - Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ws_ext_discount_amt,ws_ext_list_price,d_year] - BroadcastHashJoin [ws_sold_date_sk,d_date_sk] - Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ws_ext_discount_amt,ws_ext_list_price,ws_sold_date_sk] - BroadcastHashJoin [c_customer_sk,ws_bill_customer_sk] - Filter [c_customer_sk,c_customer_id] - ColumnarToRow - InputAdapter - Scan parquet default.customer [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] - InputAdapter - BroadcastExchange #10 - WholeStageCodegen (8) - Filter [ws_bill_customer_sk] - ColumnarToRow - InputAdapter - Scan parquet default.web_sales [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_list_price,ws_sold_date_sk] - ReusedSubquery [d_date_sk] #1 - InputAdapter - ReusedExchange [d_date_sk,d_year] #3 + Filter [year_total] + HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,sum] [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt as decimal(8,2)))), DecimalType(8,2), true))),customer_id,year_total,sum] + InputAdapter + Exchange [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year] #9 + WholeStageCodegen (10) + HashAggregate [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,d_year,ws_ext_list_price,ws_ext_discount_amt] [sum,sum] + Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ws_ext_discount_amt,ws_ext_list_price,d_year] + BroadcastHashJoin [ws_sold_date_sk,d_date_sk] + Project [c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address,ws_ext_discount_amt,ws_ext_list_price,ws_sold_date_sk] + BroadcastHashJoin [c_customer_sk,ws_bill_customer_sk] + Filter [c_customer_sk,c_customer_id] + ColumnarToRow + InputAdapter + Scan parquet default.customer [c_customer_sk,c_customer_id,c_first_name,c_last_name,c_preferred_cust_flag,c_birth_country,c_login,c_email_address] + InputAdapter + BroadcastExchange #10 + WholeStageCodegen (8) + Filter [ws_bill_customer_sk] + ColumnarToRow + InputAdapter + Scan parquet default.web_sales [ws_bill_customer_sk,ws_ext_discount_amt,ws_ext_list_price,ws_sold_date_sk] + ReusedSubquery [d_date_sk] #1 + InputAdapter + ReusedExchange [d_date_sk,d_year] #3 InputAdapter BroadcastExchange #11 WholeStageCodegen (15) diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q70a.sf100/explain.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q70a.sf100/explain.txt index a7102819024f9..883130da8087f 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q70a.sf100/explain.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q70a.sf100/explain.txt @@ -1,60 +1,59 @@ == Physical Plan == -TakeOrderedAndProject (56) -+- * Project (55) - +- Window (54) - +- * Sort (53) - +- Exchange (52) - +- * HashAggregate (51) - +- Exchange (50) - +- * HashAggregate (49) - +- Union (48) - :- * HashAggregate (37) - : +- Exchange (36) - : +- * HashAggregate (35) - : +- * Project (34) - : +- * BroadcastHashJoin Inner BuildRight (33) +TakeOrderedAndProject (55) ++- * Project (54) + +- Window (53) + +- * Sort (52) + +- Exchange (51) + +- * HashAggregate (50) + +- Exchange (49) + +- * HashAggregate (48) + +- Union (47) + :- * HashAggregate (36) + : +- Exchange (35) + : +- * HashAggregate (34) + : +- * Project (33) + : +- * BroadcastHashJoin Inner BuildRight (32) : :- * Project (6) : : +- * BroadcastHashJoin Inner BuildRight (5) : : :- * Filter (3) : : : +- * ColumnarToRow (2) : : : +- Scan parquet default.store_sales (1) : : +- ReusedExchange (4) - : +- BroadcastExchange (32) - : +- * BroadcastHashJoin LeftSemi BuildRight (31) + : +- BroadcastExchange (31) + : +- * BroadcastHashJoin LeftSemi BuildRight (30) : :- * Filter (9) : : +- * ColumnarToRow (8) : : +- Scan parquet default.store (7) - : +- BroadcastExchange (30) - : +- * Project (29) - : +- * Filter (28) - : +- Window (27) - : +- * Sort (26) - : +- Exchange (25) - : +- * HashAggregate (24) - : +- Exchange (23) - : +- * HashAggregate (22) - : +- * Project (21) - : +- * BroadcastHashJoin Inner BuildRight (20) - : :- * Project (15) - : : +- * BroadcastHashJoin Inner BuildRight (14) - : : :- * Filter (12) - : : : +- * ColumnarToRow (11) - : : : +- Scan parquet default.store_sales (10) - : : +- ReusedExchange (13) - : +- BroadcastExchange (19) - : +- * Filter (18) - : +- * ColumnarToRow (17) - : +- Scan parquet default.store (16) - :- * HashAggregate (42) - : +- Exchange (41) - : +- * HashAggregate (40) - : +- * HashAggregate (39) - : +- ReusedExchange (38) - +- * HashAggregate (47) - +- Exchange (46) - +- * HashAggregate (45) - +- * HashAggregate (44) - +- ReusedExchange (43) + : +- BroadcastExchange (29) + : +- * Project (28) + : +- * Filter (27) + : +- Window (26) + : +- * Sort (25) + : +- * HashAggregate (24) + : +- Exchange (23) + : +- * HashAggregate (22) + : +- * Project (21) + : +- * BroadcastHashJoin Inner BuildRight (20) + : :- * Project (15) + : : +- * BroadcastHashJoin Inner BuildRight (14) + : : :- * Filter (12) + : : : +- * ColumnarToRow (11) + : : : +- Scan parquet default.store_sales (10) + : : +- ReusedExchange (13) + : +- BroadcastExchange (19) + : +- * Filter (18) + : +- * ColumnarToRow (17) + : +- Scan parquet default.store (16) + :- * HashAggregate (41) + : +- Exchange (40) + : +- * HashAggregate (39) + : +- * HashAggregate (38) + : +- ReusedExchange (37) + +- * HashAggregate (46) + +- Exchange (45) + +- * HashAggregate (44) + +- * HashAggregate (43) + +- ReusedExchange (42) (1) Scan parquet default.store_sales @@ -65,22 +64,22 @@ PartitionFilters: [isnotnull(ss_sold_date_sk#3), dynamicpruningexpression(ss_sol PushedFilters: [IsNotNull(ss_store_sk)] ReadSchema: struct -(2) ColumnarToRow [codegen id : 9] +(2) ColumnarToRow [codegen id : 8] Input [3]: [ss_store_sk#1, ss_net_profit#2, ss_sold_date_sk#3] -(3) Filter [codegen id : 9] +(3) Filter [codegen id : 8] Input [3]: [ss_store_sk#1, ss_net_profit#2, ss_sold_date_sk#3] Condition : isnotnull(ss_store_sk#1) -(4) ReusedExchange [Reuses operator id: 61] +(4) ReusedExchange [Reuses operator id: 60] Output [1]: [d_date_sk#5] -(5) BroadcastHashJoin [codegen id : 9] +(5) BroadcastHashJoin [codegen id : 8] Left keys [1]: [ss_sold_date_sk#3] Right keys [1]: [d_date_sk#5] Join condition: None -(6) Project [codegen id : 9] +(6) Project [codegen id : 8] Output [2]: [ss_store_sk#1, ss_net_profit#2] Input [4]: [ss_store_sk#1, ss_net_profit#2, ss_sold_date_sk#3, d_date_sk#5] @@ -91,10 +90,10 @@ Location [not included in comparison]/{warehouse_dir}/store] PushedFilters: [IsNotNull(s_store_sk)] ReadSchema: struct -(8) ColumnarToRow [codegen id : 8] +(8) ColumnarToRow [codegen id : 7] Input [3]: [s_store_sk#6, s_county#7, s_state#8] -(9) Filter [codegen id : 8] +(9) Filter [codegen id : 7] Input [3]: [s_store_sk#6, s_county#7, s_state#8] Condition : isnotnull(s_store_sk#6) @@ -113,7 +112,7 @@ Input [3]: [ss_store_sk#9, ss_net_profit#10, ss_sold_date_sk#11] Input [3]: [ss_store_sk#9, ss_net_profit#10, ss_sold_date_sk#11] Condition : isnotnull(ss_store_sk#9) -(13) ReusedExchange [Reuses operator id: 61] +(13) ReusedExchange [Reuses operator id: 60] Output [1]: [d_date_sk#12] (14) BroadcastHashJoin [codegen id : 4] @@ -168,195 +167,191 @@ Input [2]: [s_state#14, sum#17] Keys [1]: [s_state#14] Functions [1]: [sum(UnscaledValue(ss_net_profit#10))] Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_profit#10))#19] -Results [3]: [s_state#14 AS s_state#20, s_state#14, MakeDecimal(sum(UnscaledValue(ss_net_profit#10))#19,17,2) AS _w2#21] +Results [3]: [s_state#14, s_state#14, MakeDecimal(sum(UnscaledValue(ss_net_profit#10))#19,17,2) AS _w2#20] -(25) Exchange -Input [3]: [s_state#20, s_state#14, _w2#21] -Arguments: hashpartitioning(s_state#14, 5), ENSURE_REQUIREMENTS, [id=#22] +(25) Sort [codegen id : 5] +Input [3]: [s_state#14, s_state#14, _w2#20] +Arguments: [s_state#14 ASC NULLS FIRST, _w2#20 DESC NULLS LAST], false, 0 -(26) Sort [codegen id : 6] -Input [3]: [s_state#20, s_state#14, _w2#21] -Arguments: [s_state#14 ASC NULLS FIRST, _w2#21 DESC NULLS LAST], false, 0 +(26) Window +Input [3]: [s_state#14, s_state#14, _w2#20] +Arguments: [rank(_w2#20) windowspecdefinition(s_state#14, _w2#20 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS ranking#21], [s_state#14], [_w2#20 DESC NULLS LAST] -(27) Window -Input [3]: [s_state#20, s_state#14, _w2#21] -Arguments: [rank(_w2#21) windowspecdefinition(s_state#14, _w2#21 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS ranking#23], [s_state#14], [_w2#21 DESC NULLS LAST] +(27) Filter [codegen id : 6] +Input [4]: [s_state#14, s_state#14, _w2#20, ranking#21] +Condition : (ranking#21 <= 5) -(28) Filter [codegen id : 7] -Input [4]: [s_state#20, s_state#14, _w2#21, ranking#23] -Condition : (ranking#23 <= 5) +(28) Project [codegen id : 6] +Output [1]: [s_state#14] +Input [4]: [s_state#14, s_state#14, _w2#20, ranking#21] -(29) Project [codegen id : 7] -Output [1]: [s_state#20] -Input [4]: [s_state#20, s_state#14, _w2#21, ranking#23] +(29) BroadcastExchange +Input [1]: [s_state#14] +Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#22] -(30) BroadcastExchange -Input [1]: [s_state#20] -Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#24] - -(31) BroadcastHashJoin [codegen id : 8] +(30) BroadcastHashJoin [codegen id : 7] Left keys [1]: [s_state#8] -Right keys [1]: [s_state#20] +Right keys [1]: [s_state#14] Join condition: None -(32) BroadcastExchange +(31) BroadcastExchange Input [3]: [s_store_sk#6, s_county#7, s_state#8] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#25] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#23] -(33) BroadcastHashJoin [codegen id : 9] +(32) BroadcastHashJoin [codegen id : 8] Left keys [1]: [ss_store_sk#1] Right keys [1]: [s_store_sk#6] Join condition: None -(34) Project [codegen id : 9] +(33) Project [codegen id : 8] Output [3]: [ss_net_profit#2, s_county#7, s_state#8] Input [5]: [ss_store_sk#1, ss_net_profit#2, s_store_sk#6, s_county#7, s_state#8] -(35) HashAggregate [codegen id : 9] +(34) HashAggregate [codegen id : 8] Input [3]: [ss_net_profit#2, s_county#7, s_state#8] Keys [2]: [s_state#8, s_county#7] Functions [1]: [partial_sum(UnscaledValue(ss_net_profit#2))] -Aggregate Attributes [1]: [sum#26] -Results [3]: [s_state#8, s_county#7, sum#27] +Aggregate Attributes [1]: [sum#24] +Results [3]: [s_state#8, s_county#7, sum#25] -(36) Exchange -Input [3]: [s_state#8, s_county#7, sum#27] -Arguments: hashpartitioning(s_state#8, s_county#7, 5), ENSURE_REQUIREMENTS, [id=#28] +(35) Exchange +Input [3]: [s_state#8, s_county#7, sum#25] +Arguments: hashpartitioning(s_state#8, s_county#7, 5), ENSURE_REQUIREMENTS, [id=#26] -(37) HashAggregate [codegen id : 10] -Input [3]: [s_state#8, s_county#7, sum#27] +(36) HashAggregate [codegen id : 9] +Input [3]: [s_state#8, s_county#7, sum#25] Keys [2]: [s_state#8, s_county#7] Functions [1]: [sum(UnscaledValue(ss_net_profit#2))] -Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_profit#2))#29] -Results [6]: [cast(MakeDecimal(sum(UnscaledValue(ss_net_profit#2))#29,17,2) as decimal(27,2)) AS total_sum#30, s_state#8, s_county#7, 0 AS g_state#31, 0 AS g_county#32, 0 AS lochierarchy#33] - -(38) ReusedExchange [Reuses operator id: 36] -Output [3]: [s_state#34, s_county#35, sum#36] - -(39) HashAggregate [codegen id : 20] -Input [3]: [s_state#34, s_county#35, sum#36] -Keys [2]: [s_state#34, s_county#35] -Functions [1]: [sum(UnscaledValue(ss_net_profit#37))] -Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_profit#37))#38] -Results [2]: [MakeDecimal(sum(UnscaledValue(ss_net_profit#37))#38,17,2) AS total_sum#39, s_state#34] - -(40) HashAggregate [codegen id : 20] -Input [2]: [total_sum#39, s_state#34] -Keys [1]: [s_state#34] -Functions [1]: [partial_sum(total_sum#39)] -Aggregate Attributes [2]: [sum#40, isEmpty#41] -Results [3]: [s_state#34, sum#42, isEmpty#43] - -(41) Exchange -Input [3]: [s_state#34, sum#42, isEmpty#43] -Arguments: hashpartitioning(s_state#34, 5), ENSURE_REQUIREMENTS, [id=#44] - -(42) HashAggregate [codegen id : 21] -Input [3]: [s_state#34, sum#42, isEmpty#43] -Keys [1]: [s_state#34] -Functions [1]: [sum(total_sum#39)] -Aggregate Attributes [1]: [sum(total_sum#39)#45] -Results [6]: [sum(total_sum#39)#45 AS total_sum#46, s_state#34, null AS s_county#47, 0 AS g_state#48, 1 AS g_county#49, 1 AS lochierarchy#50] - -(43) ReusedExchange [Reuses operator id: 36] -Output [3]: [s_state#51, s_county#52, sum#53] - -(44) HashAggregate [codegen id : 31] -Input [3]: [s_state#51, s_county#52, sum#53] -Keys [2]: [s_state#51, s_county#52] -Functions [1]: [sum(UnscaledValue(ss_net_profit#54))] -Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_profit#54))#55] -Results [1]: [MakeDecimal(sum(UnscaledValue(ss_net_profit#54))#55,17,2) AS total_sum#39] - -(45) HashAggregate [codegen id : 31] -Input [1]: [total_sum#39] +Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_profit#2))#27] +Results [6]: [cast(MakeDecimal(sum(UnscaledValue(ss_net_profit#2))#27,17,2) as decimal(27,2)) AS total_sum#28, s_state#8, s_county#7, 0 AS g_state#29, 0 AS g_county#30, 0 AS lochierarchy#31] + +(37) ReusedExchange [Reuses operator id: 35] +Output [3]: [s_state#32, s_county#33, sum#34] + +(38) HashAggregate [codegen id : 18] +Input [3]: [s_state#32, s_county#33, sum#34] +Keys [2]: [s_state#32, s_county#33] +Functions [1]: [sum(UnscaledValue(ss_net_profit#35))] +Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_profit#35))#36] +Results [2]: [MakeDecimal(sum(UnscaledValue(ss_net_profit#35))#36,17,2) AS total_sum#37, s_state#32] + +(39) HashAggregate [codegen id : 18] +Input [2]: [total_sum#37, s_state#32] +Keys [1]: [s_state#32] +Functions [1]: [partial_sum(total_sum#37)] +Aggregate Attributes [2]: [sum#38, isEmpty#39] +Results [3]: [s_state#32, sum#40, isEmpty#41] + +(40) Exchange +Input [3]: [s_state#32, sum#40, isEmpty#41] +Arguments: hashpartitioning(s_state#32, 5), ENSURE_REQUIREMENTS, [id=#42] + +(41) HashAggregate [codegen id : 19] +Input [3]: [s_state#32, sum#40, isEmpty#41] +Keys [1]: [s_state#32] +Functions [1]: [sum(total_sum#37)] +Aggregate Attributes [1]: [sum(total_sum#37)#43] +Results [6]: [sum(total_sum#37)#43 AS total_sum#44, s_state#32, null AS s_county#45, 0 AS g_state#46, 1 AS g_county#47, 1 AS lochierarchy#48] + +(42) ReusedExchange [Reuses operator id: 35] +Output [3]: [s_state#49, s_county#50, sum#51] + +(43) HashAggregate [codegen id : 28] +Input [3]: [s_state#49, s_county#50, sum#51] +Keys [2]: [s_state#49, s_county#50] +Functions [1]: [sum(UnscaledValue(ss_net_profit#52))] +Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_profit#52))#53] +Results [1]: [MakeDecimal(sum(UnscaledValue(ss_net_profit#52))#53,17,2) AS total_sum#37] + +(44) HashAggregate [codegen id : 28] +Input [1]: [total_sum#37] Keys: [] -Functions [1]: [partial_sum(total_sum#39)] -Aggregate Attributes [2]: [sum#56, isEmpty#57] -Results [2]: [sum#58, isEmpty#59] +Functions [1]: [partial_sum(total_sum#37)] +Aggregate Attributes [2]: [sum#54, isEmpty#55] +Results [2]: [sum#56, isEmpty#57] -(46) Exchange -Input [2]: [sum#58, isEmpty#59] -Arguments: SinglePartition, ENSURE_REQUIREMENTS, [id=#60] +(45) Exchange +Input [2]: [sum#56, isEmpty#57] +Arguments: SinglePartition, ENSURE_REQUIREMENTS, [id=#58] -(47) HashAggregate [codegen id : 32] -Input [2]: [sum#58, isEmpty#59] +(46) HashAggregate [codegen id : 29] +Input [2]: [sum#56, isEmpty#57] Keys: [] -Functions [1]: [sum(total_sum#39)] -Aggregate Attributes [1]: [sum(total_sum#39)#61] -Results [6]: [sum(total_sum#39)#61 AS total_sum#62, null AS s_state#63, null AS s_county#64, 1 AS g_state#65, 1 AS g_county#66, 2 AS lochierarchy#67] +Functions [1]: [sum(total_sum#37)] +Aggregate Attributes [1]: [sum(total_sum#37)#59] +Results [6]: [sum(total_sum#37)#59 AS total_sum#60, null AS s_state#61, null AS s_county#62, 1 AS g_state#63, 1 AS g_county#64, 2 AS lochierarchy#65] -(48) Union +(47) Union -(49) HashAggregate [codegen id : 33] -Input [6]: [total_sum#30, s_state#8, s_county#7, g_state#31, g_county#32, lochierarchy#33] -Keys [6]: [total_sum#30, s_state#8, s_county#7, g_state#31, g_county#32, lochierarchy#33] +(48) HashAggregate [codegen id : 30] +Input [6]: [total_sum#28, s_state#8, s_county#7, g_state#29, g_county#30, lochierarchy#31] +Keys [6]: [total_sum#28, s_state#8, s_county#7, g_state#29, g_county#30, lochierarchy#31] Functions: [] Aggregate Attributes: [] -Results [6]: [total_sum#30, s_state#8, s_county#7, g_state#31, g_county#32, lochierarchy#33] +Results [6]: [total_sum#28, s_state#8, s_county#7, g_state#29, g_county#30, lochierarchy#31] -(50) Exchange -Input [6]: [total_sum#30, s_state#8, s_county#7, g_state#31, g_county#32, lochierarchy#33] -Arguments: hashpartitioning(total_sum#30, s_state#8, s_county#7, g_state#31, g_county#32, lochierarchy#33, 5), ENSURE_REQUIREMENTS, [id=#68] +(49) Exchange +Input [6]: [total_sum#28, s_state#8, s_county#7, g_state#29, g_county#30, lochierarchy#31] +Arguments: hashpartitioning(total_sum#28, s_state#8, s_county#7, g_state#29, g_county#30, lochierarchy#31, 5), ENSURE_REQUIREMENTS, [id=#66] -(51) HashAggregate [codegen id : 34] -Input [6]: [total_sum#30, s_state#8, s_county#7, g_state#31, g_county#32, lochierarchy#33] -Keys [6]: [total_sum#30, s_state#8, s_county#7, g_state#31, g_county#32, lochierarchy#33] +(50) HashAggregate [codegen id : 31] +Input [6]: [total_sum#28, s_state#8, s_county#7, g_state#29, g_county#30, lochierarchy#31] +Keys [6]: [total_sum#28, s_state#8, s_county#7, g_state#29, g_county#30, lochierarchy#31] Functions: [] Aggregate Attributes: [] -Results [5]: [total_sum#30, s_state#8, s_county#7, lochierarchy#33, CASE WHEN (g_county#32 = 0) THEN s_state#8 END AS _w0#69] +Results [5]: [total_sum#28, s_state#8, s_county#7, lochierarchy#31, CASE WHEN (g_county#30 = 0) THEN s_state#8 END AS _w0#67] -(52) Exchange -Input [5]: [total_sum#30, s_state#8, s_county#7, lochierarchy#33, _w0#69] -Arguments: hashpartitioning(lochierarchy#33, _w0#69, 5), ENSURE_REQUIREMENTS, [id=#70] +(51) Exchange +Input [5]: [total_sum#28, s_state#8, s_county#7, lochierarchy#31, _w0#67] +Arguments: hashpartitioning(lochierarchy#31, _w0#67, 5), ENSURE_REQUIREMENTS, [id=#68] -(53) Sort [codegen id : 35] -Input [5]: [total_sum#30, s_state#8, s_county#7, lochierarchy#33, _w0#69] -Arguments: [lochierarchy#33 ASC NULLS FIRST, _w0#69 ASC NULLS FIRST, total_sum#30 DESC NULLS LAST], false, 0 +(52) Sort [codegen id : 32] +Input [5]: [total_sum#28, s_state#8, s_county#7, lochierarchy#31, _w0#67] +Arguments: [lochierarchy#31 ASC NULLS FIRST, _w0#67 ASC NULLS FIRST, total_sum#28 DESC NULLS LAST], false, 0 -(54) Window -Input [5]: [total_sum#30, s_state#8, s_county#7, lochierarchy#33, _w0#69] -Arguments: [rank(total_sum#30) windowspecdefinition(lochierarchy#33, _w0#69, total_sum#30 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS rank_within_parent#71], [lochierarchy#33, _w0#69], [total_sum#30 DESC NULLS LAST] +(53) Window +Input [5]: [total_sum#28, s_state#8, s_county#7, lochierarchy#31, _w0#67] +Arguments: [rank(total_sum#28) windowspecdefinition(lochierarchy#31, _w0#67, total_sum#28 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS rank_within_parent#69], [lochierarchy#31, _w0#67], [total_sum#28 DESC NULLS LAST] -(55) Project [codegen id : 36] -Output [5]: [total_sum#30, s_state#8, s_county#7, lochierarchy#33, rank_within_parent#71] -Input [6]: [total_sum#30, s_state#8, s_county#7, lochierarchy#33, _w0#69, rank_within_parent#71] +(54) Project [codegen id : 33] +Output [5]: [total_sum#28, s_state#8, s_county#7, lochierarchy#31, rank_within_parent#69] +Input [6]: [total_sum#28, s_state#8, s_county#7, lochierarchy#31, _w0#67, rank_within_parent#69] -(56) TakeOrderedAndProject -Input [5]: [total_sum#30, s_state#8, s_county#7, lochierarchy#33, rank_within_parent#71] -Arguments: 100, [lochierarchy#33 DESC NULLS LAST, CASE WHEN (lochierarchy#33 = 0) THEN s_state#8 END ASC NULLS FIRST, rank_within_parent#71 ASC NULLS FIRST], [total_sum#30, s_state#8, s_county#7, lochierarchy#33, rank_within_parent#71] +(55) TakeOrderedAndProject +Input [5]: [total_sum#28, s_state#8, s_county#7, lochierarchy#31, rank_within_parent#69] +Arguments: 100, [lochierarchy#31 DESC NULLS LAST, CASE WHEN (lochierarchy#31 = 0) THEN s_state#8 END ASC NULLS FIRST, rank_within_parent#69 ASC NULLS FIRST], [total_sum#28, s_state#8, s_county#7, lochierarchy#31, rank_within_parent#69] ===== Subqueries ===== Subquery:1 Hosting operator id = 1 Hosting Expression = ss_sold_date_sk#3 IN dynamicpruning#4 -BroadcastExchange (61) -+- * Project (60) - +- * Filter (59) - +- * ColumnarToRow (58) - +- Scan parquet default.date_dim (57) +BroadcastExchange (60) ++- * Project (59) + +- * Filter (58) + +- * ColumnarToRow (57) + +- Scan parquet default.date_dim (56) -(57) Scan parquet default.date_dim -Output [2]: [d_date_sk#5, d_month_seq#72] +(56) Scan parquet default.date_dim +Output [2]: [d_date_sk#5, d_month_seq#70] Batched: true Location [not included in comparison]/{warehouse_dir}/date_dim] PushedFilters: [IsNotNull(d_month_seq), GreaterThanOrEqual(d_month_seq,1212), LessThanOrEqual(d_month_seq,1223), IsNotNull(d_date_sk)] ReadSchema: struct -(58) ColumnarToRow [codegen id : 1] -Input [2]: [d_date_sk#5, d_month_seq#72] +(57) ColumnarToRow [codegen id : 1] +Input [2]: [d_date_sk#5, d_month_seq#70] -(59) Filter [codegen id : 1] -Input [2]: [d_date_sk#5, d_month_seq#72] -Condition : (((isnotnull(d_month_seq#72) AND (d_month_seq#72 >= 1212)) AND (d_month_seq#72 <= 1223)) AND isnotnull(d_date_sk#5)) +(58) Filter [codegen id : 1] +Input [2]: [d_date_sk#5, d_month_seq#70] +Condition : (((isnotnull(d_month_seq#70) AND (d_month_seq#70 >= 1212)) AND (d_month_seq#70 <= 1223)) AND isnotnull(d_date_sk#5)) -(60) Project [codegen id : 1] +(59) Project [codegen id : 1] Output [1]: [d_date_sk#5] -Input [2]: [d_date_sk#5, d_month_seq#72] +Input [2]: [d_date_sk#5, d_month_seq#70] -(61) BroadcastExchange +(60) BroadcastExchange Input [1]: [d_date_sk#5] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [id=#73] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [id=#71] Subquery:2 Hosting operator id = 10 Hosting Expression = ss_sold_date_sk#11 IN dynamicpruning#4 diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q70a.sf100/simplified.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q70a.sf100/simplified.txt index 0dee28b728723..46d5eb070d7b7 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q70a.sf100/simplified.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q70a.sf100/simplified.txt @@ -1,25 +1,25 @@ TakeOrderedAndProject [lochierarchy,s_state,rank_within_parent,total_sum,s_county] - WholeStageCodegen (36) + WholeStageCodegen (33) Project [total_sum,s_state,s_county,lochierarchy,rank_within_parent] InputAdapter Window [total_sum,lochierarchy,_w0] - WholeStageCodegen (35) + WholeStageCodegen (32) Sort [lochierarchy,_w0,total_sum] InputAdapter Exchange [lochierarchy,_w0] #1 - WholeStageCodegen (34) + WholeStageCodegen (31) HashAggregate [total_sum,s_state,s_county,g_state,g_county,lochierarchy] [_w0] InputAdapter Exchange [total_sum,s_state,s_county,g_state,g_county,lochierarchy] #2 - WholeStageCodegen (33) + WholeStageCodegen (30) HashAggregate [total_sum,s_state,s_county,g_state,g_county,lochierarchy] InputAdapter Union - WholeStageCodegen (10) + WholeStageCodegen (9) HashAggregate [s_state,s_county,sum] [sum(UnscaledValue(ss_net_profit)),total_sum,g_state,g_county,lochierarchy,sum] InputAdapter Exchange [s_state,s_county] #3 - WholeStageCodegen (9) + WholeStageCodegen (8) HashAggregate [s_state,s_county,ss_net_profit] [sum,sum] Project [ss_net_profit,s_county,s_state] BroadcastHashJoin [ss_store_sk,s_store_sk] @@ -41,7 +41,7 @@ TakeOrderedAndProject [lochierarchy,s_state,rank_within_parent,total_sum,s_count ReusedExchange [d_date_sk] #4 InputAdapter BroadcastExchange #5 - WholeStageCodegen (8) + WholeStageCodegen (7) BroadcastHashJoin [s_state,s_state] Filter [s_store_sk] ColumnarToRow @@ -49,53 +49,50 @@ TakeOrderedAndProject [lochierarchy,s_state,rank_within_parent,total_sum,s_count Scan parquet default.store [s_store_sk,s_county,s_state] InputAdapter BroadcastExchange #6 - WholeStageCodegen (7) + WholeStageCodegen (6) Project [s_state] Filter [ranking] InputAdapter Window [_w2,s_state] - WholeStageCodegen (6) + WholeStageCodegen (5) Sort [s_state,_w2] - InputAdapter - Exchange [s_state] #7 - WholeStageCodegen (5) - HashAggregate [s_state,sum] [sum(UnscaledValue(ss_net_profit)),s_state,_w2,sum] - InputAdapter - Exchange [s_state] #8 - WholeStageCodegen (4) - HashAggregate [s_state,ss_net_profit] [sum,sum] - Project [ss_net_profit,s_state] - BroadcastHashJoin [ss_store_sk,s_store_sk] - Project [ss_store_sk,ss_net_profit] - BroadcastHashJoin [ss_sold_date_sk,d_date_sk] - Filter [ss_store_sk] - ColumnarToRow - InputAdapter - Scan parquet default.store_sales [ss_store_sk,ss_net_profit,ss_sold_date_sk] - ReusedSubquery [d_date_sk] #1 + HashAggregate [sum] [sum(UnscaledValue(ss_net_profit)),s_state,_w2,sum] + InputAdapter + Exchange [s_state] #7 + WholeStageCodegen (4) + HashAggregate [s_state,ss_net_profit] [sum,sum] + Project [ss_net_profit,s_state] + BroadcastHashJoin [ss_store_sk,s_store_sk] + Project [ss_store_sk,ss_net_profit] + BroadcastHashJoin [ss_sold_date_sk,d_date_sk] + Filter [ss_store_sk] + ColumnarToRow + InputAdapter + Scan parquet default.store_sales [ss_store_sk,ss_net_profit,ss_sold_date_sk] + ReusedSubquery [d_date_sk] #1 + InputAdapter + ReusedExchange [d_date_sk] #4 + InputAdapter + BroadcastExchange #8 + WholeStageCodegen (3) + Filter [s_store_sk] + ColumnarToRow InputAdapter - ReusedExchange [d_date_sk] #4 - InputAdapter - BroadcastExchange #9 - WholeStageCodegen (3) - Filter [s_store_sk] - ColumnarToRow - InputAdapter - Scan parquet default.store [s_store_sk,s_state] - WholeStageCodegen (21) + Scan parquet default.store [s_store_sk,s_state] + WholeStageCodegen (19) HashAggregate [s_state,sum,isEmpty] [sum(total_sum),total_sum,s_county,g_state,g_county,lochierarchy,sum,isEmpty] InputAdapter - Exchange [s_state] #10 - WholeStageCodegen (20) + Exchange [s_state] #9 + WholeStageCodegen (18) HashAggregate [s_state,total_sum] [sum,isEmpty,sum,isEmpty] HashAggregate [s_state,s_county,sum] [sum(UnscaledValue(ss_net_profit)),total_sum,sum] InputAdapter ReusedExchange [s_state,s_county,sum] #3 - WholeStageCodegen (32) + WholeStageCodegen (29) HashAggregate [sum,isEmpty] [sum(total_sum),total_sum,s_state,s_county,g_state,g_county,lochierarchy,sum,isEmpty] InputAdapter - Exchange #11 - WholeStageCodegen (31) + Exchange #10 + WholeStageCodegen (28) HashAggregate [total_sum] [sum,isEmpty,sum,isEmpty] HashAggregate [s_state,s_county,sum] [sum(UnscaledValue(ss_net_profit)),total_sum,sum] InputAdapter diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q70a/explain.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q70a/explain.txt index 21d63a7f4bf47..c5cb2010c67dd 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q70a/explain.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q70a/explain.txt @@ -1,60 +1,59 @@ == Physical Plan == -TakeOrderedAndProject (56) -+- * Project (55) - +- Window (54) - +- * Sort (53) - +- Exchange (52) - +- * HashAggregate (51) - +- Exchange (50) - +- * HashAggregate (49) - +- Union (48) - :- * HashAggregate (37) - : +- Exchange (36) - : +- * HashAggregate (35) - : +- * Project (34) - : +- * BroadcastHashJoin Inner BuildRight (33) +TakeOrderedAndProject (55) ++- * Project (54) + +- Window (53) + +- * Sort (52) + +- Exchange (51) + +- * HashAggregate (50) + +- Exchange (49) + +- * HashAggregate (48) + +- Union (47) + :- * HashAggregate (36) + : +- Exchange (35) + : +- * HashAggregate (34) + : +- * Project (33) + : +- * BroadcastHashJoin Inner BuildRight (32) : :- * Project (6) : : +- * BroadcastHashJoin Inner BuildRight (5) : : :- * Filter (3) : : : +- * ColumnarToRow (2) : : : +- Scan parquet default.store_sales (1) : : +- ReusedExchange (4) - : +- BroadcastExchange (32) - : +- * BroadcastHashJoin LeftSemi BuildRight (31) + : +- BroadcastExchange (31) + : +- * BroadcastHashJoin LeftSemi BuildRight (30) : :- * Filter (9) : : +- * ColumnarToRow (8) : : +- Scan parquet default.store (7) - : +- BroadcastExchange (30) - : +- * Project (29) - : +- * Filter (28) - : +- Window (27) - : +- * Sort (26) - : +- Exchange (25) - : +- * HashAggregate (24) - : +- Exchange (23) - : +- * HashAggregate (22) - : +- * Project (21) - : +- * BroadcastHashJoin Inner BuildRight (20) - : :- * Project (18) - : : +- * BroadcastHashJoin Inner BuildRight (17) - : : :- * Filter (12) - : : : +- * ColumnarToRow (11) - : : : +- Scan parquet default.store_sales (10) - : : +- BroadcastExchange (16) - : : +- * Filter (15) - : : +- * ColumnarToRow (14) - : : +- Scan parquet default.store (13) - : +- ReusedExchange (19) - :- * HashAggregate (42) - : +- Exchange (41) - : +- * HashAggregate (40) - : +- * HashAggregate (39) - : +- ReusedExchange (38) - +- * HashAggregate (47) - +- Exchange (46) - +- * HashAggregate (45) - +- * HashAggregate (44) - +- ReusedExchange (43) + : +- BroadcastExchange (29) + : +- * Project (28) + : +- * Filter (27) + : +- Window (26) + : +- * Sort (25) + : +- * HashAggregate (24) + : +- Exchange (23) + : +- * HashAggregate (22) + : +- * Project (21) + : +- * BroadcastHashJoin Inner BuildRight (20) + : :- * Project (18) + : : +- * BroadcastHashJoin Inner BuildRight (17) + : : :- * Filter (12) + : : : +- * ColumnarToRow (11) + : : : +- Scan parquet default.store_sales (10) + : : +- BroadcastExchange (16) + : : +- * Filter (15) + : : +- * ColumnarToRow (14) + : : +- Scan parquet default.store (13) + : +- ReusedExchange (19) + :- * HashAggregate (41) + : +- Exchange (40) + : +- * HashAggregate (39) + : +- * HashAggregate (38) + : +- ReusedExchange (37) + +- * HashAggregate (46) + +- Exchange (45) + +- * HashAggregate (44) + +- * HashAggregate (43) + +- ReusedExchange (42) (1) Scan parquet default.store_sales @@ -65,22 +64,22 @@ PartitionFilters: [isnotnull(ss_sold_date_sk#3), dynamicpruningexpression(ss_sol PushedFilters: [IsNotNull(ss_store_sk)] ReadSchema: struct -(2) ColumnarToRow [codegen id : 9] +(2) ColumnarToRow [codegen id : 8] Input [3]: [ss_store_sk#1, ss_net_profit#2, ss_sold_date_sk#3] -(3) Filter [codegen id : 9] +(3) Filter [codegen id : 8] Input [3]: [ss_store_sk#1, ss_net_profit#2, ss_sold_date_sk#3] Condition : isnotnull(ss_store_sk#1) -(4) ReusedExchange [Reuses operator id: 61] +(4) ReusedExchange [Reuses operator id: 60] Output [1]: [d_date_sk#5] -(5) BroadcastHashJoin [codegen id : 9] +(5) BroadcastHashJoin [codegen id : 8] Left keys [1]: [ss_sold_date_sk#3] Right keys [1]: [d_date_sk#5] Join condition: None -(6) Project [codegen id : 9] +(6) Project [codegen id : 8] Output [2]: [ss_store_sk#1, ss_net_profit#2] Input [4]: [ss_store_sk#1, ss_net_profit#2, ss_sold_date_sk#3, d_date_sk#5] @@ -91,10 +90,10 @@ Location [not included in comparison]/{warehouse_dir}/store] PushedFilters: [IsNotNull(s_store_sk)] ReadSchema: struct -(8) ColumnarToRow [codegen id : 8] +(8) ColumnarToRow [codegen id : 7] Input [3]: [s_store_sk#6, s_county#7, s_state#8] -(9) Filter [codegen id : 8] +(9) Filter [codegen id : 7] Input [3]: [s_store_sk#6, s_county#7, s_state#8] Condition : isnotnull(s_store_sk#6) @@ -140,7 +139,7 @@ Join condition: None Output [3]: [ss_net_profit#10, ss_sold_date_sk#11, s_state#13] Input [5]: [ss_store_sk#9, ss_net_profit#10, ss_sold_date_sk#11, s_store_sk#12, s_state#13] -(19) ReusedExchange [Reuses operator id: 61] +(19) ReusedExchange [Reuses operator id: 60] Output [1]: [d_date_sk#15] (20) BroadcastHashJoin [codegen id : 4] @@ -168,195 +167,191 @@ Input [2]: [s_state#13, sum#17] Keys [1]: [s_state#13] Functions [1]: [sum(UnscaledValue(ss_net_profit#10))] Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_profit#10))#19] -Results [3]: [s_state#13 AS s_state#20, s_state#13, MakeDecimal(sum(UnscaledValue(ss_net_profit#10))#19,17,2) AS _w2#21] +Results [3]: [s_state#13, s_state#13, MakeDecimal(sum(UnscaledValue(ss_net_profit#10))#19,17,2) AS _w2#20] -(25) Exchange -Input [3]: [s_state#20, s_state#13, _w2#21] -Arguments: hashpartitioning(s_state#13, 5), ENSURE_REQUIREMENTS, [id=#22] +(25) Sort [codegen id : 5] +Input [3]: [s_state#13, s_state#13, _w2#20] +Arguments: [s_state#13 ASC NULLS FIRST, _w2#20 DESC NULLS LAST], false, 0 -(26) Sort [codegen id : 6] -Input [3]: [s_state#20, s_state#13, _w2#21] -Arguments: [s_state#13 ASC NULLS FIRST, _w2#21 DESC NULLS LAST], false, 0 +(26) Window +Input [3]: [s_state#13, s_state#13, _w2#20] +Arguments: [rank(_w2#20) windowspecdefinition(s_state#13, _w2#20 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS ranking#21], [s_state#13], [_w2#20 DESC NULLS LAST] -(27) Window -Input [3]: [s_state#20, s_state#13, _w2#21] -Arguments: [rank(_w2#21) windowspecdefinition(s_state#13, _w2#21 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS ranking#23], [s_state#13], [_w2#21 DESC NULLS LAST] +(27) Filter [codegen id : 6] +Input [4]: [s_state#13, s_state#13, _w2#20, ranking#21] +Condition : (ranking#21 <= 5) -(28) Filter [codegen id : 7] -Input [4]: [s_state#20, s_state#13, _w2#21, ranking#23] -Condition : (ranking#23 <= 5) +(28) Project [codegen id : 6] +Output [1]: [s_state#13] +Input [4]: [s_state#13, s_state#13, _w2#20, ranking#21] -(29) Project [codegen id : 7] -Output [1]: [s_state#20] -Input [4]: [s_state#20, s_state#13, _w2#21, ranking#23] +(29) BroadcastExchange +Input [1]: [s_state#13] +Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#22] -(30) BroadcastExchange -Input [1]: [s_state#20] -Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#24] - -(31) BroadcastHashJoin [codegen id : 8] +(30) BroadcastHashJoin [codegen id : 7] Left keys [1]: [s_state#8] -Right keys [1]: [s_state#20] +Right keys [1]: [s_state#13] Join condition: None -(32) BroadcastExchange +(31) BroadcastExchange Input [3]: [s_store_sk#6, s_county#7, s_state#8] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#25] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#23] -(33) BroadcastHashJoin [codegen id : 9] +(32) BroadcastHashJoin [codegen id : 8] Left keys [1]: [ss_store_sk#1] Right keys [1]: [s_store_sk#6] Join condition: None -(34) Project [codegen id : 9] +(33) Project [codegen id : 8] Output [3]: [ss_net_profit#2, s_county#7, s_state#8] Input [5]: [ss_store_sk#1, ss_net_profit#2, s_store_sk#6, s_county#7, s_state#8] -(35) HashAggregate [codegen id : 9] +(34) HashAggregate [codegen id : 8] Input [3]: [ss_net_profit#2, s_county#7, s_state#8] Keys [2]: [s_state#8, s_county#7] Functions [1]: [partial_sum(UnscaledValue(ss_net_profit#2))] -Aggregate Attributes [1]: [sum#26] -Results [3]: [s_state#8, s_county#7, sum#27] +Aggregate Attributes [1]: [sum#24] +Results [3]: [s_state#8, s_county#7, sum#25] -(36) Exchange -Input [3]: [s_state#8, s_county#7, sum#27] -Arguments: hashpartitioning(s_state#8, s_county#7, 5), ENSURE_REQUIREMENTS, [id=#28] +(35) Exchange +Input [3]: [s_state#8, s_county#7, sum#25] +Arguments: hashpartitioning(s_state#8, s_county#7, 5), ENSURE_REQUIREMENTS, [id=#26] -(37) HashAggregate [codegen id : 10] -Input [3]: [s_state#8, s_county#7, sum#27] +(36) HashAggregate [codegen id : 9] +Input [3]: [s_state#8, s_county#7, sum#25] Keys [2]: [s_state#8, s_county#7] Functions [1]: [sum(UnscaledValue(ss_net_profit#2))] -Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_profit#2))#29] -Results [6]: [cast(MakeDecimal(sum(UnscaledValue(ss_net_profit#2))#29,17,2) as decimal(27,2)) AS total_sum#30, s_state#8, s_county#7, 0 AS g_state#31, 0 AS g_county#32, 0 AS lochierarchy#33] - -(38) ReusedExchange [Reuses operator id: 36] -Output [3]: [s_state#34, s_county#35, sum#36] - -(39) HashAggregate [codegen id : 20] -Input [3]: [s_state#34, s_county#35, sum#36] -Keys [2]: [s_state#34, s_county#35] -Functions [1]: [sum(UnscaledValue(ss_net_profit#37))] -Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_profit#37))#38] -Results [2]: [MakeDecimal(sum(UnscaledValue(ss_net_profit#37))#38,17,2) AS total_sum#39, s_state#34] - -(40) HashAggregate [codegen id : 20] -Input [2]: [total_sum#39, s_state#34] -Keys [1]: [s_state#34] -Functions [1]: [partial_sum(total_sum#39)] -Aggregate Attributes [2]: [sum#40, isEmpty#41] -Results [3]: [s_state#34, sum#42, isEmpty#43] - -(41) Exchange -Input [3]: [s_state#34, sum#42, isEmpty#43] -Arguments: hashpartitioning(s_state#34, 5), ENSURE_REQUIREMENTS, [id=#44] - -(42) HashAggregate [codegen id : 21] -Input [3]: [s_state#34, sum#42, isEmpty#43] -Keys [1]: [s_state#34] -Functions [1]: [sum(total_sum#39)] -Aggregate Attributes [1]: [sum(total_sum#39)#45] -Results [6]: [sum(total_sum#39)#45 AS total_sum#46, s_state#34, null AS s_county#47, 0 AS g_state#48, 1 AS g_county#49, 1 AS lochierarchy#50] - -(43) ReusedExchange [Reuses operator id: 36] -Output [3]: [s_state#51, s_county#52, sum#53] - -(44) HashAggregate [codegen id : 31] -Input [3]: [s_state#51, s_county#52, sum#53] -Keys [2]: [s_state#51, s_county#52] -Functions [1]: [sum(UnscaledValue(ss_net_profit#54))] -Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_profit#54))#55] -Results [1]: [MakeDecimal(sum(UnscaledValue(ss_net_profit#54))#55,17,2) AS total_sum#39] - -(45) HashAggregate [codegen id : 31] -Input [1]: [total_sum#39] +Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_profit#2))#27] +Results [6]: [cast(MakeDecimal(sum(UnscaledValue(ss_net_profit#2))#27,17,2) as decimal(27,2)) AS total_sum#28, s_state#8, s_county#7, 0 AS g_state#29, 0 AS g_county#30, 0 AS lochierarchy#31] + +(37) ReusedExchange [Reuses operator id: 35] +Output [3]: [s_state#32, s_county#33, sum#34] + +(38) HashAggregate [codegen id : 18] +Input [3]: [s_state#32, s_county#33, sum#34] +Keys [2]: [s_state#32, s_county#33] +Functions [1]: [sum(UnscaledValue(ss_net_profit#35))] +Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_profit#35))#36] +Results [2]: [MakeDecimal(sum(UnscaledValue(ss_net_profit#35))#36,17,2) AS total_sum#37, s_state#32] + +(39) HashAggregate [codegen id : 18] +Input [2]: [total_sum#37, s_state#32] +Keys [1]: [s_state#32] +Functions [1]: [partial_sum(total_sum#37)] +Aggregate Attributes [2]: [sum#38, isEmpty#39] +Results [3]: [s_state#32, sum#40, isEmpty#41] + +(40) Exchange +Input [3]: [s_state#32, sum#40, isEmpty#41] +Arguments: hashpartitioning(s_state#32, 5), ENSURE_REQUIREMENTS, [id=#42] + +(41) HashAggregate [codegen id : 19] +Input [3]: [s_state#32, sum#40, isEmpty#41] +Keys [1]: [s_state#32] +Functions [1]: [sum(total_sum#37)] +Aggregate Attributes [1]: [sum(total_sum#37)#43] +Results [6]: [sum(total_sum#37)#43 AS total_sum#44, s_state#32, null AS s_county#45, 0 AS g_state#46, 1 AS g_county#47, 1 AS lochierarchy#48] + +(42) ReusedExchange [Reuses operator id: 35] +Output [3]: [s_state#49, s_county#50, sum#51] + +(43) HashAggregate [codegen id : 28] +Input [3]: [s_state#49, s_county#50, sum#51] +Keys [2]: [s_state#49, s_county#50] +Functions [1]: [sum(UnscaledValue(ss_net_profit#52))] +Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_profit#52))#53] +Results [1]: [MakeDecimal(sum(UnscaledValue(ss_net_profit#52))#53,17,2) AS total_sum#37] + +(44) HashAggregate [codegen id : 28] +Input [1]: [total_sum#37] Keys: [] -Functions [1]: [partial_sum(total_sum#39)] -Aggregate Attributes [2]: [sum#56, isEmpty#57] -Results [2]: [sum#58, isEmpty#59] +Functions [1]: [partial_sum(total_sum#37)] +Aggregate Attributes [2]: [sum#54, isEmpty#55] +Results [2]: [sum#56, isEmpty#57] -(46) Exchange -Input [2]: [sum#58, isEmpty#59] -Arguments: SinglePartition, ENSURE_REQUIREMENTS, [id=#60] +(45) Exchange +Input [2]: [sum#56, isEmpty#57] +Arguments: SinglePartition, ENSURE_REQUIREMENTS, [id=#58] -(47) HashAggregate [codegen id : 32] -Input [2]: [sum#58, isEmpty#59] +(46) HashAggregate [codegen id : 29] +Input [2]: [sum#56, isEmpty#57] Keys: [] -Functions [1]: [sum(total_sum#39)] -Aggregate Attributes [1]: [sum(total_sum#39)#61] -Results [6]: [sum(total_sum#39)#61 AS total_sum#62, null AS s_state#63, null AS s_county#64, 1 AS g_state#65, 1 AS g_county#66, 2 AS lochierarchy#67] +Functions [1]: [sum(total_sum#37)] +Aggregate Attributes [1]: [sum(total_sum#37)#59] +Results [6]: [sum(total_sum#37)#59 AS total_sum#60, null AS s_state#61, null AS s_county#62, 1 AS g_state#63, 1 AS g_county#64, 2 AS lochierarchy#65] -(48) Union +(47) Union -(49) HashAggregate [codegen id : 33] -Input [6]: [total_sum#30, s_state#8, s_county#7, g_state#31, g_county#32, lochierarchy#33] -Keys [6]: [total_sum#30, s_state#8, s_county#7, g_state#31, g_county#32, lochierarchy#33] +(48) HashAggregate [codegen id : 30] +Input [6]: [total_sum#28, s_state#8, s_county#7, g_state#29, g_county#30, lochierarchy#31] +Keys [6]: [total_sum#28, s_state#8, s_county#7, g_state#29, g_county#30, lochierarchy#31] Functions: [] Aggregate Attributes: [] -Results [6]: [total_sum#30, s_state#8, s_county#7, g_state#31, g_county#32, lochierarchy#33] +Results [6]: [total_sum#28, s_state#8, s_county#7, g_state#29, g_county#30, lochierarchy#31] -(50) Exchange -Input [6]: [total_sum#30, s_state#8, s_county#7, g_state#31, g_county#32, lochierarchy#33] -Arguments: hashpartitioning(total_sum#30, s_state#8, s_county#7, g_state#31, g_county#32, lochierarchy#33, 5), ENSURE_REQUIREMENTS, [id=#68] +(49) Exchange +Input [6]: [total_sum#28, s_state#8, s_county#7, g_state#29, g_county#30, lochierarchy#31] +Arguments: hashpartitioning(total_sum#28, s_state#8, s_county#7, g_state#29, g_county#30, lochierarchy#31, 5), ENSURE_REQUIREMENTS, [id=#66] -(51) HashAggregate [codegen id : 34] -Input [6]: [total_sum#30, s_state#8, s_county#7, g_state#31, g_county#32, lochierarchy#33] -Keys [6]: [total_sum#30, s_state#8, s_county#7, g_state#31, g_county#32, lochierarchy#33] +(50) HashAggregate [codegen id : 31] +Input [6]: [total_sum#28, s_state#8, s_county#7, g_state#29, g_county#30, lochierarchy#31] +Keys [6]: [total_sum#28, s_state#8, s_county#7, g_state#29, g_county#30, lochierarchy#31] Functions: [] Aggregate Attributes: [] -Results [5]: [total_sum#30, s_state#8, s_county#7, lochierarchy#33, CASE WHEN (g_county#32 = 0) THEN s_state#8 END AS _w0#69] +Results [5]: [total_sum#28, s_state#8, s_county#7, lochierarchy#31, CASE WHEN (g_county#30 = 0) THEN s_state#8 END AS _w0#67] -(52) Exchange -Input [5]: [total_sum#30, s_state#8, s_county#7, lochierarchy#33, _w0#69] -Arguments: hashpartitioning(lochierarchy#33, _w0#69, 5), ENSURE_REQUIREMENTS, [id=#70] +(51) Exchange +Input [5]: [total_sum#28, s_state#8, s_county#7, lochierarchy#31, _w0#67] +Arguments: hashpartitioning(lochierarchy#31, _w0#67, 5), ENSURE_REQUIREMENTS, [id=#68] -(53) Sort [codegen id : 35] -Input [5]: [total_sum#30, s_state#8, s_county#7, lochierarchy#33, _w0#69] -Arguments: [lochierarchy#33 ASC NULLS FIRST, _w0#69 ASC NULLS FIRST, total_sum#30 DESC NULLS LAST], false, 0 +(52) Sort [codegen id : 32] +Input [5]: [total_sum#28, s_state#8, s_county#7, lochierarchy#31, _w0#67] +Arguments: [lochierarchy#31 ASC NULLS FIRST, _w0#67 ASC NULLS FIRST, total_sum#28 DESC NULLS LAST], false, 0 -(54) Window -Input [5]: [total_sum#30, s_state#8, s_county#7, lochierarchy#33, _w0#69] -Arguments: [rank(total_sum#30) windowspecdefinition(lochierarchy#33, _w0#69, total_sum#30 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS rank_within_parent#71], [lochierarchy#33, _w0#69], [total_sum#30 DESC NULLS LAST] +(53) Window +Input [5]: [total_sum#28, s_state#8, s_county#7, lochierarchy#31, _w0#67] +Arguments: [rank(total_sum#28) windowspecdefinition(lochierarchy#31, _w0#67, total_sum#28 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS rank_within_parent#69], [lochierarchy#31, _w0#67], [total_sum#28 DESC NULLS LAST] -(55) Project [codegen id : 36] -Output [5]: [total_sum#30, s_state#8, s_county#7, lochierarchy#33, rank_within_parent#71] -Input [6]: [total_sum#30, s_state#8, s_county#7, lochierarchy#33, _w0#69, rank_within_parent#71] +(54) Project [codegen id : 33] +Output [5]: [total_sum#28, s_state#8, s_county#7, lochierarchy#31, rank_within_parent#69] +Input [6]: [total_sum#28, s_state#8, s_county#7, lochierarchy#31, _w0#67, rank_within_parent#69] -(56) TakeOrderedAndProject -Input [5]: [total_sum#30, s_state#8, s_county#7, lochierarchy#33, rank_within_parent#71] -Arguments: 100, [lochierarchy#33 DESC NULLS LAST, CASE WHEN (lochierarchy#33 = 0) THEN s_state#8 END ASC NULLS FIRST, rank_within_parent#71 ASC NULLS FIRST], [total_sum#30, s_state#8, s_county#7, lochierarchy#33, rank_within_parent#71] +(55) TakeOrderedAndProject +Input [5]: [total_sum#28, s_state#8, s_county#7, lochierarchy#31, rank_within_parent#69] +Arguments: 100, [lochierarchy#31 DESC NULLS LAST, CASE WHEN (lochierarchy#31 = 0) THEN s_state#8 END ASC NULLS FIRST, rank_within_parent#69 ASC NULLS FIRST], [total_sum#28, s_state#8, s_county#7, lochierarchy#31, rank_within_parent#69] ===== Subqueries ===== Subquery:1 Hosting operator id = 1 Hosting Expression = ss_sold_date_sk#3 IN dynamicpruning#4 -BroadcastExchange (61) -+- * Project (60) - +- * Filter (59) - +- * ColumnarToRow (58) - +- Scan parquet default.date_dim (57) +BroadcastExchange (60) ++- * Project (59) + +- * Filter (58) + +- * ColumnarToRow (57) + +- Scan parquet default.date_dim (56) -(57) Scan parquet default.date_dim -Output [2]: [d_date_sk#5, d_month_seq#72] +(56) Scan parquet default.date_dim +Output [2]: [d_date_sk#5, d_month_seq#70] Batched: true Location [not included in comparison]/{warehouse_dir}/date_dim] PushedFilters: [IsNotNull(d_month_seq), GreaterThanOrEqual(d_month_seq,1212), LessThanOrEqual(d_month_seq,1223), IsNotNull(d_date_sk)] ReadSchema: struct -(58) ColumnarToRow [codegen id : 1] -Input [2]: [d_date_sk#5, d_month_seq#72] +(57) ColumnarToRow [codegen id : 1] +Input [2]: [d_date_sk#5, d_month_seq#70] -(59) Filter [codegen id : 1] -Input [2]: [d_date_sk#5, d_month_seq#72] -Condition : (((isnotnull(d_month_seq#72) AND (d_month_seq#72 >= 1212)) AND (d_month_seq#72 <= 1223)) AND isnotnull(d_date_sk#5)) +(58) Filter [codegen id : 1] +Input [2]: [d_date_sk#5, d_month_seq#70] +Condition : (((isnotnull(d_month_seq#70) AND (d_month_seq#70 >= 1212)) AND (d_month_seq#70 <= 1223)) AND isnotnull(d_date_sk#5)) -(60) Project [codegen id : 1] +(59) Project [codegen id : 1] Output [1]: [d_date_sk#5] -Input [2]: [d_date_sk#5, d_month_seq#72] +Input [2]: [d_date_sk#5, d_month_seq#70] -(61) BroadcastExchange +(60) BroadcastExchange Input [1]: [d_date_sk#5] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [id=#73] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [id=#71] Subquery:2 Hosting operator id = 10 Hosting Expression = ss_sold_date_sk#11 IN dynamicpruning#4 diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q70a/simplified.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q70a/simplified.txt index 174ed6bd7414d..bef99c6f74d39 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q70a/simplified.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q70a/simplified.txt @@ -1,25 +1,25 @@ TakeOrderedAndProject [lochierarchy,s_state,rank_within_parent,total_sum,s_county] - WholeStageCodegen (36) + WholeStageCodegen (33) Project [total_sum,s_state,s_county,lochierarchy,rank_within_parent] InputAdapter Window [total_sum,lochierarchy,_w0] - WholeStageCodegen (35) + WholeStageCodegen (32) Sort [lochierarchy,_w0,total_sum] InputAdapter Exchange [lochierarchy,_w0] #1 - WholeStageCodegen (34) + WholeStageCodegen (31) HashAggregate [total_sum,s_state,s_county,g_state,g_county,lochierarchy] [_w0] InputAdapter Exchange [total_sum,s_state,s_county,g_state,g_county,lochierarchy] #2 - WholeStageCodegen (33) + WholeStageCodegen (30) HashAggregate [total_sum,s_state,s_county,g_state,g_county,lochierarchy] InputAdapter Union - WholeStageCodegen (10) + WholeStageCodegen (9) HashAggregate [s_state,s_county,sum] [sum(UnscaledValue(ss_net_profit)),total_sum,g_state,g_county,lochierarchy,sum] InputAdapter Exchange [s_state,s_county] #3 - WholeStageCodegen (9) + WholeStageCodegen (8) HashAggregate [s_state,s_county,ss_net_profit] [sum,sum] Project [ss_net_profit,s_county,s_state] BroadcastHashJoin [ss_store_sk,s_store_sk] @@ -41,7 +41,7 @@ TakeOrderedAndProject [lochierarchy,s_state,rank_within_parent,total_sum,s_count ReusedExchange [d_date_sk] #4 InputAdapter BroadcastExchange #5 - WholeStageCodegen (8) + WholeStageCodegen (7) BroadcastHashJoin [s_state,s_state] Filter [s_store_sk] ColumnarToRow @@ -49,53 +49,50 @@ TakeOrderedAndProject [lochierarchy,s_state,rank_within_parent,total_sum,s_count Scan parquet default.store [s_store_sk,s_county,s_state] InputAdapter BroadcastExchange #6 - WholeStageCodegen (7) + WholeStageCodegen (6) Project [s_state] Filter [ranking] InputAdapter Window [_w2,s_state] - WholeStageCodegen (6) + WholeStageCodegen (5) Sort [s_state,_w2] - InputAdapter - Exchange [s_state] #7 - WholeStageCodegen (5) - HashAggregate [s_state,sum] [sum(UnscaledValue(ss_net_profit)),s_state,_w2,sum] - InputAdapter - Exchange [s_state] #8 - WholeStageCodegen (4) - HashAggregate [s_state,ss_net_profit] [sum,sum] - Project [ss_net_profit,s_state] - BroadcastHashJoin [ss_sold_date_sk,d_date_sk] - Project [ss_net_profit,ss_sold_date_sk,s_state] - BroadcastHashJoin [ss_store_sk,s_store_sk] - Filter [ss_store_sk] + HashAggregate [sum] [sum(UnscaledValue(ss_net_profit)),s_state,_w2,sum] + InputAdapter + Exchange [s_state] #7 + WholeStageCodegen (4) + HashAggregate [s_state,ss_net_profit] [sum,sum] + Project [ss_net_profit,s_state] + BroadcastHashJoin [ss_sold_date_sk,d_date_sk] + Project [ss_net_profit,ss_sold_date_sk,s_state] + BroadcastHashJoin [ss_store_sk,s_store_sk] + Filter [ss_store_sk] + ColumnarToRow + InputAdapter + Scan parquet default.store_sales [ss_store_sk,ss_net_profit,ss_sold_date_sk] + ReusedSubquery [d_date_sk] #1 + InputAdapter + BroadcastExchange #8 + WholeStageCodegen (2) + Filter [s_store_sk] ColumnarToRow InputAdapter - Scan parquet default.store_sales [ss_store_sk,ss_net_profit,ss_sold_date_sk] - ReusedSubquery [d_date_sk] #1 - InputAdapter - BroadcastExchange #9 - WholeStageCodegen (2) - Filter [s_store_sk] - ColumnarToRow - InputAdapter - Scan parquet default.store [s_store_sk,s_state] - InputAdapter - ReusedExchange [d_date_sk] #4 - WholeStageCodegen (21) + Scan parquet default.store [s_store_sk,s_state] + InputAdapter + ReusedExchange [d_date_sk] #4 + WholeStageCodegen (19) HashAggregate [s_state,sum,isEmpty] [sum(total_sum),total_sum,s_county,g_state,g_county,lochierarchy,sum,isEmpty] InputAdapter - Exchange [s_state] #10 - WholeStageCodegen (20) + Exchange [s_state] #9 + WholeStageCodegen (18) HashAggregate [s_state,total_sum] [sum,isEmpty,sum,isEmpty] HashAggregate [s_state,s_county,sum] [sum(UnscaledValue(ss_net_profit)),total_sum,sum] InputAdapter ReusedExchange [s_state,s_county,sum] #3 - WholeStageCodegen (32) + WholeStageCodegen (29) HashAggregate [sum,isEmpty] [sum(total_sum),total_sum,s_state,s_county,g_state,g_county,lochierarchy,sum,isEmpty] InputAdapter - Exchange #11 - WholeStageCodegen (31) + Exchange #10 + WholeStageCodegen (28) HashAggregate [total_sum] [sum,isEmpty,sum,isEmpty] HashAggregate [s_state,s_county,sum] [sum(UnscaledValue(ss_net_profit)),total_sum,sum] InputAdapter diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q74.sf100/explain.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q74.sf100/explain.txt index fea0bcbbef17e..0ba4816e69f99 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q74.sf100/explain.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q74.sf100/explain.txt @@ -1,9 +1,9 @@ == Physical Plan == -TakeOrderedAndProject (80) -+- * Project (79) - +- * SortMergeJoin Inner (78) - :- * Project (60) - : +- * SortMergeJoin Inner (59) +TakeOrderedAndProject (79) ++- * Project (78) + +- * SortMergeJoin Inner (77) + :- * Project (59) + : +- * SortMergeJoin Inner (58) : :- * SortMergeJoin Inner (39) : : :- * Sort (21) : : : +- Exchange (20) @@ -43,42 +43,41 @@ TakeOrderedAndProject (80) : : : +- ReusedExchange (25) : : +- * Sort (31) : : +- ReusedExchange (30) - : +- * Sort (58) - : +- Exchange (57) - : +- * Project (56) - : +- * Filter (55) - : +- * HashAggregate (54) - : +- Exchange (53) - : +- * HashAggregate (52) - : +- * Project (51) - : +- * SortMergeJoin Inner (50) - : :- * Sort (47) - : : +- Exchange (46) - : : +- * Project (45) - : : +- * BroadcastHashJoin Inner BuildRight (44) - : : :- * Filter (42) - : : : +- * ColumnarToRow (41) - : : : +- Scan parquet default.web_sales (40) - : : +- ReusedExchange (43) - : +- * Sort (49) - : +- ReusedExchange (48) - +- * Sort (77) - +- Exchange (76) - +- * HashAggregate (75) - +- Exchange (74) - +- * HashAggregate (73) - +- * Project (72) - +- * SortMergeJoin Inner (71) - :- * Sort (68) - : +- Exchange (67) - : +- * Project (66) - : +- * BroadcastHashJoin Inner BuildRight (65) - : :- * Filter (63) - : : +- * ColumnarToRow (62) - : : +- Scan parquet default.web_sales (61) - : +- ReusedExchange (64) - +- * Sort (70) - +- ReusedExchange (69) + : +- * Sort (57) + : +- Exchange (56) + : +- * Filter (55) + : +- * HashAggregate (54) + : +- Exchange (53) + : +- * HashAggregate (52) + : +- * Project (51) + : +- * SortMergeJoin Inner (50) + : :- * Sort (47) + : : +- Exchange (46) + : : +- * Project (45) + : : +- * BroadcastHashJoin Inner BuildRight (44) + : : :- * Filter (42) + : : : +- * ColumnarToRow (41) + : : : +- Scan parquet default.web_sales (40) + : : +- ReusedExchange (43) + : +- * Sort (49) + : +- ReusedExchange (48) + +- * Sort (76) + +- Exchange (75) + +- * HashAggregate (74) + +- Exchange (73) + +- * HashAggregate (72) + +- * Project (71) + +- * SortMergeJoin Inner (70) + :- * Sort (67) + : +- Exchange (66) + : +- * Project (65) + : +- * BroadcastHashJoin Inner BuildRight (64) + : :- * Filter (62) + : : +- * ColumnarToRow (61) + : : +- Scan parquet default.web_sales (60) + : +- ReusedExchange (63) + +- * Sort (69) + +- ReusedExchange (68) (1) Scan parquet default.store_sales @@ -96,7 +95,7 @@ Input [3]: [ss_customer_sk#1, ss_net_paid#2, ss_sold_date_sk#3] Input [3]: [ss_customer_sk#1, ss_net_paid#2, ss_sold_date_sk#3] Condition : isnotnull(ss_customer_sk#1) -(4) ReusedExchange [Reuses operator id: 84] +(4) ReusedExchange [Reuses operator id: 83] Output [2]: [d_date_sk#5, d_year#6] (5) BroadcastHashJoin [codegen id : 2] @@ -192,7 +191,7 @@ Input [3]: [ss_customer_sk#20, ss_net_paid#21, ss_sold_date_sk#22] Input [3]: [ss_customer_sk#20, ss_net_paid#21, ss_sold_date_sk#22] Condition : isnotnull(ss_customer_sk#20) -(25) ReusedExchange [Reuses operator id: 88] +(25) ReusedExchange [Reuses operator id: 87] Output [2]: [d_date_sk#24, d_year#25] (26) BroadcastHashJoin [codegen id : 10] @@ -274,7 +273,7 @@ Input [3]: [ws_bill_customer_sk#40, ws_net_paid#41, ws_sold_date_sk#42] Input [3]: [ws_bill_customer_sk#40, ws_net_paid#41, ws_sold_date_sk#42] Condition : isnotnull(ws_bill_customer_sk#40) -(43) ReusedExchange [Reuses operator id: 84] +(43) ReusedExchange [Reuses operator id: 83] Output [2]: [d_date_sk#43, d_year#44] (44) BroadcastHashJoin [codegen id : 19] @@ -332,171 +331,167 @@ Results [2]: [c_customer_id#47 AS customer_id#54, MakeDecimal(sum(UnscaledValue( Input [2]: [customer_id#54, year_total#55] Condition : (isnotnull(year_total#55) AND (year_total#55 > 0.00)) -(56) Project [codegen id : 24] -Output [2]: [customer_id#54 AS customer_id#56, year_total#55 AS year_total#57] +(56) Exchange Input [2]: [customer_id#54, year_total#55] +Arguments: hashpartitioning(customer_id#54, 5), ENSURE_REQUIREMENTS, [id=#56] -(57) Exchange -Input [2]: [customer_id#56, year_total#57] -Arguments: hashpartitioning(customer_id#56, 5), ENSURE_REQUIREMENTS, [id=#58] - -(58) Sort [codegen id : 25] -Input [2]: [customer_id#56, year_total#57] -Arguments: [customer_id#56 ASC NULLS FIRST], false, 0 +(57) Sort [codegen id : 25] +Input [2]: [customer_id#54, year_total#55] +Arguments: [customer_id#54 ASC NULLS FIRST], false, 0 -(59) SortMergeJoin [codegen id : 26] +(58) SortMergeJoin [codegen id : 26] Left keys [1]: [customer_id#17] -Right keys [1]: [customer_id#56] +Right keys [1]: [customer_id#54] Join condition: None -(60) Project [codegen id : 26] -Output [7]: [customer_id#17, year_total#18, customer_id#35, customer_first_name#36, customer_last_name#37, year_total#38, year_total#57] -Input [8]: [customer_id#17, year_total#18, customer_id#35, customer_first_name#36, customer_last_name#37, year_total#38, customer_id#56, year_total#57] +(59) Project [codegen id : 26] +Output [7]: [customer_id#17, year_total#18, customer_id#35, customer_first_name#36, customer_last_name#37, year_total#38, year_total#55] +Input [8]: [customer_id#17, year_total#18, customer_id#35, customer_first_name#36, customer_last_name#37, year_total#38, customer_id#54, year_total#55] -(61) Scan parquet default.web_sales -Output [3]: [ws_bill_customer_sk#59, ws_net_paid#60, ws_sold_date_sk#61] +(60) Scan parquet default.web_sales +Output [3]: [ws_bill_customer_sk#57, ws_net_paid#58, ws_sold_date_sk#59] Batched: true Location: InMemoryFileIndex [] -PartitionFilters: [isnotnull(ws_sold_date_sk#61), dynamicpruningexpression(ws_sold_date_sk#61 IN dynamicpruning#23)] +PartitionFilters: [isnotnull(ws_sold_date_sk#59), dynamicpruningexpression(ws_sold_date_sk#59 IN dynamicpruning#23)] PushedFilters: [IsNotNull(ws_bill_customer_sk)] ReadSchema: struct -(62) ColumnarToRow [codegen id : 28] -Input [3]: [ws_bill_customer_sk#59, ws_net_paid#60, ws_sold_date_sk#61] +(61) ColumnarToRow [codegen id : 28] +Input [3]: [ws_bill_customer_sk#57, ws_net_paid#58, ws_sold_date_sk#59] -(63) Filter [codegen id : 28] -Input [3]: [ws_bill_customer_sk#59, ws_net_paid#60, ws_sold_date_sk#61] -Condition : isnotnull(ws_bill_customer_sk#59) +(62) Filter [codegen id : 28] +Input [3]: [ws_bill_customer_sk#57, ws_net_paid#58, ws_sold_date_sk#59] +Condition : isnotnull(ws_bill_customer_sk#57) -(64) ReusedExchange [Reuses operator id: 88] -Output [2]: [d_date_sk#62, d_year#63] +(63) ReusedExchange [Reuses operator id: 87] +Output [2]: [d_date_sk#60, d_year#61] -(65) BroadcastHashJoin [codegen id : 28] -Left keys [1]: [ws_sold_date_sk#61] -Right keys [1]: [d_date_sk#62] +(64) BroadcastHashJoin [codegen id : 28] +Left keys [1]: [ws_sold_date_sk#59] +Right keys [1]: [d_date_sk#60] Join condition: None -(66) Project [codegen id : 28] -Output [3]: [ws_bill_customer_sk#59, ws_net_paid#60, d_year#63] -Input [5]: [ws_bill_customer_sk#59, ws_net_paid#60, ws_sold_date_sk#61, d_date_sk#62, d_year#63] +(65) Project [codegen id : 28] +Output [3]: [ws_bill_customer_sk#57, ws_net_paid#58, d_year#61] +Input [5]: [ws_bill_customer_sk#57, ws_net_paid#58, ws_sold_date_sk#59, d_date_sk#60, d_year#61] -(67) Exchange -Input [3]: [ws_bill_customer_sk#59, ws_net_paid#60, d_year#63] -Arguments: hashpartitioning(ws_bill_customer_sk#59, 5), ENSURE_REQUIREMENTS, [id=#64] +(66) Exchange +Input [3]: [ws_bill_customer_sk#57, ws_net_paid#58, d_year#61] +Arguments: hashpartitioning(ws_bill_customer_sk#57, 5), ENSURE_REQUIREMENTS, [id=#62] -(68) Sort [codegen id : 29] -Input [3]: [ws_bill_customer_sk#59, ws_net_paid#60, d_year#63] -Arguments: [ws_bill_customer_sk#59 ASC NULLS FIRST], false, 0 +(67) Sort [codegen id : 29] +Input [3]: [ws_bill_customer_sk#57, ws_net_paid#58, d_year#61] +Arguments: [ws_bill_customer_sk#57 ASC NULLS FIRST], false, 0 -(69) ReusedExchange [Reuses operator id: 12] -Output [4]: [c_customer_sk#65, c_customer_id#66, c_first_name#67, c_last_name#68] +(68) ReusedExchange [Reuses operator id: 12] +Output [4]: [c_customer_sk#63, c_customer_id#64, c_first_name#65, c_last_name#66] -(70) Sort [codegen id : 31] -Input [4]: [c_customer_sk#65, c_customer_id#66, c_first_name#67, c_last_name#68] -Arguments: [c_customer_sk#65 ASC NULLS FIRST], false, 0 +(69) Sort [codegen id : 31] +Input [4]: [c_customer_sk#63, c_customer_id#64, c_first_name#65, c_last_name#66] +Arguments: [c_customer_sk#63 ASC NULLS FIRST], false, 0 -(71) SortMergeJoin [codegen id : 32] -Left keys [1]: [ws_bill_customer_sk#59] -Right keys [1]: [c_customer_sk#65] +(70) SortMergeJoin [codegen id : 32] +Left keys [1]: [ws_bill_customer_sk#57] +Right keys [1]: [c_customer_sk#63] Join condition: None -(72) Project [codegen id : 32] -Output [5]: [c_customer_id#66, c_first_name#67, c_last_name#68, ws_net_paid#60, d_year#63] -Input [7]: [ws_bill_customer_sk#59, ws_net_paid#60, d_year#63, c_customer_sk#65, c_customer_id#66, c_first_name#67, c_last_name#68] - -(73) HashAggregate [codegen id : 32] -Input [5]: [c_customer_id#66, c_first_name#67, c_last_name#68, ws_net_paid#60, d_year#63] -Keys [4]: [c_customer_id#66, c_first_name#67, c_last_name#68, d_year#63] -Functions [1]: [partial_sum(UnscaledValue(ws_net_paid#60))] -Aggregate Attributes [1]: [sum#69] -Results [5]: [c_customer_id#66, c_first_name#67, c_last_name#68, d_year#63, sum#70] - -(74) Exchange -Input [5]: [c_customer_id#66, c_first_name#67, c_last_name#68, d_year#63, sum#70] -Arguments: hashpartitioning(c_customer_id#66, c_first_name#67, c_last_name#68, d_year#63, 5), ENSURE_REQUIREMENTS, [id=#71] - -(75) HashAggregate [codegen id : 33] -Input [5]: [c_customer_id#66, c_first_name#67, c_last_name#68, d_year#63, sum#70] -Keys [4]: [c_customer_id#66, c_first_name#67, c_last_name#68, d_year#63] -Functions [1]: [sum(UnscaledValue(ws_net_paid#60))] -Aggregate Attributes [1]: [sum(UnscaledValue(ws_net_paid#60))#72] -Results [2]: [c_customer_id#66 AS customer_id#73, MakeDecimal(sum(UnscaledValue(ws_net_paid#60))#72,17,2) AS year_total#74] - -(76) Exchange -Input [2]: [customer_id#73, year_total#74] -Arguments: hashpartitioning(customer_id#73, 5), ENSURE_REQUIREMENTS, [id=#75] - -(77) Sort [codegen id : 34] -Input [2]: [customer_id#73, year_total#74] -Arguments: [customer_id#73 ASC NULLS FIRST], false, 0 - -(78) SortMergeJoin [codegen id : 35] +(71) Project [codegen id : 32] +Output [5]: [c_customer_id#64, c_first_name#65, c_last_name#66, ws_net_paid#58, d_year#61] +Input [7]: [ws_bill_customer_sk#57, ws_net_paid#58, d_year#61, c_customer_sk#63, c_customer_id#64, c_first_name#65, c_last_name#66] + +(72) HashAggregate [codegen id : 32] +Input [5]: [c_customer_id#64, c_first_name#65, c_last_name#66, ws_net_paid#58, d_year#61] +Keys [4]: [c_customer_id#64, c_first_name#65, c_last_name#66, d_year#61] +Functions [1]: [partial_sum(UnscaledValue(ws_net_paid#58))] +Aggregate Attributes [1]: [sum#67] +Results [5]: [c_customer_id#64, c_first_name#65, c_last_name#66, d_year#61, sum#68] + +(73) Exchange +Input [5]: [c_customer_id#64, c_first_name#65, c_last_name#66, d_year#61, sum#68] +Arguments: hashpartitioning(c_customer_id#64, c_first_name#65, c_last_name#66, d_year#61, 5), ENSURE_REQUIREMENTS, [id=#69] + +(74) HashAggregate [codegen id : 33] +Input [5]: [c_customer_id#64, c_first_name#65, c_last_name#66, d_year#61, sum#68] +Keys [4]: [c_customer_id#64, c_first_name#65, c_last_name#66, d_year#61] +Functions [1]: [sum(UnscaledValue(ws_net_paid#58))] +Aggregate Attributes [1]: [sum(UnscaledValue(ws_net_paid#58))#70] +Results [2]: [c_customer_id#64 AS customer_id#71, MakeDecimal(sum(UnscaledValue(ws_net_paid#58))#70,17,2) AS year_total#72] + +(75) Exchange +Input [2]: [customer_id#71, year_total#72] +Arguments: hashpartitioning(customer_id#71, 5), ENSURE_REQUIREMENTS, [id=#73] + +(76) Sort [codegen id : 34] +Input [2]: [customer_id#71, year_total#72] +Arguments: [customer_id#71 ASC NULLS FIRST], false, 0 + +(77) SortMergeJoin [codegen id : 35] Left keys [1]: [customer_id#17] -Right keys [1]: [customer_id#73] -Join condition: (CASE WHEN (year_total#57 > 0.00) THEN CheckOverflow((promote_precision(year_total#74) / promote_precision(year_total#57)), DecimalType(37,20), true) ELSE null END > CASE WHEN (year_total#18 > 0.00) THEN CheckOverflow((promote_precision(year_total#38) / promote_precision(year_total#18)), DecimalType(37,20), true) ELSE null END) +Right keys [1]: [customer_id#71] +Join condition: (CASE WHEN (year_total#55 > 0.00) THEN CheckOverflow((promote_precision(year_total#72) / promote_precision(year_total#55)), DecimalType(37,20), true) ELSE null END > CASE WHEN (year_total#18 > 0.00) THEN CheckOverflow((promote_precision(year_total#38) / promote_precision(year_total#18)), DecimalType(37,20), true) ELSE null END) -(79) Project [codegen id : 35] +(78) Project [codegen id : 35] Output [3]: [customer_id#35, customer_first_name#36, customer_last_name#37] -Input [9]: [customer_id#17, year_total#18, customer_id#35, customer_first_name#36, customer_last_name#37, year_total#38, year_total#57, customer_id#73, year_total#74] +Input [9]: [customer_id#17, year_total#18, customer_id#35, customer_first_name#36, customer_last_name#37, year_total#38, year_total#55, customer_id#71, year_total#72] -(80) TakeOrderedAndProject +(79) TakeOrderedAndProject Input [3]: [customer_id#35, customer_first_name#36, customer_last_name#37] Arguments: 100, [customer_first_name#36 ASC NULLS FIRST, customer_id#35 ASC NULLS FIRST, customer_last_name#37 ASC NULLS FIRST], [customer_id#35, customer_first_name#36, customer_last_name#37] ===== Subqueries ===== Subquery:1 Hosting operator id = 1 Hosting Expression = ss_sold_date_sk#3 IN dynamicpruning#4 -BroadcastExchange (84) -+- * Filter (83) - +- * ColumnarToRow (82) - +- Scan parquet default.date_dim (81) +BroadcastExchange (83) ++- * Filter (82) + +- * ColumnarToRow (81) + +- Scan parquet default.date_dim (80) -(81) Scan parquet default.date_dim +(80) Scan parquet default.date_dim Output [2]: [d_date_sk#5, d_year#6] Batched: true Location [not included in comparison]/{warehouse_dir}/date_dim] PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2001), In(d_year, [2001,2002]), IsNotNull(d_date_sk)] ReadSchema: struct -(82) ColumnarToRow [codegen id : 1] +(81) ColumnarToRow [codegen id : 1] Input [2]: [d_date_sk#5, d_year#6] -(83) Filter [codegen id : 1] +(82) Filter [codegen id : 1] Input [2]: [d_date_sk#5, d_year#6] Condition : (((isnotnull(d_year#6) AND (d_year#6 = 2001)) AND d_year#6 IN (2001,2002)) AND isnotnull(d_date_sk#5)) -(84) BroadcastExchange +(83) BroadcastExchange Input [2]: [d_date_sk#5, d_year#6] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#76] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#74] Subquery:2 Hosting operator id = 22 Hosting Expression = ss_sold_date_sk#22 IN dynamicpruning#23 -BroadcastExchange (88) -+- * Filter (87) - +- * ColumnarToRow (86) - +- Scan parquet default.date_dim (85) +BroadcastExchange (87) ++- * Filter (86) + +- * ColumnarToRow (85) + +- Scan parquet default.date_dim (84) -(85) Scan parquet default.date_dim +(84) Scan parquet default.date_dim Output [2]: [d_date_sk#24, d_year#25] Batched: true Location [not included in comparison]/{warehouse_dir}/date_dim] PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2002), In(d_year, [2001,2002]), IsNotNull(d_date_sk)] ReadSchema: struct -(86) ColumnarToRow [codegen id : 1] +(85) ColumnarToRow [codegen id : 1] Input [2]: [d_date_sk#24, d_year#25] -(87) Filter [codegen id : 1] +(86) Filter [codegen id : 1] Input [2]: [d_date_sk#24, d_year#25] Condition : (((isnotnull(d_year#25) AND (d_year#25 = 2002)) AND d_year#25 IN (2001,2002)) AND isnotnull(d_date_sk#24)) -(88) BroadcastExchange +(87) BroadcastExchange Input [2]: [d_date_sk#24, d_year#25] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#77] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#75] Subquery:3 Hosting operator id = 40 Hosting Expression = ws_sold_date_sk#42 IN dynamicpruning#4 -Subquery:4 Hosting operator id = 61 Hosting Expression = ws_sold_date_sk#61 IN dynamicpruning#23 +Subquery:4 Hosting operator id = 60 Hosting Expression = ws_sold_date_sk#59 IN dynamicpruning#23 diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q74.sf100/simplified.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q74.sf100/simplified.txt index 99e72fe265b6b..0a7813f60c5dd 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q74.sf100/simplified.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q74.sf100/simplified.txt @@ -99,35 +99,34 @@ TakeOrderedAndProject [customer_first_name,customer_id,customer_last_name] InputAdapter Exchange [customer_id] #10 WholeStageCodegen (24) - Project [customer_id,year_total] - Filter [year_total] - HashAggregate [c_customer_id,c_first_name,c_last_name,d_year,sum] [sum(UnscaledValue(ws_net_paid)),customer_id,year_total,sum] - InputAdapter - Exchange [c_customer_id,c_first_name,c_last_name,d_year] #11 - WholeStageCodegen (23) - HashAggregate [c_customer_id,c_first_name,c_last_name,d_year,ws_net_paid] [sum,sum] - Project [c_customer_id,c_first_name,c_last_name,ws_net_paid,d_year] - SortMergeJoin [ws_bill_customer_sk,c_customer_sk] - InputAdapter - WholeStageCodegen (20) - Sort [ws_bill_customer_sk] - InputAdapter - Exchange [ws_bill_customer_sk] #12 - WholeStageCodegen (19) - Project [ws_bill_customer_sk,ws_net_paid,d_year] - BroadcastHashJoin [ws_sold_date_sk,d_date_sk] - Filter [ws_bill_customer_sk] - ColumnarToRow - InputAdapter - Scan parquet default.web_sales [ws_bill_customer_sk,ws_net_paid,ws_sold_date_sk] - ReusedSubquery [d_date_sk] #1 - InputAdapter - ReusedExchange [d_date_sk,d_year] #4 - InputAdapter - WholeStageCodegen (22) - Sort [c_customer_sk] - InputAdapter - ReusedExchange [c_customer_sk,c_customer_id,c_first_name,c_last_name] #5 + Filter [year_total] + HashAggregate [c_customer_id,c_first_name,c_last_name,d_year,sum] [sum(UnscaledValue(ws_net_paid)),customer_id,year_total,sum] + InputAdapter + Exchange [c_customer_id,c_first_name,c_last_name,d_year] #11 + WholeStageCodegen (23) + HashAggregate [c_customer_id,c_first_name,c_last_name,d_year,ws_net_paid] [sum,sum] + Project [c_customer_id,c_first_name,c_last_name,ws_net_paid,d_year] + SortMergeJoin [ws_bill_customer_sk,c_customer_sk] + InputAdapter + WholeStageCodegen (20) + Sort [ws_bill_customer_sk] + InputAdapter + Exchange [ws_bill_customer_sk] #12 + WholeStageCodegen (19) + Project [ws_bill_customer_sk,ws_net_paid,d_year] + BroadcastHashJoin [ws_sold_date_sk,d_date_sk] + Filter [ws_bill_customer_sk] + ColumnarToRow + InputAdapter + Scan parquet default.web_sales [ws_bill_customer_sk,ws_net_paid,ws_sold_date_sk] + ReusedSubquery [d_date_sk] #1 + InputAdapter + ReusedExchange [d_date_sk,d_year] #4 + InputAdapter + WholeStageCodegen (22) + Sort [c_customer_sk] + InputAdapter + ReusedExchange [c_customer_sk,c_customer_id,c_first_name,c_last_name] #5 InputAdapter WholeStageCodegen (34) Sort [customer_id] diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q74/explain.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q74/explain.txt index 1554259f337c1..7d73fade67751 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q74/explain.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q74/explain.txt @@ -1,9 +1,9 @@ == Physical Plan == -TakeOrderedAndProject (72) -+- * Project (71) - +- * BroadcastHashJoin Inner BuildRight (70) - :- * Project (53) - : +- * BroadcastHashJoin Inner BuildRight (52) +TakeOrderedAndProject (71) ++- * Project (70) + +- * BroadcastHashJoin Inner BuildRight (69) + :- * Project (52) + : +- * BroadcastHashJoin Inner BuildRight (51) : :- * BroadcastHashJoin Inner BuildRight (33) : : :- * Filter (16) : : : +- * HashAggregate (15) @@ -37,40 +37,39 @@ TakeOrderedAndProject (72) : : : +- * ColumnarToRow (21) : : : +- Scan parquet default.store_sales (20) : : +- ReusedExchange (26) - : +- BroadcastExchange (51) - : +- * Project (50) - : +- * Filter (49) - : +- * HashAggregate (48) - : +- Exchange (47) - : +- * HashAggregate (46) - : +- * Project (45) - : +- * BroadcastHashJoin Inner BuildRight (44) - : :- * Project (42) - : : +- * BroadcastHashJoin Inner BuildRight (41) - : : :- * Filter (36) - : : : +- * ColumnarToRow (35) - : : : +- Scan parquet default.customer (34) - : : +- BroadcastExchange (40) - : : +- * Filter (39) - : : +- * ColumnarToRow (38) - : : +- Scan parquet default.web_sales (37) - : +- ReusedExchange (43) - +- BroadcastExchange (69) - +- * HashAggregate (68) - +- Exchange (67) - +- * HashAggregate (66) - +- * Project (65) - +- * BroadcastHashJoin Inner BuildRight (64) - :- * Project (62) - : +- * BroadcastHashJoin Inner BuildRight (61) - : :- * Filter (56) - : : +- * ColumnarToRow (55) - : : +- Scan parquet default.customer (54) - : +- BroadcastExchange (60) - : +- * Filter (59) - : +- * ColumnarToRow (58) - : +- Scan parquet default.web_sales (57) - +- ReusedExchange (63) + : +- BroadcastExchange (50) + : +- * Filter (49) + : +- * HashAggregate (48) + : +- Exchange (47) + : +- * HashAggregate (46) + : +- * Project (45) + : +- * BroadcastHashJoin Inner BuildRight (44) + : :- * Project (42) + : : +- * BroadcastHashJoin Inner BuildRight (41) + : : :- * Filter (36) + : : : +- * ColumnarToRow (35) + : : : +- Scan parquet default.customer (34) + : : +- BroadcastExchange (40) + : : +- * Filter (39) + : : +- * ColumnarToRow (38) + : : +- Scan parquet default.web_sales (37) + : +- ReusedExchange (43) + +- BroadcastExchange (68) + +- * HashAggregate (67) + +- Exchange (66) + +- * HashAggregate (65) + +- * Project (64) + +- * BroadcastHashJoin Inner BuildRight (63) + :- * Project (61) + : +- * BroadcastHashJoin Inner BuildRight (60) + : :- * Filter (55) + : : +- * ColumnarToRow (54) + : : +- Scan parquet default.customer (53) + : +- BroadcastExchange (59) + : +- * Filter (58) + : +- * ColumnarToRow (57) + : +- Scan parquet default.web_sales (56) + +- ReusedExchange (62) (1) Scan parquet default.customer @@ -115,7 +114,7 @@ Join condition: None Output [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, ss_net_paid#6, ss_sold_date_sk#7] Input [7]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4, ss_customer_sk#5, ss_net_paid#6, ss_sold_date_sk#7] -(10) ReusedExchange [Reuses operator id: 76] +(10) ReusedExchange [Reuses operator id: 75] Output [2]: [d_date_sk#10, d_year#11] (11) BroadcastHashJoin [codegen id : 3] @@ -191,7 +190,7 @@ Join condition: None Output [5]: [c_customer_id#19, c_first_name#20, c_last_name#21, ss_net_paid#23, ss_sold_date_sk#24] Input [7]: [c_customer_sk#18, c_customer_id#19, c_first_name#20, c_last_name#21, ss_customer_sk#22, ss_net_paid#23, ss_sold_date_sk#24] -(26) ReusedExchange [Reuses operator id: 80] +(26) ReusedExchange [Reuses operator id: 79] Output [2]: [d_date_sk#27, d_year#28] (27) BroadcastHashJoin [codegen id : 6] @@ -272,7 +271,7 @@ Join condition: None Output [5]: [c_customer_id#39, c_first_name#40, c_last_name#41, ws_net_paid#43, ws_sold_date_sk#44] Input [7]: [c_customer_sk#38, c_customer_id#39, c_first_name#40, c_last_name#41, ws_bill_customer_sk#42, ws_net_paid#43, ws_sold_date_sk#44] -(43) ReusedExchange [Reuses operator id: 76] +(43) ReusedExchange [Reuses operator id: 75] Output [2]: [d_date_sk#46, d_year#47] (44) BroadcastHashJoin [codegen id : 10] @@ -306,166 +305,162 @@ Results [2]: [c_customer_id#39 AS customer_id#52, MakeDecimal(sum(UnscaledValue( Input [2]: [customer_id#52, year_total#53] Condition : (isnotnull(year_total#53) AND (year_total#53 > 0.00)) -(50) Project [codegen id : 11] -Output [2]: [customer_id#52 AS customer_id#54, year_total#53 AS year_total#55] +(50) BroadcastExchange Input [2]: [customer_id#52, year_total#53] +Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#54] -(51) BroadcastExchange -Input [2]: [customer_id#54, year_total#55] -Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#56] - -(52) BroadcastHashJoin [codegen id : 16] +(51) BroadcastHashJoin [codegen id : 16] Left keys [1]: [customer_id#16] -Right keys [1]: [customer_id#54] +Right keys [1]: [customer_id#52] Join condition: None -(53) Project [codegen id : 16] -Output [7]: [customer_id#16, year_total#17, customer_id#33, customer_first_name#34, customer_last_name#35, year_total#36, year_total#55] -Input [8]: [customer_id#16, year_total#17, customer_id#33, customer_first_name#34, customer_last_name#35, year_total#36, customer_id#54, year_total#55] +(52) Project [codegen id : 16] +Output [7]: [customer_id#16, year_total#17, customer_id#33, customer_first_name#34, customer_last_name#35, year_total#36, year_total#53] +Input [8]: [customer_id#16, year_total#17, customer_id#33, customer_first_name#34, customer_last_name#35, year_total#36, customer_id#52, year_total#53] -(54) Scan parquet default.customer -Output [4]: [c_customer_sk#57, c_customer_id#58, c_first_name#59, c_last_name#60] +(53) Scan parquet default.customer +Output [4]: [c_customer_sk#55, c_customer_id#56, c_first_name#57, c_last_name#58] Batched: true Location [not included in comparison]/{warehouse_dir}/customer] PushedFilters: [IsNotNull(c_customer_sk), IsNotNull(c_customer_id)] ReadSchema: struct -(55) ColumnarToRow [codegen id : 14] -Input [4]: [c_customer_sk#57, c_customer_id#58, c_first_name#59, c_last_name#60] +(54) ColumnarToRow [codegen id : 14] +Input [4]: [c_customer_sk#55, c_customer_id#56, c_first_name#57, c_last_name#58] -(56) Filter [codegen id : 14] -Input [4]: [c_customer_sk#57, c_customer_id#58, c_first_name#59, c_last_name#60] -Condition : (isnotnull(c_customer_sk#57) AND isnotnull(c_customer_id#58)) +(55) Filter [codegen id : 14] +Input [4]: [c_customer_sk#55, c_customer_id#56, c_first_name#57, c_last_name#58] +Condition : (isnotnull(c_customer_sk#55) AND isnotnull(c_customer_id#56)) -(57) Scan parquet default.web_sales -Output [3]: [ws_bill_customer_sk#61, ws_net_paid#62, ws_sold_date_sk#63] +(56) Scan parquet default.web_sales +Output [3]: [ws_bill_customer_sk#59, ws_net_paid#60, ws_sold_date_sk#61] Batched: true Location: InMemoryFileIndex [] -PartitionFilters: [isnotnull(ws_sold_date_sk#63), dynamicpruningexpression(ws_sold_date_sk#63 IN dynamicpruning#25)] +PartitionFilters: [isnotnull(ws_sold_date_sk#61), dynamicpruningexpression(ws_sold_date_sk#61 IN dynamicpruning#25)] PushedFilters: [IsNotNull(ws_bill_customer_sk)] ReadSchema: struct -(58) ColumnarToRow [codegen id : 12] -Input [3]: [ws_bill_customer_sk#61, ws_net_paid#62, ws_sold_date_sk#63] +(57) ColumnarToRow [codegen id : 12] +Input [3]: [ws_bill_customer_sk#59, ws_net_paid#60, ws_sold_date_sk#61] -(59) Filter [codegen id : 12] -Input [3]: [ws_bill_customer_sk#61, ws_net_paid#62, ws_sold_date_sk#63] -Condition : isnotnull(ws_bill_customer_sk#61) +(58) Filter [codegen id : 12] +Input [3]: [ws_bill_customer_sk#59, ws_net_paid#60, ws_sold_date_sk#61] +Condition : isnotnull(ws_bill_customer_sk#59) -(60) BroadcastExchange -Input [3]: [ws_bill_customer_sk#61, ws_net_paid#62, ws_sold_date_sk#63] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#64] +(59) BroadcastExchange +Input [3]: [ws_bill_customer_sk#59, ws_net_paid#60, ws_sold_date_sk#61] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#62] -(61) BroadcastHashJoin [codegen id : 14] -Left keys [1]: [c_customer_sk#57] -Right keys [1]: [ws_bill_customer_sk#61] +(60) BroadcastHashJoin [codegen id : 14] +Left keys [1]: [c_customer_sk#55] +Right keys [1]: [ws_bill_customer_sk#59] Join condition: None -(62) Project [codegen id : 14] -Output [5]: [c_customer_id#58, c_first_name#59, c_last_name#60, ws_net_paid#62, ws_sold_date_sk#63] -Input [7]: [c_customer_sk#57, c_customer_id#58, c_first_name#59, c_last_name#60, ws_bill_customer_sk#61, ws_net_paid#62, ws_sold_date_sk#63] +(61) Project [codegen id : 14] +Output [5]: [c_customer_id#56, c_first_name#57, c_last_name#58, ws_net_paid#60, ws_sold_date_sk#61] +Input [7]: [c_customer_sk#55, c_customer_id#56, c_first_name#57, c_last_name#58, ws_bill_customer_sk#59, ws_net_paid#60, ws_sold_date_sk#61] -(63) ReusedExchange [Reuses operator id: 80] -Output [2]: [d_date_sk#65, d_year#66] +(62) ReusedExchange [Reuses operator id: 79] +Output [2]: [d_date_sk#63, d_year#64] -(64) BroadcastHashJoin [codegen id : 14] -Left keys [1]: [ws_sold_date_sk#63] -Right keys [1]: [d_date_sk#65] +(63) BroadcastHashJoin [codegen id : 14] +Left keys [1]: [ws_sold_date_sk#61] +Right keys [1]: [d_date_sk#63] Join condition: None -(65) Project [codegen id : 14] -Output [5]: [c_customer_id#58, c_first_name#59, c_last_name#60, ws_net_paid#62, d_year#66] -Input [7]: [c_customer_id#58, c_first_name#59, c_last_name#60, ws_net_paid#62, ws_sold_date_sk#63, d_date_sk#65, d_year#66] - -(66) HashAggregate [codegen id : 14] -Input [5]: [c_customer_id#58, c_first_name#59, c_last_name#60, ws_net_paid#62, d_year#66] -Keys [4]: [c_customer_id#58, c_first_name#59, c_last_name#60, d_year#66] -Functions [1]: [partial_sum(UnscaledValue(ws_net_paid#62))] -Aggregate Attributes [1]: [sum#67] -Results [5]: [c_customer_id#58, c_first_name#59, c_last_name#60, d_year#66, sum#68] - -(67) Exchange -Input [5]: [c_customer_id#58, c_first_name#59, c_last_name#60, d_year#66, sum#68] -Arguments: hashpartitioning(c_customer_id#58, c_first_name#59, c_last_name#60, d_year#66, 5), ENSURE_REQUIREMENTS, [id=#69] - -(68) HashAggregate [codegen id : 15] -Input [5]: [c_customer_id#58, c_first_name#59, c_last_name#60, d_year#66, sum#68] -Keys [4]: [c_customer_id#58, c_first_name#59, c_last_name#60, d_year#66] -Functions [1]: [sum(UnscaledValue(ws_net_paid#62))] -Aggregate Attributes [1]: [sum(UnscaledValue(ws_net_paid#62))#70] -Results [2]: [c_customer_id#58 AS customer_id#71, MakeDecimal(sum(UnscaledValue(ws_net_paid#62))#70,17,2) AS year_total#72] - -(69) BroadcastExchange -Input [2]: [customer_id#71, year_total#72] -Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#73] - -(70) BroadcastHashJoin [codegen id : 16] +(64) Project [codegen id : 14] +Output [5]: [c_customer_id#56, c_first_name#57, c_last_name#58, ws_net_paid#60, d_year#64] +Input [7]: [c_customer_id#56, c_first_name#57, c_last_name#58, ws_net_paid#60, ws_sold_date_sk#61, d_date_sk#63, d_year#64] + +(65) HashAggregate [codegen id : 14] +Input [5]: [c_customer_id#56, c_first_name#57, c_last_name#58, ws_net_paid#60, d_year#64] +Keys [4]: [c_customer_id#56, c_first_name#57, c_last_name#58, d_year#64] +Functions [1]: [partial_sum(UnscaledValue(ws_net_paid#60))] +Aggregate Attributes [1]: [sum#65] +Results [5]: [c_customer_id#56, c_first_name#57, c_last_name#58, d_year#64, sum#66] + +(66) Exchange +Input [5]: [c_customer_id#56, c_first_name#57, c_last_name#58, d_year#64, sum#66] +Arguments: hashpartitioning(c_customer_id#56, c_first_name#57, c_last_name#58, d_year#64, 5), ENSURE_REQUIREMENTS, [id=#67] + +(67) HashAggregate [codegen id : 15] +Input [5]: [c_customer_id#56, c_first_name#57, c_last_name#58, d_year#64, sum#66] +Keys [4]: [c_customer_id#56, c_first_name#57, c_last_name#58, d_year#64] +Functions [1]: [sum(UnscaledValue(ws_net_paid#60))] +Aggregate Attributes [1]: [sum(UnscaledValue(ws_net_paid#60))#68] +Results [2]: [c_customer_id#56 AS customer_id#69, MakeDecimal(sum(UnscaledValue(ws_net_paid#60))#68,17,2) AS year_total#70] + +(68) BroadcastExchange +Input [2]: [customer_id#69, year_total#70] +Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#71] + +(69) BroadcastHashJoin [codegen id : 16] Left keys [1]: [customer_id#16] -Right keys [1]: [customer_id#71] -Join condition: (CASE WHEN (year_total#55 > 0.00) THEN CheckOverflow((promote_precision(year_total#72) / promote_precision(year_total#55)), DecimalType(37,20), true) ELSE null END > CASE WHEN (year_total#17 > 0.00) THEN CheckOverflow((promote_precision(year_total#36) / promote_precision(year_total#17)), DecimalType(37,20), true) ELSE null END) +Right keys [1]: [customer_id#69] +Join condition: (CASE WHEN (year_total#53 > 0.00) THEN CheckOverflow((promote_precision(year_total#70) / promote_precision(year_total#53)), DecimalType(37,20), true) ELSE null END > CASE WHEN (year_total#17 > 0.00) THEN CheckOverflow((promote_precision(year_total#36) / promote_precision(year_total#17)), DecimalType(37,20), true) ELSE null END) -(71) Project [codegen id : 16] +(70) Project [codegen id : 16] Output [3]: [customer_id#33, customer_first_name#34, customer_last_name#35] -Input [9]: [customer_id#16, year_total#17, customer_id#33, customer_first_name#34, customer_last_name#35, year_total#36, year_total#55, customer_id#71, year_total#72] +Input [9]: [customer_id#16, year_total#17, customer_id#33, customer_first_name#34, customer_last_name#35, year_total#36, year_total#53, customer_id#69, year_total#70] -(72) TakeOrderedAndProject +(71) TakeOrderedAndProject Input [3]: [customer_id#33, customer_first_name#34, customer_last_name#35] Arguments: 100, [customer_first_name#34 ASC NULLS FIRST, customer_id#33 ASC NULLS FIRST, customer_last_name#35 ASC NULLS FIRST], [customer_id#33, customer_first_name#34, customer_last_name#35] ===== Subqueries ===== Subquery:1 Hosting operator id = 4 Hosting Expression = ss_sold_date_sk#7 IN dynamicpruning#8 -BroadcastExchange (76) -+- * Filter (75) - +- * ColumnarToRow (74) - +- Scan parquet default.date_dim (73) +BroadcastExchange (75) ++- * Filter (74) + +- * ColumnarToRow (73) + +- Scan parquet default.date_dim (72) -(73) Scan parquet default.date_dim +(72) Scan parquet default.date_dim Output [2]: [d_date_sk#10, d_year#11] Batched: true Location [not included in comparison]/{warehouse_dir}/date_dim] PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2001), In(d_year, [2001,2002]), IsNotNull(d_date_sk)] ReadSchema: struct -(74) ColumnarToRow [codegen id : 1] +(73) ColumnarToRow [codegen id : 1] Input [2]: [d_date_sk#10, d_year#11] -(75) Filter [codegen id : 1] +(74) Filter [codegen id : 1] Input [2]: [d_date_sk#10, d_year#11] Condition : (((isnotnull(d_year#11) AND (d_year#11 = 2001)) AND d_year#11 IN (2001,2002)) AND isnotnull(d_date_sk#10)) -(76) BroadcastExchange +(75) BroadcastExchange Input [2]: [d_date_sk#10, d_year#11] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#74] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#72] Subquery:2 Hosting operator id = 20 Hosting Expression = ss_sold_date_sk#24 IN dynamicpruning#25 -BroadcastExchange (80) -+- * Filter (79) - +- * ColumnarToRow (78) - +- Scan parquet default.date_dim (77) +BroadcastExchange (79) ++- * Filter (78) + +- * ColumnarToRow (77) + +- Scan parquet default.date_dim (76) -(77) Scan parquet default.date_dim +(76) Scan parquet default.date_dim Output [2]: [d_date_sk#27, d_year#28] Batched: true Location [not included in comparison]/{warehouse_dir}/date_dim] PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2002), In(d_year, [2001,2002]), IsNotNull(d_date_sk)] ReadSchema: struct -(78) ColumnarToRow [codegen id : 1] +(77) ColumnarToRow [codegen id : 1] Input [2]: [d_date_sk#27, d_year#28] -(79) Filter [codegen id : 1] +(78) Filter [codegen id : 1] Input [2]: [d_date_sk#27, d_year#28] Condition : (((isnotnull(d_year#28) AND (d_year#28 = 2002)) AND d_year#28 IN (2001,2002)) AND isnotnull(d_date_sk#27)) -(80) BroadcastExchange +(79) BroadcastExchange Input [2]: [d_date_sk#27, d_year#28] -Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#75] +Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#73] Subquery:3 Hosting operator id = 37 Hosting Expression = ws_sold_date_sk#44 IN dynamicpruning#8 -Subquery:4 Hosting operator id = 57 Hosting Expression = ws_sold_date_sk#63 IN dynamicpruning#25 +Subquery:4 Hosting operator id = 56 Hosting Expression = ws_sold_date_sk#61 IN dynamicpruning#25 diff --git a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q74/simplified.txt b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q74/simplified.txt index ef4d5a103e0d6..b04eb09aea915 100644 --- a/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q74/simplified.txt +++ b/sql/core/src/test/resources/tpcds-plan-stability/approved-plans-v2_7/q74/simplified.txt @@ -70,31 +70,30 @@ TakeOrderedAndProject [customer_first_name,customer_id,customer_last_name] InputAdapter BroadcastExchange #8 WholeStageCodegen (11) - Project [customer_id,year_total] - Filter [year_total] - HashAggregate [c_customer_id,c_first_name,c_last_name,d_year,sum] [sum(UnscaledValue(ws_net_paid)),customer_id,year_total,sum] - InputAdapter - Exchange [c_customer_id,c_first_name,c_last_name,d_year] #9 - WholeStageCodegen (10) - HashAggregate [c_customer_id,c_first_name,c_last_name,d_year,ws_net_paid] [sum,sum] - Project [c_customer_id,c_first_name,c_last_name,ws_net_paid,d_year] - BroadcastHashJoin [ws_sold_date_sk,d_date_sk] - Project [c_customer_id,c_first_name,c_last_name,ws_net_paid,ws_sold_date_sk] - BroadcastHashJoin [c_customer_sk,ws_bill_customer_sk] - Filter [c_customer_sk,c_customer_id] - ColumnarToRow - InputAdapter - Scan parquet default.customer [c_customer_sk,c_customer_id,c_first_name,c_last_name] - InputAdapter - BroadcastExchange #10 - WholeStageCodegen (8) - Filter [ws_bill_customer_sk] - ColumnarToRow - InputAdapter - Scan parquet default.web_sales [ws_bill_customer_sk,ws_net_paid,ws_sold_date_sk] - ReusedSubquery [d_date_sk] #1 - InputAdapter - ReusedExchange [d_date_sk,d_year] #3 + Filter [year_total] + HashAggregate [c_customer_id,c_first_name,c_last_name,d_year,sum] [sum(UnscaledValue(ws_net_paid)),customer_id,year_total,sum] + InputAdapter + Exchange [c_customer_id,c_first_name,c_last_name,d_year] #9 + WholeStageCodegen (10) + HashAggregate [c_customer_id,c_first_name,c_last_name,d_year,ws_net_paid] [sum,sum] + Project [c_customer_id,c_first_name,c_last_name,ws_net_paid,d_year] + BroadcastHashJoin [ws_sold_date_sk,d_date_sk] + Project [c_customer_id,c_first_name,c_last_name,ws_net_paid,ws_sold_date_sk] + BroadcastHashJoin [c_customer_sk,ws_bill_customer_sk] + Filter [c_customer_sk,c_customer_id] + ColumnarToRow + InputAdapter + Scan parquet default.customer [c_customer_sk,c_customer_id,c_first_name,c_last_name] + InputAdapter + BroadcastExchange #10 + WholeStageCodegen (8) + Filter [ws_bill_customer_sk] + ColumnarToRow + InputAdapter + Scan parquet default.web_sales [ws_bill_customer_sk,ws_net_paid,ws_sold_date_sk] + ReusedSubquery [d_date_sk] #1 + InputAdapter + ReusedExchange [d_date_sk,d_year] #3 InputAdapter BroadcastExchange #11 WholeStageCodegen (15) diff --git a/sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala index c3362b377e152..1e3a61cfbdab0 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala @@ -24,6 +24,7 @@ import org.apache.spark.sql.catalyst.plans.logical.{Join, LogicalPlan, Sort} import org.apache.spark.sql.execution.{ColumnarToRowExec, ExecSubqueryExpression, FileSourceScanExec, InputAdapter, ReusedSubqueryExec, ScalarSubquery, SubqueryExec, WholeStageCodegenExec} import org.apache.spark.sql.execution.adaptive.{AdaptiveSparkPlanHelper, DisableAdaptiveExecution} import org.apache.spark.sql.execution.datasources.FileScanRDD +import org.apache.spark.sql.execution.exchange.ShuffleExchangeExec import org.apache.spark.sql.execution.joins.{BaseJoinExec, BroadcastHashJoinExec, BroadcastNestedLoopJoinExec} import org.apache.spark.sql.internal.SQLConf import org.apache.spark.sql.test.SharedSparkSession @@ -1877,4 +1878,28 @@ class SubquerySuite extends QueryTest with SharedSparkSession with AdaptiveSpark "ReusedSubqueryExec should reuse an existing subquery") } } + + test("SPARK-36280: Remove redundant aliases after RewritePredicateSubquery") { + withTable("t1", "t2") { + sql("CREATE TABLE t1 USING parquet AS SELECT id AS a, id AS b, id AS c FROM range(10)") + sql("CREATE TABLE t2 USING parquet AS SELECT id AS x, id AS y FROM range(8)") + val df = sql( + """ + |SELECT * + |FROM t1 + |WHERE a IN (SELECT x + | FROM (SELECT x AS x, + | RANK() OVER (PARTITION BY x ORDER BY SUM(y) DESC) AS ranking + | FROM t2 + | GROUP BY x) tmp1 + | WHERE ranking <= 5) + |""".stripMargin) + + df.collect() + val exchanges = collect(df.queryExecution.executedPlan) { + case s: ShuffleExchangeExec => s + } + assert(exchanges.size === 1) + } + } }