== Physical Plan ==
TakeOrderedAndProject (55)
+- Union (54)
   :- * HashAggregate (25)
   :  +- * HashAggregate (24)
   :     +- * HashAggregate (23)
   :        +- * CometColumnarToRow (22)
   :           +- CometColumnarExchange (21)
   :              +- * HashAggregate (20)
   :                 +- * Project (19)
   :                    +- * BroadcastHashJoin Inner BuildRight (18)
   :                       :- * Project (13)
   :                       :  +- * BroadcastHashJoin Inner BuildRight (12)
   :                       :     :- * Project (6)
   :                       :     :  +- * BroadcastHashJoin Inner BuildRight (5)
   :                       :     :     :- * Filter (3)
   :                       :     :     :  +- * ColumnarToRow (2)
   :                       :     :     :     +- Scan parquet spark_catalog.default.inventory (1)
   :                       :     :     +- ReusedExchange (4)
   :                       :     +- BroadcastExchange (11)
   :                       :        +- * CometColumnarToRow (10)
   :                       :           +- CometProject (9)
   :                       :              +- CometFilter (8)
   :                       :                 +- CometNativeScan parquet spark_catalog.default.item (7)
   :                       +- BroadcastExchange (17)
   :                          +- * CometColumnarToRow (16)
   :                             +- CometFilter (15)
   :                                +- CometNativeScan parquet spark_catalog.default.warehouse (14)
   :- * HashAggregate (32)
   :  +- * CometColumnarToRow (31)
   :     +- CometColumnarExchange (30)
   :        +- * HashAggregate (29)
   :           +- * HashAggregate (28)
   :              +- * CometColumnarToRow (27)
   :                 +- ReusedExchange (26)
   :- * HashAggregate (39)
   :  +- * CometColumnarToRow (38)
   :     +- CometColumnarExchange (37)
   :        +- * HashAggregate (36)
   :           +- * HashAggregate (35)
   :              +- * CometColumnarToRow (34)
   :                 +- ReusedExchange (33)
   :- * HashAggregate (46)
   :  +- * CometColumnarToRow (45)
   :     +- CometColumnarExchange (44)
   :        +- * HashAggregate (43)
   :           +- * HashAggregate (42)
   :              +- * CometColumnarToRow (41)
   :                 +- ReusedExchange (40)
   +- * HashAggregate (53)
      +- * CometColumnarToRow (52)
         +- CometColumnarExchange (51)
            +- * HashAggregate (50)
               +- * HashAggregate (49)
                  +- * CometColumnarToRow (48)
                     +- ReusedExchange (47)


(1) Scan 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) ColumnarToRow [codegen id : 4]
Input [4]: [inv_item_sk#1, inv_warehouse_sk#2, inv_quantity_on_hand#3, inv_date_sk#4]

(3) Filter [codegen id : 4]
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))

(4) ReusedExchange [Reuses operator id: 60]
Output [1]: [d_date_sk#6]

(5) BroadcastHashJoin [codegen id : 4]
Left keys [1]: [inv_date_sk#4]
Right keys [1]: [d_date_sk#6]
Join type: Inner
Join condition: None

(6) Project [codegen id : 4]
Output [3]: [inv_item_sk#1, inv_warehouse_sk#2, inv_quantity_on_hand#3]
Input [5]: [inv_item_sk#1, inv_warehouse_sk#2, inv_quantity_on_hand#3, inv_date_sk#4, d_date_sk#6]

(7) CometNativeScan parquet spark_catalog.default.item
Output [5]: [i_item_sk#7, i_brand#8, i_class#9, i_category#10, i_product_name#11]
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>

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

(9) CometProject
Input [5]: [i_item_sk#7, i_brand#8, i_class#9, i_category#10, i_product_name#11]
Arguments: [i_item_sk#7, i_brand#12, i_class#13, i_category#14, i_product_name#15], [i_item_sk#7, static_invoke(CharVarcharCodegenUtils.readSidePadding(i_brand#8, 50)) AS i_brand#12, static_invoke(CharVarcharCodegenUtils.readSidePadding(i_class#9, 50)) AS i_class#13, static_invoke(CharVarcharCodegenUtils.readSidePadding(i_category#10, 50)) AS i_category#14, static_invoke(CharVarcharCodegenUtils.readSidePadding(i_product_name#11, 50)) AS i_product_name#15]

(10) CometColumnarToRow [codegen id : 2]
Input [5]: [i_item_sk#7, i_brand#12, i_class#13, i_category#14, i_product_name#15]

(11) BroadcastExchange
Input [5]: [i_item_sk#7, i_brand#12, i_class#13, i_category#14, i_product_name#15]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [plan_id=1]

(12) BroadcastHashJoin [codegen id : 4]
Left keys [1]: [inv_item_sk#1]
Right keys [1]: [i_item_sk#7]
Join type: Inner
Join condition: None

(13) Project [codegen id : 4]
Output [6]: [inv_warehouse_sk#2, inv_quantity_on_hand#3, i_brand#12, i_class#13, i_category#14, i_product_name#15]
Input [8]: [inv_item_sk#1, inv_warehouse_sk#2, inv_quantity_on_hand#3, i_item_sk#7, i_brand#12, i_class#13, i_category#14, i_product_name#15]

(14) CometNativeScan parquet spark_catalog.default.warehouse
Output [1]: [w_warehouse_sk#16]
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#16]
Condition : isnotnull(w_warehouse_sk#16)

(16) CometColumnarToRow [codegen id : 3]
Input [1]: [w_warehouse_sk#16]

(17) BroadcastExchange
Input [1]: [w_warehouse_sk#16]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=2]

(18) BroadcastHashJoin [codegen id : 4]
Left keys [1]: [inv_warehouse_sk#2]
Right keys [1]: [w_warehouse_sk#16]
Join type: Inner
Join condition: None

(19) Project [codegen id : 4]
Output [5]: [inv_quantity_on_hand#3, i_brand#12, i_class#13, i_category#14, i_product_name#15]
Input [7]: [inv_warehouse_sk#2, inv_quantity_on_hand#3, i_brand#12, i_class#13, i_category#14, i_product_name#15, w_warehouse_sk#16]

(20) HashAggregate [codegen id : 4]
Input [5]: [inv_quantity_on_hand#3, i_brand#12, i_class#13, i_category#14, i_product_name#15]
Keys [4]: [i_product_name#15, i_brand#12, i_class#13, i_category#14]
Functions [1]: [partial_avg(inv_quantity_on_hand#3)]
Aggregate Attributes [2]: [sum#17, count#18]
Results [6]: [i_product_name#15, i_brand#12, i_class#13, i_category#14, sum#19, count#20]

(21) CometColumnarExchange
Input [6]: [i_product_name#15, i_brand#12, i_class#13, i_category#14, sum#19, count#20]
Arguments: hashpartitioning(i_product_name#15, i_brand#12, i_class#13, i_category#14, 5), ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=3]

(22) CometColumnarToRow [codegen id : 5]
Input [6]: [i_product_name#15, i_brand#12, i_class#13, i_category#14, sum#19, count#20]

(23) HashAggregate [codegen id : 5]
Input [6]: [i_product_name#15, i_brand#12, i_class#13, i_category#14, sum#19, count#20]
Keys [4]: [i_product_name#15, i_brand#12, i_class#13, i_category#14]
Functions [1]: [avg(inv_quantity_on_hand#3)]
Aggregate Attributes [1]: [avg(inv_quantity_on_hand#3)#21]
Results [5]: [i_product_name#15, i_brand#12, i_class#13, i_category#14, avg(inv_quantity_on_hand#3)#21 AS qoh#22]

(24) HashAggregate [codegen id : 5]
Input [5]: [i_product_name#15, i_brand#12, i_class#13, i_category#14, qoh#22]
Keys [4]: [i_product_name#15, i_brand#12, i_class#13, i_category#14]
Functions [1]: [partial_avg(qoh#22)]
Aggregate Attributes [2]: [sum#23, count#24]
Results [6]: [i_product_name#15, i_brand#12, i_class#13, i_category#14, sum#25, count#26]

(25) HashAggregate [codegen id : 5]
Input [6]: [i_product_name#15, i_brand#12, i_class#13, i_category#14, sum#25, count#26]
Keys [4]: [i_product_name#15, i_brand#12, i_class#13, i_category#14]
Functions [1]: [avg(qoh#22)]
Aggregate Attributes [1]: [avg(qoh#22)#27]
Results [5]: [i_product_name#15 AS i_product_name#28, i_brand#12 AS i_brand#29, i_class#13 AS i_class#30, i_category#14 AS i_category#31, avg(qoh#22)#27 AS qoh#32]

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

(27) CometColumnarToRow [codegen id : 10]
Input [6]: [i_product_name#33, i_brand#34, i_class#35, i_category#36, sum#37, count#38]

(28) HashAggregate [codegen id : 10]
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)]
Aggregate Attributes [1]: [avg(inv_quantity_on_hand#39)#21]
Results [4]: [i_product_name#33, i_brand#34, i_class#35, avg(inv_quantity_on_hand#39)#21 AS qoh#40]

(29) HashAggregate [codegen id : 10]
Input [4]: [i_product_name#33, i_brand#34, i_class#35, qoh#40]
Keys [3]: [i_product_name#33, i_brand#34, i_class#35]
Functions [1]: [partial_avg(qoh#40)]
Aggregate Attributes [2]: [sum#41, count#42]
Results [5]: [i_product_name#33, i_brand#34, i_class#35, sum#43, count#44]

(30) CometColumnarExchange
Input [5]: [i_product_name#33, i_brand#34, i_class#35, sum#43, count#44]
Arguments: hashpartitioning(i_product_name#33, i_brand#34, i_class#35, 5), ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=4]

(31) CometColumnarToRow [codegen id : 11]
Input [5]: [i_product_name#33, i_brand#34, i_class#35, sum#43, count#44]

(32) HashAggregate [codegen id : 11]
Input [5]: [i_product_name#33, i_brand#34, i_class#35, sum#43, count#44]
Keys [3]: [i_product_name#33, i_brand#34, i_class#35]
Functions [1]: [avg(qoh#40)]
Aggregate Attributes [1]: [avg(qoh#40)#45]
Results [5]: [i_product_name#33, i_brand#34, i_class#35, null AS i_category#46, avg(qoh#40)#45 AS qoh#47]

(33) ReusedExchange [Reuses operator id: 21]
Output [6]: [i_product_name#48, i_brand#49, i_class#50, i_category#51, sum#52, count#53]

(34) CometColumnarToRow [codegen id : 16]
Input [6]: [i_product_name#48, i_brand#49, i_class#50, i_category#51, sum#52, count#53]

(35) HashAggregate [codegen id : 16]
Input [6]: [i_product_name#48, i_brand#49, i_class#50, i_category#51, sum#52, count#53]
Keys [4]: [i_product_name#48, i_brand#49, i_class#50, i_category#51]
Functions [1]: [avg(inv_quantity_on_hand#54)]
Aggregate Attributes [1]: [avg(inv_quantity_on_hand#54)#21]
Results [3]: [i_product_name#48, i_brand#49, avg(inv_quantity_on_hand#54)#21 AS qoh#55]

(36) HashAggregate [codegen id : 16]
Input [3]: [i_product_name#48, i_brand#49, qoh#55]
Keys [2]: [i_product_name#48, i_brand#49]
Functions [1]: [partial_avg(qoh#55)]
Aggregate Attributes [2]: [sum#56, count#57]
Results [4]: [i_product_name#48, i_brand#49, sum#58, count#59]

(37) CometColumnarExchange
Input [4]: [i_product_name#48, i_brand#49, sum#58, count#59]
Arguments: hashpartitioning(i_product_name#48, i_brand#49, 5), ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=5]

(38) CometColumnarToRow [codegen id : 17]
Input [4]: [i_product_name#48, i_brand#49, sum#58, count#59]

(39) HashAggregate [codegen id : 17]
Input [4]: [i_product_name#48, i_brand#49, sum#58, count#59]
Keys [2]: [i_product_name#48, i_brand#49]
Functions [1]: [avg(qoh#55)]
Aggregate Attributes [1]: [avg(qoh#55)#60]
Results [5]: [i_product_name#48, i_brand#49, null AS i_class#61, null AS i_category#62, avg(qoh#55)#60 AS qoh#63]

(40) ReusedExchange [Reuses operator id: 21]
Output [6]: [i_product_name#64, i_brand#65, i_class#66, i_category#67, sum#68, count#69]

(41) CometColumnarToRow [codegen id : 22]
Input [6]: [i_product_name#64, i_brand#65, i_class#66, i_category#67, sum#68, count#69]

(42) HashAggregate [codegen id : 22]
Input [6]: [i_product_name#64, i_brand#65, i_class#66, i_category#67, sum#68, count#69]
Keys [4]: [i_product_name#64, i_brand#65, i_class#66, i_category#67]
Functions [1]: [avg(inv_quantity_on_hand#70)]
Aggregate Attributes [1]: [avg(inv_quantity_on_hand#70)#21]
Results [2]: [i_product_name#64, avg(inv_quantity_on_hand#70)#21 AS qoh#71]

(43) HashAggregate [codegen id : 22]
Input [2]: [i_product_name#64, qoh#71]
Keys [1]: [i_product_name#64]
Functions [1]: [partial_avg(qoh#71)]
Aggregate Attributes [2]: [sum#72, count#73]
Results [3]: [i_product_name#64, sum#74, count#75]

(44) CometColumnarExchange
Input [3]: [i_product_name#64, sum#74, count#75]
Arguments: hashpartitioning(i_product_name#64, 5), ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=6]

(45) CometColumnarToRow [codegen id : 23]
Input [3]: [i_product_name#64, sum#74, count#75]

(46) HashAggregate [codegen id : 23]
Input [3]: [i_product_name#64, sum#74, count#75]
Keys [1]: [i_product_name#64]
Functions [1]: [avg(qoh#71)]
Aggregate Attributes [1]: [avg(qoh#71)#76]
Results [5]: [i_product_name#64, null AS i_brand#77, null AS i_class#78, null AS i_category#79, avg(qoh#71)#76 AS qoh#80]

(47) ReusedExchange [Reuses operator id: 21]
Output [6]: [i_product_name#81, i_brand#82, i_class#83, i_category#84, sum#85, count#86]

(48) CometColumnarToRow [codegen id : 28]
Input [6]: [i_product_name#81, i_brand#82, i_class#83, i_category#84, sum#85, count#86]

(49) HashAggregate [codegen id : 28]
Input [6]: [i_product_name#81, i_brand#82, i_class#83, i_category#84, sum#85, count#86]
Keys [4]: [i_product_name#81, i_brand#82, i_class#83, i_category#84]
Functions [1]: [avg(inv_quantity_on_hand#87)]
Aggregate Attributes [1]: [avg(inv_quantity_on_hand#87)#21]
Results [1]: [avg(inv_quantity_on_hand#87)#21 AS qoh#88]

(50) HashAggregate [codegen id : 28]
Input [1]: [qoh#88]
Keys: []
Functions [1]: [partial_avg(qoh#88)]
Aggregate Attributes [2]: [sum#89, count#90]
Results [2]: [sum#91, count#92]

(51) CometColumnarExchange
Input [2]: [sum#91, count#92]
Arguments: SinglePartition, ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=7]

(52) CometColumnarToRow [codegen id : 29]
Input [2]: [sum#91, count#92]

(53) HashAggregate [codegen id : 29]
Input [2]: [sum#91, count#92]
Keys: []
Functions [1]: [avg(qoh#88)]
Aggregate Attributes [1]: [avg(qoh#88)#93]
Results [5]: [null AS i_product_name#94, null AS i_brand#95, null AS i_class#96, null AS i_category#97, avg(qoh#88)#93 AS qoh#98]

(54) Union

(55) TakeOrderedAndProject
Input [5]: [i_product_name#28, i_brand#29, i_class#30, i_category#31, qoh#32]
Arguments: 100, [qoh#32 ASC NULLS FIRST, i_product_name#28 ASC NULLS FIRST, i_brand#29 ASC NULLS FIRST, i_class#30 ASC NULLS FIRST, i_category#31 ASC NULLS FIRST], [i_product_name#28, i_brand#29, i_class#30, i_category#31, qoh#32]

===== Subqueries =====

Subquery:1 Hosting operator id = 1 Hosting Expression = inv_date_sk#4 IN dynamicpruning#5
BroadcastExchange (60)
+- * CometColumnarToRow (59)
   +- CometProject (58)
      +- CometFilter (57)
         +- CometNativeScan parquet spark_catalog.default.date_dim (56)


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

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

(58) CometProject
Input [2]: [d_date_sk#6, d_month_seq#99]
Arguments: [d_date_sk#6], [d_date_sk#6]

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

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


