== Physical Plan ==
TakeOrderedAndProject (36)
+- * Project (35)
   +- Window (34)
      +- * ColumnarToRow (33)
         +- CometSort (32)
            +- CometExchange (31)
               +- CometHashAggregate (30)
                  +- CometExchange (29)
                     +- CometHashAggregate (28)
                        +- CometUnion (27)
                           :- CometHashAggregate (16)
                           :  +- CometExchange (15)
                           :     +- CometHashAggregate (14)
                           :        +- CometProject (13)
                           :           +- CometBroadcastHashJoin (12)
                           :              :- CometProject (8)
                           :              :  +- CometBroadcastHashJoin (7)
                           :              :     :- CometFilter (2)
                           :              :     :  +- CometScan parquet spark_catalog.default.web_sales (1)
                           :              :     +- CometBroadcastExchange (6)
                           :              :        +- CometProject (5)
                           :              :           +- CometFilter (4)
                           :              :              +- CometScan parquet spark_catalog.default.date_dim (3)
                           :              +- CometBroadcastExchange (11)
                           :                 +- CometFilter (10)
                           :                    +- CometScan parquet spark_catalog.default.item (9)
                           :- CometHashAggregate (21)
                           :  +- CometExchange (20)
                           :     +- CometHashAggregate (19)
                           :        +- CometHashAggregate (18)
                           :           +- ReusedExchange (17)
                           +- CometHashAggregate (26)
                              +- CometExchange (25)
                                 +- CometHashAggregate (24)
                                    +- CometHashAggregate (23)
                                       +- ReusedExchange (22)


(1) CometScan parquet spark_catalog.default.web_sales
Output [3]: [ws_item_sk#1, ws_net_paid#2, ws_sold_date_sk#3]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ws_sold_date_sk#3)]
PushedFilters: [IsNotNull(ws_item_sk)]
ReadSchema: struct<ws_item_sk:int,ws_net_paid:decimal(7,2)>

(2) CometFilter
Input [3]: [ws_item_sk#1, ws_net_paid#2, ws_sold_date_sk#3]
Condition : isnotnull(ws_item_sk#1)

(3) CometScan parquet spark_catalog.default.date_dim
Output [2]: [d_date_sk#4, d_month_seq#5]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_month_seq), GreaterThanOrEqual(d_month_seq,1212), LessThanOrEqual(d_month_seq,1223), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_month_seq:int>

(4) CometFilter
Input [2]: [d_date_sk#4, d_month_seq#5]
Condition : (((isnotnull(d_month_seq#5) AND (d_month_seq#5 >= 1212)) AND (d_month_seq#5 <= 1223)) AND isnotnull(d_date_sk#4))

(5) CometProject
Input [2]: [d_date_sk#4, d_month_seq#5]
Arguments: [d_date_sk#4], [d_date_sk#4]

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

(7) CometBroadcastHashJoin
Left output [3]: [ws_item_sk#1, ws_net_paid#2, ws_sold_date_sk#3]
Right output [1]: [d_date_sk#4]
Arguments: [ws_sold_date_sk#3], [d_date_sk#4], Inner, BuildRight

(8) CometProject
Input [4]: [ws_item_sk#1, ws_net_paid#2, ws_sold_date_sk#3, d_date_sk#4]
Arguments: [ws_item_sk#1, ws_net_paid#2], [ws_item_sk#1, ws_net_paid#2]

(9) CometScan parquet spark_catalog.default.item
Output [3]: [i_item_sk#6, i_class#7, i_category#8]
Batched: true
Location [not included in comparison]/{warehouse_dir}/item]
PushedFilters: [IsNotNull(i_item_sk)]
ReadSchema: struct<i_item_sk:int,i_class:string,i_category:string>

(10) CometFilter
Input [3]: [i_item_sk#6, i_class#7, i_category#8]
Condition : isnotnull(i_item_sk#6)

(11) CometBroadcastExchange
Input [3]: [i_item_sk#6, i_class#7, i_category#8]
Arguments: [i_item_sk#6, i_class#7, i_category#8]

(12) CometBroadcastHashJoin
Left output [2]: [ws_item_sk#1, ws_net_paid#2]
Right output [3]: [i_item_sk#6, i_class#7, i_category#8]
Arguments: [ws_item_sk#1], [i_item_sk#6], Inner, BuildRight

(13) CometProject
Input [5]: [ws_item_sk#1, ws_net_paid#2, i_item_sk#6, i_class#7, i_category#8]
Arguments: [ws_net_paid#2, i_class#7, i_category#8], [ws_net_paid#2, i_class#7, i_category#8]

(14) CometHashAggregate
Input [3]: [ws_net_paid#2, i_class#7, i_category#8]
Keys [2]: [i_category#8, i_class#7]
Functions [1]: [partial_sum(UnscaledValue(ws_net_paid#2))]

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

(16) CometHashAggregate
Input [3]: [i_category#8, i_class#7, sum#9]
Keys [2]: [i_category#8, i_class#7]
Functions [1]: [sum(UnscaledValue(ws_net_paid#2))]

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

(18) CometHashAggregate
Input [3]: [i_category#10, i_class#11, sum#12]
Keys [2]: [i_category#10, i_class#11]
Functions [1]: [sum(UnscaledValue(ws_net_paid#13))]

(19) CometHashAggregate
Input [2]: [total_sum#14, i_category#10]
Keys [1]: [i_category#10]
Functions [1]: [partial_sum(total_sum#14)]

(20) CometExchange
Input [3]: [i_category#10, sum#15, isEmpty#16]
Arguments: hashpartitioning(i_category#10, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=2]

(21) CometHashAggregate
Input [3]: [i_category#10, sum#15, isEmpty#16]
Keys [1]: [i_category#10]
Functions [1]: [sum(total_sum#14)]

(22) ReusedExchange [Reuses operator id: 15]
Output [3]: [i_category#17, i_class#18, sum#19]

(23) CometHashAggregate
Input [3]: [i_category#17, i_class#18, sum#19]
Keys [2]: [i_category#17, i_class#18]
Functions [1]: [sum(UnscaledValue(ws_net_paid#20))]

(24) CometHashAggregate
Input [1]: [total_sum#21]
Keys: []
Functions [1]: [partial_sum(total_sum#21)]

(25) CometExchange
Input [2]: [sum#22, isEmpty#23]
Arguments: SinglePartition, ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=3]

(26) CometHashAggregate
Input [2]: [sum#22, isEmpty#23]
Keys: []
Functions [1]: [sum(total_sum#21)]

(27) CometUnion
Child 0 Input [6]: [total_sum#24, i_category#8, i_class#7, g_category#25, g_class#26, lochierarchy#27]
Child 1 Input [6]: [total_sum#28, i_category#10, i_class#29, g_category#30, g_class#31, lochierarchy#32]
Child 2 Input [6]: [total_sum#33, i_category#34, i_class#35, g_category#36, g_class#37, lochierarchy#38]

(28) CometHashAggregate
Input [6]: [total_sum#24, i_category#8, i_class#7, g_category#25, g_class#26, lochierarchy#27]
Keys [6]: [total_sum#24, i_category#8, i_class#7, g_category#25, g_class#26, lochierarchy#27]
Functions: []

(29) CometExchange
Input [6]: [total_sum#24, i_category#8, i_class#7, g_category#25, g_class#26, lochierarchy#27]
Arguments: hashpartitioning(total_sum#24, i_category#8, i_class#7, g_category#25, g_class#26, lochierarchy#27, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=4]

(30) CometHashAggregate
Input [6]: [total_sum#24, i_category#8, i_class#7, g_category#25, g_class#26, lochierarchy#27]
Keys [6]: [total_sum#24, i_category#8, i_class#7, g_category#25, g_class#26, lochierarchy#27]
Functions: []

(31) CometExchange
Input [5]: [total_sum#24, i_category#8, i_class#7, lochierarchy#27, _w0#39]
Arguments: hashpartitioning(lochierarchy#27, _w0#39, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=5]

(32) CometSort
Input [5]: [total_sum#24, i_category#8, i_class#7, lochierarchy#27, _w0#39]
Arguments: [total_sum#24, i_category#8, i_class#7, lochierarchy#27, _w0#39], [lochierarchy#27 ASC NULLS FIRST, _w0#39 ASC NULLS FIRST, total_sum#24 DESC NULLS LAST]

(33) ColumnarToRow [codegen id : 1]
Input [5]: [total_sum#24, i_category#8, i_class#7, lochierarchy#27, _w0#39]

(34) Window
Input [5]: [total_sum#24, i_category#8, i_class#7, lochierarchy#27, _w0#39]
Arguments: [rank(total_sum#24) windowspecdefinition(lochierarchy#27, _w0#39, total_sum#24 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS rank_within_parent#40], [lochierarchy#27, _w0#39], [total_sum#24 DESC NULLS LAST]

(35) Project [codegen id : 2]
Output [5]: [total_sum#24, i_category#8, i_class#7, lochierarchy#27, rank_within_parent#40]
Input [6]: [total_sum#24, i_category#8, i_class#7, lochierarchy#27, _w0#39, rank_within_parent#40]

(36) TakeOrderedAndProject
Input [5]: [total_sum#24, i_category#8, i_class#7, lochierarchy#27, rank_within_parent#40]
Arguments: 100, [lochierarchy#27 DESC NULLS LAST, CASE WHEN (lochierarchy#27 = 0) THEN i_category#8 END ASC NULLS FIRST, rank_within_parent#40 ASC NULLS FIRST], [total_sum#24, i_category#8, i_class#7, lochierarchy#27, rank_within_parent#40]

