== Physical Plan ==
TakeOrderedAndProject (87)
+- * Project (86)
   +- * SortMergeJoin Inner (85)
      :- * Project (67)
      :  +- * SortMergeJoin Inner (66)
      :     :- * Project (46)
      :     :  +- * SortMergeJoin Inner (45)
      :     :     :- * Sort (24)
      :     :     :  +- Exchange (23)
      :     :     :     +- * Filter (22)
      :     :     :        +- * HashAggregate (21)
      :     :     :           +- Exchange (20)
      :     :     :              +- * HashAggregate (19)
      :     :     :                 +- * Project (18)
      :     :     :                    +- * SortMergeJoin Inner (17)
      :     :     :                       :- * Sort (11)
      :     :     :                       :  +- Exchange (10)
      :     :     :                       :     +- * Project (9)
      :     :     :                       :        +- * BroadcastHashJoin Inner BuildRight (8)
      :     :     :                       :           :- * Filter (3)
      :     :     :                       :           :  +- * ColumnarToRow (2)
      :     :     :                       :           :     +- Scan parquet default.store_sales (1)
      :     :     :                       :           +- BroadcastExchange (7)
      :     :     :                       :              +- * Filter (6)
      :     :     :                       :                 +- * ColumnarToRow (5)
      :     :     :                       :                    +- Scan parquet default.date_dim (4)
      :     :     :                       +- * Sort (16)
      :     :     :                          +- Exchange (15)
      :     :     :                             +- * Filter (14)
      :     :     :                                +- * ColumnarToRow (13)
      :     :     :                                   +- Scan parquet default.customer (12)
      :     :     +- * Sort (44)
      :     :        +- Exchange (43)
      :     :           +- * HashAggregate (42)
      :     :              +- Exchange (41)
      :     :                 +- * HashAggregate (40)
      :     :                    +- * Project (39)
      :     :                       +- * SortMergeJoin Inner (38)
      :     :                          :- * Sort (35)
      :     :                          :  +- Exchange (34)
      :     :                          :     +- * Project (33)
      :     :                          :        +- * BroadcastHashJoin Inner BuildRight (32)
      :     :                          :           :- * Filter (27)
      :     :                          :           :  +- * ColumnarToRow (26)
      :     :                          :           :     +- Scan parquet default.store_sales (25)
      :     :                          :           +- BroadcastExchange (31)
      :     :                          :              +- * Filter (30)
      :     :                          :                 +- * ColumnarToRow (29)
      :     :                          :                    +- Scan parquet default.date_dim (28)
      :     :                          +- * Sort (37)
      :     :                             +- ReusedExchange (36)
      :     +- * Sort (65)
      :        +- Exchange (64)
      :           +- * Project (63)
      :              +- * Filter (62)
      :                 +- * HashAggregate (61)
      :                    +- Exchange (60)
      :                       +- * HashAggregate (59)
      :                          +- * Project (58)
      :                             +- * SortMergeJoin Inner (57)
      :                                :- * Sort (54)
      :                                :  +- Exchange (53)
      :                                :     +- * Project (52)
      :                                :        +- * BroadcastHashJoin Inner BuildRight (51)
      :                                :           :- * Filter (49)
      :                                :           :  +- * ColumnarToRow (48)
      :                                :           :     +- Scan parquet default.web_sales (47)
      :                                :           +- ReusedExchange (50)
      :                                +- * Sort (56)
      :                                   +- ReusedExchange (55)
      +- * Sort (84)
         +- Exchange (83)
            +- * HashAggregate (82)
               +- Exchange (81)
                  +- * HashAggregate (80)
                     +- * Project (79)
                        +- * SortMergeJoin Inner (78)
                           :- * Sort (75)
                           :  +- Exchange (74)
                           :     +- * Project (73)
                           :        +- * BroadcastHashJoin Inner BuildRight (72)
                           :           :- * Filter (70)
                           :           :  +- * ColumnarToRow (69)
                           :           :     +- Scan parquet default.web_sales (68)
                           :           +- ReusedExchange (71)
                           +- * Sort (77)
                              +- ReusedExchange (76)


(1) Scan parquet default.store_sales
Output [4]: [ss_sold_date_sk#1, ss_customer_sk#2, ss_ext_discount_amt#3, ss_ext_list_price#4]
Batched: true
Location [not included in comparison]/{warehouse_dir}/store_sales]
PushedFilters: [IsNotNull(ss_customer_sk), IsNotNull(ss_sold_date_sk)]
ReadSchema: struct<ss_sold_date_sk:int,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_sold_date_sk#1, ss_customer_sk#2, ss_ext_discount_amt#3, ss_ext_list_price#4]

(3) Filter [codegen id : 2]
Input [4]: [ss_sold_date_sk#1, ss_customer_sk#2, ss_ext_discount_amt#3, ss_ext_list_price#4]
Condition : (isnotnull(ss_customer_sk#2) AND isnotnull(ss_sold_date_sk#1))

(4) 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), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_year:int>

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

(6) Filter [codegen id : 1]
Input [2]: [d_date_sk#5, d_year#6]
Condition : ((isnotnull(d_year#6) AND (d_year#6 = 2001)) AND isnotnull(d_date_sk#5))

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

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

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

(10) Exchange
Input [4]: [ss_customer_sk#2, ss_ext_discount_amt#3, ss_ext_list_price#4, d_year#6]
Arguments: hashpartitioning(ss_customer_sk#2, 5), true, [id=#8]

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

(12) Scan parquet default.customer
Output [8]: [c_customer_sk#9, c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16]
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>

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

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

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

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

(17) SortMergeJoin [codegen id : 6]
Left keys [1]: [ss_customer_sk#2]
Right keys [1]: [c_customer_sk#9]
Join condition: None

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

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

(20) Exchange
Input [9]: [c_customer_id#10, c_first_name#11, c_last_name#12, d_year#6, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, sum#19]
Arguments: hashpartitioning(c_customer_id#10, c_first_name#11, c_last_name#12, d_year#6, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, 5), true, [id=#20]

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

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

(23) Exchange
Input [2]: [customer_id#22, year_total#23]
Arguments: hashpartitioning(customer_id#22, 5), true, [id=#24]

(24) Sort [codegen id : 8]
Input [2]: [customer_id#22, year_total#23]
Arguments: [customer_id#22 ASC NULLS FIRST], false, 0

(25) Scan parquet default.store_sales
Output [4]: [ss_sold_date_sk#1, ss_customer_sk#2, ss_ext_discount_amt#3, ss_ext_list_price#4]
Batched: true
Location [not included in comparison]/{warehouse_dir}/store_sales]
PushedFilters: [IsNotNull(ss_customer_sk), IsNotNull(ss_sold_date_sk)]
ReadSchema: struct<ss_sold_date_sk:int,ss_customer_sk:int,ss_ext_discount_amt:decimal(7,2),ss_ext_list_price:decimal(7,2)>

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

(27) Filter [codegen id : 10]
Input [4]: [ss_sold_date_sk#1, ss_customer_sk#2, ss_ext_discount_amt#3, ss_ext_list_price#4]
Condition : (isnotnull(ss_customer_sk#2) AND isnotnull(ss_sold_date_sk#1))

(28) 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,2002), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_year:int>

(29) ColumnarToRow [codegen id : 9]
Input [2]: [d_date_sk#5, d_year#6]

(30) Filter [codegen id : 9]
Input [2]: [d_date_sk#5, d_year#6]
Condition : ((isnotnull(d_year#6) AND (d_year#6 = 2002)) AND isnotnull(d_date_sk#5))

(31) BroadcastExchange
Input [2]: [d_date_sk#5, d_year#6]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#25]

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

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

(34) Exchange
Input [4]: [ss_customer_sk#2, ss_ext_discount_amt#3, ss_ext_list_price#4, d_year#6]
Arguments: hashpartitioning(ss_customer_sk#2, 5), true, [id=#26]

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

(36) ReusedExchange [Reuses operator id: 15]
Output [8]: [c_customer_sk#9, c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16]

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

(38) SortMergeJoin [codegen id : 14]
Left keys [1]: [ss_customer_sk#2]
Right keys [1]: [c_customer_sk#9]
Join condition: None

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

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

(41) Exchange
Input [9]: [c_customer_id#10, c_first_name#11, c_last_name#12, d_year#6, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, sum#28]
Arguments: hashpartitioning(c_customer_id#10, c_first_name#11, c_last_name#12, d_year#6, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, 5), true, [id=#29]

(42) HashAggregate [codegen id : 15]
Input [9]: [c_customer_id#10, c_first_name#11, c_last_name#12, d_year#6, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, sum#28]
Keys [8]: [c_customer_id#10, c_first_name#11, c_last_name#12, d_year#6, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16]
Functions [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ss_ext_list_price#4 as decimal(8,2))) - promote_precision(cast(ss_ext_discount_amt#3 as decimal(8,2)))), DecimalType(8,2), true)))]
Aggregate Attributes [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ss_ext_list_price#4 as decimal(8,2))) - promote_precision(cast(ss_ext_discount_amt#3 as decimal(8,2)))), DecimalType(8,2), true)))#30]
Results [3]: [c_customer_id#10 AS customer_id#31, c_preferred_cust_flag#13 AS customer_preferred_cust_flag#32, MakeDecimal(sum(UnscaledValue(CheckOverflow((promote_precision(cast(ss_ext_list_price#4 as decimal(8,2))) - promote_precision(cast(ss_ext_discount_amt#3 as decimal(8,2)))), DecimalType(8,2), true)))#30,18,2) AS year_total#33]

(43) Exchange
Input [3]: [customer_id#31, customer_preferred_cust_flag#32, year_total#33]
Arguments: hashpartitioning(customer_id#31, 5), true, [id=#34]

(44) Sort [codegen id : 16]
Input [3]: [customer_id#31, customer_preferred_cust_flag#32, year_total#33]
Arguments: [customer_id#31 ASC NULLS FIRST], false, 0

(45) SortMergeJoin [codegen id : 17]
Left keys [1]: [customer_id#22]
Right keys [1]: [customer_id#31]
Join condition: None

(46) Project [codegen id : 17]
Output [4]: [customer_id#22, year_total#23, customer_preferred_cust_flag#32, year_total#33]
Input [5]: [customer_id#22, year_total#23, customer_id#31, customer_preferred_cust_flag#32, year_total#33]

(47) Scan parquet default.web_sales
Output [4]: [ws_sold_date_sk#35, ws_bill_customer_sk#36, ws_ext_discount_amt#37, ws_ext_list_price#38]
Batched: true
Location [not included in comparison]/{warehouse_dir}/web_sales]
PushedFilters: [IsNotNull(ws_bill_customer_sk), IsNotNull(ws_sold_date_sk)]
ReadSchema: struct<ws_sold_date_sk:int,ws_bill_customer_sk:int,ws_ext_discount_amt:decimal(7,2),ws_ext_list_price:decimal(7,2)>

(48) ColumnarToRow [codegen id : 19]
Input [4]: [ws_sold_date_sk#35, ws_bill_customer_sk#36, ws_ext_discount_amt#37, ws_ext_list_price#38]

(49) Filter [codegen id : 19]
Input [4]: [ws_sold_date_sk#35, ws_bill_customer_sk#36, ws_ext_discount_amt#37, ws_ext_list_price#38]
Condition : (isnotnull(ws_bill_customer_sk#36) AND isnotnull(ws_sold_date_sk#35))

(50) ReusedExchange [Reuses operator id: 7]
Output [2]: [d_date_sk#5, d_year#6]

(51) BroadcastHashJoin [codegen id : 19]
Left keys [1]: [ws_sold_date_sk#35]
Right keys [1]: [d_date_sk#5]
Join condition: None

(52) Project [codegen id : 19]
Output [4]: [ws_bill_customer_sk#36, ws_ext_discount_amt#37, ws_ext_list_price#38, d_year#6]
Input [6]: [ws_sold_date_sk#35, ws_bill_customer_sk#36, ws_ext_discount_amt#37, ws_ext_list_price#38, d_date_sk#5, d_year#6]

(53) Exchange
Input [4]: [ws_bill_customer_sk#36, ws_ext_discount_amt#37, ws_ext_list_price#38, d_year#6]
Arguments: hashpartitioning(ws_bill_customer_sk#36, 5), true, [id=#39]

(54) Sort [codegen id : 20]
Input [4]: [ws_bill_customer_sk#36, ws_ext_discount_amt#37, ws_ext_list_price#38, d_year#6]
Arguments: [ws_bill_customer_sk#36 ASC NULLS FIRST], false, 0

(55) ReusedExchange [Reuses operator id: 15]
Output [8]: [c_customer_sk#9, c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16]

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

(57) SortMergeJoin [codegen id : 23]
Left keys [1]: [ws_bill_customer_sk#36]
Right keys [1]: [c_customer_sk#9]
Join condition: None

(58) Project [codegen id : 23]
Output [10]: [c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, ws_ext_discount_amt#37, ws_ext_list_price#38, d_year#6]
Input [12]: [ws_bill_customer_sk#36, ws_ext_discount_amt#37, ws_ext_list_price#38, d_year#6, c_customer_sk#9, c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16]

(59) HashAggregate [codegen id : 23]
Input [10]: [c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, ws_ext_discount_amt#37, ws_ext_list_price#38, d_year#6]
Keys [8]: [c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, d_year#6]
Functions [1]: [partial_sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#38 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#37 as decimal(8,2)))), DecimalType(8,2), true)))]
Aggregate Attributes [1]: [sum#40]
Results [9]: [c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, d_year#6, sum#41]

(60) Exchange
Input [9]: [c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, d_year#6, sum#41]
Arguments: hashpartitioning(c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, d_year#6, 5), true, [id=#42]

(61) HashAggregate [codegen id : 24]
Input [9]: [c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, d_year#6, sum#41]
Keys [8]: [c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, d_year#6]
Functions [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#38 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#37 as decimal(8,2)))), DecimalType(8,2), true)))]
Aggregate Attributes [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#38 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#37 as decimal(8,2)))), DecimalType(8,2), true)))#43]
Results [2]: [c_customer_id#10 AS customer_id#44, MakeDecimal(sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#38 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#37 as decimal(8,2)))), DecimalType(8,2), true)))#43,18,2) AS year_total#45]

(62) Filter [codegen id : 24]
Input [2]: [customer_id#44, year_total#45]
Condition : (isnotnull(year_total#45) AND (year_total#45 > 0.00))

(63) Project [codegen id : 24]
Output [2]: [customer_id#44 AS customer_id#46, year_total#45 AS year_total#47]
Input [2]: [customer_id#44, year_total#45]

(64) Exchange
Input [2]: [customer_id#46, year_total#47]
Arguments: hashpartitioning(customer_id#46, 5), true, [id=#48]

(65) Sort [codegen id : 25]
Input [2]: [customer_id#46, year_total#47]
Arguments: [customer_id#46 ASC NULLS FIRST], false, 0

(66) SortMergeJoin [codegen id : 26]
Left keys [1]: [customer_id#22]
Right keys [1]: [customer_id#46]
Join condition: None

(67) Project [codegen id : 26]
Output [5]: [customer_id#22, year_total#23, customer_preferred_cust_flag#32, year_total#33, year_total#47]
Input [6]: [customer_id#22, year_total#23, customer_preferred_cust_flag#32, year_total#33, customer_id#46, year_total#47]

(68) Scan parquet default.web_sales
Output [4]: [ws_sold_date_sk#35, ws_bill_customer_sk#36, ws_ext_discount_amt#37, ws_ext_list_price#38]
Batched: true
Location [not included in comparison]/{warehouse_dir}/web_sales]
PushedFilters: [IsNotNull(ws_bill_customer_sk), IsNotNull(ws_sold_date_sk)]
ReadSchema: struct<ws_sold_date_sk:int,ws_bill_customer_sk:int,ws_ext_discount_amt:decimal(7,2),ws_ext_list_price:decimal(7,2)>

(69) ColumnarToRow [codegen id : 28]
Input [4]: [ws_sold_date_sk#35, ws_bill_customer_sk#36, ws_ext_discount_amt#37, ws_ext_list_price#38]

(70) Filter [codegen id : 28]
Input [4]: [ws_sold_date_sk#35, ws_bill_customer_sk#36, ws_ext_discount_amt#37, ws_ext_list_price#38]
Condition : (isnotnull(ws_bill_customer_sk#36) AND isnotnull(ws_sold_date_sk#35))

(71) ReusedExchange [Reuses operator id: 31]
Output [2]: [d_date_sk#5, d_year#6]

(72) BroadcastHashJoin [codegen id : 28]
Left keys [1]: [ws_sold_date_sk#35]
Right keys [1]: [d_date_sk#5]
Join condition: None

(73) Project [codegen id : 28]
Output [4]: [ws_bill_customer_sk#36, ws_ext_discount_amt#37, ws_ext_list_price#38, d_year#6]
Input [6]: [ws_sold_date_sk#35, ws_bill_customer_sk#36, ws_ext_discount_amt#37, ws_ext_list_price#38, d_date_sk#5, d_year#6]

(74) Exchange
Input [4]: [ws_bill_customer_sk#36, ws_ext_discount_amt#37, ws_ext_list_price#38, d_year#6]
Arguments: hashpartitioning(ws_bill_customer_sk#36, 5), true, [id=#49]

(75) Sort [codegen id : 29]
Input [4]: [ws_bill_customer_sk#36, ws_ext_discount_amt#37, ws_ext_list_price#38, d_year#6]
Arguments: [ws_bill_customer_sk#36 ASC NULLS FIRST], false, 0

(76) ReusedExchange [Reuses operator id: 15]
Output [8]: [c_customer_sk#9, c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16]

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

(78) SortMergeJoin [codegen id : 32]
Left keys [1]: [ws_bill_customer_sk#36]
Right keys [1]: [c_customer_sk#9]
Join condition: None

(79) Project [codegen id : 32]
Output [10]: [c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, ws_ext_discount_amt#37, ws_ext_list_price#38, d_year#6]
Input [12]: [ws_bill_customer_sk#36, ws_ext_discount_amt#37, ws_ext_list_price#38, d_year#6, c_customer_sk#9, c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16]

(80) HashAggregate [codegen id : 32]
Input [10]: [c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, ws_ext_discount_amt#37, ws_ext_list_price#38, d_year#6]
Keys [8]: [c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, d_year#6]
Functions [1]: [partial_sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#38 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#37 as decimal(8,2)))), DecimalType(8,2), true)))]
Aggregate Attributes [1]: [sum#50]
Results [9]: [c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, d_year#6, sum#51]

(81) Exchange
Input [9]: [c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, d_year#6, sum#51]
Arguments: hashpartitioning(c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, d_year#6, 5), true, [id=#52]

(82) HashAggregate [codegen id : 33]
Input [9]: [c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, d_year#6, sum#51]
Keys [8]: [c_customer_id#10, c_first_name#11, c_last_name#12, c_preferred_cust_flag#13, c_birth_country#14, c_login#15, c_email_address#16, d_year#6]
Functions [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#38 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#37 as decimal(8,2)))), DecimalType(8,2), true)))]
Aggregate Attributes [1]: [sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#38 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#37 as decimal(8,2)))), DecimalType(8,2), true)))#53]
Results [2]: [c_customer_id#10 AS customer_id#54, MakeDecimal(sum(UnscaledValue(CheckOverflow((promote_precision(cast(ws_ext_list_price#38 as decimal(8,2))) - promote_precision(cast(ws_ext_discount_amt#37 as decimal(8,2)))), DecimalType(8,2), true)))#53,18,2) AS year_total#55]

(83) Exchange
Input [2]: [customer_id#54, year_total#55]
Arguments: hashpartitioning(customer_id#54, 5), true, [id=#56]

(84) Sort [codegen id : 34]
Input [2]: [customer_id#54, year_total#55]
Arguments: [customer_id#54 ASC NULLS FIRST], false, 0

(85) SortMergeJoin [codegen id : 35]
Left keys [1]: [customer_id#22]
Right keys [1]: [customer_id#54]
Join condition: (CASE WHEN (year_total#47 > 0.00) THEN CheckOverflow((promote_precision(year_total#55) / promote_precision(year_total#47)), DecimalType(38,20), true) ELSE null END > CASE WHEN (year_total#23 > 0.00) THEN CheckOverflow((promote_precision(year_total#33) / promote_precision(year_total#23)), DecimalType(38,20), true) ELSE null END)

(86) Project [codegen id : 35]
Output [1]: [customer_preferred_cust_flag#32]
Input [7]: [customer_id#22, year_total#23, customer_preferred_cust_flag#32, year_total#33, year_total#47, customer_id#54, year_total#55]

(87) TakeOrderedAndProject
Input [1]: [customer_preferred_cust_flag#32]
Arguments: 100, [customer_preferred_cust_flag#32 ASC NULLS FIRST], [customer_preferred_cust_flag#32]

