== Physical Plan ==
TakeOrderedAndProject (28)
+- * HashAggregate (27)
   +- Exchange (26)
      +- * HashAggregate (25)
         +- * Expand (24)
            +- BroadcastNestedLoopJoin Inner BuildRight (23)
               :- * Project (19)
               :  +- * SortMergeJoin Inner (18)
               :     :- * Sort (12)
               :     :  +- Exchange (11)
               :     :     +- * 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)
               :     +- * Sort (17)
               :        +- Exchange (16)
               :           +- * Filter (15)
               :              +- * ColumnarToRow (14)
               :                 +- Scan parquet default.item (13)
               +- BroadcastExchange (22)
                  +- * ColumnarToRow (21)
                     +- Scan parquet default.warehouse (20)


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

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

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

(4) Scan parquet default.date_dim
Output [2]: [d_date_sk#4, d_month_seq#5]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_month_seq), GreaterThanOrEqual(d_month_seq,1200), LessThanOrEqual(d_month_seq,1211), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_month_seq:int>

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

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

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

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

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

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

(11) Exchange
Input [2]: [inv_item_sk#2, inv_quantity_on_hand#3]
Arguments: hashpartitioning(inv_item_sk#2, 5), true, [id=#7]

(12) Sort [codegen id : 3]
Input [2]: [inv_item_sk#2, inv_quantity_on_hand#3]
Arguments: [inv_item_sk#2 ASC NULLS FIRST], false, 0

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

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

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

(16) Exchange
Input [5]: [i_item_sk#8, i_brand#9, i_class#10, i_category#11, i_product_name#12]
Arguments: hashpartitioning(i_item_sk#8, 5), true, [id=#13]

(17) Sort [codegen id : 5]
Input [5]: [i_item_sk#8, i_brand#9, i_class#10, i_category#11, i_product_name#12]
Arguments: [i_item_sk#8 ASC NULLS FIRST], false, 0

(18) SortMergeJoin [codegen id : 6]
Left keys [1]: [inv_item_sk#2]
Right keys [1]: [i_item_sk#8]
Join condition: None

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

(20) Scan parquet default.warehouse
Output: []
Batched: true
Location [not included in comparison]/{warehouse_dir}/warehouse]
ReadSchema: struct<>

(21) ColumnarToRow [codegen id : 7]
Input: []

(22) BroadcastExchange
Input: []
Arguments: IdentityBroadcastMode, [id=#14]

(23) BroadcastNestedLoopJoin
Join condition: None

(24) Expand [codegen id : 8]
Input [5]: [inv_quantity_on_hand#3, i_brand#9, i_class#10, i_category#11, i_product_name#12]
Arguments: [List(inv_quantity_on_hand#3, i_product_name#12, i_brand#9, i_class#10, i_category#11, 0), List(inv_quantity_on_hand#3, i_product_name#12, i_brand#9, i_class#10, null, 1), List(inv_quantity_on_hand#3, i_product_name#12, i_brand#9, null, null, 3), List(inv_quantity_on_hand#3, i_product_name#12, null, null, null, 7), List(inv_quantity_on_hand#3, null, null, null, null, 15)], [inv_quantity_on_hand#3, i_product_name#15, i_brand#16, i_class#17, i_category#18, spark_grouping_id#19]

(25) HashAggregate [codegen id : 8]
Input [6]: [inv_quantity_on_hand#3, i_product_name#15, i_brand#16, i_class#17, i_category#18, spark_grouping_id#19]
Keys [5]: [i_product_name#15, i_brand#16, i_class#17, i_category#18, spark_grouping_id#19]
Functions [1]: [partial_avg(cast(inv_quantity_on_hand#3 as bigint))]
Aggregate Attributes [2]: [sum#20, count#21]
Results [7]: [i_product_name#15, i_brand#16, i_class#17, i_category#18, spark_grouping_id#19, sum#22, count#23]

(26) Exchange
Input [7]: [i_product_name#15, i_brand#16, i_class#17, i_category#18, spark_grouping_id#19, sum#22, count#23]
Arguments: hashpartitioning(i_product_name#15, i_brand#16, i_class#17, i_category#18, spark_grouping_id#19, 5), true, [id=#24]

(27) HashAggregate [codegen id : 9]
Input [7]: [i_product_name#15, i_brand#16, i_class#17, i_category#18, spark_grouping_id#19, sum#22, count#23]
Keys [5]: [i_product_name#15, i_brand#16, i_class#17, i_category#18, spark_grouping_id#19]
Functions [1]: [avg(cast(inv_quantity_on_hand#3 as bigint))]
Aggregate Attributes [1]: [avg(cast(inv_quantity_on_hand#3 as bigint))#25]
Results [5]: [i_product_name#15, i_brand#16, i_class#17, i_category#18, avg(cast(inv_quantity_on_hand#3 as bigint))#25 AS qoh#26]

(28) TakeOrderedAndProject
Input [5]: [i_product_name#15, i_brand#16, i_class#17, i_category#18, qoh#26]
Arguments: 100, [qoh#26 ASC NULLS FIRST, i_product_name#15 ASC NULLS FIRST, i_brand#16 ASC NULLS FIRST, i_class#17 ASC NULLS FIRST, i_category#18 ASC NULLS FIRST], [i_product_name#15, i_brand#16, i_class#17, i_category#18, qoh#26]

