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


(1) Scan parquet default.customer
Output [4]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4]
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>

(2) ColumnarToRow [codegen id : 3]
Input [4]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4]

(3) Filter [codegen id : 3]
Input [4]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4]
Condition : (isnotnull(c_customer_sk#1) AND isnotnull(c_customer_id#2))

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

(5) ColumnarToRow [codegen id : 1]
Input [3]: [ss_sold_date_sk#5, ss_customer_sk#6, ss_net_paid#7]

(6) Filter [codegen id : 1]
Input [3]: [ss_sold_date_sk#5, ss_customer_sk#6, ss_net_paid#7]
Condition : (isnotnull(ss_customer_sk#6) AND isnotnull(ss_sold_date_sk#5))

(7) BroadcastExchange
Input [3]: [ss_sold_date_sk#5, ss_customer_sk#6, ss_net_paid#7]
Arguments: HashedRelationBroadcastMode(List(cast(input[1, int, false] as bigint)),false), [id=#8]

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

(9) Project [codegen id : 3]
Output [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, ss_sold_date_sk#5, ss_net_paid#7]
Input [7]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4, ss_sold_date_sk#5, ss_customer_sk#6, ss_net_paid#7]

(10) Scan parquet default.date_dim
Output [2]: [d_date_sk#9, d_year#10]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2001), In(d_year, [2001,2002]), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_year:int>

(11) ColumnarToRow [codegen id : 2]
Input [2]: [d_date_sk#9, d_year#10]

(12) Filter [codegen id : 2]
Input [2]: [d_date_sk#9, d_year#10]
Condition : (((isnotnull(d_year#10) AND (d_year#10 = 2001)) AND d_year#10 IN (2001,2002)) AND isnotnull(d_date_sk#9))

(13) BroadcastExchange
Input [2]: [d_date_sk#9, d_year#10]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#11]

(14) BroadcastHashJoin [codegen id : 3]
Left keys [1]: [ss_sold_date_sk#5]
Right keys [1]: [d_date_sk#9]
Join condition: None

(15) Project [codegen id : 3]
Output [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, ss_net_paid#7, d_year#10]
Input [7]: [c_customer_id#2, c_first_name#3, c_last_name#4, ss_sold_date_sk#5, ss_net_paid#7, d_date_sk#9, d_year#10]

(16) HashAggregate [codegen id : 3]
Input [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, ss_net_paid#7, d_year#10]
Keys [4]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10]
Functions [1]: [partial_sum(UnscaledValue(ss_net_paid#7))]
Aggregate Attributes [1]: [sum#12]
Results [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10, sum#13]

(17) Exchange
Input [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10, sum#13]
Arguments: hashpartitioning(c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10, 5), true, [id=#14]

(18) HashAggregate [codegen id : 16]
Input [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10, sum#13]
Keys [4]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10]
Functions [1]: [sum(UnscaledValue(ss_net_paid#7))]
Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_paid#7))#15]
Results [2]: [c_customer_id#2 AS customer_id#16, MakeDecimal(sum(UnscaledValue(ss_net_paid#7))#15,17,2) AS year_total#17]

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

(20) Scan parquet default.customer
Output [4]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4]
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>

(21) ColumnarToRow [codegen id : 6]
Input [4]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4]

(22) Filter [codegen id : 6]
Input [4]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4]
Condition : (isnotnull(c_customer_sk#1) AND isnotnull(c_customer_id#2))

(23) ReusedExchange [Reuses operator id: 7]
Output [3]: [ss_sold_date_sk#5, ss_customer_sk#6, ss_net_paid#7]

(24) BroadcastHashJoin [codegen id : 6]
Left keys [1]: [c_customer_sk#1]
Right keys [1]: [ss_customer_sk#6]
Join condition: None

(25) Project [codegen id : 6]
Output [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, ss_sold_date_sk#5, ss_net_paid#7]
Input [7]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4, ss_sold_date_sk#5, ss_customer_sk#6, ss_net_paid#7]

(26) Scan parquet default.date_dim
Output [2]: [d_date_sk#9, d_year#10]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2002), In(d_year, [2001,2002]), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_year:int>

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

(28) Filter [codegen id : 5]
Input [2]: [d_date_sk#9, d_year#10]
Condition : (((isnotnull(d_year#10) AND (d_year#10 = 2002)) AND d_year#10 IN (2001,2002)) AND isnotnull(d_date_sk#9))

(29) BroadcastExchange
Input [2]: [d_date_sk#9, d_year#10]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#18]

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

(31) Project [codegen id : 6]
Output [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, ss_net_paid#7, d_year#10]
Input [7]: [c_customer_id#2, c_first_name#3, c_last_name#4, ss_sold_date_sk#5, ss_net_paid#7, d_date_sk#9, d_year#10]

(32) HashAggregate [codegen id : 6]
Input [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, ss_net_paid#7, d_year#10]
Keys [4]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10]
Functions [1]: [partial_sum(UnscaledValue(ss_net_paid#7))]
Aggregate Attributes [1]: [sum#19]
Results [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10, sum#20]

(33) Exchange
Input [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10, sum#20]
Arguments: hashpartitioning(c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10, 5), true, [id=#21]

(34) HashAggregate [codegen id : 7]
Input [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10, sum#20]
Keys [4]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10]
Functions [1]: [sum(UnscaledValue(ss_net_paid#7))]
Aggregate Attributes [1]: [sum(UnscaledValue(ss_net_paid#7))#22]
Results [4]: [c_customer_id#2 AS customer_id#23, c_first_name#3 AS customer_first_name#24, c_last_name#4 AS customer_last_name#25, MakeDecimal(sum(UnscaledValue(ss_net_paid#7))#22,17,2) AS year_total#26]

(35) BroadcastExchange
Input [4]: [customer_id#23, customer_first_name#24, customer_last_name#25, year_total#26]
Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#27]

(36) BroadcastHashJoin [codegen id : 16]
Left keys [1]: [customer_id#16]
Right keys [1]: [customer_id#23]
Join condition: None

(37) Scan parquet default.customer
Output [4]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4]
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>

(38) ColumnarToRow [codegen id : 10]
Input [4]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4]

(39) Filter [codegen id : 10]
Input [4]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4]
Condition : (isnotnull(c_customer_sk#1) AND isnotnull(c_customer_id#2))

(40) Scan parquet default.web_sales
Output [3]: [ws_sold_date_sk#28, ws_bill_customer_sk#29, ws_net_paid#30]
Batched: true
Location [not included in comparison]/{warehouse_dir}/web_sales]
PushedFilters: [IsNotNull(ws_bill_customer_sk), IsNotNull(ws_sold_date_sk)]
ReadSchema: struct<ws_sold_date_sk:int,ws_bill_customer_sk:int,ws_net_paid:decimal(7,2)>

(41) ColumnarToRow [codegen id : 8]
Input [3]: [ws_sold_date_sk#28, ws_bill_customer_sk#29, ws_net_paid#30]

(42) Filter [codegen id : 8]
Input [3]: [ws_sold_date_sk#28, ws_bill_customer_sk#29, ws_net_paid#30]
Condition : (isnotnull(ws_bill_customer_sk#29) AND isnotnull(ws_sold_date_sk#28))

(43) BroadcastExchange
Input [3]: [ws_sold_date_sk#28, ws_bill_customer_sk#29, ws_net_paid#30]
Arguments: HashedRelationBroadcastMode(List(cast(input[1, int, false] as bigint)),false), [id=#31]

(44) BroadcastHashJoin [codegen id : 10]
Left keys [1]: [c_customer_sk#1]
Right keys [1]: [ws_bill_customer_sk#29]
Join condition: None

(45) Project [codegen id : 10]
Output [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, ws_sold_date_sk#28, ws_net_paid#30]
Input [7]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4, ws_sold_date_sk#28, ws_bill_customer_sk#29, ws_net_paid#30]

(46) ReusedExchange [Reuses operator id: 13]
Output [2]: [d_date_sk#9, d_year#10]

(47) BroadcastHashJoin [codegen id : 10]
Left keys [1]: [ws_sold_date_sk#28]
Right keys [1]: [d_date_sk#9]
Join condition: None

(48) Project [codegen id : 10]
Output [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, ws_net_paid#30, d_year#10]
Input [7]: [c_customer_id#2, c_first_name#3, c_last_name#4, ws_sold_date_sk#28, ws_net_paid#30, d_date_sk#9, d_year#10]

(49) HashAggregate [codegen id : 10]
Input [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, ws_net_paid#30, d_year#10]
Keys [4]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10]
Functions [1]: [partial_sum(UnscaledValue(ws_net_paid#30))]
Aggregate Attributes [1]: [sum#32]
Results [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10, sum#33]

(50) Exchange
Input [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10, sum#33]
Arguments: hashpartitioning(c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10, 5), true, [id=#34]

(51) HashAggregate [codegen id : 11]
Input [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10, sum#33]
Keys [4]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10]
Functions [1]: [sum(UnscaledValue(ws_net_paid#30))]
Aggregate Attributes [1]: [sum(UnscaledValue(ws_net_paid#30))#35]
Results [2]: [c_customer_id#2 AS customer_id#36, MakeDecimal(sum(UnscaledValue(ws_net_paid#30))#35,17,2) AS year_total#37]

(52) Filter [codegen id : 11]
Input [2]: [customer_id#36, year_total#37]
Condition : (isnotnull(year_total#37) AND (year_total#37 > 0.00))

(53) Project [codegen id : 11]
Output [2]: [customer_id#36 AS customer_id#38, year_total#37 AS year_total#39]
Input [2]: [customer_id#36, year_total#37]

(54) BroadcastExchange
Input [2]: [customer_id#38, year_total#39]
Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#40]

(55) BroadcastHashJoin [codegen id : 16]
Left keys [1]: [customer_id#16]
Right keys [1]: [customer_id#38]
Join condition: None

(56) Project [codegen id : 16]
Output [7]: [customer_id#16, year_total#17, customer_id#23, customer_first_name#24, customer_last_name#25, year_total#26, year_total#39]
Input [8]: [customer_id#16, year_total#17, customer_id#23, customer_first_name#24, customer_last_name#25, year_total#26, customer_id#38, year_total#39]

(57) Scan parquet default.customer
Output [4]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4]
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>

(58) ColumnarToRow [codegen id : 14]
Input [4]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4]

(59) Filter [codegen id : 14]
Input [4]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4]
Condition : (isnotnull(c_customer_sk#1) AND isnotnull(c_customer_id#2))

(60) ReusedExchange [Reuses operator id: 43]
Output [3]: [ws_sold_date_sk#28, ws_bill_customer_sk#29, ws_net_paid#30]

(61) BroadcastHashJoin [codegen id : 14]
Left keys [1]: [c_customer_sk#1]
Right keys [1]: [ws_bill_customer_sk#29]
Join condition: None

(62) Project [codegen id : 14]
Output [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, ws_sold_date_sk#28, ws_net_paid#30]
Input [7]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4, ws_sold_date_sk#28, ws_bill_customer_sk#29, ws_net_paid#30]

(63) ReusedExchange [Reuses operator id: 29]
Output [2]: [d_date_sk#9, d_year#10]

(64) BroadcastHashJoin [codegen id : 14]
Left keys [1]: [ws_sold_date_sk#28]
Right keys [1]: [d_date_sk#9]
Join condition: None

(65) Project [codegen id : 14]
Output [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, ws_net_paid#30, d_year#10]
Input [7]: [c_customer_id#2, c_first_name#3, c_last_name#4, ws_sold_date_sk#28, ws_net_paid#30, d_date_sk#9, d_year#10]

(66) HashAggregate [codegen id : 14]
Input [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, ws_net_paid#30, d_year#10]
Keys [4]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10]
Functions [1]: [partial_sum(UnscaledValue(ws_net_paid#30))]
Aggregate Attributes [1]: [sum#41]
Results [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10, sum#42]

(67) Exchange
Input [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10, sum#42]
Arguments: hashpartitioning(c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10, 5), true, [id=#43]

(68) HashAggregate [codegen id : 15]
Input [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10, sum#42]
Keys [4]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#10]
Functions [1]: [sum(UnscaledValue(ws_net_paid#30))]
Aggregate Attributes [1]: [sum(UnscaledValue(ws_net_paid#30))#44]
Results [2]: [c_customer_id#2 AS customer_id#45, MakeDecimal(sum(UnscaledValue(ws_net_paid#30))#44,17,2) AS year_total#46]

(69) BroadcastExchange
Input [2]: [customer_id#45, year_total#46]
Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [id=#47]

(70) BroadcastHashJoin [codegen id : 16]
Left keys [1]: [customer_id#16]
Right keys [1]: [customer_id#45]
Join condition: (CASE WHEN (year_total#39 > 0.00) THEN CheckOverflow((promote_precision(year_total#46) / promote_precision(year_total#39)), DecimalType(37,20), true) ELSE null END > CASE WHEN (year_total#17 > 0.00) THEN CheckOverflow((promote_precision(year_total#26) / promote_precision(year_total#17)), DecimalType(37,20), true) ELSE null END)

(71) Project [codegen id : 16]
Output [3]: [customer_id#23, customer_first_name#24, customer_last_name#25]
Input [9]: [customer_id#16, year_total#17, customer_id#23, customer_first_name#24, customer_last_name#25, year_total#26, year_total#39, customer_id#45, year_total#46]

(72) TakeOrderedAndProject
Input [3]: [customer_id#23, customer_first_name#24, customer_last_name#25]
Arguments: 100, [customer_first_name#24 ASC NULLS FIRST, customer_id#23 ASC NULLS FIRST, customer_last_name#25 ASC NULLS FIRST], [customer_id#23, customer_first_name#24, customer_last_name#25]

