== Physical Plan ==
TakeOrderedAndProject (41)
+- * Project (40)
   +- Window (39)
      +- * CometColumnarToRow (38)
         +- CometSort (37)
            +- CometExchange (36)
               +- CometHashAggregate (35)
                  +- CometColumnarExchange (34)
                     +- * HashAggregate (33)
                        +- Union (32)
                           :- * HashAggregate (17)
                           :  +- * CometColumnarToRow (16)
                           :     +- CometColumnarExchange (15)
                           :        +- * HashAggregate (14)
                           :           +- * Project (13)
                           :              +- * BroadcastHashJoin Inner BuildRight (12)
                           :                 :- * Project (6)
                           :                 :  +- * BroadcastHashJoin Inner BuildRight (5)
                           :                 :     :- * Filter (3)
                           :                 :     :  +- * ColumnarToRow (2)
                           :                 :     :     +- Scan parquet spark_catalog.default.web_sales (1)
                           :                 :     +- ReusedExchange (4)
                           :                 +- BroadcastExchange (11)
                           :                    +- * CometColumnarToRow (10)
                           :                       +- CometProject (9)
                           :                          +- CometFilter (8)
                           :                             +- CometNativeScan parquet spark_catalog.default.item (7)
                           :- * HashAggregate (24)
                           :  +- * CometColumnarToRow (23)
                           :     +- CometColumnarExchange (22)
                           :        +- * HashAggregate (21)
                           :           +- * HashAggregate (20)
                           :              +- * CometColumnarToRow (19)
                           :                 +- ReusedExchange (18)
                           +- * HashAggregate (31)
                              +- * CometColumnarToRow (30)
                                 +- CometColumnarExchange (29)
                                    +- * HashAggregate (28)
                                       +- * HashAggregate (27)
                                          +- * CometColumnarToRow (26)
                                             +- ReusedExchange (25)


(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) ColumnarToRow [codegen id : 3]
Input [3]: [ws_item_sk#1, ws_net_paid#2, ws_sold_date_sk#3]

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

(4) ReusedExchange [Reuses operator id: 46]
Output [1]: [d_date_sk#5]

(5) BroadcastHashJoin [codegen id : 3]
Left keys [1]: [ws_sold_date_sk#3]
Right keys [1]: [d_date_sk#5]
Join type: Inner
Join condition: None

(6) Project [codegen id : 3]
Output [2]: [ws_item_sk#1, ws_net_paid#2]
Input [4]: [ws_item_sk#1, ws_net_paid#2, ws_sold_date_sk#3, d_date_sk#5]

(7) CometNativeScan 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>

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

(9) CometProject
Input [3]: [i_item_sk#6, i_class#7, i_category#8]
Arguments: [i_item_sk#6, i_class#9, i_category#10], [i_item_sk#6, static_invoke(CharVarcharCodegenUtils.readSidePadding(i_class#7, 50)) AS i_class#9, static_invoke(CharVarcharCodegenUtils.readSidePadding(i_category#8, 50)) AS i_category#10]

(10) CometColumnarToRow [codegen id : 2]
Input [3]: [i_item_sk#6, i_class#9, i_category#10]

(11) BroadcastExchange
Input [3]: [i_item_sk#6, i_class#9, i_category#10]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [plan_id=1]

(12) BroadcastHashJoin [codegen id : 3]
Left keys [1]: [ws_item_sk#1]
Right keys [1]: [i_item_sk#6]
Join type: Inner
Join condition: None

(13) Project [codegen id : 3]
Output [3]: [ws_net_paid#2, i_class#9, i_category#10]
Input [5]: [ws_item_sk#1, ws_net_paid#2, i_item_sk#6, i_class#9, i_category#10]

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

(15) CometColumnarExchange
Input [3]: [i_category#10, i_class#9, sum#12]
Arguments: hashpartitioning(i_category#10, i_class#9, 5), ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=2]

(16) CometColumnarToRow [codegen id : 4]
Input [3]: [i_category#10, i_class#9, sum#12]

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

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

(19) CometColumnarToRow [codegen id : 8]
Input [3]: [i_category#20, i_class#21, sum#22]

(20) HashAggregate [codegen id : 8]
Input [3]: [i_category#20, i_class#21, sum#22]
Keys [2]: [i_category#20, i_class#21]
Functions [1]: [sum(UnscaledValue(ws_net_paid#23))]
Aggregate Attributes [1]: [sum(UnscaledValue(ws_net_paid#23))#13]
Results [2]: [MakeDecimal(sum(UnscaledValue(ws_net_paid#23))#13,17,2) AS total_sum#24, i_category#20]

(21) HashAggregate [codegen id : 8]
Input [2]: [total_sum#24, i_category#20]
Keys [1]: [i_category#20]
Functions [1]: [partial_sum(total_sum#24)]
Aggregate Attributes [2]: [sum#25, isEmpty#26]
Results [3]: [i_category#20, sum#27, isEmpty#28]

(22) CometColumnarExchange
Input [3]: [i_category#20, sum#27, isEmpty#28]
Arguments: hashpartitioning(i_category#20, 5), ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=3]

(23) CometColumnarToRow [codegen id : 9]
Input [3]: [i_category#20, sum#27, isEmpty#28]

(24) HashAggregate [codegen id : 9]
Input [3]: [i_category#20, sum#27, isEmpty#28]
Keys [1]: [i_category#20]
Functions [1]: [sum(total_sum#24)]
Aggregate Attributes [1]: [sum(total_sum#24)#29]
Results [6]: [sum(total_sum#24)#29 AS total_sum#30, i_category#20, null AS i_class#31, 0 AS g_category#32, 1 AS g_class#33, 1 AS lochierarchy#34]

(25) ReusedExchange [Reuses operator id: 15]
Output [3]: [i_category#35, i_class#36, sum#37]

(26) CometColumnarToRow [codegen id : 13]
Input [3]: [i_category#35, i_class#36, sum#37]

(27) HashAggregate [codegen id : 13]
Input [3]: [i_category#35, i_class#36, sum#37]
Keys [2]: [i_category#35, i_class#36]
Functions [1]: [sum(UnscaledValue(ws_net_paid#38))]
Aggregate Attributes [1]: [sum(UnscaledValue(ws_net_paid#38))#13]
Results [1]: [MakeDecimal(sum(UnscaledValue(ws_net_paid#38))#13,17,2) AS total_sum#39]

(28) HashAggregate [codegen id : 13]
Input [1]: [total_sum#39]
Keys: []
Functions [1]: [partial_sum(total_sum#39)]
Aggregate Attributes [2]: [sum#40, isEmpty#41]
Results [2]: [sum#42, isEmpty#43]

(29) CometColumnarExchange
Input [2]: [sum#42, isEmpty#43]
Arguments: SinglePartition, ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=4]

(30) CometColumnarToRow [codegen id : 14]
Input [2]: [sum#42, isEmpty#43]

(31) HashAggregate [codegen id : 14]
Input [2]: [sum#42, isEmpty#43]
Keys: []
Functions [1]: [sum(total_sum#39)]
Aggregate Attributes [1]: [sum(total_sum#39)#44]
Results [6]: [sum(total_sum#39)#44 AS total_sum#45, null AS i_category#46, null AS i_class#47, 1 AS g_category#48, 1 AS g_class#49, 2 AS lochierarchy#50]

(32) Union

(33) HashAggregate [codegen id : 15]
Input [6]: [total_sum#14, i_category#15, i_class#16, g_category#17, g_class#18, lochierarchy#19]
Keys [6]: [total_sum#14, i_category#15, i_class#16, g_category#17, g_class#18, lochierarchy#19]
Functions: []
Aggregate Attributes: []
Results [6]: [total_sum#14, i_category#15, i_class#16, g_category#17, g_class#18, lochierarchy#19]

(34) CometColumnarExchange
Input [6]: [total_sum#14, i_category#15, i_class#16, g_category#17, g_class#18, lochierarchy#19]
Arguments: hashpartitioning(total_sum#14, i_category#15, i_class#16, g_category#17, g_class#18, lochierarchy#19, 5), ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=5]

(35) CometHashAggregate
Input [6]: [total_sum#14, i_category#15, i_class#16, g_category#17, g_class#18, lochierarchy#19]
Keys [6]: [total_sum#14, i_category#15, i_class#16, g_category#17, g_class#18, lochierarchy#19]
Functions: []

(36) CometExchange
Input [5]: [total_sum#14, i_category#15, i_class#16, lochierarchy#19, _w0#51]
Arguments: hashpartitioning(lochierarchy#19, _w0#51, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=6]

(37) CometSort
Input [5]: [total_sum#14, i_category#15, i_class#16, lochierarchy#19, _w0#51]
Arguments: [total_sum#14, i_category#15, i_class#16, lochierarchy#19, _w0#51], [lochierarchy#19 ASC NULLS FIRST, _w0#51 ASC NULLS FIRST, total_sum#14 DESC NULLS LAST]

(38) CometColumnarToRow [codegen id : 16]
Input [5]: [total_sum#14, i_category#15, i_class#16, lochierarchy#19, _w0#51]

(39) Window
Input [5]: [total_sum#14, i_category#15, i_class#16, lochierarchy#19, _w0#51]
Arguments: [rank(total_sum#14) windowspecdefinition(lochierarchy#19, _w0#51, total_sum#14 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS rank_within_parent#52], [lochierarchy#19, _w0#51], [total_sum#14 DESC NULLS LAST]

(40) Project [codegen id : 17]
Output [5]: [total_sum#14, i_category#15, i_class#16, lochierarchy#19, rank_within_parent#52]
Input [6]: [total_sum#14, i_category#15, i_class#16, lochierarchy#19, _w0#51, rank_within_parent#52]

(41) TakeOrderedAndProject
Input [5]: [total_sum#14, i_category#15, i_class#16, lochierarchy#19, rank_within_parent#52]
Arguments: 100, [lochierarchy#19 DESC NULLS LAST, CASE WHEN (lochierarchy#19 = 0) THEN i_category#15 END ASC NULLS FIRST, rank_within_parent#52 ASC NULLS FIRST], [total_sum#14, i_category#15, i_class#16, lochierarchy#19, rank_within_parent#52]

===== Subqueries =====

Subquery:1 Hosting operator id = 1 Hosting Expression = ws_sold_date_sk#3 IN dynamicpruning#4
BroadcastExchange (46)
+- * CometColumnarToRow (45)
   +- CometProject (44)
      +- CometFilter (43)
         +- CometNativeScan parquet spark_catalog.default.date_dim (42)


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

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

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

(45) CometColumnarToRow [codegen id : 1]
Input [1]: [d_date_sk#5]

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


