== Physical Plan ==
* CometColumnarToRow (46)
+- CometTakeOrderedAndProject (45)
   +- CometUnion (44)
      :- CometHashAggregate (23)
      :  +- CometHashAggregate (22)
      :     +- CometHashAggregate (21)
      :        +- CometExchange (20)
      :           +- CometHashAggregate (19)
      :              +- CometProject (18)
      :                 +- CometBroadcastHashJoin (17)
      :                    :- CometProject (13)
      :                    :  +- CometBroadcastHashJoin (12)
      :                    :     :- CometProject (8)
      :                    :     :  +- CometBroadcastHashJoin (7)
      :                    :     :     :- CometFilter (2)
      :                    :     :     :  +- CometScan parquet spark_catalog.default.inventory (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)
      :                    +- CometBroadcastExchange (16)
      :                       +- CometFilter (15)
      :                          +- CometScan parquet spark_catalog.default.warehouse (14)
      :- CometHashAggregate (28)
      :  +- CometExchange (27)
      :     +- CometHashAggregate (26)
      :        +- CometHashAggregate (25)
      :           +- ReusedExchange (24)
      :- CometHashAggregate (33)
      :  +- CometExchange (32)
      :     +- CometHashAggregate (31)
      :        +- CometHashAggregate (30)
      :           +- ReusedExchange (29)
      :- CometHashAggregate (38)
      :  +- CometExchange (37)
      :     +- CometHashAggregate (36)
      :        +- CometHashAggregate (35)
      :           +- ReusedExchange (34)
      +- CometHashAggregate (43)
         +- CometExchange (42)
            +- CometHashAggregate (41)
               +- CometHashAggregate (40)
                  +- ReusedExchange (39)


(1) CometScan parquet spark_catalog.default.inventory
Output [4]: [inv_item_sk#1, inv_warehouse_sk#2, inv_quantity_on_hand#3, inv_date_sk#4]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(inv_date_sk#4), dynamicpruningexpression(inv_date_sk#4 IN dynamicpruning#5)]
PushedFilters: [IsNotNull(inv_item_sk), IsNotNull(inv_warehouse_sk)]
ReadSchema: struct<inv_item_sk:int,inv_warehouse_sk:int,inv_quantity_on_hand:int>

(2) CometFilter
Input [4]: [inv_item_sk#1, inv_warehouse_sk#2, inv_quantity_on_hand#3, inv_date_sk#4]
Condition : (isnotnull(inv_item_sk#1) AND isnotnull(inv_warehouse_sk#2))

(3) CometScan parquet spark_catalog.default.date_dim
Output [2]: [d_date_sk#6, d_month_seq#7]
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#6, d_month_seq#7]
Condition : (((isnotnull(d_month_seq#7) AND (d_month_seq#7 >= 1212)) AND (d_month_seq#7 <= 1223)) AND isnotnull(d_date_sk#6))

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

(6) CometBroadcastExchange
Input [1]: [d_date_sk#6]
Arguments: [d_date_sk#6]

(7) CometBroadcastHashJoin
Left output [4]: [inv_item_sk#1, inv_warehouse_sk#2, inv_quantity_on_hand#3, inv_date_sk#4]
Right output [1]: [d_date_sk#6]
Arguments: [inv_date_sk#4], [d_date_sk#6], Inner, BuildRight

(8) CometProject
Input [5]: [inv_item_sk#1, inv_warehouse_sk#2, inv_quantity_on_hand#3, inv_date_sk#4, d_date_sk#6]
Arguments: [inv_item_sk#1, inv_warehouse_sk#2, inv_quantity_on_hand#3], [inv_item_sk#1, inv_warehouse_sk#2, inv_quantity_on_hand#3]

(9) CometScan parquet spark_catalog.default.item
Output [5]: [i_item_sk#8, i_brand#9, i_class#10, i_category#11, i_product_name#12]
Batched: true
Location [not included in comparison]/{warehouse_dir}/item]
PushedFilters: [IsNotNull(i_item_sk)]
ReadSchema: struct<i_item_sk:int,i_brand:string,i_class:string,i_category:string,i_product_name:string>

(10) CometFilter
Input [5]: [i_item_sk#8, i_brand#9, i_class#10, i_category#11, i_product_name#12]
Condition : isnotnull(i_item_sk#8)

(11) CometBroadcastExchange
Input [5]: [i_item_sk#8, i_brand#9, i_class#10, i_category#11, i_product_name#12]
Arguments: [i_item_sk#8, i_brand#9, i_class#10, i_category#11, i_product_name#12]

(12) CometBroadcastHashJoin
Left output [3]: [inv_item_sk#1, inv_warehouse_sk#2, inv_quantity_on_hand#3]
Right output [5]: [i_item_sk#8, i_brand#9, i_class#10, i_category#11, i_product_name#12]
Arguments: [inv_item_sk#1], [i_item_sk#8], Inner, BuildRight

(13) CometProject
Input [8]: [inv_item_sk#1, inv_warehouse_sk#2, inv_quantity_on_hand#3, i_item_sk#8, i_brand#9, i_class#10, i_category#11, i_product_name#12]
Arguments: [inv_warehouse_sk#2, inv_quantity_on_hand#3, i_brand#9, i_class#10, i_category#11, i_product_name#12], [inv_warehouse_sk#2, inv_quantity_on_hand#3, i_brand#9, i_class#10, i_category#11, i_product_name#12]

(14) CometScan parquet spark_catalog.default.warehouse
Output [1]: [w_warehouse_sk#13]
Batched: true
Location [not included in comparison]/{warehouse_dir}/warehouse]
PushedFilters: [IsNotNull(w_warehouse_sk)]
ReadSchema: struct<w_warehouse_sk:int>

(15) CometFilter
Input [1]: [w_warehouse_sk#13]
Condition : isnotnull(w_warehouse_sk#13)

(16) CometBroadcastExchange
Input [1]: [w_warehouse_sk#13]
Arguments: [w_warehouse_sk#13]

(17) CometBroadcastHashJoin
Left output [6]: [inv_warehouse_sk#2, inv_quantity_on_hand#3, i_brand#9, i_class#10, i_category#11, i_product_name#12]
Right output [1]: [w_warehouse_sk#13]
Arguments: [inv_warehouse_sk#2], [w_warehouse_sk#13], Inner, BuildRight

(18) CometProject
Input [7]: [inv_warehouse_sk#2, inv_quantity_on_hand#3, i_brand#9, i_class#10, i_category#11, i_product_name#12, w_warehouse_sk#13]
Arguments: [inv_quantity_on_hand#3, i_brand#9, i_class#10, i_category#11, i_product_name#12], [inv_quantity_on_hand#3, i_brand#9, i_class#10, i_category#11, i_product_name#12]

(19) CometHashAggregate
Input [5]: [inv_quantity_on_hand#3, i_brand#9, i_class#10, i_category#11, i_product_name#12]
Keys [4]: [i_product_name#12, i_brand#9, i_class#10, i_category#11]
Functions [1]: [partial_avg(inv_quantity_on_hand#3)]

(20) CometExchange
Input [6]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, sum#14, count#15]
Arguments: hashpartitioning(i_product_name#12, i_brand#9, i_class#10, i_category#11, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=1]

(21) CometHashAggregate
Input [6]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, sum#14, count#15]
Keys [4]: [i_product_name#12, i_brand#9, i_class#10, i_category#11]
Functions [1]: [avg(inv_quantity_on_hand#3)]

(22) CometHashAggregate
Input [5]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, qoh#16]
Keys [4]: [i_product_name#12, i_brand#9, i_class#10, i_category#11]
Functions [1]: [partial_avg(qoh#16)]

(23) CometHashAggregate
Input [6]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, sum#17, count#18]
Keys [4]: [i_product_name#12, i_brand#9, i_class#10, i_category#11]
Functions [1]: [avg(qoh#16)]

(24) ReusedExchange [Reuses operator id: 20]
Output [6]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, sum#14, count#15]

(25) CometHashAggregate
Input [6]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, sum#14, count#15]
Keys [4]: [i_product_name#12, i_brand#9, i_class#10, i_category#11]
Functions [1]: [avg(inv_quantity_on_hand#3)]

(26) CometHashAggregate
Input [4]: [i_product_name#12, i_brand#9, i_class#10, qoh#16]
Keys [3]: [i_product_name#12, i_brand#9, i_class#10]
Functions [1]: [partial_avg(qoh#16)]

(27) CometExchange
Input [5]: [i_product_name#12, i_brand#9, i_class#10, sum#19, count#20]
Arguments: hashpartitioning(i_product_name#12, i_brand#9, i_class#10, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=2]

(28) CometHashAggregate
Input [5]: [i_product_name#12, i_brand#9, i_class#10, sum#19, count#20]
Keys [3]: [i_product_name#12, i_brand#9, i_class#10]
Functions [1]: [avg(qoh#16)]

(29) ReusedExchange [Reuses operator id: 20]
Output [6]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, sum#14, count#15]

(30) CometHashAggregate
Input [6]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, sum#14, count#15]
Keys [4]: [i_product_name#12, i_brand#9, i_class#10, i_category#11]
Functions [1]: [avg(inv_quantity_on_hand#3)]

(31) CometHashAggregate
Input [3]: [i_product_name#12, i_brand#9, qoh#16]
Keys [2]: [i_product_name#12, i_brand#9]
Functions [1]: [partial_avg(qoh#16)]

(32) CometExchange
Input [4]: [i_product_name#12, i_brand#9, sum#21, count#22]
Arguments: hashpartitioning(i_product_name#12, i_brand#9, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=3]

(33) CometHashAggregate
Input [4]: [i_product_name#12, i_brand#9, sum#21, count#22]
Keys [2]: [i_product_name#12, i_brand#9]
Functions [1]: [avg(qoh#16)]

(34) ReusedExchange [Reuses operator id: 20]
Output [6]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, sum#14, count#15]

(35) CometHashAggregate
Input [6]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, sum#14, count#15]
Keys [4]: [i_product_name#12, i_brand#9, i_class#10, i_category#11]
Functions [1]: [avg(inv_quantity_on_hand#3)]

(36) CometHashAggregate
Input [2]: [i_product_name#12, qoh#16]
Keys [1]: [i_product_name#12]
Functions [1]: [partial_avg(qoh#16)]

(37) CometExchange
Input [3]: [i_product_name#12, sum#23, count#24]
Arguments: hashpartitioning(i_product_name#12, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=4]

(38) CometHashAggregate
Input [3]: [i_product_name#12, sum#23, count#24]
Keys [1]: [i_product_name#12]
Functions [1]: [avg(qoh#16)]

(39) ReusedExchange [Reuses operator id: 20]
Output [6]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, sum#14, count#15]

(40) CometHashAggregate
Input [6]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, sum#14, count#15]
Keys [4]: [i_product_name#12, i_brand#9, i_class#10, i_category#11]
Functions [1]: [avg(inv_quantity_on_hand#3)]

(41) CometHashAggregate
Input [1]: [qoh#16]
Keys: []
Functions [1]: [partial_avg(qoh#16)]

(42) CometExchange
Input [2]: [sum#25, count#26]
Arguments: SinglePartition, ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=5]

(43) CometHashAggregate
Input [2]: [sum#25, count#26]
Keys: []
Functions [1]: [avg(qoh#16)]

(44) CometUnion
Child 0 Input [5]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, qoh#27]
Child 1 Input [5]: [i_product_name#12, i_brand#9, i_class#10, i_category#28, qoh#29]
Child 2 Input [5]: [i_product_name#12, i_brand#9, i_class#30, i_category#31, qoh#32]
Child 3 Input [5]: [i_product_name#12, i_brand#33, i_class#34, i_category#35, qoh#36]
Child 4 Input [5]: [i_product_name#37, i_brand#38, i_class#39, i_category#40, qoh#41]

(45) CometTakeOrderedAndProject
Input [5]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, qoh#27]
Arguments: TakeOrderedAndProject(limit=100, orderBy=[qoh#27 ASC NULLS FIRST,i_product_name#12 ASC NULLS FIRST,i_brand#9 ASC NULLS FIRST,i_class#10 ASC NULLS FIRST,i_category#11 ASC NULLS FIRST], output=[i_product_name#12,i_brand#9,i_class#10,i_category#11,qoh#27]), [i_product_name#12, i_brand#9, i_class#10, i_category#11, qoh#27], 100, [qoh#27 ASC NULLS FIRST, i_product_name#12 ASC NULLS FIRST, i_brand#9 ASC NULLS FIRST, i_class#10 ASC NULLS FIRST, i_category#11 ASC NULLS FIRST], [i_product_name#12, i_brand#9, i_class#10, i_category#11, qoh#27]

(46) CometColumnarToRow [codegen id : 1]
Input [5]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, qoh#27]

===== Subqueries =====

Subquery:1 Hosting operator id = 1 Hosting Expression = inv_date_sk#4 IN dynamicpruning#5
BroadcastExchange (51)
+- * CometColumnarToRow (50)
   +- CometProject (49)
      +- CometFilter (48)
         +- CometScan parquet spark_catalog.default.date_dim (47)


(47) CometScan parquet spark_catalog.default.date_dim
Output [2]: [d_date_sk#6, d_month_seq#7]
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>

(48) CometFilter
Input [2]: [d_date_sk#6, d_month_seq#7]
Condition : (((isnotnull(d_month_seq#7) AND (d_month_seq#7 >= 1212)) AND (d_month_seq#7 <= 1223)) AND isnotnull(d_date_sk#6))

(49) CometProject
Input [2]: [d_date_sk#6, d_month_seq#7]
Arguments: [d_date_sk#6], [d_date_sk#6]

(50) CometColumnarToRow [codegen id : 1]
Input [1]: [d_date_sk#6]

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


