== 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, staticinvoke(class org.apache.spark.sql.catalyst.util.CharVarcharCodegenUtils, StringType, readSidePadding, i_brand#8, 50, true, false, true) AS i_brand#12, staticinvoke(class org.apache.spark.sql.catalyst.util.CharVarcharCodegenUtils, StringType, readSidePadding, i_class#9, 50, true, false, true) AS i_class#13, staticinvoke(class org.apache.spark.sql.catalyst.util.CharVarcharCodegenUtils, StringType, readSidePadding, i_category#10, 50, true, false, true) AS i_category#14, staticinvoke(class org.apache.spark.sql.catalyst.util.CharVarcharCodegenUtils, StringType, readSidePadding, i_product_name#11, 50, true, false, true) 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 AS i_product_name#22, i_brand#12 AS i_brand#23, i_class#13 AS i_class#24, i_category#14 AS i_category#25, avg(inv_quantity_on_hand#3)#21 AS qoh#26]

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

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

(26) ReusedExchange [Reuses operator id: 21]
Output [6]: [i_product_name#15, i_brand#12, i_class#13, i_category#14, sum#33, count#34]

(27) CometColumnarToRow [codegen id : 10]
Input [6]: [i_product_name#15, i_brand#12, i_class#13, i_category#14, sum#33, count#34]

(28) HashAggregate [codegen id : 10]
Input [6]: [i_product_name#15, i_brand#12, i_class#13, i_category#14, sum#33, count#34]
Keys [4]: [i_product_name#15, i_brand#12, i_class#13, i_category#14]
Functions [1]: [avg(inv_quantity_on_hand#35)]
Aggregate Attributes [1]: [avg(inv_quantity_on_hand#35)#21]
Results [4]: [i_product_name#15, i_brand#12, i_class#13, avg(inv_quantity_on_hand#35)#21 AS qoh#36]

(29) HashAggregate [codegen id : 10]
Input [4]: [i_product_name#15, i_brand#12, i_class#13, qoh#36]
Keys [3]: [i_product_name#15, i_brand#12, i_class#13]
Functions [1]: [partial_avg(qoh#36)]
Aggregate Attributes [2]: [sum#37, count#38]
Results [5]: [i_product_name#15, i_brand#12, i_class#13, sum#39, count#40]

(30) CometColumnarExchange
Input [5]: [i_product_name#15, i_brand#12, i_class#13, sum#39, count#40]
Arguments: hashpartitioning(i_product_name#15, i_brand#12, i_class#13, 5), ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=4]

(31) CometColumnarToRow [codegen id : 11]
Input [5]: [i_product_name#15, i_brand#12, i_class#13, sum#39, count#40]

(32) HashAggregate [codegen id : 11]
Input [5]: [i_product_name#15, i_brand#12, i_class#13, sum#39, count#40]
Keys [3]: [i_product_name#15, i_brand#12, i_class#13]
Functions [1]: [avg(qoh#36)]
Aggregate Attributes [1]: [avg(qoh#36)#41]
Results [5]: [i_product_name#15, i_brand#12, i_class#13, null AS i_category#42, avg(qoh#36)#41 AS qoh#43]

(33) ReusedExchange [Reuses operator id: 21]
Output [6]: [i_product_name#15, i_brand#12, i_class#13, i_category#14, sum#44, count#45]

(34) CometColumnarToRow [codegen id : 16]
Input [6]: [i_product_name#15, i_brand#12, i_class#13, i_category#14, sum#44, count#45]

(35) HashAggregate [codegen id : 16]
Input [6]: [i_product_name#15, i_brand#12, i_class#13, i_category#14, sum#44, count#45]
Keys [4]: [i_product_name#15, i_brand#12, i_class#13, i_category#14]
Functions [1]: [avg(inv_quantity_on_hand#46)]
Aggregate Attributes [1]: [avg(inv_quantity_on_hand#46)#21]
Results [3]: [i_product_name#15, i_brand#12, avg(inv_quantity_on_hand#46)#21 AS qoh#47]

(36) HashAggregate [codegen id : 16]
Input [3]: [i_product_name#15, i_brand#12, qoh#47]
Keys [2]: [i_product_name#15, i_brand#12]
Functions [1]: [partial_avg(qoh#47)]
Aggregate Attributes [2]: [sum#48, count#49]
Results [4]: [i_product_name#15, i_brand#12, sum#50, count#51]

(37) CometColumnarExchange
Input [4]: [i_product_name#15, i_brand#12, sum#50, count#51]
Arguments: hashpartitioning(i_product_name#15, i_brand#12, 5), ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=5]

(38) CometColumnarToRow [codegen id : 17]
Input [4]: [i_product_name#15, i_brand#12, sum#50, count#51]

(39) HashAggregate [codegen id : 17]
Input [4]: [i_product_name#15, i_brand#12, sum#50, count#51]
Keys [2]: [i_product_name#15, i_brand#12]
Functions [1]: [avg(qoh#47)]
Aggregate Attributes [1]: [avg(qoh#47)#52]
Results [5]: [i_product_name#15, i_brand#12, null AS i_class#53, null AS i_category#54, avg(qoh#47)#52 AS qoh#55]

(40) ReusedExchange [Reuses operator id: 21]
Output [6]: [i_product_name#15, i_brand#12, i_class#13, i_category#14, sum#56, count#57]

(41) CometColumnarToRow [codegen id : 22]
Input [6]: [i_product_name#15, i_brand#12, i_class#13, i_category#14, sum#56, count#57]

(42) HashAggregate [codegen id : 22]
Input [6]: [i_product_name#15, i_brand#12, i_class#13, i_category#14, sum#56, count#57]
Keys [4]: [i_product_name#15, i_brand#12, i_class#13, i_category#14]
Functions [1]: [avg(inv_quantity_on_hand#58)]
Aggregate Attributes [1]: [avg(inv_quantity_on_hand#58)#21]
Results [2]: [i_product_name#15, avg(inv_quantity_on_hand#58)#21 AS qoh#59]

(43) HashAggregate [codegen id : 22]
Input [2]: [i_product_name#15, qoh#59]
Keys [1]: [i_product_name#15]
Functions [1]: [partial_avg(qoh#59)]
Aggregate Attributes [2]: [sum#60, count#61]
Results [3]: [i_product_name#15, sum#62, count#63]

(44) CometColumnarExchange
Input [3]: [i_product_name#15, sum#62, count#63]
Arguments: hashpartitioning(i_product_name#15, 5), ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=6]

(45) CometColumnarToRow [codegen id : 23]
Input [3]: [i_product_name#15, sum#62, count#63]

(46) HashAggregate [codegen id : 23]
Input [3]: [i_product_name#15, sum#62, count#63]
Keys [1]: [i_product_name#15]
Functions [1]: [avg(qoh#59)]
Aggregate Attributes [1]: [avg(qoh#59)#64]
Results [5]: [i_product_name#15, null AS i_brand#65, null AS i_class#66, null AS i_category#67, avg(qoh#59)#64 AS qoh#68]

(47) ReusedExchange [Reuses operator id: 21]
Output [6]: [i_product_name#15, i_brand#12, i_class#13, i_category#14, sum#69, count#70]

(48) CometColumnarToRow [codegen id : 28]
Input [6]: [i_product_name#15, i_brand#12, i_class#13, i_category#14, sum#69, count#70]

(49) HashAggregate [codegen id : 28]
Input [6]: [i_product_name#15, i_brand#12, i_class#13, i_category#14, sum#69, count#70]
Keys [4]: [i_product_name#15, i_brand#12, i_class#13, i_category#14]
Functions [1]: [avg(inv_quantity_on_hand#71)]
Aggregate Attributes [1]: [avg(inv_quantity_on_hand#71)#21]
Results [1]: [avg(inv_quantity_on_hand#71)#21 AS qoh#72]

(50) HashAggregate [codegen id : 28]
Input [1]: [qoh#72]
Keys: []
Functions [1]: [partial_avg(qoh#72)]
Aggregate Attributes [2]: [sum#73, count#74]
Results [2]: [sum#75, count#76]

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

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

(53) HashAggregate [codegen id : 29]
Input [2]: [sum#75, count#76]
Keys: []
Functions [1]: [avg(qoh#72)]
Aggregate Attributes [1]: [avg(qoh#72)#77]
Results [5]: [null AS i_product_name#78, null AS i_brand#79, null AS i_class#80, null AS i_category#81, avg(qoh#72)#77 AS qoh#82]

(54) Union

(55) TakeOrderedAndProject
Input [5]: [i_product_name#22, i_brand#23, i_class#24, i_category#25, qoh#32]
Arguments: 100, [qoh#32 ASC NULLS FIRST, i_product_name#22 ASC NULLS FIRST, i_brand#23 ASC NULLS FIRST, i_class#24 ASC NULLS FIRST, i_category#25 ASC NULLS FIRST], [i_product_name#22, i_brand#23, i_class#24, i_category#25, 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#83]
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#83]
Condition : (((isnotnull(d_month_seq#83) AND (d_month_seq#83 >= 1212)) AND (d_month_seq#83 <= 1223)) AND isnotnull(d_date_sk#6))

(58) CometProject
Input [2]: [d_date_sk#6, d_month_seq#83]
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]


