== Physical Plan ==
TakeOrderedAndProject (120)
+- * Project (119)
   +- * SortMergeJoin Inner (118)
      :- * Project (100)
      :  +- * SortMergeJoin Inner (99)
      :     :- * 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.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)


(1) Scan parquet default.store_sales
Output [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]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#6), dynamicpruningexpression(ss_sold_date_sk#6 IN dynamicpruning#7)]
PushedFilters: [IsNotNull(ss_customer_sk)]
ReadSchema: struct<ss_customer_sk:int,ss_ext_discount_amt:decimal(7,2),ss_ext_sales_price:decimal(7,2),ss_ext_wholesale_cost:decimal(7,2),ss_ext_list_price:decimal(7,2)>

(2) ColumnarToRow [codegen id : 2]
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]

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

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

(6) Project [codegen id : 2]
Output [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, d_year#9]
Input [8]: [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, d_date_sk#8, d_year#9]

(7) Exchange
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, d_year#9]
Arguments: hashpartitioning(ss_customer_sk#1, 5), ENSURE_REQUIREMENTS, [id=#10]

(8) Sort [codegen id : 3]
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, d_year#9]
Arguments: [ss_customer_sk#1 ASC NULLS FIRST], false, 0

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

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

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

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

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

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

(16) HashAggregate [codegen id : 6]
Input [12]: [c_customer_id#12, c_first_name#13, c_last_name#14, c_preferred_cust_flag#15, c_birth_country#16, c_login#17, c_email_address#18, ss_ext_discount_amt#2, ss_ext_sales_price#3, ss_ext_wholesale_cost#4, ss_ext_list_price#5, d_year#9]
Keys [8]: [c_customer_id#12, c_first_name#13, c_last_name#14, c_preferred_cust_flag#15, c_birth_country#16, c_login#17, c_email_address#18, d_year#9]
Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ss_ext_list_price#5 as decimal(8,2))) - promote_precision(cast(ss_ext_wholesale_cost#4 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ss_ext_discount_amt#2 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ss_ext_sales_price#3 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))]
Aggregate Attributes [2]: [sum#20, isEmpty#21]
Results [10]: [c_customer_id#12, c_first_name#13, c_last_name#14, c_preferred_cust_flag#15, c_birth_country#16, c_login#17, c_email_address#18, d_year#9, sum#22, isEmpty#23]

(17) Exchange
Input [10]: [c_customer_id#12, c_first_name#13, c_last_name#14, c_preferred_cust_flag#15, c_birth_country#16, c_login#17, c_email_address#18, d_year#9, sum#22, isEmpty#23]
Arguments: hashpartitioning(c_customer_id#12, c_first_name#13, c_last_name#14, c_preferred_cust_flag#15, c_birth_country#16, c_login#17, c_email_address#18, d_year#9, 5), ENSURE_REQUIREMENTS, [id=#24]

(18) HashAggregate [codegen id : 7]
Input [10]: [c_customer_id#12, c_first_name#13, c_last_name#14, c_preferred_cust_flag#15, c_birth_country#16, c_login#17, c_email_address#18, d_year#9, sum#22, isEmpty#23]
Keys [8]: [c_customer_id#12, c_first_name#13, c_last_name#14, c_preferred_cust_flag#15, c_birth_country#16, c_login#17, c_email_address#18, d_year#9]
Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ss_ext_list_price#5 as decimal(8,2))) - promote_precision(cast(ss_ext_wholesale_cost#4 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ss_ext_discount_amt#2 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ss_ext_sales_price#3 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(ss_ext_list_price#5 as decimal(8,2))) - promote_precision(cast(ss_ext_wholesale_cost#4 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ss_ext_discount_amt#2 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ss_ext_sales_price#3 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#25]
Results [2]: [c_customer_id#12 AS customer_id#26, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ss_ext_list_price#5 as decimal(8,2))) - promote_precision(cast(ss_ext_wholesale_cost#4 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ss_ext_discount_amt#2 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ss_ext_sales_price#3 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#25 AS year_total#27]

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

(20) Exchange
Input [2]: [customer_id#26, year_total#27]
Arguments: hashpartitioning(customer_id#26, 5), ENSURE_REQUIREMENTS, [id=#28]

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

(22) Scan parquet default.store_sales
Output [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]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#34), dynamicpruningexpression(ss_sold_date_sk#34 IN dynamicpruning#35)]
PushedFilters: [IsNotNull(ss_customer_sk)]
ReadSchema: struct<ss_customer_sk:int,ss_ext_discount_amt:decimal(7,2),ss_ext_sales_price:decimal(7,2),ss_ext_wholesale_cost:decimal(7,2),ss_ext_list_price:decimal(7,2)>

(23) ColumnarToRow [codegen id : 10]
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]

(24) Filter [codegen id : 10]
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]
Output [2]: [d_date_sk#36, d_year#37]

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

(27) Project [codegen id : 10]
Output [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, d_year#37]
Input [8]: [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, d_date_sk#36, d_year#37]

(28) Exchange
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, d_year#37]
Arguments: hashpartitioning(ss_customer_sk#29, 5), ENSURE_REQUIREMENTS, [id=#38]

(29) Sort [codegen id : 11]
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, d_year#37]
Arguments: [ss_customer_sk#29 ASC NULLS FIRST], false, 0

(30) ReusedExchange [Reuses operator id: 12]
Output [8]: [c_customer_sk#39, c_customer_id#40, c_first_name#41, c_last_name#42, c_preferred_cust_flag#43, c_birth_country#44, c_login#45, c_email_address#46]

(31) Sort [codegen id : 13]
Input [8]: [c_customer_sk#39, c_customer_id#40, c_first_name#41, c_last_name#42, c_preferred_cust_flag#43, c_birth_country#44, c_login#45, c_email_address#46]
Arguments: [c_customer_sk#39 ASC NULLS FIRST], false, 0

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

(33) Project [codegen id : 14]
Output [12]: [c_customer_id#40, c_first_name#41, c_last_name#42, c_preferred_cust_flag#43, c_birth_country#44, c_login#45, c_email_address#46, ss_ext_discount_amt#30, ss_ext_sales_price#31, ss_ext_wholesale_cost#32, ss_ext_list_price#33, d_year#37]
Input [14]: [ss_customer_sk#29, ss_ext_discount_amt#30, ss_ext_sales_price#31, ss_ext_wholesale_cost#32, ss_ext_list_price#33, d_year#37, c_customer_sk#39, c_customer_id#40, c_first_name#41, c_last_name#42, c_preferred_cust_flag#43, c_birth_country#44, c_login#45, c_email_address#46]

(34) HashAggregate [codegen id : 14]
Input [12]: [c_customer_id#40, c_first_name#41, c_last_name#42, c_preferred_cust_flag#43, c_birth_country#44, c_login#45, c_email_address#46, ss_ext_discount_amt#30, ss_ext_sales_price#31, ss_ext_wholesale_cost#32, ss_ext_list_price#33, d_year#37]
Keys [8]: [c_customer_id#40, c_first_name#41, c_last_name#42, c_preferred_cust_flag#43, c_birth_country#44, c_login#45, c_email_address#46, d_year#37]
Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ss_ext_list_price#33 as decimal(8,2))) - promote_precision(cast(ss_ext_wholesale_cost#32 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ss_ext_discount_amt#30 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ss_ext_sales_price#31 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))]
Aggregate Attributes [2]: [sum#47, isEmpty#48]
Results [10]: [c_customer_id#40, c_first_name#41, c_last_name#42, c_preferred_cust_flag#43, c_birth_country#44, c_login#45, c_email_address#46, d_year#37, sum#49, isEmpty#50]

(35) Exchange
Input [10]: [c_customer_id#40, c_first_name#41, c_last_name#42, c_preferred_cust_flag#43, c_birth_country#44, c_login#45, c_email_address#46, d_year#37, sum#49, isEmpty#50]
Arguments: hashpartitioning(c_customer_id#40, c_first_name#41, c_last_name#42, c_preferred_cust_flag#43, c_birth_country#44, c_login#45, c_email_address#46, d_year#37, 5), ENSURE_REQUIREMENTS, [id=#51]

(36) HashAggregate [codegen id : 15]
Input [10]: [c_customer_id#40, c_first_name#41, c_last_name#42, c_preferred_cust_flag#43, c_birth_country#44, c_login#45, c_email_address#46, d_year#37, sum#49, isEmpty#50]
Keys [8]: [c_customer_id#40, c_first_name#41, c_last_name#42, c_preferred_cust_flag#43, c_birth_country#44, c_login#45, c_email_address#46, d_year#37]
Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ss_ext_list_price#33 as decimal(8,2))) - promote_precision(cast(ss_ext_wholesale_cost#32 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ss_ext_discount_amt#30 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ss_ext_sales_price#31 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(ss_ext_list_price#33 as decimal(8,2))) - promote_precision(cast(ss_ext_wholesale_cost#32 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ss_ext_discount_amt#30 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ss_ext_sales_price#31 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#25]
Results [8]: [c_customer_id#40 AS customer_id#52, c_first_name#41 AS customer_first_name#53, c_last_name#42 AS customer_last_name#54, c_preferred_cust_flag#43 AS customer_preferred_cust_flag#55, c_birth_country#44 AS customer_birth_country#56, c_login#45 AS customer_login#57, c_email_address#46 AS customer_email_address#58, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ss_ext_list_price#33 as decimal(8,2))) - promote_precision(cast(ss_ext_wholesale_cost#32 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ss_ext_discount_amt#30 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ss_ext_sales_price#31 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#25 AS year_total#59]

(37) Exchange
Input [8]: [customer_id#52, customer_first_name#53, customer_last_name#54, customer_preferred_cust_flag#55, customer_birth_country#56, customer_login#57, customer_email_address#58, year_total#59]
Arguments: hashpartitioning(customer_id#52, 5), ENSURE_REQUIREMENTS, [id=#60]

(38) Sort [codegen id : 16]
Input [8]: [customer_id#52, customer_first_name#53, customer_last_name#54, customer_preferred_cust_flag#55, customer_birth_country#56, customer_login#57, customer_email_address#58, year_total#59]
Arguments: [customer_id#52 ASC NULLS FIRST], false, 0

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

(40) Scan parquet default.catalog_sales
Output [6]: [cs_bill_customer_sk#61, cs_ext_discount_amt#62, cs_ext_sales_price#63, cs_ext_wholesale_cost#64, cs_ext_list_price#65, cs_sold_date_sk#66]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(cs_sold_date_sk#66), dynamicpruningexpression(cs_sold_date_sk#66 IN dynamicpruning#7)]
PushedFilters: [IsNotNull(cs_bill_customer_sk)]
ReadSchema: struct<cs_bill_customer_sk:int,cs_ext_discount_amt:decimal(7,2),cs_ext_sales_price:decimal(7,2),cs_ext_wholesale_cost:decimal(7,2),cs_ext_list_price:decimal(7,2)>

(41) ColumnarToRow [codegen id : 19]
Input [6]: [cs_bill_customer_sk#61, cs_ext_discount_amt#62, cs_ext_sales_price#63, cs_ext_wholesale_cost#64, cs_ext_list_price#65, cs_sold_date_sk#66]

(42) Filter [codegen id : 19]
Input [6]: [cs_bill_customer_sk#61, cs_ext_discount_amt#62, cs_ext_sales_price#63, cs_ext_wholesale_cost#64, cs_ext_list_price#65, cs_sold_date_sk#66]
Condition : isnotnull(cs_bill_customer_sk#61)

(43) ReusedExchange [Reuses operator id: 124]
Output [2]: [d_date_sk#67, d_year#68]

(44) BroadcastHashJoin [codegen id : 19]
Left keys [1]: [cs_sold_date_sk#66]
Right keys [1]: [d_date_sk#67]
Join condition: None

(45) Project [codegen id : 19]
Output [6]: [cs_bill_customer_sk#61, cs_ext_discount_amt#62, cs_ext_sales_price#63, cs_ext_wholesale_cost#64, cs_ext_list_price#65, d_year#68]
Input [8]: [cs_bill_customer_sk#61, cs_ext_discount_amt#62, cs_ext_sales_price#63, cs_ext_wholesale_cost#64, cs_ext_list_price#65, cs_sold_date_sk#66, d_date_sk#67, d_year#68]

(46) Exchange
Input [6]: [cs_bill_customer_sk#61, cs_ext_discount_amt#62, cs_ext_sales_price#63, cs_ext_wholesale_cost#64, cs_ext_list_price#65, d_year#68]
Arguments: hashpartitioning(cs_bill_customer_sk#61, 5), ENSURE_REQUIREMENTS, [id=#69]

(47) Sort [codegen id : 20]
Input [6]: [cs_bill_customer_sk#61, cs_ext_discount_amt#62, cs_ext_sales_price#63, cs_ext_wholesale_cost#64, cs_ext_list_price#65, d_year#68]
Arguments: [cs_bill_customer_sk#61 ASC NULLS FIRST], false, 0

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

(49) Sort [codegen id : 22]
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

(50) SortMergeJoin [codegen id : 23]
Left keys [1]: [cs_bill_customer_sk#61]
Right keys [1]: [c_customer_sk#70]
Join condition: None

(51) Project [codegen id : 23]
Output [12]: [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, cs_ext_discount_amt#62, cs_ext_sales_price#63, cs_ext_wholesale_cost#64, cs_ext_list_price#65, d_year#68]
Input [14]: [cs_bill_customer_sk#61, cs_ext_discount_amt#62, cs_ext_sales_price#63, cs_ext_wholesale_cost#64, cs_ext_list_price#65, d_year#68, 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]

(52) HashAggregate [codegen id : 23]
Input [12]: [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, cs_ext_discount_amt#62, cs_ext_sales_price#63, cs_ext_wholesale_cost#64, cs_ext_list_price#65, d_year#68]
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#68]
Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#65 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#64 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#62 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#63 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))]
Aggregate Attributes [2]: [sum#78, isEmpty#79]
Results [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, d_year#68, sum#80, isEmpty#81]

(53) Exchange
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, d_year#68, sum#80, isEmpty#81]
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#68, 5), ENSURE_REQUIREMENTS, [id=#82]

(54) HashAggregate [codegen id : 24]
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, d_year#68, sum#80, isEmpty#81]
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#68]
Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#65 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#64 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#62 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#63 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#65 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#64 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#62 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#63 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#83]
Results [2]: [c_customer_id#71 AS customer_id#84, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#65 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#64 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#62 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#63 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#83 AS year_total#85]

(55) Filter [codegen id : 24]
Input [2]: [customer_id#84, year_total#85]
Condition : (isnotnull(year_total#85) AND (year_total#85 > 0.000000))

(56) Project [codegen id : 24]
Output [2]: [customer_id#84 AS customer_id#86, year_total#85 AS year_total#87]
Input [2]: [customer_id#84, year_total#85]

(57) Exchange
Input [2]: [customer_id#86, year_total#87]
Arguments: hashpartitioning(customer_id#86, 5), ENSURE_REQUIREMENTS, [id=#88]

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

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

(60) Project [codegen id : 26]
Output [11]: [customer_id#26, year_total#27, customer_id#52, customer_first_name#53, customer_last_name#54, customer_preferred_cust_flag#55, customer_birth_country#56, customer_login#57, customer_email_address#58, year_total#59, year_total#87]
Input [12]: [customer_id#26, year_total#27, customer_id#52, customer_first_name#53, customer_last_name#54, customer_preferred_cust_flag#55, customer_birth_country#56, customer_login#57, customer_email_address#58, year_total#59, customer_id#86, year_total#87]

(61) Scan parquet default.catalog_sales
Output [6]: [cs_bill_customer_sk#89, cs_ext_discount_amt#90, cs_ext_sales_price#91, cs_ext_wholesale_cost#92, cs_ext_list_price#93, cs_sold_date_sk#94]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(cs_sold_date_sk#94), dynamicpruningexpression(cs_sold_date_sk#94 IN dynamicpruning#35)]
PushedFilters: [IsNotNull(cs_bill_customer_sk)]
ReadSchema: struct<cs_bill_customer_sk:int,cs_ext_discount_amt:decimal(7,2),cs_ext_sales_price:decimal(7,2),cs_ext_wholesale_cost:decimal(7,2),cs_ext_list_price:decimal(7,2)>

(62) ColumnarToRow [codegen id : 28]
Input [6]: [cs_bill_customer_sk#89, cs_ext_discount_amt#90, cs_ext_sales_price#91, cs_ext_wholesale_cost#92, cs_ext_list_price#93, cs_sold_date_sk#94]

(63) Filter [codegen id : 28]
Input [6]: [cs_bill_customer_sk#89, cs_ext_discount_amt#90, cs_ext_sales_price#91, cs_ext_wholesale_cost#92, cs_ext_list_price#93, cs_sold_date_sk#94]
Condition : isnotnull(cs_bill_customer_sk#89)

(64) ReusedExchange [Reuses operator id: 128]
Output [2]: [d_date_sk#95, d_year#96]

(65) BroadcastHashJoin [codegen id : 28]
Left keys [1]: [cs_sold_date_sk#94]
Right keys [1]: [d_date_sk#95]
Join condition: None

(66) Project [codegen id : 28]
Output [6]: [cs_bill_customer_sk#89, cs_ext_discount_amt#90, cs_ext_sales_price#91, cs_ext_wholesale_cost#92, cs_ext_list_price#93, d_year#96]
Input [8]: [cs_bill_customer_sk#89, cs_ext_discount_amt#90, cs_ext_sales_price#91, cs_ext_wholesale_cost#92, cs_ext_list_price#93, cs_sold_date_sk#94, d_date_sk#95, d_year#96]

(67) Exchange
Input [6]: [cs_bill_customer_sk#89, cs_ext_discount_amt#90, cs_ext_sales_price#91, cs_ext_wholesale_cost#92, cs_ext_list_price#93, d_year#96]
Arguments: hashpartitioning(cs_bill_customer_sk#89, 5), ENSURE_REQUIREMENTS, [id=#97]

(68) Sort [codegen id : 29]
Input [6]: [cs_bill_customer_sk#89, cs_ext_discount_amt#90, cs_ext_sales_price#91, cs_ext_wholesale_cost#92, cs_ext_list_price#93, d_year#96]
Arguments: [cs_bill_customer_sk#89 ASC NULLS FIRST], false, 0

(69) ReusedExchange [Reuses operator id: 12]
Output [8]: [c_customer_sk#98, c_customer_id#99, c_first_name#100, c_last_name#101, c_preferred_cust_flag#102, c_birth_country#103, c_login#104, c_email_address#105]

(70) Sort [codegen id : 31]
Input [8]: [c_customer_sk#98, c_customer_id#99, c_first_name#100, c_last_name#101, c_preferred_cust_flag#102, c_birth_country#103, c_login#104, c_email_address#105]
Arguments: [c_customer_sk#98 ASC NULLS FIRST], false, 0

(71) SortMergeJoin [codegen id : 32]
Left keys [1]: [cs_bill_customer_sk#89]
Right keys [1]: [c_customer_sk#98]
Join condition: None

(72) Project [codegen id : 32]
Output [12]: [c_customer_id#99, c_first_name#100, c_last_name#101, c_preferred_cust_flag#102, c_birth_country#103, c_login#104, c_email_address#105, cs_ext_discount_amt#90, cs_ext_sales_price#91, cs_ext_wholesale_cost#92, cs_ext_list_price#93, d_year#96]
Input [14]: [cs_bill_customer_sk#89, cs_ext_discount_amt#90, cs_ext_sales_price#91, cs_ext_wholesale_cost#92, cs_ext_list_price#93, d_year#96, c_customer_sk#98, c_customer_id#99, c_first_name#100, c_last_name#101, c_preferred_cust_flag#102, c_birth_country#103, c_login#104, c_email_address#105]

(73) HashAggregate [codegen id : 32]
Input [12]: [c_customer_id#99, c_first_name#100, c_last_name#101, c_preferred_cust_flag#102, c_birth_country#103, c_login#104, c_email_address#105, cs_ext_discount_amt#90, cs_ext_sales_price#91, cs_ext_wholesale_cost#92, cs_ext_list_price#93, d_year#96]
Keys [8]: [c_customer_id#99, c_first_name#100, c_last_name#101, c_preferred_cust_flag#102, c_birth_country#103, c_login#104, c_email_address#105, d_year#96]
Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#93 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#92 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#90 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#91 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))]
Aggregate Attributes [2]: [sum#106, isEmpty#107]
Results [10]: [c_customer_id#99, c_first_name#100, c_last_name#101, c_preferred_cust_flag#102, c_birth_country#103, c_login#104, c_email_address#105, d_year#96, sum#108, isEmpty#109]

(74) Exchange
Input [10]: [c_customer_id#99, c_first_name#100, c_last_name#101, c_preferred_cust_flag#102, c_birth_country#103, c_login#104, c_email_address#105, d_year#96, sum#108, isEmpty#109]
Arguments: hashpartitioning(c_customer_id#99, c_first_name#100, c_last_name#101, c_preferred_cust_flag#102, c_birth_country#103, c_login#104, c_email_address#105, d_year#96, 5), ENSURE_REQUIREMENTS, [id=#110]

(75) HashAggregate [codegen id : 33]
Input [10]: [c_customer_id#99, c_first_name#100, c_last_name#101, c_preferred_cust_flag#102, c_birth_country#103, c_login#104, c_email_address#105, d_year#96, sum#108, isEmpty#109]
Keys [8]: [c_customer_id#99, c_first_name#100, c_last_name#101, c_preferred_cust_flag#102, c_birth_country#103, c_login#104, c_email_address#105, d_year#96]
Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#93 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#92 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#90 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#91 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#93 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#92 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#90 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#91 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#83]
Results [2]: [c_customer_id#99 AS customer_id#111, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#93 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#92 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#90 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#91 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#83 AS year_total#112]

(76) Exchange
Input [2]: [customer_id#111, year_total#112]
Arguments: hashpartitioning(customer_id#111, 5), ENSURE_REQUIREMENTS, [id=#113]

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

(78) SortMergeJoin [codegen id : 35]
Left keys [1]: [customer_id#26]
Right keys [1]: [customer_id#111]
Join condition: (CASE WHEN (year_total#87 > 0.000000) THEN CheckOverflow((promote_precision(year_total#112) / promote_precision(year_total#87)), DecimalType(38,14), true) ELSE null END > CASE WHEN (year_total#27 > 0.000000) THEN CheckOverflow((promote_precision(year_total#59) / promote_precision(year_total#27)), DecimalType(38,14), true) ELSE null END)

(79) Project [codegen id : 35]
Output [10]: [customer_id#26, customer_id#52, customer_first_name#53, customer_last_name#54, customer_preferred_cust_flag#55, customer_birth_country#56, customer_login#57, customer_email_address#58, year_total#87, year_total#112]
Input [13]: [customer_id#26, year_total#27, customer_id#52, customer_first_name#53, customer_last_name#54, customer_preferred_cust_flag#55, customer_birth_country#56, customer_login#57, customer_email_address#58, year_total#59, year_total#87, customer_id#111, year_total#112]

(80) 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#119), dynamicpruningexpression(ws_sold_date_sk#119 IN dynamicpruning#7)]
PushedFilters: [IsNotNull(ws_bill_customer_sk)]
ReadSchema: struct<ws_bill_customer_sk:int,ws_ext_discount_amt:decimal(7,2),ws_ext_sales_price:decimal(7,2),ws_ext_wholesale_cost:decimal(7,2),ws_ext_list_price:decimal(7,2)>

(81) 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#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#120, d_year#121]

(84) 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#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#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#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#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#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#114]
Right keys [1]: [c_customer_sk#123]
Join condition: None

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

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

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

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

(95) Filter [codegen id : 42]
Input [2]: [customer_id#137, year_total#138]
Condition : (isnotnull(year_total#138) AND (year_total#138 > 0.000000))

(96) Project [codegen id : 42]
Output [2]: [customer_id#137 AS customer_id#139, year_total#138 AS year_total#140]
Input [2]: [customer_id#137, year_total#138]

(97) Exchange
Input [2]: [customer_id#139, year_total#140]
Arguments: hashpartitioning(customer_id#139, 5), ENSURE_REQUIREMENTS, [id=#141]

(98) Sort [codegen id : 43]
Input [2]: [customer_id#139, year_total#140]
Arguments: [customer_id#139 ASC NULLS FIRST], false, 0

(99) SortMergeJoin [codegen id : 44]
Left keys [1]: [customer_id#26]
Right keys [1]: [customer_id#139]
Join condition: None

(100) Project [codegen id : 44]
Output [11]: [customer_id#26, customer_id#52, customer_first_name#53, customer_last_name#54, customer_preferred_cust_flag#55, customer_birth_country#56, customer_login#57, customer_email_address#58, year_total#87, year_total#112, year_total#140]
Input [12]: [customer_id#26, customer_id#52, customer_first_name#53, customer_last_name#54, customer_preferred_cust_flag#55, customer_birth_country#56, customer_login#57, customer_email_address#58, year_total#87, year_total#112, customer_id#139, year_total#140]

(101) Scan parquet default.web_sales
Output [6]: [ws_bill_customer_sk#142, ws_ext_discount_amt#143, ws_ext_sales_price#144, ws_ext_wholesale_cost#145, ws_ext_list_price#146, ws_sold_date_sk#147]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ws_sold_date_sk#147), dynamicpruningexpression(ws_sold_date_sk#147 IN dynamicpruning#35)]
PushedFilters: [IsNotNull(ws_bill_customer_sk)]
ReadSchema: struct<ws_bill_customer_sk:int,ws_ext_discount_amt:decimal(7,2),ws_ext_sales_price:decimal(7,2),ws_ext_wholesale_cost:decimal(7,2),ws_ext_list_price:decimal(7,2)>

(102) ColumnarToRow [codegen id : 46]
Input [6]: [ws_bill_customer_sk#142, ws_ext_discount_amt#143, ws_ext_sales_price#144, ws_ext_wholesale_cost#145, ws_ext_list_price#146, ws_sold_date_sk#147]

(103) Filter [codegen id : 46]
Input [6]: [ws_bill_customer_sk#142, ws_ext_discount_amt#143, ws_ext_sales_price#144, ws_ext_wholesale_cost#145, ws_ext_list_price#146, ws_sold_date_sk#147]
Condition : isnotnull(ws_bill_customer_sk#142)

(104) ReusedExchange [Reuses operator id: 128]
Output [2]: [d_date_sk#148, d_year#149]

(105) BroadcastHashJoin [codegen id : 46]
Left keys [1]: [ws_sold_date_sk#147]
Right keys [1]: [d_date_sk#148]
Join condition: None

(106) Project [codegen id : 46]
Output [6]: [ws_bill_customer_sk#142, ws_ext_discount_amt#143, ws_ext_sales_price#144, ws_ext_wholesale_cost#145, ws_ext_list_price#146, d_year#149]
Input [8]: [ws_bill_customer_sk#142, ws_ext_discount_amt#143, ws_ext_sales_price#144, ws_ext_wholesale_cost#145, ws_ext_list_price#146, ws_sold_date_sk#147, d_date_sk#148, d_year#149]

(107) Exchange
Input [6]: [ws_bill_customer_sk#142, ws_ext_discount_amt#143, ws_ext_sales_price#144, ws_ext_wholesale_cost#145, ws_ext_list_price#146, d_year#149]
Arguments: hashpartitioning(ws_bill_customer_sk#142, 5), ENSURE_REQUIREMENTS, [id=#150]

(108) Sort [codegen id : 47]
Input [6]: [ws_bill_customer_sk#142, ws_ext_discount_amt#143, ws_ext_sales_price#144, ws_ext_wholesale_cost#145, ws_ext_list_price#146, d_year#149]
Arguments: [ws_bill_customer_sk#142 ASC NULLS FIRST], false, 0

(109) ReusedExchange [Reuses operator id: 12]
Output [8]: [c_customer_sk#151, c_customer_id#152, c_first_name#153, c_last_name#154, c_preferred_cust_flag#155, c_birth_country#156, c_login#157, c_email_address#158]

(110) Sort [codegen id : 49]
Input [8]: [c_customer_sk#151, c_customer_id#152, c_first_name#153, c_last_name#154, c_preferred_cust_flag#155, c_birth_country#156, c_login#157, c_email_address#158]
Arguments: [c_customer_sk#151 ASC NULLS FIRST], false, 0

(111) SortMergeJoin [codegen id : 50]
Left keys [1]: [ws_bill_customer_sk#142]
Right keys [1]: [c_customer_sk#151]
Join condition: None

(112) Project [codegen id : 50]
Output [12]: [c_customer_id#152, c_first_name#153, c_last_name#154, c_preferred_cust_flag#155, c_birth_country#156, c_login#157, c_email_address#158, ws_ext_discount_amt#143, ws_ext_sales_price#144, ws_ext_wholesale_cost#145, ws_ext_list_price#146, d_year#149]
Input [14]: [ws_bill_customer_sk#142, ws_ext_discount_amt#143, ws_ext_sales_price#144, ws_ext_wholesale_cost#145, ws_ext_list_price#146, d_year#149, c_customer_sk#151, c_customer_id#152, c_first_name#153, c_last_name#154, c_preferred_cust_flag#155, c_birth_country#156, c_login#157, c_email_address#158]

(113) HashAggregate [codegen id : 50]
Input [12]: [c_customer_id#152, c_first_name#153, c_last_name#154, c_preferred_cust_flag#155, c_birth_country#156, c_login#157, c_email_address#158, ws_ext_discount_amt#143, ws_ext_sales_price#144, ws_ext_wholesale_cost#145, ws_ext_list_price#146, d_year#149]
Keys [8]: [c_customer_id#152, c_first_name#153, c_last_name#154, c_preferred_cust_flag#155, c_birth_country#156, c_login#157, c_email_address#158, d_year#149]
Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#146 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#145 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#143 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#144 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#152, c_first_name#153, c_last_name#154, c_preferred_cust_flag#155, c_birth_country#156, c_login#157, c_email_address#158, d_year#149, sum#161, isEmpty#162]

(114) Exchange
Input [10]: [c_customer_id#152, c_first_name#153, c_last_name#154, c_preferred_cust_flag#155, c_birth_country#156, c_login#157, c_email_address#158, d_year#149, sum#161, isEmpty#162]
Arguments: hashpartitioning(c_customer_id#152, c_first_name#153, c_last_name#154, c_preferred_cust_flag#155, c_birth_country#156, c_login#157, c_email_address#158, d_year#149, 5), ENSURE_REQUIREMENTS, [id=#163]

(115) HashAggregate [codegen id : 51]
Input [10]: [c_customer_id#152, c_first_name#153, c_last_name#154, c_preferred_cust_flag#155, c_birth_country#156, c_login#157, c_email_address#158, d_year#149, sum#161, isEmpty#162]
Keys [8]: [c_customer_id#152, c_first_name#153, c_last_name#154, c_preferred_cust_flag#155, c_birth_country#156, c_login#157, c_email_address#158, d_year#149]
Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#146 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#145 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#143 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#144 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#146 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#145 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#143 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#144 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#136]
Results [2]: [c_customer_id#152 AS customer_id#164, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#146 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#145 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#143 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#144 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#136 AS year_total#165]

(116) Exchange
Input [2]: [customer_id#164, year_total#165]
Arguments: hashpartitioning(customer_id#164, 5), ENSURE_REQUIREMENTS, [id=#166]

(117) Sort [codegen id : 52]
Input [2]: [customer_id#164, year_total#165]
Arguments: [customer_id#164 ASC NULLS FIRST], false, 0

(118) SortMergeJoin [codegen id : 53]
Left keys [1]: [customer_id#26]
Right keys [1]: [customer_id#164]
Join condition: (CASE WHEN (year_total#87 > 0.000000) THEN CheckOverflow((promote_precision(year_total#112) / promote_precision(year_total#87)), DecimalType(38,14), true) ELSE null END > CASE WHEN (year_total#140 > 0.000000) THEN CheckOverflow((promote_precision(year_total#165) / promote_precision(year_total#140)), DecimalType(38,14), true) ELSE null END)

(119) Project [codegen id : 53]
Output [7]: [customer_id#52, customer_first_name#53, customer_last_name#54, customer_preferred_cust_flag#55, customer_birth_country#56, customer_login#57, customer_email_address#58]
Input [13]: [customer_id#26, customer_id#52, customer_first_name#53, customer_last_name#54, customer_preferred_cust_flag#55, customer_birth_country#56, customer_login#57, customer_email_address#58, year_total#87, year_total#112, year_total#140, customer_id#164, year_total#165]

(120) TakeOrderedAndProject
Input [7]: [customer_id#52, customer_first_name#53, customer_last_name#54, customer_preferred_cust_flag#55, customer_birth_country#56, customer_login#57, customer_email_address#58]
Arguments: 100, [customer_id#52 ASC NULLS FIRST, customer_first_name#53 ASC NULLS FIRST, customer_last_name#54 ASC NULLS FIRST, customer_preferred_cust_flag#55 ASC NULLS FIRST, customer_birth_country#56 ASC NULLS FIRST, customer_login#57 ASC NULLS FIRST, customer_email_address#58 ASC NULLS FIRST], [customer_id#52, customer_first_name#53, customer_last_name#54, customer_preferred_cust_flag#55, customer_birth_country#56, customer_login#57, customer_email_address#58]

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


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

(122) ColumnarToRow [codegen id : 1]
Input [2]: [d_date_sk#8, d_year#9]

(123) 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
Input [2]: [d_date_sk#8, d_year#9]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#167]

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)


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

(126) ColumnarToRow [codegen id : 1]
Input [2]: [d_date_sk#36, d_year#37]

(127) 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
Input [2]: [d_date_sk#36, d_year#37]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#168]

Subquery:3 Hosting operator id = 40 Hosting Expression = cs_sold_date_sk#66 IN dynamicpruning#7

Subquery:4 Hosting operator id = 61 Hosting Expression = cs_sold_date_sk#94 IN dynamicpruning#35

Subquery:5 Hosting operator id = 80 Hosting Expression = ws_sold_date_sk#119 IN dynamicpruning#7

Subquery:6 Hosting operator id = 101 Hosting Expression = ws_sold_date_sk#147 IN dynamicpruning#35


