== 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, staticinvoke(class org.apache.spark.sql.catalyst.util.CharVarcharCodegenUtils, StringType, readSidePadding, i_class#7, 50, true, false, true) AS i_class#9, staticinvoke(class org.apache.spark.sql.catalyst.util.CharVarcharCodegenUtils, StringType, readSidePadding, i_category#8, 50, true, false, true) 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#10, i_class#9, sum#20]

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

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

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

(22) CometColumnarExchange
Input [3]: [i_category#10, sum#25, isEmpty#26]
Arguments: hashpartitioning(i_category#10, 5), ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=3]

(23) CometColumnarToRow [codegen id : 9]
Input [3]: [i_category#10, sum#25, isEmpty#26]

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

(25) ReusedExchange [Reuses operator id: 15]
Output [3]: [i_category#10, i_class#9, sum#33]

(26) CometColumnarToRow [codegen id : 13]
Input [3]: [i_category#10, i_class#9, sum#33]

(27) HashAggregate [codegen id : 13]
Input [3]: [i_category#10, i_class#9, sum#33]
Keys [2]: [i_category#10, i_class#9]
Functions [1]: [sum(UnscaledValue(ws_net_paid#34))]
Aggregate Attributes [1]: [sum(UnscaledValue(ws_net_paid#34))#13]
Results [1]: [MakeDecimal(sum(UnscaledValue(ws_net_paid#34))#13,17,2) AS total_sum#35]

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

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

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

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

(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#47]
Arguments: hashpartitioning(lochierarchy#19, _w0#47, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=6]

(37) CometSort
Input [5]: [total_sum#14, i_category#15, i_class#16, lochierarchy#19, _w0#47]
Arguments: [total_sum#14, i_category#15, i_class#16, lochierarchy#19, _w0#47], [lochierarchy#19 ASC NULLS FIRST, _w0#47 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#47]

(39) Window
Input [5]: [total_sum#14, i_category#15, i_class#16, lochierarchy#19, _w0#47]
Arguments: [rank(total_sum#14) windowspecdefinition(lochierarchy#19, _w0#47, total_sum#14 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS rank_within_parent#48], [lochierarchy#19, _w0#47], [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#48]
Input [6]: [total_sum#14, i_category#15, i_class#16, lochierarchy#19, _w0#47, rank_within_parent#48]

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

===== 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#49]
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#49]
Condition : (((isnotnull(d_month_seq#49) AND (d_month_seq#49 >= 1212)) AND (d_month_seq#49 <= 1223)) AND isnotnull(d_date_sk#5))

(44) CometProject
Input [2]: [d_date_sk#5, d_month_seq#49]
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]


