== Physical Plan ==
* ColumnarToRow (44)
+- CometTakeOrderedAndProject (43)
   +- CometProject (42)
      +- CometBroadcastHashJoin (41)
         :- CometProject (37)
         :  +- CometBroadcastHashJoin (36)
         :     :- CometBroadcastHashJoin (31)
         :     :  :- CometFilter (16)
         :     :  :  +- CometHashAggregate (15)
         :     :  :     +- CometExchange (14)
         :     :  :        +- CometHashAggregate (13)
         :     :  :           +- CometProject (12)
         :     :  :              +- CometBroadcastHashJoin (11)
         :     :  :                 :- CometProject (7)
         :     :  :                 :  +- CometBroadcastHashJoin (6)
         :     :  :                 :     :- CometFilter (2)
         :     :  :                 :     :  +- CometNativeScan: `spark_catalog`.`default`.`customer` (1)
         :     :  :                 :     +- CometBroadcastExchange (5)
         :     :  :                 :        +- CometFilter (4)
         :     :  :                 :           +- CometNativeScan: `spark_catalog`.`default`.`store_sales` (3)
         :     :  :                 +- CometBroadcastExchange (10)
         :     :  :                    +- CometFilter (9)
         :     :  :                       +- CometNativeScan: `spark_catalog`.`default`.`date_dim` (8)
         :     :  +- CometBroadcastExchange (30)
         :     :     +- CometHashAggregate (29)
         :     :        +- CometExchange (28)
         :     :           +- CometHashAggregate (27)
         :     :              +- CometProject (26)
         :     :                 +- CometBroadcastHashJoin (25)
         :     :                    :- CometProject (21)
         :     :                    :  +- CometBroadcastHashJoin (20)
         :     :                    :     :- CometFilter (18)
         :     :                    :     :  +- CometNativeScan: `spark_catalog`.`default`.`customer` (17)
         :     :                    :     +- ReusedExchange (19)
         :     :                    +- CometBroadcastExchange (24)
         :     :                       +- CometFilter (23)
         :     :                          +- CometNativeScan: `spark_catalog`.`default`.`date_dim` (22)
         :     +- CometBroadcastExchange (35)
         :        +- CometFilter (34)
         :           +- CometHashAggregate (33)
         :              +- ReusedExchange (32)
         +- CometBroadcastExchange (40)
            +- CometHashAggregate (39)
               +- ReusedExchange (38)


(1) CometNativeScan: `spark_catalog`.`default`.`customer`
Output [4]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4]
Arguments: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4]

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

(3) CometNativeScan: `spark_catalog`.`default`.`store_sales`
Output [3]: [ss_customer_sk#5, ss_net_paid#6, ss_sold_date_sk#7]
Arguments: [ss_customer_sk#5, ss_net_paid#6, ss_sold_date_sk#7]

(4) CometFilter
Input [3]: [ss_customer_sk#5, ss_net_paid#6, ss_sold_date_sk#7]
Condition : isnotnull(ss_customer_sk#5)

(5) CometBroadcastExchange
Input [3]: [ss_customer_sk#5, ss_net_paid#6, ss_sold_date_sk#7]
Arguments: [ss_customer_sk#5, ss_net_paid#6, ss_sold_date_sk#7]

(6) CometBroadcastHashJoin
Left output [4]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4]
Right output [3]: [ss_customer_sk#5, ss_net_paid#6, ss_sold_date_sk#7]
Arguments: [c_customer_sk#1], [ss_customer_sk#5], Inner, BuildRight

(7) CometProject
Input [7]: [c_customer_sk#1, c_customer_id#2, c_first_name#3, c_last_name#4, ss_customer_sk#5, ss_net_paid#6, ss_sold_date_sk#7]
Arguments: [c_customer_id#2, c_first_name#3, c_last_name#4, ss_net_paid#6, ss_sold_date_sk#7], [c_customer_id#2, c_first_name#3, c_last_name#4, ss_net_paid#6, ss_sold_date_sk#7]

(8) CometNativeScan: `spark_catalog`.`default`.`date_dim`
Output [2]: [d_date_sk#8, d_year#9]
Arguments: [d_date_sk#8, d_year#9]

(9) CometFilter
Input [2]: [d_date_sk#8, d_year#9]
Condition : (((isnotnull(d_year#9) AND (d_year#9 = 2001)) AND d_year#9 IN (2001,2002)) AND isnotnull(d_date_sk#8))

(10) CometBroadcastExchange
Input [2]: [d_date_sk#8, d_year#9]
Arguments: [d_date_sk#8, d_year#9]

(11) CometBroadcastHashJoin
Left output [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, ss_net_paid#6, ss_sold_date_sk#7]
Right output [2]: [d_date_sk#8, d_year#9]
Arguments: [ss_sold_date_sk#7], [d_date_sk#8], Inner, BuildRight

(12) CometProject
Input [7]: [c_customer_id#2, c_first_name#3, c_last_name#4, ss_net_paid#6, ss_sold_date_sk#7, d_date_sk#8, d_year#9]
Arguments: [c_customer_id#2, c_first_name#3, c_last_name#4, ss_net_paid#6, d_year#9], [c_customer_id#2, c_first_name#3, c_last_name#4, ss_net_paid#6, d_year#9]

(13) CometHashAggregate
Input [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, ss_net_paid#6, d_year#9]
Keys [4]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#9]
Functions [1]: [partial_sum(UnscaledValue(ss_net_paid#6))]

(14) CometExchange
Input [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#9, sum#10]
Arguments: hashpartitioning(c_customer_id#2, c_first_name#3, c_last_name#4, d_year#9, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=1]

(15) CometHashAggregate
Input [5]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#9, sum#10]
Keys [4]: [c_customer_id#2, c_first_name#3, c_last_name#4, d_year#9]
Functions [1]: [sum(UnscaledValue(ss_net_paid#6))]

(16) CometFilter
Input [2]: [customer_id#11, year_total#12]
Condition : (isnotnull(year_total#12) AND (year_total#12 > 0.00))

(17) CometNativeScan: `spark_catalog`.`default`.`customer`
Output [4]: [c_customer_sk#13, c_customer_id#14, c_first_name#15, c_last_name#16]
Arguments: [c_customer_sk#13, c_customer_id#14, c_first_name#15, c_last_name#16]

(18) CometFilter
Input [4]: [c_customer_sk#13, c_customer_id#14, c_first_name#15, c_last_name#16]
Condition : (isnotnull(c_customer_sk#13) AND isnotnull(c_customer_id#14))

(19) ReusedExchange [Reuses operator id: 5]
Output [3]: [ss_customer_sk#17, ss_net_paid#18, ss_sold_date_sk#19]

(20) CometBroadcastHashJoin
Left output [4]: [c_customer_sk#13, c_customer_id#14, c_first_name#15, c_last_name#16]
Right output [3]: [ss_customer_sk#17, ss_net_paid#18, ss_sold_date_sk#19]
Arguments: [c_customer_sk#13], [ss_customer_sk#17], Inner, BuildRight

(21) CometProject
Input [7]: [c_customer_sk#13, c_customer_id#14, c_first_name#15, c_last_name#16, ss_customer_sk#17, ss_net_paid#18, ss_sold_date_sk#19]
Arguments: [c_customer_id#14, c_first_name#15, c_last_name#16, ss_net_paid#18, ss_sold_date_sk#19], [c_customer_id#14, c_first_name#15, c_last_name#16, ss_net_paid#18, ss_sold_date_sk#19]

(22) CometNativeScan: `spark_catalog`.`default`.`date_dim`
Output [2]: [d_date_sk#20, d_year#21]
Arguments: [d_date_sk#20, d_year#21]

(23) CometFilter
Input [2]: [d_date_sk#20, d_year#21]
Condition : (((isnotnull(d_year#21) AND (d_year#21 = 2002)) AND d_year#21 IN (2001,2002)) AND isnotnull(d_date_sk#20))

(24) CometBroadcastExchange
Input [2]: [d_date_sk#20, d_year#21]
Arguments: [d_date_sk#20, d_year#21]

(25) CometBroadcastHashJoin
Left output [5]: [c_customer_id#14, c_first_name#15, c_last_name#16, ss_net_paid#18, ss_sold_date_sk#19]
Right output [2]: [d_date_sk#20, d_year#21]
Arguments: [ss_sold_date_sk#19], [d_date_sk#20], Inner, BuildRight

(26) CometProject
Input [7]: [c_customer_id#14, c_first_name#15, c_last_name#16, ss_net_paid#18, ss_sold_date_sk#19, d_date_sk#20, d_year#21]
Arguments: [c_customer_id#14, c_first_name#15, c_last_name#16, ss_net_paid#18, d_year#21], [c_customer_id#14, c_first_name#15, c_last_name#16, ss_net_paid#18, d_year#21]

(27) CometHashAggregate
Input [5]: [c_customer_id#14, c_first_name#15, c_last_name#16, ss_net_paid#18, d_year#21]
Keys [4]: [c_customer_id#14, c_first_name#15, c_last_name#16, d_year#21]
Functions [1]: [partial_sum(UnscaledValue(ss_net_paid#18))]

(28) CometExchange
Input [5]: [c_customer_id#14, c_first_name#15, c_last_name#16, d_year#21, sum#22]
Arguments: hashpartitioning(c_customer_id#14, c_first_name#15, c_last_name#16, d_year#21, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=2]

(29) CometHashAggregate
Input [5]: [c_customer_id#14, c_first_name#15, c_last_name#16, d_year#21, sum#22]
Keys [4]: [c_customer_id#14, c_first_name#15, c_last_name#16, d_year#21]
Functions [1]: [sum(UnscaledValue(ss_net_paid#18))]

(30) CometBroadcastExchange
Input [4]: [customer_id#23, customer_first_name#24, customer_last_name#25, year_total#26]
Arguments: [customer_id#23, customer_first_name#24, customer_last_name#25, year_total#26]

(31) CometBroadcastHashJoin
Left output [2]: [customer_id#11, year_total#12]
Right output [4]: [customer_id#23, customer_first_name#24, customer_last_name#25, year_total#26]
Arguments: [customer_id#11], [customer_id#23], Inner, BuildRight

(32) ReusedExchange [Reuses operator id: 14]
Output [5]: [c_customer_id#27, c_first_name#28, c_last_name#29, d_year#30, sum#31]

(33) CometHashAggregate
Input [5]: [c_customer_id#27, c_first_name#28, c_last_name#29, d_year#30, sum#31]
Keys [4]: [c_customer_id#27, c_first_name#28, c_last_name#29, d_year#30]
Functions [1]: [sum(UnscaledValue(ws_net_paid#32))]

(34) CometFilter
Input [2]: [customer_id#33, year_total#34]
Condition : (isnotnull(year_total#34) AND (year_total#34 > 0.00))

(35) CometBroadcastExchange
Input [2]: [customer_id#33, year_total#34]
Arguments: [customer_id#33, year_total#34]

(36) CometBroadcastHashJoin
Left output [6]: [customer_id#11, year_total#12, customer_id#23, customer_first_name#24, customer_last_name#25, year_total#26]
Right output [2]: [customer_id#33, year_total#34]
Arguments: [customer_id#11], [customer_id#33], Inner, BuildRight

(37) CometProject
Input [8]: [customer_id#11, year_total#12, customer_id#23, customer_first_name#24, customer_last_name#25, year_total#26, customer_id#33, year_total#34]
Arguments: [customer_id#11, year_total#12, customer_id#23, customer_first_name#24, customer_last_name#25, year_total#26, year_total#34], [customer_id#11, year_total#12, customer_id#23, customer_first_name#24, customer_last_name#25, year_total#26, year_total#34]

(38) ReusedExchange [Reuses operator id: 28]
Output [5]: [c_customer_id#35, c_first_name#36, c_last_name#37, d_year#38, sum#39]

(39) CometHashAggregate
Input [5]: [c_customer_id#35, c_first_name#36, c_last_name#37, d_year#38, sum#39]
Keys [4]: [c_customer_id#35, c_first_name#36, c_last_name#37, d_year#38]
Functions [1]: [sum(UnscaledValue(ws_net_paid#40))]

(40) CometBroadcastExchange
Input [2]: [customer_id#41, year_total#42]
Arguments: [customer_id#41, year_total#42]

(41) CometBroadcastHashJoin
Left output [7]: [customer_id#11, year_total#12, customer_id#23, customer_first_name#24, customer_last_name#25, year_total#26, year_total#34]
Right output [2]: [customer_id#41, year_total#42]
Arguments: [customer_id#11], [customer_id#41], Inner, (CASE WHEN (year_total#34 > 0.00) THEN (year_total#42 / year_total#34) END > CASE WHEN (year_total#12 > 0.00) THEN (year_total#26 / year_total#12) END), BuildRight

(42) CometProject
Input [9]: [customer_id#11, year_total#12, customer_id#23, customer_first_name#24, customer_last_name#25, year_total#26, year_total#34, customer_id#41, year_total#42]
Arguments: [customer_id#23, customer_first_name#24, customer_last_name#25], [customer_id#23, customer_first_name#24, customer_last_name#25]

(43) CometTakeOrderedAndProject
Input [3]: [customer_id#23, customer_first_name#24, customer_last_name#25]
Arguments: TakeOrderedAndProject(limit=100, orderBy=[customer_id#23 ASC NULLS FIRST,customer_id#23 ASC NULLS FIRST,customer_id#23 ASC NULLS FIRST], output=[customer_id#23,customer_first_name#24,customer_last_name#25]), [customer_id#23, customer_first_name#24, customer_last_name#25], 100, [customer_id#23 ASC NULLS FIRST, customer_id#23 ASC NULLS FIRST, customer_id#23 ASC NULLS FIRST], [customer_id#23, customer_first_name#24, customer_last_name#25]

(44) ColumnarToRow [codegen id : 1]
Input [3]: [customer_id#23, customer_first_name#24, customer_last_name#25]

