== Physical Plan ==
TakeOrderedAndProject (23)
+- * Project (22)
   +- Window (21)
      +- * ColumnarToRow (20)
         +- CometSort (19)
            +- CometExchange (18)
               +- CometHashAggregate (17)
                  +- CometExchange (16)
                     +- CometHashAggregate (15)
                        +- CometExpand (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)


(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,1200), LessThanOrEqual(d_month_seq,1211), 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 >= 1200)) AND (d_month_seq#6 <= 1211)) 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) 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_category#9, i_class#8], [ws_net_paid#2, i_category#9, i_class#8]

(14) CometExpand
Input [3]: [ws_net_paid#2, i_category#9, i_class#8]
Arguments: [[ws_net_paid#2, i_category#9, i_class#8, 0], [ws_net_paid#2, i_category#9, null, 1], [ws_net_paid#2, null, null, 3]], [ws_net_paid#2, i_category#10, i_class#11, spark_grouping_id#12]

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

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

(17) CometHashAggregate
Input [4]: [i_category#10, i_class#11, spark_grouping_id#12, sum#13]
Keys [3]: [i_category#10, i_class#11, spark_grouping_id#12]
Functions [1]: [sum(UnscaledValue(ws_net_paid#2))]

(18) CometExchange
Input [7]: [total_sum#14, i_category#10, i_class#11, lochierarchy#15, _w0#16, _w1#17, _w2#18]
Arguments: hashpartitioning(_w1#17, _w2#18, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=2]

(19) CometSort
Input [7]: [total_sum#14, i_category#10, i_class#11, lochierarchy#15, _w0#16, _w1#17, _w2#18]
Arguments: [total_sum#14, i_category#10, i_class#11, lochierarchy#15, _w0#16, _w1#17, _w2#18], [_w1#17 ASC NULLS FIRST, _w2#18 ASC NULLS FIRST, _w0#16 DESC NULLS LAST]

(20) ColumnarToRow [codegen id : 1]
Input [7]: [total_sum#14, i_category#10, i_class#11, lochierarchy#15, _w0#16, _w1#17, _w2#18]

(21) Window
Input [7]: [total_sum#14, i_category#10, i_class#11, lochierarchy#15, _w0#16, _w1#17, _w2#18]
Arguments: [rank(_w0#16) windowspecdefinition(_w1#17, _w2#18, _w0#16 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS rank_within_parent#19], [_w1#17, _w2#18], [_w0#16 DESC NULLS LAST]

(22) Project [codegen id : 2]
Output [5]: [total_sum#14, i_category#10, i_class#11, lochierarchy#15, rank_within_parent#19]
Input [8]: [total_sum#14, i_category#10, i_class#11, lochierarchy#15, _w0#16, _w1#17, _w2#18, rank_within_parent#19]

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

===== Subqueries =====

Subquery:1 Hosting operator id = 1 Hosting Expression = ws_sold_date_sk#3 IN dynamicpruning#4
BroadcastExchange (28)
+- * ColumnarToRow (27)
   +- CometProject (26)
      +- CometFilter (25)
         +- CometScan parquet spark_catalog.default.date_dim (24)


(24) 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,1200), LessThanOrEqual(d_month_seq,1211), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_month_seq:int>

(25) CometFilter
Input [2]: [d_date_sk#5, d_month_seq#6]
Condition : (((isnotnull(d_month_seq#6) AND (d_month_seq#6 >= 1200)) AND (d_month_seq#6 <= 1211)) AND isnotnull(d_date_sk#5))

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

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

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


