== Physical Plan ==
TakeOrderedAndProject (66)
+- * HashAggregate (65)
   +- Exchange (64)
      +- * HashAggregate (63)
         +- Union (62)
            :- * HashAggregate (51)
            :  +- Exchange (50)
            :     +- * HashAggregate (49)
            :        +- Union (48)
            :           :- * ColumnarToRow (22)
            :           :  +- CometProject (21)
            :           :     +- CometBroadcastHashJoin (20)
            :           :        :- CometHashAggregate (16)
            :           :        :  +- CometExchange (15)
            :           :        :     +- CometHashAggregate (14)
            :           :        :        +- CometProject (13)
            :           :        :           +- CometBroadcastHashJoin (12)
            :           :        :              :- CometProject (8)
            :           :        :              :  +- CometBroadcastHashJoin (7)
            :           :        :              :     :- CometFilter (2)
            :           :        :              :     :  +- CometNativeScan: `spark_catalog`.`default`.`store_sales` (1)
            :           :        :              :     +- CometBroadcastExchange (6)
            :           :        :              :        +- CometProject (5)
            :           :        :              :           +- CometFilter (4)
            :           :        :              :              +- CometNativeScan: `spark_catalog`.`default`.`date_dim` (3)
            :           :        :              +- CometBroadcastExchange (11)
            :           :        :                 +- CometFilter (10)
            :           :        :                    +- CometNativeScan: `spark_catalog`.`default`.`store` (9)
            :           :        +- CometBroadcastExchange (19)
            :           :           +- CometHashAggregate (18)
            :           :              +- ReusedExchange (17)
            :           :- * Project (41)
            :           :  +- * BroadcastNestedLoopJoin Inner BuildLeft (40)
            :           :     :- BroadcastExchange (31)
            :           :     :  +- * ColumnarToRow (30)
            :           :     :     +- CometHashAggregate (29)
            :           :     :        +- CometExchange (28)
            :           :     :           +- CometHashAggregate (27)
            :           :     :              +- CometProject (26)
            :           :     :                 +- CometBroadcastHashJoin (25)
            :           :     :                    :- CometNativeScan: `spark_catalog`.`default`.`catalog_sales` (23)
            :           :     :                    +- ReusedExchange (24)
            :           :     +- * ColumnarToRow (39)
            :           :        +- CometHashAggregate (38)
            :           :           +- CometExchange (37)
            :           :              +- CometHashAggregate (36)
            :           :                 +- CometProject (35)
            :           :                    +- CometBroadcastHashJoin (34)
            :           :                       :- CometNativeScan: `spark_catalog`.`default`.`catalog_returns` (32)
            :           :                       +- ReusedExchange (33)
            :           +- * ColumnarToRow (47)
            :              +- CometProject (46)
            :                 +- CometBroadcastHashJoin (45)
            :                    :- CometHashAggregate (43)
            :                    :  +- ReusedExchange (42)
            :                    +- ReusedExchange (44)
            :- * HashAggregate (56)
            :  +- Exchange (55)
            :     +- * HashAggregate (54)
            :        +- * HashAggregate (53)
            :           +- ReusedExchange (52)
            +- * HashAggregate (61)
               +- Exchange (60)
                  +- * HashAggregate (59)
                     +- * HashAggregate (58)
                        +- ReusedExchange (57)


(1) CometNativeScan: `spark_catalog`.`default`.`store_sales`
Output [4]: [ss_store_sk#1, ss_ext_sales_price#2, ss_net_profit#3, ss_sold_date_sk#4]
Arguments: [ss_store_sk#1, ss_ext_sales_price#2, ss_net_profit#3, ss_sold_date_sk#4]

(2) CometFilter
Input [4]: [ss_store_sk#1, ss_ext_sales_price#2, ss_net_profit#3, ss_sold_date_sk#4]
Condition : isnotnull(ss_store_sk#1)

(3) CometNativeScan: `spark_catalog`.`default`.`date_dim`
Output [2]: [d_date_sk#5, d_date#6]
Arguments: [d_date_sk#5, d_date#6]

(4) CometFilter
Input [2]: [d_date_sk#5, d_date#6]
Condition : (((isnotnull(d_date#6) AND (d_date#6 >= 1998-08-04)) AND (d_date#6 <= 1998-09-03)) AND isnotnull(d_date_sk#5))

(5) CometProject
Input [2]: [d_date_sk#5, d_date#6]
Arguments: [d_date_sk#5], [d_date_sk#5]

(6) CometBroadcastExchange
Input [1]: [d_date_sk#5]
Arguments: [d_date_sk#5]

(7) CometBroadcastHashJoin
Left output [4]: [ss_store_sk#1, ss_ext_sales_price#2, ss_net_profit#3, ss_sold_date_sk#4]
Right output [1]: [d_date_sk#5]
Arguments: [ss_sold_date_sk#4], [d_date_sk#5], Inner, BuildRight

(8) CometProject
Input [5]: [ss_store_sk#1, ss_ext_sales_price#2, ss_net_profit#3, ss_sold_date_sk#4, d_date_sk#5]
Arguments: [ss_store_sk#1, ss_ext_sales_price#2, ss_net_profit#3], [ss_store_sk#1, ss_ext_sales_price#2, ss_net_profit#3]

(9) CometNativeScan: `spark_catalog`.`default`.`store`
Output [1]: [s_store_sk#7]
Arguments: [s_store_sk#7]

(10) CometFilter
Input [1]: [s_store_sk#7]
Condition : isnotnull(s_store_sk#7)

(11) CometBroadcastExchange
Input [1]: [s_store_sk#7]
Arguments: [s_store_sk#7]

(12) CometBroadcastHashJoin
Left output [3]: [ss_store_sk#1, ss_ext_sales_price#2, ss_net_profit#3]
Right output [1]: [s_store_sk#7]
Arguments: [ss_store_sk#1], [s_store_sk#7], Inner, BuildRight

(13) CometProject
Input [4]: [ss_store_sk#1, ss_ext_sales_price#2, ss_net_profit#3, s_store_sk#7]
Arguments: [ss_ext_sales_price#2, ss_net_profit#3, s_store_sk#7], [ss_ext_sales_price#2, ss_net_profit#3, s_store_sk#7]

(14) CometHashAggregate
Input [3]: [ss_ext_sales_price#2, ss_net_profit#3, s_store_sk#7]
Keys [1]: [s_store_sk#7]
Functions [2]: [partial_sum(UnscaledValue(ss_ext_sales_price#2)), partial_sum(UnscaledValue(ss_net_profit#3))]

(15) CometExchange
Input [3]: [s_store_sk#7, sum#8, sum#9]
Arguments: hashpartitioning(s_store_sk#7, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=1]

(16) CometHashAggregate
Input [3]: [s_store_sk#7, sum#8, sum#9]
Keys [1]: [s_store_sk#7]
Functions [2]: [sum(UnscaledValue(ss_ext_sales_price#2)), sum(UnscaledValue(ss_net_profit#3))]

(17) ReusedExchange [Reuses operator id: 15]
Output [3]: [s_store_sk#10, sum#11, sum#12]

(18) CometHashAggregate
Input [3]: [s_store_sk#10, sum#11, sum#12]
Keys [1]: [s_store_sk#10]
Functions [2]: [sum(UnscaledValue(sr_return_amt#13)), sum(UnscaledValue(sr_net_loss#14))]

(19) CometBroadcastExchange
Input [3]: [s_store_sk#10, returns#15, profit_loss#16]
Arguments: [s_store_sk#10, returns#15, profit_loss#16]

(20) CometBroadcastHashJoin
Left output [3]: [s_store_sk#7, sales#17, profit#18]
Right output [3]: [s_store_sk#10, returns#15, profit_loss#16]
Arguments: [s_store_sk#7], [s_store_sk#10], LeftOuter, BuildRight

(21) CometProject
Input [6]: [s_store_sk#7, sales#17, profit#18, s_store_sk#10, returns#15, profit_loss#16]
Arguments: [channel#19, id#20, sales#17, returns#21, profit#22], [store channel AS channel#19, s_store_sk#7 AS id#20, sales#17, coalesce(returns#15, 0.00) AS returns#21, (profit#18 - coalesce(profit_loss#16, 0.00)) AS profit#22]

(22) ColumnarToRow [codegen id : 1]
Input [5]: [channel#19, id#20, sales#17, returns#21, profit#22]

(23) CometNativeScan: `spark_catalog`.`default`.`catalog_sales`
Output [4]: [cs_call_center_sk#23, cs_ext_sales_price#24, cs_net_profit#25, cs_sold_date_sk#26]
Arguments: [cs_call_center_sk#23, cs_ext_sales_price#24, cs_net_profit#25, cs_sold_date_sk#26]

(24) ReusedExchange [Reuses operator id: 6]
Output [1]: [d_date_sk#27]

(25) CometBroadcastHashJoin
Left output [4]: [cs_call_center_sk#23, cs_ext_sales_price#24, cs_net_profit#25, cs_sold_date_sk#26]
Right output [1]: [d_date_sk#27]
Arguments: [cs_sold_date_sk#26], [d_date_sk#27], Inner, BuildRight

(26) CometProject
Input [5]: [cs_call_center_sk#23, cs_ext_sales_price#24, cs_net_profit#25, cs_sold_date_sk#26, d_date_sk#27]
Arguments: [cs_call_center_sk#23, cs_ext_sales_price#24, cs_net_profit#25], [cs_call_center_sk#23, cs_ext_sales_price#24, cs_net_profit#25]

(27) CometHashAggregate
Input [3]: [cs_call_center_sk#23, cs_ext_sales_price#24, cs_net_profit#25]
Keys [1]: [cs_call_center_sk#23]
Functions [2]: [partial_sum(UnscaledValue(cs_ext_sales_price#24)), partial_sum(UnscaledValue(cs_net_profit#25))]

(28) CometExchange
Input [3]: [cs_call_center_sk#23, sum#28, sum#29]
Arguments: hashpartitioning(cs_call_center_sk#23, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=2]

(29) CometHashAggregate
Input [3]: [cs_call_center_sk#23, sum#28, sum#29]
Keys [1]: [cs_call_center_sk#23]
Functions [2]: [sum(UnscaledValue(cs_ext_sales_price#24)), sum(UnscaledValue(cs_net_profit#25))]

(30) ColumnarToRow [codegen id : 2]
Input [3]: [cs_call_center_sk#23, sales#30, profit#31]

(31) BroadcastExchange
Input [3]: [cs_call_center_sk#23, sales#30, profit#31]
Arguments: IdentityBroadcastMode, [plan_id=3]

(32) CometNativeScan: `spark_catalog`.`default`.`catalog_returns`
Output [3]: [cr_return_amount#32, cr_net_loss#33, cr_returned_date_sk#34]
Arguments: [cr_return_amount#32, cr_net_loss#33, cr_returned_date_sk#34]

(33) ReusedExchange [Reuses operator id: 6]
Output [1]: [d_date_sk#35]

(34) CometBroadcastHashJoin
Left output [3]: [cr_return_amount#32, cr_net_loss#33, cr_returned_date_sk#34]
Right output [1]: [d_date_sk#35]
Arguments: [cr_returned_date_sk#34], [d_date_sk#35], Inner, BuildRight

(35) CometProject
Input [4]: [cr_return_amount#32, cr_net_loss#33, cr_returned_date_sk#34, d_date_sk#35]
Arguments: [cr_return_amount#32, cr_net_loss#33], [cr_return_amount#32, cr_net_loss#33]

(36) CometHashAggregate
Input [2]: [cr_return_amount#32, cr_net_loss#33]
Keys: []
Functions [2]: [partial_sum(UnscaledValue(cr_return_amount#32)), partial_sum(UnscaledValue(cr_net_loss#33))]

(37) CometExchange
Input [2]: [sum#36, sum#37]
Arguments: SinglePartition, ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=4]

(38) CometHashAggregate
Input [2]: [sum#36, sum#37]
Keys: []
Functions [2]: [sum(UnscaledValue(cr_return_amount#32)), sum(UnscaledValue(cr_net_loss#33))]

(39) ColumnarToRow
Input [2]: [returns#38, profit_loss#39]

(40) BroadcastNestedLoopJoin [codegen id : 3]
Join type: Inner
Join condition: None

(41) Project [codegen id : 3]
Output [5]: [catalog channel AS channel#40, cs_call_center_sk#23 AS id#41, sales#30, returns#38, (profit#31 - profit_loss#39) AS profit#42]
Input [5]: [cs_call_center_sk#23, sales#30, profit#31, returns#38, profit_loss#39]

(42) ReusedExchange [Reuses operator id: 15]
Output [3]: [wp_web_page_sk#43, sum#44, sum#45]

(43) CometHashAggregate
Input [3]: [wp_web_page_sk#43, sum#44, sum#45]
Keys [1]: [wp_web_page_sk#43]
Functions [2]: [sum(UnscaledValue(ws_ext_sales_price#46)), sum(UnscaledValue(ws_net_profit#47))]

(44) ReusedExchange [Reuses operator id: 19]
Output [3]: [wp_web_page_sk#48, returns#49, profit_loss#50]

(45) CometBroadcastHashJoin
Left output [3]: [wp_web_page_sk#43, sales#51, profit#52]
Right output [3]: [wp_web_page_sk#48, returns#49, profit_loss#50]
Arguments: [wp_web_page_sk#43], [wp_web_page_sk#48], LeftOuter, BuildRight

(46) CometProject
Input [6]: [wp_web_page_sk#43, sales#51, profit#52, wp_web_page_sk#48, returns#49, profit_loss#50]
Arguments: [channel#53, id#54, sales#51, returns#55, profit#56], [web channel AS channel#53, wp_web_page_sk#43 AS id#54, sales#51, coalesce(returns#49, 0.00) AS returns#55, (profit#52 - coalesce(profit_loss#50, 0.00)) AS profit#56]

(47) ColumnarToRow [codegen id : 4]
Input [5]: [channel#53, id#54, sales#51, returns#55, profit#56]

(48) Union

(49) HashAggregate [codegen id : 5]
Input [5]: [channel#19, id#20, sales#17, returns#21, profit#22]
Keys [2]: [channel#19, id#20]
Functions [3]: [partial_sum(sales#17), partial_sum(returns#21), partial_sum(profit#22)]
Aggregate Attributes [6]: [sum#57, isEmpty#58, sum#59, isEmpty#60, sum#61, isEmpty#62]
Results [8]: [channel#19, id#20, sum#63, isEmpty#64, sum#65, isEmpty#66, sum#67, isEmpty#68]

(50) Exchange
Input [8]: [channel#19, id#20, sum#63, isEmpty#64, sum#65, isEmpty#66, sum#67, isEmpty#68]
Arguments: hashpartitioning(channel#19, id#20, 5), ENSURE_REQUIREMENTS, [plan_id=5]

(51) HashAggregate [codegen id : 6]
Input [8]: [channel#19, id#20, sum#63, isEmpty#64, sum#65, isEmpty#66, sum#67, isEmpty#68]
Keys [2]: [channel#19, id#20]
Functions [3]: [sum(sales#17), sum(returns#21), sum(profit#22)]
Aggregate Attributes [3]: [sum(sales#17)#69, sum(returns#21)#70, sum(profit#22)#71]
Results [5]: [channel#19, id#20, cast(sum(sales#17)#69 as decimal(37,2)) AS sales#72, cast(sum(returns#21)#70 as decimal(37,2)) AS returns#73, cast(sum(profit#22)#71 as decimal(38,2)) AS profit#74]

(52) ReusedExchange [Reuses operator id: 50]
Output [8]: [channel#19, id#20, sum#63, isEmpty#64, sum#65, isEmpty#66, sum#67, isEmpty#68]

(53) HashAggregate [codegen id : 12]
Input [8]: [channel#19, id#20, sum#63, isEmpty#64, sum#65, isEmpty#66, sum#67, isEmpty#68]
Keys [2]: [channel#19, id#20]
Functions [3]: [sum(sales#17), sum(returns#21), sum(profit#22)]
Aggregate Attributes [3]: [sum(sales#17)#69, sum(returns#21)#70, sum(profit#22)#71]
Results [4]: [channel#19, sum(sales#17)#69 AS sales#75, sum(returns#21)#70 AS returns#76, sum(profit#22)#71 AS profit#77]

(54) HashAggregate [codegen id : 12]
Input [4]: [channel#19, sales#75, returns#76, profit#77]
Keys [1]: [channel#19]
Functions [3]: [partial_sum(sales#75), partial_sum(returns#76), partial_sum(profit#77)]
Aggregate Attributes [6]: [sum#78, isEmpty#79, sum#80, isEmpty#81, sum#82, isEmpty#83]
Results [7]: [channel#19, sum#84, isEmpty#85, sum#86, isEmpty#87, sum#88, isEmpty#89]

(55) Exchange
Input [7]: [channel#19, sum#84, isEmpty#85, sum#86, isEmpty#87, sum#88, isEmpty#89]
Arguments: hashpartitioning(channel#19, 5), ENSURE_REQUIREMENTS, [plan_id=6]

(56) HashAggregate [codegen id : 13]
Input [7]: [channel#19, sum#84, isEmpty#85, sum#86, isEmpty#87, sum#88, isEmpty#89]
Keys [1]: [channel#19]
Functions [3]: [sum(sales#75), sum(returns#76), sum(profit#77)]
Aggregate Attributes [3]: [sum(sales#75)#90, sum(returns#76)#91, sum(profit#77)#92]
Results [5]: [channel#19, null AS id#93, sum(sales#75)#90 AS sales#94, sum(returns#76)#91 AS returns#95, sum(profit#77)#92 AS profit#96]

(57) ReusedExchange [Reuses operator id: 50]
Output [8]: [channel#19, id#20, sum#63, isEmpty#64, sum#65, isEmpty#66, sum#67, isEmpty#68]

(58) HashAggregate [codegen id : 19]
Input [8]: [channel#19, id#20, sum#63, isEmpty#64, sum#65, isEmpty#66, sum#67, isEmpty#68]
Keys [2]: [channel#19, id#20]
Functions [3]: [sum(sales#17), sum(returns#21), sum(profit#22)]
Aggregate Attributes [3]: [sum(sales#17)#69, sum(returns#21)#70, sum(profit#22)#71]
Results [3]: [sum(sales#17)#69 AS sales#97, sum(returns#21)#70 AS returns#98, sum(profit#22)#71 AS profit#99]

(59) HashAggregate [codegen id : 19]
Input [3]: [sales#97, returns#98, profit#99]
Keys: []
Functions [3]: [partial_sum(sales#97), partial_sum(returns#98), partial_sum(profit#99)]
Aggregate Attributes [6]: [sum#100, isEmpty#101, sum#102, isEmpty#103, sum#104, isEmpty#105]
Results [6]: [sum#106, isEmpty#107, sum#108, isEmpty#109, sum#110, isEmpty#111]

(60) Exchange
Input [6]: [sum#106, isEmpty#107, sum#108, isEmpty#109, sum#110, isEmpty#111]
Arguments: SinglePartition, ENSURE_REQUIREMENTS, [plan_id=7]

(61) HashAggregate [codegen id : 20]
Input [6]: [sum#106, isEmpty#107, sum#108, isEmpty#109, sum#110, isEmpty#111]
Keys: []
Functions [3]: [sum(sales#97), sum(returns#98), sum(profit#99)]
Aggregate Attributes [3]: [sum(sales#97)#112, sum(returns#98)#113, sum(profit#99)#114]
Results [5]: [null AS channel#115, null AS id#116, sum(sales#97)#112 AS sales#117, sum(returns#98)#113 AS returns#118, sum(profit#99)#114 AS profit#119]

(62) Union

(63) HashAggregate [codegen id : 21]
Input [5]: [channel#19, id#20, sales#72, returns#73, profit#74]
Keys [5]: [channel#19, id#20, sales#72, returns#73, profit#74]
Functions: []
Aggregate Attributes: []
Results [5]: [channel#19, id#20, sales#72, returns#73, profit#74]

(64) Exchange
Input [5]: [channel#19, id#20, sales#72, returns#73, profit#74]
Arguments: hashpartitioning(channel#19, id#20, sales#72, returns#73, profit#74, 5), ENSURE_REQUIREMENTS, [plan_id=8]

(65) HashAggregate [codegen id : 22]
Input [5]: [channel#19, id#20, sales#72, returns#73, profit#74]
Keys [5]: [channel#19, id#20, sales#72, returns#73, profit#74]
Functions: []
Aggregate Attributes: []
Results [5]: [channel#19, id#20, sales#72, returns#73, profit#74]

(66) TakeOrderedAndProject
Input [5]: [channel#19, id#20, sales#72, returns#73, profit#74]
Arguments: 100, [channel#19 ASC NULLS FIRST, id#20 ASC NULLS FIRST], [channel#19, id#20, sales#72, returns#73, profit#74]

