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


(1) Scan parquet default.inventory
Output [4]: [inv_date_sk#1, inv_item_sk#2, inv_warehouse_sk#3, inv_quantity_on_hand#4]
Batched: true
Location [not included in comparison]/{warehouse_dir}/inventory]
PushedFilters: [IsNotNull(inv_date_sk), IsNotNull(inv_item_sk), IsNotNull(inv_warehouse_sk)]
ReadSchema: struct<inv_date_sk:int,inv_item_sk:int,inv_warehouse_sk:int,inv_quantity_on_hand:int>

(2) ColumnarToRow [codegen id : 4]
Input [4]: [inv_date_sk#1, inv_item_sk#2, inv_warehouse_sk#3, inv_quantity_on_hand#4]

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

(4) Scan parquet 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,1212), LessThanOrEqual(d_month_seq,1223), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_month_seq:int>

(5) ColumnarToRow [codegen id : 1]
Input [2]: [d_date_sk#5, d_month_seq#6]

(6) Filter [codegen id : 1]
Input [2]: [d_date_sk#5, d_month_seq#6]
Condition : (((isnotnull(d_month_seq#6) AND (d_month_seq#6 >= 1212)) AND (d_month_seq#6 <= 1223)) AND isnotnull(d_date_sk#5))

(7) Project [codegen id : 1]
Output [1]: [d_date_sk#5]
Input [2]: [d_date_sk#5, d_month_seq#6]

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

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

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

(11) Scan parquet 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>

(12) ColumnarToRow [codegen id : 2]
Input [5]: [i_item_sk#8, i_brand#9, i_class#10, i_category#11, i_product_name#12]

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

(14) BroadcastExchange
Input [5]: [i_item_sk#8, i_brand#9, i_class#10, i_category#11, i_product_name#12]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#13]

(15) BroadcastHashJoin [codegen id : 4]
Left keys [1]: [inv_item_sk#2]
Right keys [1]: [i_item_sk#8]
Join condition: None

(16) Project [codegen id : 4]
Output [6]: [inv_warehouse_sk#3, inv_quantity_on_hand#4, i_brand#9, i_class#10, i_category#11, i_product_name#12]
Input [8]: [inv_item_sk#2, inv_warehouse_sk#3, inv_quantity_on_hand#4, i_item_sk#8, i_brand#9, i_class#10, i_category#11, i_product_name#12]

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

(18) ColumnarToRow [codegen id : 3]
Input [1]: [w_warehouse_sk#14]

(19) Filter [codegen id : 3]
Input [1]: [w_warehouse_sk#14]
Condition : isnotnull(w_warehouse_sk#14)

(20) BroadcastExchange
Input [1]: [w_warehouse_sk#14]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#15]

(21) BroadcastHashJoin [codegen id : 4]
Left keys [1]: [inv_warehouse_sk#3]
Right keys [1]: [w_warehouse_sk#14]
Join condition: None

(22) Project [codegen id : 4]
Output [5]: [inv_quantity_on_hand#4, i_brand#9, i_class#10, i_category#11, i_product_name#12]
Input [7]: [inv_warehouse_sk#3, inv_quantity_on_hand#4, i_brand#9, i_class#10, i_category#11, i_product_name#12, w_warehouse_sk#14]

(23) HashAggregate [codegen id : 4]
Input [5]: [inv_quantity_on_hand#4, 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(cast(inv_quantity_on_hand#4 as bigint))]
Aggregate Attributes [2]: [sum#16, count#17]
Results [6]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, sum#18, count#19]

(24) Exchange
Input [6]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, sum#18, count#19]
Arguments: hashpartitioning(i_product_name#12, i_brand#9, i_class#10, i_category#11, 5), true, [id=#20]

(25) HashAggregate [codegen id : 5]
Input [6]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, sum#18, count#19]
Keys [4]: [i_product_name#12, i_brand#9, i_class#10, i_category#11]
Functions [1]: [avg(cast(inv_quantity_on_hand#4 as bigint))]
Aggregate Attributes [1]: [avg(cast(inv_quantity_on_hand#4 as bigint))#21]
Results [5]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, avg(cast(inv_quantity_on_hand#4 as bigint))#21 AS qoh#22]

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

(27) HashAggregate [codegen id : 5]
Input [6]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, sum#25, count#26]
Keys [4]: [i_product_name#12, i_brand#9, i_class#10, i_category#11]
Functions [1]: [avg(qoh#22)]
Aggregate Attributes [1]: [avg(qoh#22)#27]
Results [5]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, avg(qoh#22)#27 AS qoh#28]

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

(29) HashAggregate [codegen id : 10]
Input [6]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, sum#29, count#30]
Keys [4]: [i_product_name#12, i_brand#9, i_class#10, i_category#11]
Functions [1]: [avg(cast(inv_quantity_on_hand#4 as bigint))]
Aggregate Attributes [1]: [avg(cast(inv_quantity_on_hand#4 as bigint))#31]
Results [4]: [i_product_name#12, i_brand#9, i_class#10, avg(cast(inv_quantity_on_hand#4 as bigint))#31 AS qoh#22]

(30) HashAggregate [codegen id : 10]
Input [4]: [i_product_name#12, i_brand#9, i_class#10, qoh#22]
Keys [3]: [i_product_name#12, i_brand#9, i_class#10]
Functions [1]: [partial_avg(qoh#22)]
Aggregate Attributes [2]: [sum#32, count#33]
Results [5]: [i_product_name#12, i_brand#9, i_class#10, sum#34, count#35]

(31) Exchange
Input [5]: [i_product_name#12, i_brand#9, i_class#10, sum#34, count#35]
Arguments: hashpartitioning(i_product_name#12, i_brand#9, i_class#10, 5), true, [id=#36]

(32) HashAggregate [codegen id : 11]
Input [5]: [i_product_name#12, i_brand#9, i_class#10, sum#34, count#35]
Keys [3]: [i_product_name#12, i_brand#9, i_class#10]
Functions [1]: [avg(qoh#22)]
Aggregate Attributes [1]: [avg(qoh#22)#37]
Results [5]: [i_product_name#12, i_brand#9, i_class#10, null AS i_category#38, avg(qoh#22)#37 AS qoh#39]

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

(34) HashAggregate [codegen id : 16]
Input [6]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, sum#40, count#41]
Keys [4]: [i_product_name#12, i_brand#9, i_class#10, i_category#11]
Functions [1]: [avg(cast(inv_quantity_on_hand#4 as bigint))]
Aggregate Attributes [1]: [avg(cast(inv_quantity_on_hand#4 as bigint))#42]
Results [3]: [i_product_name#12, i_brand#9, avg(cast(inv_quantity_on_hand#4 as bigint))#42 AS qoh#22]

(35) HashAggregate [codegen id : 16]
Input [3]: [i_product_name#12, i_brand#9, qoh#22]
Keys [2]: [i_product_name#12, i_brand#9]
Functions [1]: [partial_avg(qoh#22)]
Aggregate Attributes [2]: [sum#43, count#44]
Results [4]: [i_product_name#12, i_brand#9, sum#45, count#46]

(36) Exchange
Input [4]: [i_product_name#12, i_brand#9, sum#45, count#46]
Arguments: hashpartitioning(i_product_name#12, i_brand#9, 5), true, [id=#47]

(37) HashAggregate [codegen id : 17]
Input [4]: [i_product_name#12, i_brand#9, sum#45, count#46]
Keys [2]: [i_product_name#12, i_brand#9]
Functions [1]: [avg(qoh#22)]
Aggregate Attributes [1]: [avg(qoh#22)#48]
Results [5]: [i_product_name#12, i_brand#9, null AS i_class#49, null AS i_category#50, avg(qoh#22)#48 AS qoh#51]

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

(39) HashAggregate [codegen id : 22]
Input [6]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, sum#52, count#53]
Keys [4]: [i_product_name#12, i_brand#9, i_class#10, i_category#11]
Functions [1]: [avg(cast(inv_quantity_on_hand#4 as bigint))]
Aggregate Attributes [1]: [avg(cast(inv_quantity_on_hand#4 as bigint))#54]
Results [2]: [i_product_name#12, avg(cast(inv_quantity_on_hand#4 as bigint))#54 AS qoh#22]

(40) HashAggregate [codegen id : 22]
Input [2]: [i_product_name#12, qoh#22]
Keys [1]: [i_product_name#12]
Functions [1]: [partial_avg(qoh#22)]
Aggregate Attributes [2]: [sum#55, count#56]
Results [3]: [i_product_name#12, sum#57, count#58]

(41) Exchange
Input [3]: [i_product_name#12, sum#57, count#58]
Arguments: hashpartitioning(i_product_name#12, 5), true, [id=#59]

(42) HashAggregate [codegen id : 23]
Input [3]: [i_product_name#12, sum#57, count#58]
Keys [1]: [i_product_name#12]
Functions [1]: [avg(qoh#22)]
Aggregate Attributes [1]: [avg(qoh#22)#60]
Results [5]: [i_product_name#12, null AS i_brand#61, null AS i_class#62, null AS i_category#63, avg(qoh#22)#60 AS qoh#64]

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

(44) HashAggregate [codegen id : 28]
Input [6]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, sum#65, count#66]
Keys [4]: [i_product_name#12, i_brand#9, i_class#10, i_category#11]
Functions [1]: [avg(cast(inv_quantity_on_hand#4 as bigint))]
Aggregate Attributes [1]: [avg(cast(inv_quantity_on_hand#4 as bigint))#67]
Results [1]: [avg(cast(inv_quantity_on_hand#4 as bigint))#67 AS qoh#22]

(45) HashAggregate [codegen id : 28]
Input [1]: [qoh#22]
Keys: []
Functions [1]: [partial_avg(qoh#22)]
Aggregate Attributes [2]: [sum#68, count#69]
Results [2]: [sum#70, count#71]

(46) Exchange
Input [2]: [sum#70, count#71]
Arguments: SinglePartition, true, [id=#72]

(47) HashAggregate [codegen id : 29]
Input [2]: [sum#70, count#71]
Keys: []
Functions [1]: [avg(qoh#22)]
Aggregate Attributes [1]: [avg(qoh#22)#73]
Results [5]: [null AS i_product_name#74, null AS i_brand#75, null AS i_class#76, null AS i_category#77, avg(qoh#22)#73 AS qoh#78]

(48) Union

(49) TakeOrderedAndProject
Input [5]: [i_product_name#12, i_brand#9, i_class#10, i_category#11, qoh#28]
Arguments: 100, [qoh#28 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#28]

