== Physical Plan ==
TakeOrderedAndProject (46)
+- * Project (45)
   +- Window (44)
      +- * ColumnarToRow (43)
         +- CometSort (42)
            +- CometColumnarExchange (41)
               +- CometHashAggregate (40)
                  +- CometColumnarExchange (39)
                     +- RowToColumnar (38)
                        +- * HashAggregate (37)
                           +- Union (36)
                              :- * HashAggregate (19)
                              :  +- * ColumnarToRow (18)
                              :     +- CometColumnarExchange (17)
                              :        +- RowToColumnar (16)
                              :           +- * HashAggregate (15)
                              :              +- * ColumnarToRow (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)
                              :- * HashAggregate (27)
                              :  +- * ColumnarToRow (26)
                              :     +- CometColumnarExchange (25)
                              :        +- RowToColumnar (24)
                              :           +- * HashAggregate (23)
                              :              +- * HashAggregate (22)
                              :                 +- * ColumnarToRow (21)
                              :                    +- ReusedExchange (20)
                              +- * HashAggregate (35)
                                 +- * ColumnarToRow (34)
                                    +- CometColumnarExchange (33)
                                       +- RowToColumnar (32)
                                          +- * HashAggregate (31)
                                             +- * HashAggregate (30)
                                                +- * ColumnarToRow (29)
                                                   +- ReusedExchange (28)


(1) Scan 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), dynamicpruningexpression(ws_sold_date_sk#3 IN dynamicpruning#4)]
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) Scan parquet spark_catalog.default.date_dim
Output [2]: [d_date_sk#5, d_month_seq#6]
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#5, d_month_seq#6]
Condition : (((isnotnull(d_month_seq#6) AND (d_month_seq#6 >= 1212)) AND (d_month_seq#6 <= 1223)) AND isnotnull(d_date_sk#5))

(5) CometProject
Input [2]: [d_date_sk#5, d_month_seq#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 [3]: [ws_item_sk#1, ws_net_paid#2, ws_sold_date_sk#3]
Right output [1]: [d_date_sk#5]
Arguments: [ws_sold_date_sk#3], [d_date_sk#5], Inner, BuildRight

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

(9) Scan parquet spark_catalog.default.item
Output [3]: [i_item_sk#7, i_class#8, i_category#9]
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#7, i_class#8, i_category#9]
Condition : isnotnull(i_item_sk#7)

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

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

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

(14) ColumnarToRow [codegen id : 1]
Input [3]: [ws_net_paid#2, i_class#8, i_category#9]

(15) HashAggregate [codegen id : 1]
Input [3]: [ws_net_paid#2, i_class#8, i_category#9]
Keys [2]: [i_category#9, i_class#8]
Functions [1]: [partial_sum(UnscaledValue(ws_net_paid#2))]
Aggregate Attributes [1]: [sum#10]
Results [3]: [i_category#9, i_class#8, sum#11]

(16) RowToColumnar
Input [3]: [i_category#9, i_class#8, sum#11]

(17) CometColumnarExchange
Input [3]: [i_category#9, i_class#8, sum#11]
Arguments: hashpartitioning(i_category#9, i_class#8, 5), ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=1]

(18) ColumnarToRow [codegen id : 2]
Input [3]: [i_category#9, i_class#8, sum#11]

(19) HashAggregate [codegen id : 2]
Input [3]: [i_category#9, i_class#8, sum#11]
Keys [2]: [i_category#9, i_class#8]
Functions [1]: [sum(UnscaledValue(ws_net_paid#2))]
Aggregate Attributes [1]: [sum(UnscaledValue(ws_net_paid#2))#12]
Results [6]: [cast(MakeDecimal(sum(UnscaledValue(ws_net_paid#2))#12,17,2) as decimal(27,2)) AS total_sum#13, i_category#9, i_class#8, 0 AS g_category#14, 0 AS g_class#15, 0 AS lochierarchy#16]

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

(21) ColumnarToRow [codegen id : 4]
Input [3]: [i_category#17, i_class#18, sum#19]

(22) HashAggregate [codegen id : 4]
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))]
Aggregate Attributes [1]: [sum(UnscaledValue(ws_net_paid#20))#12]
Results [2]: [MakeDecimal(sum(UnscaledValue(ws_net_paid#20))#12,17,2) AS total_sum#21, i_category#17]

(23) HashAggregate [codegen id : 4]
Input [2]: [total_sum#21, i_category#17]
Keys [1]: [i_category#17]
Functions [1]: [partial_sum(total_sum#21)]
Aggregate Attributes [2]: [sum#22, isEmpty#23]
Results [3]: [i_category#17, sum#24, isEmpty#25]

(24) RowToColumnar
Input [3]: [i_category#17, sum#24, isEmpty#25]

(25) CometColumnarExchange
Input [3]: [i_category#17, sum#24, isEmpty#25]
Arguments: hashpartitioning(i_category#17, 5), ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=2]

(26) ColumnarToRow [codegen id : 5]
Input [3]: [i_category#17, sum#24, isEmpty#25]

(27) HashAggregate [codegen id : 5]
Input [3]: [i_category#17, sum#24, isEmpty#25]
Keys [1]: [i_category#17]
Functions [1]: [sum(total_sum#21)]
Aggregate Attributes [1]: [sum(total_sum#21)#26]
Results [6]: [sum(total_sum#21)#26 AS total_sum#27, i_category#17, null AS i_class#28, 0 AS g_category#29, 1 AS g_class#30, 1 AS lochierarchy#31]

(28) ReusedExchange [Reuses operator id: 17]
Output [3]: [i_category#32, i_class#33, sum#34]

(29) ColumnarToRow [codegen id : 7]
Input [3]: [i_category#32, i_class#33, sum#34]

(30) HashAggregate [codegen id : 7]
Input [3]: [i_category#32, i_class#33, sum#34]
Keys [2]: [i_category#32, i_class#33]
Functions [1]: [sum(UnscaledValue(ws_net_paid#35))]
Aggregate Attributes [1]: [sum(UnscaledValue(ws_net_paid#35))#12]
Results [1]: [MakeDecimal(sum(UnscaledValue(ws_net_paid#35))#12,17,2) AS total_sum#36]

(31) HashAggregate [codegen id : 7]
Input [1]: [total_sum#36]
Keys: []
Functions [1]: [partial_sum(total_sum#36)]
Aggregate Attributes [2]: [sum#37, isEmpty#38]
Results [2]: [sum#39, isEmpty#40]

(32) RowToColumnar
Input [2]: [sum#39, isEmpty#40]

(33) CometColumnarExchange
Input [2]: [sum#39, isEmpty#40]
Arguments: SinglePartition, ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=3]

(34) ColumnarToRow [codegen id : 8]
Input [2]: [sum#39, isEmpty#40]

(35) HashAggregate [codegen id : 8]
Input [2]: [sum#39, isEmpty#40]
Keys: []
Functions [1]: [sum(total_sum#36)]
Aggregate Attributes [1]: [sum(total_sum#36)#41]
Results [6]: [sum(total_sum#36)#41 AS total_sum#42, null AS i_category#43, null AS i_class#44, 1 AS g_category#45, 1 AS g_class#46, 2 AS lochierarchy#47]

(36) Union

(37) HashAggregate [codegen id : 9]
Input [6]: [total_sum#13, i_category#9, i_class#8, g_category#14, g_class#15, lochierarchy#16]
Keys [6]: [total_sum#13, i_category#9, i_class#8, g_category#14, g_class#15, lochierarchy#16]
Functions: []
Aggregate Attributes: []
Results [6]: [total_sum#13, i_category#9, i_class#8, g_category#14, g_class#15, lochierarchy#16]

(38) RowToColumnar
Input [6]: [total_sum#13, i_category#9, i_class#8, g_category#14, g_class#15, lochierarchy#16]

(39) CometColumnarExchange
Input [6]: [total_sum#13, i_category#9, i_class#8, g_category#14, g_class#15, lochierarchy#16]
Arguments: hashpartitioning(total_sum#13, i_category#9, i_class#8, g_category#14, g_class#15, lochierarchy#16, 5), ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=4]

(40) CometHashAggregate
Input [6]: [total_sum#13, i_category#9, i_class#8, g_category#14, g_class#15, lochierarchy#16]
Keys [6]: [total_sum#13, i_category#9, i_class#8, g_category#14, g_class#15, lochierarchy#16]
Functions: []

(41) CometColumnarExchange
Input [5]: [total_sum#13, i_category#9, i_class#8, lochierarchy#16, _w0#48]
Arguments: hashpartitioning(lochierarchy#16, _w0#48, 5), ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=5]

(42) CometSort
Input [5]: [total_sum#13, i_category#9, i_class#8, lochierarchy#16, _w0#48]
Arguments: [total_sum#13, i_category#9, i_class#8, lochierarchy#16, _w0#48], [lochierarchy#16 ASC NULLS FIRST, _w0#48 ASC NULLS FIRST, total_sum#13 DESC NULLS LAST]

(43) ColumnarToRow [codegen id : 10]
Input [5]: [total_sum#13, i_category#9, i_class#8, lochierarchy#16, _w0#48]

(44) Window
Input [5]: [total_sum#13, i_category#9, i_class#8, lochierarchy#16, _w0#48]
Arguments: [rank(total_sum#13) windowspecdefinition(lochierarchy#16, _w0#48, total_sum#13 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS rank_within_parent#49], [lochierarchy#16, _w0#48], [total_sum#13 DESC NULLS LAST]

(45) Project [codegen id : 11]
Output [5]: [total_sum#13, i_category#9, i_class#8, lochierarchy#16, rank_within_parent#49]
Input [6]: [total_sum#13, i_category#9, i_class#8, lochierarchy#16, _w0#48, rank_within_parent#49]

(46) TakeOrderedAndProject
Input [5]: [total_sum#13, i_category#9, i_class#8, lochierarchy#16, rank_within_parent#49]
Arguments: 100, [lochierarchy#16 DESC NULLS LAST, CASE WHEN (lochierarchy#16 = 0) THEN i_category#9 END ASC NULLS FIRST, rank_within_parent#49 ASC NULLS FIRST], [total_sum#13, i_category#9, i_class#8, lochierarchy#16, rank_within_parent#49]

===== Subqueries =====

Subquery:1 Hosting operator id = 1 Hosting Expression = ws_sold_date_sk#3 IN dynamicpruning#4
BroadcastExchange (51)
+- * ColumnarToRow (50)
   +- CometProject (49)
      +- CometFilter (48)
         +- CometScan parquet spark_catalog.default.date_dim (47)


(47) Scan parquet spark_catalog.default.date_dim
Output [2]: [d_date_sk#5, d_month_seq#6]
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>

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

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

(50) ColumnarToRow [codegen id : 1]
Input [1]: [d_date_sk#5]

(51) BroadcastExchange
Input [1]: [d_date_sk#5]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [plan_id=6]


