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


(1) CometScan [native_iceberg_compat] 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 [native_iceberg_compat] 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 [native_iceberg_compat] 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) CometProject
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#13, i_class#14, i_category#15, i_product_name#16], [i_item_sk#8, static_invoke(CharVarcharCodegenUtils.readSidePadding(i_brand#9, 50)) AS i_brand#13, static_invoke(CharVarcharCodegenUtils.readSidePadding(i_class#10, 50)) AS i_class#14, static_invoke(CharVarcharCodegenUtils.readSidePadding(i_category#11, 50)) AS i_category#15, static_invoke(CharVarcharCodegenUtils.readSidePadding(i_product_name#12, 50)) AS i_product_name#16]

(12) CometBroadcastExchange
Input [5]: [i_item_sk#8, i_brand#13, i_class#14, i_category#15, i_product_name#16]
Arguments: [i_item_sk#8, i_brand#13, i_class#14, i_category#15, i_product_name#16]

(13) 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#13, i_class#14, i_category#15, i_product_name#16]
Arguments: [inv_item_sk#1], [i_item_sk#8], Inner, BuildRight

(14) CometProject
Input [8]: [inv_item_sk#1, inv_warehouse_sk#2, inv_quantity_on_hand#3, i_item_sk#8, i_brand#13, i_class#14, i_category#15, i_product_name#16]
Arguments: [inv_warehouse_sk#2, inv_quantity_on_hand#3, i_brand#13, i_class#14, i_category#15, i_product_name#16], [inv_warehouse_sk#2, inv_quantity_on_hand#3, i_brand#13, i_class#14, i_category#15, i_product_name#16]

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

(16) CometFilter
Input [1]: [w_warehouse_sk#17]
Condition : isnotnull(w_warehouse_sk#17)

(17) CometBroadcastExchange
Input [1]: [w_warehouse_sk#17]
Arguments: [w_warehouse_sk#17]

(18) CometBroadcastHashJoin
Left output [6]: [inv_warehouse_sk#2, inv_quantity_on_hand#3, i_brand#13, i_class#14, i_category#15, i_product_name#16]
Right output [1]: [w_warehouse_sk#17]
Arguments: [inv_warehouse_sk#2], [w_warehouse_sk#17], Inner, BuildRight

(19) CometProject
Input [7]: [inv_warehouse_sk#2, inv_quantity_on_hand#3, i_brand#13, i_class#14, i_category#15, i_product_name#16, w_warehouse_sk#17]
Arguments: [inv_quantity_on_hand#3, i_brand#13, i_class#14, i_category#15, i_product_name#16], [inv_quantity_on_hand#3, i_brand#13, i_class#14, i_category#15, i_product_name#16]

(20) CometHashAggregate
Input [5]: [inv_quantity_on_hand#3, i_brand#13, i_class#14, i_category#15, i_product_name#16]
Keys [4]: [i_product_name#16, i_brand#13, i_class#14, i_category#15]
Functions [1]: [partial_avg(inv_quantity_on_hand#3)]

(21) CometExchange
Input [6]: [i_product_name#16, i_brand#13, i_class#14, i_category#15, sum#18, count#19]
Arguments: hashpartitioning(i_product_name#16, i_brand#13, i_class#14, i_category#15, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=1]

(22) CometHashAggregate
Input [6]: [i_product_name#16, i_brand#13, i_class#14, i_category#15, sum#18, count#19]
Keys [4]: [i_product_name#16, i_brand#13, i_class#14, i_category#15]
Functions [1]: [avg(inv_quantity_on_hand#3)]

(23) CometHashAggregate
Input [5]: [i_product_name#16, i_brand#13, i_class#14, i_category#15, qoh#20]
Keys [4]: [i_product_name#16, i_brand#13, i_class#14, i_category#15]
Functions [1]: [partial_avg(qoh#20)]

(24) CometHashAggregate
Input [6]: [i_product_name#16, i_brand#13, i_class#14, i_category#15, sum#21, count#22]
Keys [4]: [i_product_name#16, i_brand#13, i_class#14, i_category#15]
Functions [1]: [avg(qoh#20)]

(25) ReusedExchange [Reuses operator id: 21]
Output [6]: [i_product_name#23, i_brand#24, i_class#25, i_category#26, sum#27, count#28]

(26) CometHashAggregate
Input [6]: [i_product_name#23, i_brand#24, i_class#25, i_category#26, sum#27, count#28]
Keys [4]: [i_product_name#23, i_brand#24, i_class#25, i_category#26]
Functions [1]: [avg(inv_quantity_on_hand#29)]

(27) CometHashAggregate
Input [4]: [i_product_name#23, i_brand#24, i_class#25, qoh#30]
Keys [3]: [i_product_name#23, i_brand#24, i_class#25]
Functions [1]: [partial_avg(qoh#30)]

(28) CometExchange
Input [5]: [i_product_name#23, i_brand#24, i_class#25, sum#31, count#32]
Arguments: hashpartitioning(i_product_name#23, i_brand#24, i_class#25, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=2]

(29) CometHashAggregate
Input [5]: [i_product_name#23, i_brand#24, i_class#25, sum#31, count#32]
Keys [3]: [i_product_name#23, i_brand#24, i_class#25]
Functions [1]: [avg(qoh#30)]

(30) ReusedExchange [Reuses operator id: 21]
Output [6]: [i_product_name#33, i_brand#34, i_class#35, i_category#36, sum#37, count#38]

(31) CometHashAggregate
Input [6]: [i_product_name#33, i_brand#34, i_class#35, i_category#36, sum#37, count#38]
Keys [4]: [i_product_name#33, i_brand#34, i_class#35, i_category#36]
Functions [1]: [avg(inv_quantity_on_hand#39)]

(32) CometHashAggregate
Input [3]: [i_product_name#33, i_brand#34, qoh#40]
Keys [2]: [i_product_name#33, i_brand#34]
Functions [1]: [partial_avg(qoh#40)]

(33) CometExchange
Input [4]: [i_product_name#33, i_brand#34, sum#41, count#42]
Arguments: hashpartitioning(i_product_name#33, i_brand#34, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=3]

(34) CometHashAggregate
Input [4]: [i_product_name#33, i_brand#34, sum#41, count#42]
Keys [2]: [i_product_name#33, i_brand#34]
Functions [1]: [avg(qoh#40)]

(35) ReusedExchange [Reuses operator id: 21]
Output [6]: [i_product_name#43, i_brand#44, i_class#45, i_category#46, sum#47, count#48]

(36) CometHashAggregate
Input [6]: [i_product_name#43, i_brand#44, i_class#45, i_category#46, sum#47, count#48]
Keys [4]: [i_product_name#43, i_brand#44, i_class#45, i_category#46]
Functions [1]: [avg(inv_quantity_on_hand#49)]

(37) CometHashAggregate
Input [2]: [i_product_name#43, qoh#50]
Keys [1]: [i_product_name#43]
Functions [1]: [partial_avg(qoh#50)]

(38) CometExchange
Input [3]: [i_product_name#43, sum#51, count#52]
Arguments: hashpartitioning(i_product_name#43, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=4]

(39) CometHashAggregate
Input [3]: [i_product_name#43, sum#51, count#52]
Keys [1]: [i_product_name#43]
Functions [1]: [avg(qoh#50)]

(40) ReusedExchange [Reuses operator id: 21]
Output [6]: [i_product_name#53, i_brand#54, i_class#55, i_category#56, sum#57, count#58]

(41) CometHashAggregate
Input [6]: [i_product_name#53, i_brand#54, i_class#55, i_category#56, sum#57, count#58]
Keys [4]: [i_product_name#53, i_brand#54, i_class#55, i_category#56]
Functions [1]: [avg(inv_quantity_on_hand#59)]

(42) CometHashAggregate
Input [1]: [qoh#60]
Keys: []
Functions [1]: [partial_avg(qoh#60)]

(43) CometExchange
Input [2]: [sum#61, count#62]
Arguments: SinglePartition, ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=5]

(44) CometHashAggregate
Input [2]: [sum#61, count#62]
Keys: []
Functions [1]: [avg(qoh#60)]

(45) CometUnion
Child 0 Input [5]: [i_product_name#63, i_brand#64, i_class#65, i_category#66, qoh#67]
Child 1 Input [5]: [i_product_name#23, i_brand#24, i_class#25, i_category#68, qoh#69]
Child 2 Input [5]: [i_product_name#33, i_brand#34, i_class#70, i_category#71, qoh#72]
Child 3 Input [5]: [i_product_name#43, i_brand#73, i_class#74, i_category#75, qoh#76]
Child 4 Input [5]: [i_product_name#77, i_brand#78, i_class#79, i_category#80, qoh#81]

(46) CometTakeOrderedAndProject
Input [5]: [i_product_name#63, i_brand#64, i_class#65, i_category#66, qoh#67]
Arguments: TakeOrderedAndProject(limit=100, orderBy=[qoh#67 ASC NULLS FIRST,i_product_name#63 ASC NULLS FIRST,i_brand#64 ASC NULLS FIRST,i_class#65 ASC NULLS FIRST,i_category#66 ASC NULLS FIRST], output=[i_product_name#63,i_brand#64,i_class#65,i_category#66,qoh#67]), [i_product_name#63, i_brand#64, i_class#65, i_category#66, qoh#67], 100, 0, [qoh#67 ASC NULLS FIRST, i_product_name#63 ASC NULLS FIRST, i_brand#64 ASC NULLS FIRST, i_class#65 ASC NULLS FIRST, i_category#66 ASC NULLS FIRST], [i_product_name#63, i_brand#64, i_class#65, i_category#66, qoh#67]

(47) CometColumnarToRow [codegen id : 1]
Input [5]: [i_product_name#63, i_brand#64, i_class#65, i_category#66, qoh#67]

===== Subqueries =====

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


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

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

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

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

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


