== Physical Plan ==
TakeOrderedAndProject (43)
+- * Project (42)
   +- Window (41)
      +- * CometColumnarToRow (40)
         +- CometSort (39)
            +- CometExchange (38)
               +- CometHashAggregate (37)
                  +- CometColumnarExchange (36)
                     +- * HashAggregate (35)
                        +- Union (34)
                           :- * HashAggregate (19)
                           :  +- * CometColumnarToRow (18)
                           :     +- CometColumnarExchange (17)
                           :        +- * HashAggregate (16)
                           :           +- * CometColumnarToRow (15)
                           :              +- CometProject (14)
                           :                 +- CometBroadcastHashJoin (13)
                           :                    :- 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 (12)
                           :                       +- CometProject (11)
                           :                          +- CometFilter (10)
                           :                             +- CometScan parquet spark_catalog.default.item (9)
                           :- * HashAggregate (26)
                           :  +- * CometColumnarToRow (25)
                           :     +- CometColumnarExchange (24)
                           :        +- * HashAggregate (23)
                           :           +- * HashAggregate (22)
                           :              +- * CometColumnarToRow (21)
                           :                 +- ReusedExchange (20)
                           +- * HashAggregate (33)
                              +- * CometColumnarToRow (32)
                                 +- CometColumnarExchange (31)
                                    +- * HashAggregate (30)
                                       +- * HashAggregate (29)
                                          +- * CometColumnarToRow (28)
                                             +- ReusedExchange (27)


(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), 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 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 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, staticinvoke(class org.apache.spark.sql.catalyst.util.CharVarcharCodegenUtils, StringType, readSidePadding, i_class#8, 50, true, false, true) AS i_class#10, staticinvoke(class org.apache.spark.sql.catalyst.util.CharVarcharCodegenUtils, StringType, readSidePadding, i_category#9, 50, true, false, true) 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) CometColumnarToRow [codegen id : 1]
Input [3]: [ws_net_paid#2, i_class#10, i_category#11]

(16) HashAggregate [codegen id : 1]
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))]
Aggregate Attributes [1]: [sum#12]
Results [3]: [i_category#11, i_class#10, sum#13]

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

(18) CometColumnarToRow [codegen id : 2]
Input [3]: [i_category#11, i_class#10, sum#13]

(19) HashAggregate [codegen id : 2]
Input [3]: [i_category#11, i_class#10, sum#13]
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))#14]
Results [6]: [cast(MakeDecimal(sum(UnscaledValue(ws_net_paid#2))#14,17,2) as decimal(27,2)) AS total_sum#15, i_category#11 AS i_category#16, i_class#10 AS i_class#17, 0 AS g_category#18, 0 AS g_class#19, 0 AS lochierarchy#20]

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

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

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

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

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

(25) CometColumnarToRow [codegen id : 5]
Input [3]: [i_category#21, sum#28, isEmpty#29]

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

(27) ReusedExchange [Reuses operator id: 17]
Output [3]: [i_category#36, i_class#37, sum#38]

(28) CometColumnarToRow [codegen id : 7]
Input [3]: [i_category#36, i_class#37, sum#38]

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

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

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

(32) CometColumnarToRow [codegen id : 8]
Input [2]: [sum#43, isEmpty#44]

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

(34) Union

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

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

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

(38) CometExchange
Input [5]: [total_sum#15, i_category#16, i_class#17, lochierarchy#20, _w0#52]
Arguments: hashpartitioning(lochierarchy#20, _w0#52, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=5]

(39) CometSort
Input [5]: [total_sum#15, i_category#16, i_class#17, lochierarchy#20, _w0#52]
Arguments: [total_sum#15, i_category#16, i_class#17, lochierarchy#20, _w0#52], [lochierarchy#20 ASC NULLS FIRST, _w0#52 ASC NULLS FIRST, total_sum#15 DESC NULLS LAST]

(40) CometColumnarToRow [codegen id : 10]
Input [5]: [total_sum#15, i_category#16, i_class#17, lochierarchy#20, _w0#52]

(41) Window
Input [5]: [total_sum#15, i_category#16, i_class#17, lochierarchy#20, _w0#52]
Arguments: [rank(total_sum#15) windowspecdefinition(lochierarchy#20, _w0#52, total_sum#15 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS rank_within_parent#53], [lochierarchy#20, _w0#52], [total_sum#15 DESC NULLS LAST]

(42) Project [codegen id : 11]
Output [5]: [total_sum#15, i_category#16, i_class#17, lochierarchy#20, rank_within_parent#53]
Input [6]: [total_sum#15, i_category#16, i_class#17, lochierarchy#20, _w0#52, rank_within_parent#53]

(43) TakeOrderedAndProject
Input [5]: [total_sum#15, i_category#16, i_class#17, lochierarchy#20, rank_within_parent#53]
Arguments: 100, [lochierarchy#20 DESC NULLS LAST, CASE WHEN (lochierarchy#20 = 0) THEN i_category#16 END ASC NULLS FIRST, rank_within_parent#53 ASC NULLS FIRST], [total_sum#15, i_category#16, i_class#17, lochierarchy#20, rank_within_parent#53]

===== Subqueries =====

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


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

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

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

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

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


