== 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, [plan_id=1]

(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#10, c_customer_id#11, c_first_name#12, c_last_name#13, c_preferred_cust_flag#14, c_birth_country#15, c_login#16, c_email_address#17]
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#10, c_customer_id#11, c_first_name#12, c_last_name#13, c_preferred_cust_flag#14, c_birth_country#15, c_login#16, c_email_address#17]

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

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

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

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

(15) Project [codegen id : 6]
Output [12]: [c_customer_id#11, c_first_name#12, c_last_name#13, c_preferred_cust_flag#14, c_birth_country#15, c_login#16, c_email_address#17, 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#10, c_customer_id#11, c_first_name#12, c_last_name#13, c_preferred_cust_flag#14, c_birth_country#15, c_login#16, c_email_address#17]

(16) HashAggregate [codegen id : 6]
Input [12]: [c_customer_id#11, c_first_name#12, c_last_name#13, c_preferred_cust_flag#14, c_birth_country#15, c_login#16, c_email_address#17, 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#11, c_first_name#12, c_last_name#13, c_preferred_cust_flag#14, c_birth_country#15, c_login#16, c_email_address#17, 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#18, isEmpty#19]
Results [10]: [c_customer_id#11, c_first_name#12, c_last_name#13, c_preferred_cust_flag#14, c_birth_country#15, c_login#16, c_email_address#17, d_year#9, sum#20, isEmpty#21]

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

(18) HashAggregate [codegen id : 7]
Input [10]: [c_customer_id#11, c_first_name#12, c_last_name#13, c_preferred_cust_flag#14, c_birth_country#15, c_login#16, c_email_address#17, d_year#9, sum#20, isEmpty#21]
Keys [8]: [c_customer_id#11, c_first_name#12, c_last_name#13, c_preferred_cust_flag#14, c_birth_country#15, c_login#16, c_email_address#17, 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))#22]
Results [2]: [c_customer_id#11 AS customer_id#23, 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))#22 AS year_total#24]

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

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

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

(22) Scan parquet default.store_sales
Output [6]: [ss_customer_sk#25, ss_ext_discount_amt#26, ss_ext_sales_price#27, ss_ext_wholesale_cost#28, ss_ext_list_price#29, ss_sold_date_sk#30]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#30), dynamicpruningexpression(ss_sold_date_sk#30 IN dynamicpruning#31)]
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#25, ss_ext_discount_amt#26, ss_ext_sales_price#27, ss_ext_wholesale_cost#28, ss_ext_list_price#29, ss_sold_date_sk#30]

(24) Filter [codegen id : 10]
Input [6]: [ss_customer_sk#25, ss_ext_discount_amt#26, ss_ext_sales_price#27, ss_ext_wholesale_cost#28, ss_ext_list_price#29, ss_sold_date_sk#30]
Condition : isnotnull(ss_customer_sk#25)

(25) ReusedExchange [Reuses operator id: 128]
Output [2]: [d_date_sk#32, d_year#33]

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

(27) Project [codegen id : 10]
Output [6]: [ss_customer_sk#25, ss_ext_discount_amt#26, ss_ext_sales_price#27, ss_ext_wholesale_cost#28, ss_ext_list_price#29, d_year#33]
Input [8]: [ss_customer_sk#25, ss_ext_discount_amt#26, ss_ext_sales_price#27, ss_ext_wholesale_cost#28, ss_ext_list_price#29, ss_sold_date_sk#30, d_date_sk#32, d_year#33]

(28) Exchange
Input [6]: [ss_customer_sk#25, ss_ext_discount_amt#26, ss_ext_sales_price#27, ss_ext_wholesale_cost#28, ss_ext_list_price#29, d_year#33]
Arguments: hashpartitioning(ss_customer_sk#25, 5), ENSURE_REQUIREMENTS, [plan_id=5]

(29) Sort [codegen id : 11]
Input [6]: [ss_customer_sk#25, ss_ext_discount_amt#26, ss_ext_sales_price#27, ss_ext_wholesale_cost#28, ss_ext_list_price#29, d_year#33]
Arguments: [ss_customer_sk#25 ASC NULLS FIRST], false, 0

(30) ReusedExchange [Reuses operator id: 12]
Output [8]: [c_customer_sk#34, c_customer_id#35, c_first_name#36, c_last_name#37, c_preferred_cust_flag#38, c_birth_country#39, c_login#40, c_email_address#41]

(31) Sort [codegen id : 13]
Input [8]: [c_customer_sk#34, c_customer_id#35, c_first_name#36, c_last_name#37, c_preferred_cust_flag#38, c_birth_country#39, c_login#40, c_email_address#41]
Arguments: [c_customer_sk#34 ASC NULLS FIRST], false, 0

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

(33) Project [codegen id : 14]
Output [12]: [c_customer_id#35, c_first_name#36, c_last_name#37, c_preferred_cust_flag#38, c_birth_country#39, c_login#40, c_email_address#41, ss_ext_discount_amt#26, ss_ext_sales_price#27, ss_ext_wholesale_cost#28, ss_ext_list_price#29, d_year#33]
Input [14]: [ss_customer_sk#25, ss_ext_discount_amt#26, ss_ext_sales_price#27, ss_ext_wholesale_cost#28, ss_ext_list_price#29, d_year#33, c_customer_sk#34, c_customer_id#35, c_first_name#36, c_last_name#37, c_preferred_cust_flag#38, c_birth_country#39, c_login#40, c_email_address#41]

(34) HashAggregate [codegen id : 14]
Input [12]: [c_customer_id#35, c_first_name#36, c_last_name#37, c_preferred_cust_flag#38, c_birth_country#39, c_login#40, c_email_address#41, ss_ext_discount_amt#26, ss_ext_sales_price#27, ss_ext_wholesale_cost#28, ss_ext_list_price#29, d_year#33]
Keys [8]: [c_customer_id#35, c_first_name#36, c_last_name#37, c_preferred_cust_flag#38, c_birth_country#39, c_login#40, c_email_address#41, d_year#33]
Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ss_ext_list_price#29 as decimal(8,2))) - promote_precision(cast(ss_ext_wholesale_cost#28 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ss_ext_discount_amt#26 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ss_ext_sales_price#27 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))]
Aggregate Attributes [2]: [sum#42, isEmpty#43]
Results [10]: [c_customer_id#35, c_first_name#36, c_last_name#37, c_preferred_cust_flag#38, c_birth_country#39, c_login#40, c_email_address#41, d_year#33, sum#44, isEmpty#45]

(35) Exchange
Input [10]: [c_customer_id#35, c_first_name#36, c_last_name#37, c_preferred_cust_flag#38, c_birth_country#39, c_login#40, c_email_address#41, d_year#33, sum#44, isEmpty#45]
Arguments: hashpartitioning(c_customer_id#35, c_first_name#36, c_last_name#37, c_preferred_cust_flag#38, c_birth_country#39, c_login#40, c_email_address#41, d_year#33, 5), ENSURE_REQUIREMENTS, [plan_id=6]

(36) HashAggregate [codegen id : 15]
Input [10]: [c_customer_id#35, c_first_name#36, c_last_name#37, c_preferred_cust_flag#38, c_birth_country#39, c_login#40, c_email_address#41, d_year#33, sum#44, isEmpty#45]
Keys [8]: [c_customer_id#35, c_first_name#36, c_last_name#37, c_preferred_cust_flag#38, c_birth_country#39, c_login#40, c_email_address#41, d_year#33]
Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ss_ext_list_price#29 as decimal(8,2))) - promote_precision(cast(ss_ext_wholesale_cost#28 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ss_ext_discount_amt#26 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ss_ext_sales_price#27 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#29 as decimal(8,2))) - promote_precision(cast(ss_ext_wholesale_cost#28 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ss_ext_discount_amt#26 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ss_ext_sales_price#27 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#22]
Results [8]: [c_customer_id#35 AS customer_id#46, c_first_name#36 AS customer_first_name#47, c_last_name#37 AS customer_last_name#48, c_preferred_cust_flag#38 AS customer_preferred_cust_flag#49, c_birth_country#39 AS customer_birth_country#50, c_login#40 AS customer_login#51, c_email_address#41 AS customer_email_address#52, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ss_ext_list_price#29 as decimal(8,2))) - promote_precision(cast(ss_ext_wholesale_cost#28 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ss_ext_discount_amt#26 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ss_ext_sales_price#27 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#22 AS year_total#53]

(37) Exchange
Input [8]: [customer_id#46, customer_first_name#47, customer_last_name#48, customer_preferred_cust_flag#49, customer_birth_country#50, customer_login#51, customer_email_address#52, year_total#53]
Arguments: hashpartitioning(customer_id#46, 5), ENSURE_REQUIREMENTS, [plan_id=7]

(38) Sort [codegen id : 16]
Input [8]: [customer_id#46, customer_first_name#47, customer_last_name#48, customer_preferred_cust_flag#49, customer_birth_country#50, customer_login#51, customer_email_address#52, year_total#53]
Arguments: [customer_id#46 ASC NULLS FIRST], false, 0

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

(40) Scan parquet default.catalog_sales
Output [6]: [cs_bill_customer_sk#54, cs_ext_discount_amt#55, cs_ext_sales_price#56, cs_ext_wholesale_cost#57, cs_ext_list_price#58, cs_sold_date_sk#59]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(cs_sold_date_sk#59), dynamicpruningexpression(cs_sold_date_sk#59 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#54, cs_ext_discount_amt#55, cs_ext_sales_price#56, cs_ext_wholesale_cost#57, cs_ext_list_price#58, cs_sold_date_sk#59]

(42) Filter [codegen id : 19]
Input [6]: [cs_bill_customer_sk#54, cs_ext_discount_amt#55, cs_ext_sales_price#56, cs_ext_wholesale_cost#57, cs_ext_list_price#58, cs_sold_date_sk#59]
Condition : isnotnull(cs_bill_customer_sk#54)

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

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

(45) Project [codegen id : 19]
Output [6]: [cs_bill_customer_sk#54, cs_ext_discount_amt#55, cs_ext_sales_price#56, cs_ext_wholesale_cost#57, cs_ext_list_price#58, d_year#61]
Input [8]: [cs_bill_customer_sk#54, cs_ext_discount_amt#55, cs_ext_sales_price#56, cs_ext_wholesale_cost#57, cs_ext_list_price#58, cs_sold_date_sk#59, d_date_sk#60, d_year#61]

(46) Exchange
Input [6]: [cs_bill_customer_sk#54, cs_ext_discount_amt#55, cs_ext_sales_price#56, cs_ext_wholesale_cost#57, cs_ext_list_price#58, d_year#61]
Arguments: hashpartitioning(cs_bill_customer_sk#54, 5), ENSURE_REQUIREMENTS, [plan_id=8]

(47) Sort [codegen id : 20]
Input [6]: [cs_bill_customer_sk#54, cs_ext_discount_amt#55, cs_ext_sales_price#56, cs_ext_wholesale_cost#57, cs_ext_list_price#58, d_year#61]
Arguments: [cs_bill_customer_sk#54 ASC NULLS FIRST], false, 0

(48) ReusedExchange [Reuses operator id: 12]
Output [8]: [c_customer_sk#62, c_customer_id#63, c_first_name#64, c_last_name#65, c_preferred_cust_flag#66, c_birth_country#67, c_login#68, c_email_address#69]

(49) Sort [codegen id : 22]
Input [8]: [c_customer_sk#62, c_customer_id#63, c_first_name#64, c_last_name#65, c_preferred_cust_flag#66, c_birth_country#67, c_login#68, c_email_address#69]
Arguments: [c_customer_sk#62 ASC NULLS FIRST], false, 0

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

(51) Project [codegen id : 23]
Output [12]: [c_customer_id#63, c_first_name#64, c_last_name#65, c_preferred_cust_flag#66, c_birth_country#67, c_login#68, c_email_address#69, cs_ext_discount_amt#55, cs_ext_sales_price#56, cs_ext_wholesale_cost#57, cs_ext_list_price#58, d_year#61]
Input [14]: [cs_bill_customer_sk#54, cs_ext_discount_amt#55, cs_ext_sales_price#56, cs_ext_wholesale_cost#57, cs_ext_list_price#58, d_year#61, c_customer_sk#62, c_customer_id#63, c_first_name#64, c_last_name#65, c_preferred_cust_flag#66, c_birth_country#67, c_login#68, c_email_address#69]

(52) HashAggregate [codegen id : 23]
Input [12]: [c_customer_id#63, c_first_name#64, c_last_name#65, c_preferred_cust_flag#66, c_birth_country#67, c_login#68, c_email_address#69, cs_ext_discount_amt#55, cs_ext_sales_price#56, cs_ext_wholesale_cost#57, cs_ext_list_price#58, d_year#61]
Keys [8]: [c_customer_id#63, c_first_name#64, c_last_name#65, c_preferred_cust_flag#66, c_birth_country#67, c_login#68, c_email_address#69, d_year#61]
Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#58 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#57 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#55 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#56 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))]
Aggregate Attributes [2]: [sum#70, isEmpty#71]
Results [10]: [c_customer_id#63, c_first_name#64, c_last_name#65, c_preferred_cust_flag#66, c_birth_country#67, c_login#68, c_email_address#69, d_year#61, sum#72, isEmpty#73]

(53) Exchange
Input [10]: [c_customer_id#63, c_first_name#64, c_last_name#65, c_preferred_cust_flag#66, c_birth_country#67, c_login#68, c_email_address#69, d_year#61, sum#72, isEmpty#73]
Arguments: hashpartitioning(c_customer_id#63, c_first_name#64, c_last_name#65, c_preferred_cust_flag#66, c_birth_country#67, c_login#68, c_email_address#69, d_year#61, 5), ENSURE_REQUIREMENTS, [plan_id=9]

(54) HashAggregate [codegen id : 24]
Input [10]: [c_customer_id#63, c_first_name#64, c_last_name#65, c_preferred_cust_flag#66, c_birth_country#67, c_login#68, c_email_address#69, d_year#61, sum#72, isEmpty#73]
Keys [8]: [c_customer_id#63, c_first_name#64, c_last_name#65, c_preferred_cust_flag#66, c_birth_country#67, c_login#68, c_email_address#69, d_year#61]
Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#58 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#57 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#55 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#56 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#58 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#57 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#55 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#56 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#74]
Results [2]: [c_customer_id#63 AS customer_id#75, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#58 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#57 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#55 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#56 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#74 AS year_total#76]

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

(56) Project [codegen id : 24]
Output [2]: [customer_id#75 AS customer_id#77, year_total#76 AS year_total#78]
Input [2]: [customer_id#75, year_total#76]

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

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

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

(60) Project [codegen id : 26]
Output [11]: [customer_id#23, year_total#24, customer_id#46, customer_first_name#47, customer_last_name#48, customer_preferred_cust_flag#49, customer_birth_country#50, customer_login#51, customer_email_address#52, year_total#53, year_total#78]
Input [12]: [customer_id#23, year_total#24, customer_id#46, customer_first_name#47, customer_last_name#48, customer_preferred_cust_flag#49, customer_birth_country#50, customer_login#51, customer_email_address#52, year_total#53, customer_id#77, year_total#78]

(61) Scan parquet default.catalog_sales
Output [6]: [cs_bill_customer_sk#79, cs_ext_discount_amt#80, cs_ext_sales_price#81, cs_ext_wholesale_cost#82, cs_ext_list_price#83, cs_sold_date_sk#84]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(cs_sold_date_sk#84), dynamicpruningexpression(cs_sold_date_sk#84 IN dynamicpruning#31)]
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#79, cs_ext_discount_amt#80, cs_ext_sales_price#81, cs_ext_wholesale_cost#82, cs_ext_list_price#83, cs_sold_date_sk#84]

(63) Filter [codegen id : 28]
Input [6]: [cs_bill_customer_sk#79, cs_ext_discount_amt#80, cs_ext_sales_price#81, cs_ext_wholesale_cost#82, cs_ext_list_price#83, cs_sold_date_sk#84]
Condition : isnotnull(cs_bill_customer_sk#79)

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

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

(66) Project [codegen id : 28]
Output [6]: [cs_bill_customer_sk#79, cs_ext_discount_amt#80, cs_ext_sales_price#81, cs_ext_wholesale_cost#82, cs_ext_list_price#83, d_year#86]
Input [8]: [cs_bill_customer_sk#79, cs_ext_discount_amt#80, cs_ext_sales_price#81, cs_ext_wholesale_cost#82, cs_ext_list_price#83, cs_sold_date_sk#84, d_date_sk#85, d_year#86]

(67) Exchange
Input [6]: [cs_bill_customer_sk#79, cs_ext_discount_amt#80, cs_ext_sales_price#81, cs_ext_wholesale_cost#82, cs_ext_list_price#83, d_year#86]
Arguments: hashpartitioning(cs_bill_customer_sk#79, 5), ENSURE_REQUIREMENTS, [plan_id=11]

(68) Sort [codegen id : 29]
Input [6]: [cs_bill_customer_sk#79, cs_ext_discount_amt#80, cs_ext_sales_price#81, cs_ext_wholesale_cost#82, cs_ext_list_price#83, d_year#86]
Arguments: [cs_bill_customer_sk#79 ASC NULLS FIRST], false, 0

(69) ReusedExchange [Reuses operator id: 12]
Output [8]: [c_customer_sk#87, c_customer_id#88, c_first_name#89, c_last_name#90, c_preferred_cust_flag#91, c_birth_country#92, c_login#93, c_email_address#94]

(70) Sort [codegen id : 31]
Input [8]: [c_customer_sk#87, c_customer_id#88, c_first_name#89, c_last_name#90, c_preferred_cust_flag#91, c_birth_country#92, c_login#93, c_email_address#94]
Arguments: [c_customer_sk#87 ASC NULLS FIRST], false, 0

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

(72) Project [codegen id : 32]
Output [12]: [c_customer_id#88, c_first_name#89, c_last_name#90, c_preferred_cust_flag#91, c_birth_country#92, c_login#93, c_email_address#94, cs_ext_discount_amt#80, cs_ext_sales_price#81, cs_ext_wholesale_cost#82, cs_ext_list_price#83, d_year#86]
Input [14]: [cs_bill_customer_sk#79, cs_ext_discount_amt#80, cs_ext_sales_price#81, cs_ext_wholesale_cost#82, cs_ext_list_price#83, d_year#86, c_customer_sk#87, c_customer_id#88, c_first_name#89, c_last_name#90, c_preferred_cust_flag#91, c_birth_country#92, c_login#93, c_email_address#94]

(73) HashAggregate [codegen id : 32]
Input [12]: [c_customer_id#88, c_first_name#89, c_last_name#90, c_preferred_cust_flag#91, c_birth_country#92, c_login#93, c_email_address#94, cs_ext_discount_amt#80, cs_ext_sales_price#81, cs_ext_wholesale_cost#82, cs_ext_list_price#83, d_year#86]
Keys [8]: [c_customer_id#88, c_first_name#89, c_last_name#90, c_preferred_cust_flag#91, c_birth_country#92, c_login#93, c_email_address#94, d_year#86]
Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#83 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#82 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#80 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#81 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))]
Aggregate Attributes [2]: [sum#95, isEmpty#96]
Results [10]: [c_customer_id#88, c_first_name#89, c_last_name#90, c_preferred_cust_flag#91, c_birth_country#92, c_login#93, c_email_address#94, d_year#86, sum#97, isEmpty#98]

(74) Exchange
Input [10]: [c_customer_id#88, c_first_name#89, c_last_name#90, c_preferred_cust_flag#91, c_birth_country#92, c_login#93, c_email_address#94, d_year#86, sum#97, isEmpty#98]
Arguments: hashpartitioning(c_customer_id#88, c_first_name#89, c_last_name#90, c_preferred_cust_flag#91, c_birth_country#92, c_login#93, c_email_address#94, d_year#86, 5), ENSURE_REQUIREMENTS, [plan_id=12]

(75) HashAggregate [codegen id : 33]
Input [10]: [c_customer_id#88, c_first_name#89, c_last_name#90, c_preferred_cust_flag#91, c_birth_country#92, c_login#93, c_email_address#94, d_year#86, sum#97, isEmpty#98]
Keys [8]: [c_customer_id#88, c_first_name#89, c_last_name#90, c_preferred_cust_flag#91, c_birth_country#92, c_login#93, c_email_address#94, d_year#86]
Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#83 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#82 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#80 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#81 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#83 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#82 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#80 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#81 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#74]
Results [2]: [c_customer_id#88 AS customer_id#99, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(cs_ext_list_price#83 as decimal(8,2))) - promote_precision(cast(cs_ext_wholesale_cost#82 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(cs_ext_discount_amt#80 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(cs_ext_sales_price#81 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#74 AS year_total#100]

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

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

(78) SortMergeJoin [codegen id : 35]
Left keys [1]: [customer_id#23]
Right keys [1]: [customer_id#99]
Join condition: (CASE WHEN (year_total#78 > 0.000000) THEN CheckOverflow((promote_precision(year_total#100) / promote_precision(year_total#78)), DecimalType(38,14), true) END > CASE WHEN (year_total#24 > 0.000000) THEN CheckOverflow((promote_precision(year_total#53) / promote_precision(year_total#24)), DecimalType(38,14), true) END)

(79) Project [codegen id : 35]
Output [10]: [customer_id#23, customer_id#46, customer_first_name#47, customer_last_name#48, customer_preferred_cust_flag#49, customer_birth_country#50, customer_login#51, customer_email_address#52, year_total#78, year_total#100]
Input [13]: [customer_id#23, year_total#24, customer_id#46, customer_first_name#47, customer_last_name#48, customer_preferred_cust_flag#49, customer_birth_country#50, customer_login#51, customer_email_address#52, year_total#53, year_total#78, customer_id#99, year_total#100]

(80) Scan parquet default.web_sales
Output [6]: [ws_bill_customer_sk#101, ws_ext_discount_amt#102, ws_ext_sales_price#103, ws_ext_wholesale_cost#104, ws_ext_list_price#105, ws_sold_date_sk#106]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ws_sold_date_sk#106), dynamicpruningexpression(ws_sold_date_sk#106 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#101, ws_ext_discount_amt#102, ws_ext_sales_price#103, ws_ext_wholesale_cost#104, ws_ext_list_price#105, ws_sold_date_sk#106]

(82) Filter [codegen id : 37]
Input [6]: [ws_bill_customer_sk#101, ws_ext_discount_amt#102, ws_ext_sales_price#103, ws_ext_wholesale_cost#104, ws_ext_list_price#105, ws_sold_date_sk#106]
Condition : isnotnull(ws_bill_customer_sk#101)

(83) ReusedExchange [Reuses operator id: 124]
Output [2]: [d_date_sk#107, d_year#108]

(84) BroadcastHashJoin [codegen id : 37]
Left keys [1]: [ws_sold_date_sk#106]
Right keys [1]: [d_date_sk#107]
Join condition: None

(85) Project [codegen id : 37]
Output [6]: [ws_bill_customer_sk#101, ws_ext_discount_amt#102, ws_ext_sales_price#103, ws_ext_wholesale_cost#104, ws_ext_list_price#105, d_year#108]
Input [8]: [ws_bill_customer_sk#101, ws_ext_discount_amt#102, ws_ext_sales_price#103, ws_ext_wholesale_cost#104, ws_ext_list_price#105, ws_sold_date_sk#106, d_date_sk#107, d_year#108]

(86) Exchange
Input [6]: [ws_bill_customer_sk#101, ws_ext_discount_amt#102, ws_ext_sales_price#103, ws_ext_wholesale_cost#104, ws_ext_list_price#105, d_year#108]
Arguments: hashpartitioning(ws_bill_customer_sk#101, 5), ENSURE_REQUIREMENTS, [plan_id=14]

(87) Sort [codegen id : 38]
Input [6]: [ws_bill_customer_sk#101, ws_ext_discount_amt#102, ws_ext_sales_price#103, ws_ext_wholesale_cost#104, ws_ext_list_price#105, d_year#108]
Arguments: [ws_bill_customer_sk#101 ASC NULLS FIRST], false, 0

(88) ReusedExchange [Reuses operator id: 12]
Output [8]: [c_customer_sk#109, c_customer_id#110, c_first_name#111, c_last_name#112, c_preferred_cust_flag#113, c_birth_country#114, c_login#115, c_email_address#116]

(89) Sort [codegen id : 40]
Input [8]: [c_customer_sk#109, c_customer_id#110, c_first_name#111, c_last_name#112, c_preferred_cust_flag#113, c_birth_country#114, c_login#115, c_email_address#116]
Arguments: [c_customer_sk#109 ASC NULLS FIRST], false, 0

(90) SortMergeJoin [codegen id : 41]
Left keys [1]: [ws_bill_customer_sk#101]
Right keys [1]: [c_customer_sk#109]
Join condition: None

(91) Project [codegen id : 41]
Output [12]: [c_customer_id#110, c_first_name#111, c_last_name#112, c_preferred_cust_flag#113, c_birth_country#114, c_login#115, c_email_address#116, ws_ext_discount_amt#102, ws_ext_sales_price#103, ws_ext_wholesale_cost#104, ws_ext_list_price#105, d_year#108]
Input [14]: [ws_bill_customer_sk#101, ws_ext_discount_amt#102, ws_ext_sales_price#103, ws_ext_wholesale_cost#104, ws_ext_list_price#105, d_year#108, c_customer_sk#109, c_customer_id#110, c_first_name#111, c_last_name#112, c_preferred_cust_flag#113, c_birth_country#114, c_login#115, c_email_address#116]

(92) HashAggregate [codegen id : 41]
Input [12]: [c_customer_id#110, c_first_name#111, c_last_name#112, c_preferred_cust_flag#113, c_birth_country#114, c_login#115, c_email_address#116, ws_ext_discount_amt#102, ws_ext_sales_price#103, ws_ext_wholesale_cost#104, ws_ext_list_price#105, d_year#108]
Keys [8]: [c_customer_id#110, c_first_name#111, c_last_name#112, c_preferred_cust_flag#113, c_birth_country#114, c_login#115, c_email_address#116, d_year#108]
Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#105 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#104 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#102 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#103 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))]
Aggregate Attributes [2]: [sum#117, isEmpty#118]
Results [10]: [c_customer_id#110, c_first_name#111, c_last_name#112, c_preferred_cust_flag#113, c_birth_country#114, c_login#115, c_email_address#116, d_year#108, sum#119, isEmpty#120]

(93) Exchange
Input [10]: [c_customer_id#110, c_first_name#111, c_last_name#112, c_preferred_cust_flag#113, c_birth_country#114, c_login#115, c_email_address#116, d_year#108, sum#119, isEmpty#120]
Arguments: hashpartitioning(c_customer_id#110, c_first_name#111, c_last_name#112, c_preferred_cust_flag#113, c_birth_country#114, c_login#115, c_email_address#116, d_year#108, 5), ENSURE_REQUIREMENTS, [plan_id=15]

(94) HashAggregate [codegen id : 42]
Input [10]: [c_customer_id#110, c_first_name#111, c_last_name#112, c_preferred_cust_flag#113, c_birth_country#114, c_login#115, c_email_address#116, d_year#108, sum#119, isEmpty#120]
Keys [8]: [c_customer_id#110, c_first_name#111, c_last_name#112, c_preferred_cust_flag#113, c_birth_country#114, c_login#115, c_email_address#116, d_year#108]
Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#105 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#104 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#102 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#103 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#105 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#104 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#102 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#103 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#121]
Results [2]: [c_customer_id#110 AS customer_id#122, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#105 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#104 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#102 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#103 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#121 AS year_total#123]

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

(96) Project [codegen id : 42]
Output [2]: [customer_id#122 AS customer_id#124, year_total#123 AS year_total#125]
Input [2]: [customer_id#122, year_total#123]

(97) Exchange
Input [2]: [customer_id#124, year_total#125]
Arguments: hashpartitioning(customer_id#124, 5), ENSURE_REQUIREMENTS, [plan_id=16]

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

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

(100) Project [codegen id : 44]
Output [11]: [customer_id#23, customer_id#46, customer_first_name#47, customer_last_name#48, customer_preferred_cust_flag#49, customer_birth_country#50, customer_login#51, customer_email_address#52, year_total#78, year_total#100, year_total#125]
Input [12]: [customer_id#23, customer_id#46, customer_first_name#47, customer_last_name#48, customer_preferred_cust_flag#49, customer_birth_country#50, customer_login#51, customer_email_address#52, year_total#78, year_total#100, customer_id#124, year_total#125]

(101) Scan parquet default.web_sales
Output [6]: [ws_bill_customer_sk#126, ws_ext_discount_amt#127, ws_ext_sales_price#128, ws_ext_wholesale_cost#129, ws_ext_list_price#130, ws_sold_date_sk#131]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ws_sold_date_sk#131), dynamicpruningexpression(ws_sold_date_sk#131 IN dynamicpruning#31)]
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#126, ws_ext_discount_amt#127, ws_ext_sales_price#128, ws_ext_wholesale_cost#129, ws_ext_list_price#130, ws_sold_date_sk#131]

(103) Filter [codegen id : 46]
Input [6]: [ws_bill_customer_sk#126, ws_ext_discount_amt#127, ws_ext_sales_price#128, ws_ext_wholesale_cost#129, ws_ext_list_price#130, ws_sold_date_sk#131]
Condition : isnotnull(ws_bill_customer_sk#126)

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

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

(106) Project [codegen id : 46]
Output [6]: [ws_bill_customer_sk#126, ws_ext_discount_amt#127, ws_ext_sales_price#128, ws_ext_wholesale_cost#129, ws_ext_list_price#130, d_year#133]
Input [8]: [ws_bill_customer_sk#126, ws_ext_discount_amt#127, ws_ext_sales_price#128, ws_ext_wholesale_cost#129, ws_ext_list_price#130, ws_sold_date_sk#131, d_date_sk#132, d_year#133]

(107) Exchange
Input [6]: [ws_bill_customer_sk#126, ws_ext_discount_amt#127, ws_ext_sales_price#128, ws_ext_wholesale_cost#129, ws_ext_list_price#130, d_year#133]
Arguments: hashpartitioning(ws_bill_customer_sk#126, 5), ENSURE_REQUIREMENTS, [plan_id=17]

(108) Sort [codegen id : 47]
Input [6]: [ws_bill_customer_sk#126, ws_ext_discount_amt#127, ws_ext_sales_price#128, ws_ext_wholesale_cost#129, ws_ext_list_price#130, d_year#133]
Arguments: [ws_bill_customer_sk#126 ASC NULLS FIRST], false, 0

(109) ReusedExchange [Reuses operator id: 12]
Output [8]: [c_customer_sk#134, c_customer_id#135, c_first_name#136, c_last_name#137, c_preferred_cust_flag#138, c_birth_country#139, c_login#140, c_email_address#141]

(110) Sort [codegen id : 49]
Input [8]: [c_customer_sk#134, c_customer_id#135, c_first_name#136, c_last_name#137, c_preferred_cust_flag#138, c_birth_country#139, c_login#140, c_email_address#141]
Arguments: [c_customer_sk#134 ASC NULLS FIRST], false, 0

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

(112) Project [codegen id : 50]
Output [12]: [c_customer_id#135, c_first_name#136, c_last_name#137, c_preferred_cust_flag#138, c_birth_country#139, c_login#140, c_email_address#141, ws_ext_discount_amt#127, ws_ext_sales_price#128, ws_ext_wholesale_cost#129, ws_ext_list_price#130, d_year#133]
Input [14]: [ws_bill_customer_sk#126, ws_ext_discount_amt#127, ws_ext_sales_price#128, ws_ext_wholesale_cost#129, ws_ext_list_price#130, d_year#133, c_customer_sk#134, c_customer_id#135, c_first_name#136, c_last_name#137, c_preferred_cust_flag#138, c_birth_country#139, c_login#140, c_email_address#141]

(113) HashAggregate [codegen id : 50]
Input [12]: [c_customer_id#135, c_first_name#136, c_last_name#137, c_preferred_cust_flag#138, c_birth_country#139, c_login#140, c_email_address#141, ws_ext_discount_amt#127, ws_ext_sales_price#128, ws_ext_wholesale_cost#129, ws_ext_list_price#130, d_year#133]
Keys [8]: [c_customer_id#135, c_first_name#136, c_last_name#137, c_preferred_cust_flag#138, c_birth_country#139, c_login#140, c_email_address#141, d_year#133]
Functions [1]: [partial_sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#130 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#129 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#127 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#128 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))]
Aggregate Attributes [2]: [sum#142, isEmpty#143]
Results [10]: [c_customer_id#135, c_first_name#136, c_last_name#137, c_preferred_cust_flag#138, c_birth_country#139, c_login#140, c_email_address#141, d_year#133, sum#144, isEmpty#145]

(114) Exchange
Input [10]: [c_customer_id#135, c_first_name#136, c_last_name#137, c_preferred_cust_flag#138, c_birth_country#139, c_login#140, c_email_address#141, d_year#133, sum#144, isEmpty#145]
Arguments: hashpartitioning(c_customer_id#135, c_first_name#136, c_last_name#137, c_preferred_cust_flag#138, c_birth_country#139, c_login#140, c_email_address#141, d_year#133, 5), ENSURE_REQUIREMENTS, [plan_id=18]

(115) HashAggregate [codegen id : 51]
Input [10]: [c_customer_id#135, c_first_name#136, c_last_name#137, c_preferred_cust_flag#138, c_birth_country#139, c_login#140, c_email_address#141, d_year#133, sum#144, isEmpty#145]
Keys [8]: [c_customer_id#135, c_first_name#136, c_last_name#137, c_preferred_cust_flag#138, c_birth_country#139, c_login#140, c_email_address#141, d_year#133]
Functions [1]: [sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#130 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#129 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#127 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#128 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#130 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#129 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#127 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#128 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#121]
Results [2]: [c_customer_id#135 AS customer_id#146, sum(CheckOverflow((promote_precision(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(cast(ws_ext_list_price#130 as decimal(8,2))) - promote_precision(cast(ws_ext_wholesale_cost#129 as decimal(8,2)))), DecimalType(8,2), true) as decimal(9,2))) - promote_precision(cast(ws_ext_discount_amt#127 as decimal(9,2)))), DecimalType(9,2), true) as decimal(10,2))) + promote_precision(cast(ws_ext_sales_price#128 as decimal(10,2)))), DecimalType(10,2), true)) / 2.00), DecimalType(14,6), true))#121 AS year_total#147]

(116) Exchange
Input [2]: [customer_id#146, year_total#147]
Arguments: hashpartitioning(customer_id#146, 5), ENSURE_REQUIREMENTS, [plan_id=19]

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

(118) SortMergeJoin [codegen id : 53]
Left keys [1]: [customer_id#23]
Right keys [1]: [customer_id#146]
Join condition: (CASE WHEN (year_total#78 > 0.000000) THEN CheckOverflow((promote_precision(year_total#100) / promote_precision(year_total#78)), DecimalType(38,14), true) END > CASE WHEN (year_total#125 > 0.000000) THEN CheckOverflow((promote_precision(year_total#147) / promote_precision(year_total#125)), DecimalType(38,14), true) END)

(119) Project [codegen id : 53]
Output [7]: [customer_id#46, customer_first_name#47, customer_last_name#48, customer_preferred_cust_flag#49, customer_birth_country#50, customer_login#51, customer_email_address#52]
Input [13]: [customer_id#23, customer_id#46, customer_first_name#47, customer_last_name#48, customer_preferred_cust_flag#49, customer_birth_country#50, customer_login#51, customer_email_address#52, year_total#78, year_total#100, year_total#125, customer_id#146, year_total#147]

(120) TakeOrderedAndProject
Input [7]: [customer_id#46, customer_first_name#47, customer_last_name#48, customer_preferred_cust_flag#49, customer_birth_country#50, customer_login#51, customer_email_address#52]
Arguments: 100, [customer_id#46 ASC NULLS FIRST, customer_first_name#47 ASC NULLS FIRST, customer_last_name#48 ASC NULLS FIRST, customer_preferred_cust_flag#49 ASC NULLS FIRST, customer_birth_country#50 ASC NULLS FIRST, customer_login#51 ASC NULLS FIRST, customer_email_address#52 ASC NULLS FIRST], [customer_id#46, customer_first_name#47, customer_last_name#48, customer_preferred_cust_flag#49, customer_birth_country#50, customer_login#51, customer_email_address#52]

===== 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), [plan_id=20]

Subquery:2 Hosting operator id = 22 Hosting Expression = ss_sold_date_sk#30 IN dynamicpruning#31
BroadcastExchange (128)
+- * Filter (127)
   +- * ColumnarToRow (126)
      +- Scan parquet default.date_dim (125)


(125) Scan parquet default.date_dim
Output [2]: [d_date_sk#32, d_year#33]
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#32, d_year#33]

(127) Filter [codegen id : 1]
Input [2]: [d_date_sk#32, d_year#33]
Condition : ((isnotnull(d_year#33) AND (d_year#33 = 2002)) AND isnotnull(d_date_sk#32))

(128) BroadcastExchange
Input [2]: [d_date_sk#32, d_year#33]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=21]

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

Subquery:4 Hosting operator id = 61 Hosting Expression = cs_sold_date_sk#84 IN dynamicpruning#31

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

Subquery:6 Hosting operator id = 101 Hosting Expression = ws_sold_date_sk#131 IN dynamicpruning#31


