== Physical Plan ==
TakeOrderedAndProject (80)
+- * Project (79)
   +- * SortMergeJoin Inner (78)
      :- * Project (60)
      :  +- * SortMergeJoin Inner (59)
      :     :- * SortMergeJoin Inner (39)
      :     :  :- * Sort (21)
      :     :  :  +- Exchange (20)
      :     :  :     +- * Filter (19)
      :     :  :        +- * HashAggregate (18)
      :     :  :           +- Exchange (17)
      :     :  :              +- * HashAggregate (16)
      :     :  :                 +- * Project (15)
      :     :  :                    +- * SortMergeJoin Inner (14)
      :     :  :                       :- * Sort (8)
      :     :  :                       :  +- Exchange (7)
      :     :  :                       :     +- * Project (6)
      :     :  :                       :        +- * BroadcastHashJoin Inner BuildRight (5)
      :     :  :                       :           :- * Filter (3)
      :     :  :                       :           :  +- * ColumnarToRow (2)
      :     :  :                       :           :     +- Scan parquet default.store_sales (1)
      :     :  :                       :           +- ReusedExchange (4)
      :     :  :                       +- * Sort (13)
      :     :  :                          +- Exchange (12)
      :     :  :                             +- * Filter (11)
      :     :  :                                +- * ColumnarToRow (10)
      :     :  :                                   +- Scan parquet default.customer (9)
      :     :  +- * Sort (38)
      :     :     +- Exchange (37)
      :     :        +- * HashAggregate (36)
      :     :           +- Exchange (35)
      :     :              +- * HashAggregate (34)
      :     :                 +- * Project (33)
      :     :                    +- * SortMergeJoin Inner (32)
      :     :                       :- * Sort (29)
      :     :                       :  +- Exchange (28)
      :     :                       :     +- * Project (27)
      :     :                       :        +- * BroadcastHashJoin Inner BuildRight (26)
      :     :                       :           :- * Filter (24)
      :     :                       :           :  +- * ColumnarToRow (23)
      :     :                       :           :     +- Scan parquet default.store_sales (22)
      :     :                       :           +- 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)


(1) Scan parquet default.store_sales
Output [4]: [ss_customer_sk#1, ss_ext_discount_amt#2, ss_ext_list_price#3, ss_sold_date_sk#4]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#4), dynamicpruningexpression(ss_sold_date_sk#4 IN dynamicpruning#5)]
PushedFilters: [IsNotNull(ss_customer_sk)]
ReadSchema: struct<ss_customer_sk:int,ss_ext_discount_amt:decimal(7,2),ss_ext_list_price:decimal(7,2)>

(2) ColumnarToRow [codegen id : 2]
Input [4]: [ss_customer_sk#1, ss_ext_discount_amt#2, ss_ext_list_price#3, ss_sold_date_sk#4]

(3) Filter [codegen id : 2]
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]
Output [2]: [d_date_sk#6, d_year#7]

(5) BroadcastHashJoin [codegen id : 2]
Left keys [1]: [ss_sold_date_sk#4]
Right keys [1]: [d_date_sk#6]
Join condition: None

(6) Project [codegen id : 2]
Output [4]: [ss_customer_sk#1, ss_ext_discount_amt#2, ss_ext_list_price#3, d_year#7]
Input [6]: [ss_customer_sk#1, ss_ext_discount_amt#2, ss_ext_list_price#3, ss_sold_date_sk#4, d_date_sk#6, d_year#7]

(7) Exchange
Input [4]: [ss_customer_sk#1, ss_ext_discount_amt#2, ss_ext_list_price#3, d_year#7]
Arguments: hashpartitioning(ss_customer_sk#1, 5), ENSURE_REQUIREMENTS, [plan_id=1]

(8) Sort [codegen id : 3]
Input [4]: [ss_customer_sk#1, ss_ext_discount_amt#2, ss_ext_list_price#3, d_year#7]
Arguments: [ss_customer_sk#1 ASC NULLS FIRST], false, 0

(9) Scan parquet default.customer
Output [8]: [c_customer_sk#8, c_customer_id#9, c_first_name#10, c_last_name#11, c_preferred_cust_flag#12, c_birth_country#13, c_login#14, c_email_address#15]
Batched: true
Location [not included in comparison]/{warehouse_dir}/customer]
PushedFilters: [IsNotNull(c_customer_sk), IsNotNull(c_customer_id)]
ReadSchema: struct<c_customer_sk:int,c_customer_id:string,c_first_name:string,c_last_name:string,c_preferred_cust_flag:string,c_birth_country:string,c_login:string,c_email_address:string>

(10) ColumnarToRow [codegen id : 4]
Input [8]: [c_customer_sk#8, c_customer_id#9, c_first_name#10, c_last_name#11, c_preferred_cust_flag#12, c_birth_country#13, c_login#14, c_email_address#15]

(11) Filter [codegen id : 4]
Input [8]: [c_customer_sk#8, c_customer_id#9, c_first_name#10, c_last_name#11, c_preferred_cust_flag#12, c_birth_country#13, c_login#14, c_email_address#15]
Condition : (isnotnull(c_customer_sk#8) AND isnotnull(c_customer_id#9))

(12) Exchange
Input [8]: [c_customer_sk#8, c_customer_id#9, c_first_name#10, c_last_name#11, c_preferred_cust_flag#12, c_birth_country#13, c_login#14, c_email_address#15]
Arguments: hashpartitioning(c_customer_sk#8, 5), ENSURE_REQUIREMENTS, [plan_id=2]

(13) Sort [codegen id : 5]
Input [8]: [c_customer_sk#8, c_customer_id#9, c_first_name#10, c_last_name#11, c_preferred_cust_flag#12, c_birth_country#13, c_login#14, c_email_address#15]
Arguments: [c_customer_sk#8 ASC NULLS FIRST], false, 0

(14) SortMergeJoin [codegen id : 6]
Left keys [1]: [ss_customer_sk#1]
Right keys [1]: [c_customer_sk#8]
Join condition: None

(15) Project [codegen id : 6]
Output [10]: [c_customer_id#9, c_first_name#10, c_last_name#11, c_preferred_cust_flag#12, c_birth_country#13, c_login#14, c_email_address#15, ss_ext_discount_amt#2, ss_ext_list_price#3, d_year#7]
Input [12]: [ss_customer_sk#1, ss_ext_discount_amt#2, ss_ext_list_price#3, d_year#7, c_customer_sk#8, c_customer_id#9, c_first_name#10, c_last_name#11, c_preferred_cust_flag#12, c_birth_country#13, c_login#14, c_email_address#15]

(16) HashAggregate [codegen id : 6]
Input [10]: [c_customer_id#9, c_first_name#10, c_last_name#11, c_preferred_cust_flag#12, c_birth_country#13, c_login#14, c_email_address#15, ss_ext_discount_amt#2, ss_ext_list_price#3, d_year#7]
Keys [8]: [c_customer_id#9, c_first_name#10, c_last_name#11, d_year#7, c_preferred_cust_flag#12, c_birth_country#13, c_login#14, c_email_address#15]
Functions [1]: [partial_sum(UnscaledValue(CheckOverflow((promote_precision(cast(ss_ext_list_price#3 as decimal(8,2))) - promote_precision(cast(ss_ext_discount_amt#2 as decimal(8,2)))), DecimalType(8,2), true)))]
Aggregate Attributes [1]: [sum#16]
Results [9]: [c_customer_id#9, c_first_name#10, c_last_name#11, d_year#7, c_preferred_cust_flag#12, c_birth_country#13, c_login#14, c_email_address#15, sum#17]

(17) Exchange
Input [9]: [c_customer_id#9, c_first_name#10, c_last_name#11, d_year#7, c_preferred_cust_flag#12, c_birth_country#13, c_login#14, c_email_address#15, sum#17]
Arguments: hashpartitioning(c_customer_id#9, c_first_name#10, c_last_name#11, d_year#7, c_preferred_cust_flag#12, c_birth_country#13, c_login#14, c_email_address#15, 5), ENSURE_REQUIREMENTS, [plan_id=3]

(18) HashAggregate [codegen id : 7]
Input [9]: [c_customer_id#9, c_first_name#10, c_last_name#11, d_year#7, c_preferred_cust_flag#12, c_birth_country#13, c_login#14, c_email_address#15, sum#17]
Keys [8]: [c_customer_id#9, c_first_name#10, c_last_name#11, d_year#7, c_preferred_cust_flag#12, c_birth_country#13, c_login#14, c_email_address#15]
Functions [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ss_ext_list_price#3 as decimal(8,2))) - promote_precision(cast(ss_ext_discount_amt#2 as decimal(8,2)))), DecimalType(8,2), true)))]
Aggregate Attributes [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ss_ext_list_price#3 as decimal(8,2))) - promote_precision(cast(ss_ext_discount_amt#2 as decimal(8,2)))), DecimalType(8,2), true)))#18]
Results [2]: [c_customer_id#9 AS customer_id#19, MakeDecimal(sum(UnscaledValue(CheckOverflow((promote_precision(cast(ss_ext_list_price#3 as decimal(8,2))) - promote_precision(cast(ss_ext_discount_amt#2 as decimal(8,2)))), DecimalType(8,2), true)))#18,18,2) AS year_total#20]

(19) Filter [codegen id : 7]
Input [2]: [customer_id#19, year_total#20]
Condition : (isnotnull(year_total#20) AND (year_total#20 > 0.00))

(20) Exchange
Input [2]: [customer_id#19, year_total#20]
Arguments: hashpartitioning(customer_id#19, 5), ENSURE_REQUIREMENTS, [plan_id=4]

(21) Sort [codegen id : 8]
Input [2]: [customer_id#19, year_total#20]
Arguments: [customer_id#19 ASC NULLS FIRST], false, 0

(22) Scan parquet default.store_sales
Output [4]: [ss_customer_sk#21, ss_ext_discount_amt#22, ss_ext_list_price#23, ss_sold_date_sk#24]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#24), dynamicpruningexpression(ss_sold_date_sk#24 IN dynamicpruning#25)]
PushedFilters: [IsNotNull(ss_customer_sk)]
ReadSchema: struct<ss_customer_sk:int,ss_ext_discount_amt:decimal(7,2),ss_ext_list_price:decimal(7,2)>

(23) ColumnarToRow [codegen id : 10]
Input [4]: [ss_customer_sk#21, ss_ext_discount_amt#22, ss_ext_list_price#23, ss_sold_date_sk#24]

(24) Filter [codegen id : 10]
Input [4]: [ss_customer_sk#21, ss_ext_discount_amt#22, ss_ext_list_price#23, ss_sold_date_sk#24]
Condition : isnotnull(ss_customer_sk#21)

(25) ReusedExchange [Reuses operator id: 88]
Output [2]: [d_date_sk#26, d_year#27]

(26) BroadcastHashJoin [codegen id : 10]
Left keys [1]: [ss_sold_date_sk#24]
Right keys [1]: [d_date_sk#26]
Join condition: None

(27) Project [codegen id : 10]
Output [4]: [ss_customer_sk#21, ss_ext_discount_amt#22, ss_ext_list_price#23, d_year#27]
Input [6]: [ss_customer_sk#21, ss_ext_discount_amt#22, ss_ext_list_price#23, ss_sold_date_sk#24, d_date_sk#26, d_year#27]

(28) Exchange
Input [4]: [ss_customer_sk#21, ss_ext_discount_amt#22, ss_ext_list_price#23, d_year#27]
Arguments: hashpartitioning(ss_customer_sk#21, 5), ENSURE_REQUIREMENTS, [plan_id=5]

(29) Sort [codegen id : 11]
Input [4]: [ss_customer_sk#21, ss_ext_discount_amt#22, ss_ext_list_price#23, d_year#27]
Arguments: [ss_customer_sk#21 ASC NULLS FIRST], false, 0

(30) ReusedExchange [Reuses operator id: 12]
Output [8]: [c_customer_sk#28, c_customer_id#29, c_first_name#30, c_last_name#31, c_preferred_cust_flag#32, c_birth_country#33, c_login#34, c_email_address#35]

(31) Sort [codegen id : 13]
Input [8]: [c_customer_sk#28, c_customer_id#29, c_first_name#30, c_last_name#31, c_preferred_cust_flag#32, c_birth_country#33, c_login#34, c_email_address#35]
Arguments: [c_customer_sk#28 ASC NULLS FIRST], false, 0

(32) SortMergeJoin [codegen id : 14]
Left keys [1]: [ss_customer_sk#21]
Right keys [1]: [c_customer_sk#28]
Join condition: None

(33) Project [codegen id : 14]
Output [10]: [c_customer_id#29, c_first_name#30, c_last_name#31, c_preferred_cust_flag#32, c_birth_country#33, c_login#34, c_email_address#35, ss_ext_discount_amt#22, ss_ext_list_price#23, d_year#27]
Input [12]: [ss_customer_sk#21, ss_ext_discount_amt#22, ss_ext_list_price#23, d_year#27, c_customer_sk#28, c_customer_id#29, c_first_name#30, c_last_name#31, c_preferred_cust_flag#32, c_birth_country#33, c_login#34, c_email_address#35]

(34) HashAggregate [codegen id : 14]
Input [10]: [c_customer_id#29, c_first_name#30, c_last_name#31, c_preferred_cust_flag#32, c_birth_country#33, c_login#34, c_email_address#35, ss_ext_discount_amt#22, ss_ext_list_price#23, d_year#27]
Keys [8]: [c_customer_id#29, c_first_name#30, c_last_name#31, d_year#27, c_preferred_cust_flag#32, c_birth_country#33, c_login#34, c_email_address#35]
Functions [1]: [partial_sum(UnscaledValue(CheckOverflow((promote_precision(cast(ss_ext_list_price#23 as decimal(8,2))) - promote_precision(cast(ss_ext_discount_amt#22 as decimal(8,2)))), DecimalType(8,2), true)))]
Aggregate Attributes [1]: [sum#36]
Results [9]: [c_customer_id#29, c_first_name#30, c_last_name#31, d_year#27, c_preferred_cust_flag#32, c_birth_country#33, c_login#34, c_email_address#35, sum#37]

(35) Exchange
Input [9]: [c_customer_id#29, c_first_name#30, c_last_name#31, d_year#27, c_preferred_cust_flag#32, c_birth_country#33, c_login#34, c_email_address#35, sum#37]
Arguments: hashpartitioning(c_customer_id#29, c_first_name#30, c_last_name#31, d_year#27, c_preferred_cust_flag#32, c_birth_country#33, c_login#34, c_email_address#35, 5), ENSURE_REQUIREMENTS, [plan_id=6]

(36) HashAggregate [codegen id : 15]
Input [9]: [c_customer_id#29, c_first_name#30, c_last_name#31, d_year#27, c_preferred_cust_flag#32, c_birth_country#33, c_login#34, c_email_address#35, sum#37]
Keys [8]: [c_customer_id#29, c_first_name#30, c_last_name#31, d_year#27, c_preferred_cust_flag#32, c_birth_country#33, c_login#34, c_email_address#35]
Functions [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ss_ext_list_price#23 as decimal(8,2))) - promote_precision(cast(ss_ext_discount_amt#22 as decimal(8,2)))), DecimalType(8,2), true)))]
Aggregate Attributes [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ss_ext_list_price#23 as decimal(8,2))) - promote_precision(cast(ss_ext_discount_amt#22 as decimal(8,2)))), DecimalType(8,2), true)))#18]
Results [5]: [c_customer_id#29 AS customer_id#38, c_first_name#30 AS customer_first_name#39, c_last_name#31 AS customer_last_name#40, c_email_address#35 AS customer_email_address#41, MakeDecimal(sum(UnscaledValue(CheckOverflow((promote_precision(cast(ss_ext_list_price#23 as decimal(8,2))) - promote_precision(cast(ss_ext_discount_amt#22 as decimal(8,2)))), DecimalType(8,2), true)))#18,18,2) AS year_total#42]

(37) Exchange
Input [5]: [customer_id#38, customer_first_name#39, customer_last_name#40, customer_email_address#41, year_total#42]
Arguments: hashpartitioning(customer_id#38, 5), ENSURE_REQUIREMENTS, [plan_id=7]

(38) Sort [codegen id : 16]
Input [5]: [customer_id#38, customer_first_name#39, customer_last_name#40, customer_email_address#41, year_total#42]
Arguments: [customer_id#38 ASC NULLS FIRST], false, 0

(39) SortMergeJoin [codegen id : 17]
Left keys [1]: [customer_id#19]
Right keys [1]: [customer_id#38]
Join condition: None

(40) Scan parquet default.web_sales
Output [4]: [ws_bill_customer_sk#43, ws_ext_discount_amt#44, ws_ext_list_price#45, ws_sold_date_sk#46]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ws_sold_date_sk#46), dynamicpruningexpression(ws_sold_date_sk#46 IN dynamicpruning#5)]
PushedFilters: [IsNotNull(ws_bill_customer_sk)]
ReadSchema: struct<ws_bill_customer_sk:int,ws_ext_discount_amt:decimal(7,2),ws_ext_list_price:decimal(7,2)>

(41) ColumnarToRow [codegen id : 19]
Input [4]: [ws_bill_customer_sk#43, ws_ext_discount_amt#44, ws_ext_list_price#45, ws_sold_date_sk#46]

(42) Filter [codegen id : 19]
Input [4]: [ws_bill_customer_sk#43, ws_ext_discount_amt#44, ws_ext_list_price#45, ws_sold_date_sk#46]
Condition : isnotnull(ws_bill_customer_sk#43)

(43) ReusedExchange [Reuses operator id: 84]
Output [2]: [d_date_sk#47, d_year#48]

(44) BroadcastHashJoin [codegen id : 19]
Left keys [1]: [ws_sold_date_sk#46]
Right keys [1]: [d_date_sk#47]
Join condition: None

(45) Project [codegen id : 19]
Output [4]: [ws_bill_customer_sk#43, ws_ext_discount_amt#44, ws_ext_list_price#45, d_year#48]
Input [6]: [ws_bill_customer_sk#43, ws_ext_discount_amt#44, ws_ext_list_price#45, ws_sold_date_sk#46, d_date_sk#47, d_year#48]

(46) Exchange
Input [4]: [ws_bill_customer_sk#43, ws_ext_discount_amt#44, ws_ext_list_price#45, d_year#48]
Arguments: hashpartitioning(ws_bill_customer_sk#43, 5), ENSURE_REQUIREMENTS, [plan_id=8]

(47) Sort [codegen id : 20]
Input [4]: [ws_bill_customer_sk#43, ws_ext_discount_amt#44, ws_ext_list_price#45, d_year#48]
Arguments: [ws_bill_customer_sk#43 ASC NULLS FIRST], false, 0

(48) ReusedExchange [Reuses operator id: 12]
Output [8]: [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]

(49) Sort [codegen id : 22]
Input [8]: [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]
Arguments: [c_customer_sk#49 ASC NULLS FIRST], false, 0

(50) SortMergeJoin [codegen id : 23]
Left keys [1]: [ws_bill_customer_sk#43]
Right keys [1]: [c_customer_sk#49]
Join condition: None

(51) Project [codegen id : 23]
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#44, ws_ext_list_price#45, d_year#48]
Input [12]: [ws_bill_customer_sk#43, ws_ext_discount_amt#44, ws_ext_list_price#45, d_year#48, 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]

(52) HashAggregate [codegen id : 23]
Input [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#44, ws_ext_list_price#45, d_year#48]
Keys [8]: [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, d_year#48]
Functions [1]: [partial_sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#45 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#44 as decimal(8,2)))), DecimalType(8,2), true)))]
Aggregate Attributes [1]: [sum#57]
Results [9]: [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, d_year#48, sum#58]

(53) Exchange
Input [9]: [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, d_year#48, sum#58]
Arguments: hashpartitioning(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, d_year#48, 5), ENSURE_REQUIREMENTS, [plan_id=9]

(54) HashAggregate [codegen id : 24]
Input [9]: [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, d_year#48, sum#58]
Keys [8]: [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, d_year#48]
Functions [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#45 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#44 as decimal(8,2)))), DecimalType(8,2), true)))]
Aggregate Attributes [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#45 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#44 as decimal(8,2)))), DecimalType(8,2), true)))#59]
Results [2]: [c_customer_id#50 AS customer_id#60, MakeDecimal(sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#45 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#44 as decimal(8,2)))), DecimalType(8,2), true)))#59,18,2) AS year_total#61]

(55) Filter [codegen id : 24]
Input [2]: [customer_id#60, year_total#61]
Condition : (isnotnull(year_total#61) AND (year_total#61 > 0.00))

(56) Project [codegen id : 24]
Output [2]: [customer_id#60 AS customer_id#62, year_total#61 AS year_total#63]
Input [2]: [customer_id#60, year_total#61]

(57) Exchange
Input [2]: [customer_id#62, year_total#63]
Arguments: hashpartitioning(customer_id#62, 5), ENSURE_REQUIREMENTS, [plan_id=10]

(58) Sort [codegen id : 25]
Input [2]: [customer_id#62, year_total#63]
Arguments: [customer_id#62 ASC NULLS FIRST], false, 0

(59) SortMergeJoin [codegen id : 26]
Left keys [1]: [customer_id#19]
Right keys [1]: [customer_id#62]
Join condition: None

(60) Project [codegen id : 26]
Output [8]: [customer_id#19, year_total#20, customer_id#38, customer_first_name#39, customer_last_name#40, customer_email_address#41, year_total#42, year_total#63]
Input [9]: [customer_id#19, year_total#20, customer_id#38, customer_first_name#39, customer_last_name#40, customer_email_address#41, year_total#42, customer_id#62, year_total#63]

(61) Scan parquet default.web_sales
Output [4]: [ws_bill_customer_sk#64, ws_ext_discount_amt#65, ws_ext_list_price#66, ws_sold_date_sk#67]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ws_sold_date_sk#67), dynamicpruningexpression(ws_sold_date_sk#67 IN dynamicpruning#25)]
PushedFilters: [IsNotNull(ws_bill_customer_sk)]
ReadSchema: struct<ws_bill_customer_sk:int,ws_ext_discount_amt:decimal(7,2),ws_ext_list_price:decimal(7,2)>

(62) ColumnarToRow [codegen id : 28]
Input [4]: [ws_bill_customer_sk#64, ws_ext_discount_amt#65, ws_ext_list_price#66, ws_sold_date_sk#67]

(63) Filter [codegen id : 28]
Input [4]: [ws_bill_customer_sk#64, ws_ext_discount_amt#65, ws_ext_list_price#66, ws_sold_date_sk#67]
Condition : isnotnull(ws_bill_customer_sk#64)

(64) ReusedExchange [Reuses operator id: 88]
Output [2]: [d_date_sk#68, d_year#69]

(65) BroadcastHashJoin [codegen id : 28]
Left keys [1]: [ws_sold_date_sk#67]
Right keys [1]: [d_date_sk#68]
Join condition: None

(66) Project [codegen id : 28]
Output [4]: [ws_bill_customer_sk#64, ws_ext_discount_amt#65, ws_ext_list_price#66, d_year#69]
Input [6]: [ws_bill_customer_sk#64, ws_ext_discount_amt#65, ws_ext_list_price#66, ws_sold_date_sk#67, d_date_sk#68, d_year#69]

(67) Exchange
Input [4]: [ws_bill_customer_sk#64, ws_ext_discount_amt#65, ws_ext_list_price#66, d_year#69]
Arguments: hashpartitioning(ws_bill_customer_sk#64, 5), ENSURE_REQUIREMENTS, [plan_id=11]

(68) Sort [codegen id : 29]
Input [4]: [ws_bill_customer_sk#64, ws_ext_discount_amt#65, ws_ext_list_price#66, d_year#69]
Arguments: [ws_bill_customer_sk#64 ASC NULLS FIRST], false, 0

(69) ReusedExchange [Reuses operator id: 12]
Output [8]: [c_customer_sk#70, c_customer_id#71, c_first_name#72, c_last_name#73, c_preferred_cust_flag#74, c_birth_country#75, c_login#76, c_email_address#77]

(70) Sort [codegen id : 31]
Input [8]: [c_customer_sk#70, c_customer_id#71, c_first_name#72, c_last_name#73, c_preferred_cust_flag#74, c_birth_country#75, c_login#76, c_email_address#77]
Arguments: [c_customer_sk#70 ASC NULLS FIRST], false, 0

(71) SortMergeJoin [codegen id : 32]
Left keys [1]: [ws_bill_customer_sk#64]
Right keys [1]: [c_customer_sk#70]
Join condition: None

(72) Project [codegen id : 32]
Output [10]: [c_customer_id#71, c_first_name#72, c_last_name#73, c_preferred_cust_flag#74, c_birth_country#75, c_login#76, c_email_address#77, ws_ext_discount_amt#65, ws_ext_list_price#66, d_year#69]
Input [12]: [ws_bill_customer_sk#64, ws_ext_discount_amt#65, ws_ext_list_price#66, d_year#69, c_customer_sk#70, c_customer_id#71, c_first_name#72, c_last_name#73, c_preferred_cust_flag#74, c_birth_country#75, c_login#76, c_email_address#77]

(73) HashAggregate [codegen id : 32]
Input [10]: [c_customer_id#71, c_first_name#72, c_last_name#73, c_preferred_cust_flag#74, c_birth_country#75, c_login#76, c_email_address#77, ws_ext_discount_amt#65, ws_ext_list_price#66, d_year#69]
Keys [8]: [c_customer_id#71, c_first_name#72, c_last_name#73, c_preferred_cust_flag#74, c_birth_country#75, c_login#76, c_email_address#77, d_year#69]
Functions [1]: [partial_sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#66 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#65 as decimal(8,2)))), DecimalType(8,2), true)))]
Aggregate Attributes [1]: [sum#78]
Results [9]: [c_customer_id#71, c_first_name#72, c_last_name#73, c_preferred_cust_flag#74, c_birth_country#75, c_login#76, c_email_address#77, d_year#69, sum#79]

(74) Exchange
Input [9]: [c_customer_id#71, c_first_name#72, c_last_name#73, c_preferred_cust_flag#74, c_birth_country#75, c_login#76, c_email_address#77, d_year#69, sum#79]
Arguments: hashpartitioning(c_customer_id#71, c_first_name#72, c_last_name#73, c_preferred_cust_flag#74, c_birth_country#75, c_login#76, c_email_address#77, d_year#69, 5), ENSURE_REQUIREMENTS, [plan_id=12]

(75) HashAggregate [codegen id : 33]
Input [9]: [c_customer_id#71, c_first_name#72, c_last_name#73, c_preferred_cust_flag#74, c_birth_country#75, c_login#76, c_email_address#77, d_year#69, sum#79]
Keys [8]: [c_customer_id#71, c_first_name#72, c_last_name#73, c_preferred_cust_flag#74, c_birth_country#75, c_login#76, c_email_address#77, d_year#69]
Functions [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#66 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#65 as decimal(8,2)))), DecimalType(8,2), true)))]
Aggregate Attributes [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#66 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#65 as decimal(8,2)))), DecimalType(8,2), true)))#59]
Results [2]: [c_customer_id#71 AS customer_id#80, MakeDecimal(sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#66 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#65 as decimal(8,2)))), DecimalType(8,2), true)))#59,18,2) AS year_total#81]

(76) Exchange
Input [2]: [customer_id#80, year_total#81]
Arguments: hashpartitioning(customer_id#80, 5), ENSURE_REQUIREMENTS, [plan_id=13]

(77) Sort [codegen id : 34]
Input [2]: [customer_id#80, year_total#81]
Arguments: [customer_id#80 ASC NULLS FIRST], false, 0

(78) SortMergeJoin [codegen id : 35]
Left keys [1]: [customer_id#19]
Right keys [1]: [customer_id#80]
Join condition: (CASE WHEN (year_total#63 > 0.00) THEN CheckOverflow((promote_precision(year_total#81) / promote_precision(year_total#63)), DecimalType(38,20), true) ELSE 0E-20 END > CASE WHEN (year_total#20 > 0.00) THEN CheckOverflow((promote_precision(year_total#42) / promote_precision(year_total#20)), DecimalType(38,20), true) ELSE 0E-20 END)

(79) Project [codegen id : 35]
Output [4]: [customer_id#38, customer_first_name#39, customer_last_name#40, customer_email_address#41]
Input [10]: [customer_id#19, year_total#20, customer_id#38, customer_first_name#39, customer_last_name#40, customer_email_address#41, year_total#42, year_total#63, customer_id#80, year_total#81]

(80) TakeOrderedAndProject
Input [4]: [customer_id#38, customer_first_name#39, customer_last_name#40, customer_email_address#41]
Arguments: 100, [customer_id#38 ASC NULLS FIRST, customer_first_name#39 ASC NULLS FIRST, customer_last_name#40 ASC NULLS FIRST, customer_email_address#41 ASC NULLS FIRST], [customer_id#38, customer_first_name#39, customer_last_name#40, customer_email_address#41]

===== 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)


(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<d_date_sk:int,d_year:int>

(82) ColumnarToRow [codegen id : 1]
Input [2]: [d_date_sk#6, d_year#7]

(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))

(84) BroadcastExchange
Input [2]: [d_date_sk#6, d_year#7]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=14]

Subquery:2 Hosting operator id = 22 Hosting Expression = ss_sold_date_sk#24 IN dynamicpruning#25
BroadcastExchange (88)
+- * Filter (87)
   +- * ColumnarToRow (86)
      +- Scan parquet default.date_dim (85)


(85) Scan parquet default.date_dim
Output [2]: [d_date_sk#26, d_year#27]
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<d_date_sk:int,d_year:int>

(86) ColumnarToRow [codegen id : 1]
Input [2]: [d_date_sk#26, d_year#27]

(87) Filter [codegen id : 1]
Input [2]: [d_date_sk#26, d_year#27]
Condition : ((isnotnull(d_year#27) AND (d_year#27 = 2002)) AND isnotnull(d_date_sk#26))

(88) BroadcastExchange
Input [2]: [d_date_sk#26, d_year#27]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=15]

Subquery:3 Hosting operator id = 40 Hosting Expression = ws_sold_date_sk#46 IN dynamicpruning#5

Subquery:4 Hosting operator id = 61 Hosting Expression = ws_sold_date_sk#67 IN dynamicpruning#25


