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


(1) CometScan [native_iceberg_compat] 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) CometScan [native_iceberg_compat] 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) CometScan [native_iceberg_compat] 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) CometProject
Input [3]: [i_item_sk#7, i_class#8, i_category#9]
Arguments: [i_item_sk#7, i_class#10, i_category#11], [i_item_sk#7, static_invoke(CharVarcharCodegenUtils.readSidePadding(i_class#8, 50)) AS i_class#10, static_invoke(CharVarcharCodegenUtils.readSidePadding(i_category#9, 50)) AS i_category#11]

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

(13) CometBroadcastHashJoin
Left output [2]: [ws_item_sk#1, ws_net_paid#2]
Right output [3]: [i_item_sk#7, i_class#10, i_category#11]
Arguments: [ws_item_sk#1], [i_item_sk#7], Inner, BuildRight

(14) CometProject
Input [5]: [ws_item_sk#1, ws_net_paid#2, i_item_sk#7, i_class#10, i_category#11]
Arguments: [ws_net_paid#2, i_class#10, i_category#11], [ws_net_paid#2, i_class#10, i_category#11]

(15) CometHashAggregate
Input [3]: [ws_net_paid#2, i_class#10, i_category#11]
Keys [2]: [i_category#11, i_class#10]
Functions [1]: [partial_sum(UnscaledValue(ws_net_paid#2))]

(16) CometExchange
Input [3]: [i_category#11, i_class#10, sum#12]
Arguments: hashpartitioning(i_category#11, i_class#10, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=1]

(17) CometColumnarToRow [codegen id : 1]
Input [3]: [i_category#11, i_class#10, sum#12]

(18) HashAggregate [codegen id : 1]
Input [3]: [i_category#11, i_class#10, sum#12]
Keys [2]: [i_category#11, i_class#10]
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#11 AS i_category#15, i_class#10 AS i_class#16, 0 AS g_category#17, 0 AS g_class#18, 0 AS lochierarchy#19]

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

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

(21) HashAggregate [codegen id : 2]
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]

(22) HashAggregate [codegen id : 2]
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]

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

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

(25) HashAggregate [codegen id : 3]
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]

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

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

(28) HashAggregate [codegen id : 4]
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]

(29) HashAggregate [codegen id : 4]
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]

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

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

(32) HashAggregate [codegen id : 5]
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]

(33) Union

(34) HashAggregate [codegen id : 6]
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]

(35) 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=4]

(36) 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: []

(37) 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=5]

(38) 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]

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

(40) 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]

(41) Project [codegen id : 8]
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]

(42) 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 (47)
+- * CometColumnarToRow (46)
   +- CometProject (45)
      +- CometFilter (44)
         +- CometScan [native_iceberg_compat] parquet spark_catalog.default.date_dim (43)


(43) CometScan [native_iceberg_compat] 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>

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

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

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

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


