== Physical Plan ==
TakeOrderedAndProject (34)
+- * Filter (33)
   +- Window (32)
      +- * Sort (31)
         +- Exchange (30)
            +- * HashAggregate (29)
               +- Exchange (28)
                  +- * HashAggregate (27)
                     +- * Expand (26)
                        +- * Project (25)
                           +- * SortMergeJoin Inner (24)
                              :- * Sort (18)
                              :  +- Exchange (17)
                              :     +- * Project (16)
                              :        +- * BroadcastHashJoin Inner BuildRight (15)
                              :           :- * Project (10)
                              :           :  +- * BroadcastHashJoin Inner BuildRight (9)
                              :           :     :- * Filter (3)
                              :           :     :  +- * ColumnarToRow (2)
                              :           :     :     +- Scan parquet default.store_sales (1)
                              :           :     +- BroadcastExchange (8)
                              :           :        +- * Project (7)
                              :           :           +- * Filter (6)
                              :           :              +- * ColumnarToRow (5)
                              :           :                 +- Scan parquet default.date_dim (4)
                              :           +- BroadcastExchange (14)
                              :              +- * Filter (13)
                              :                 +- * ColumnarToRow (12)
                              :                    +- Scan parquet default.store (11)
                              +- * Sort (23)
                                 +- Exchange (22)
                                    +- * Filter (21)
                                       +- * ColumnarToRow (20)
                                          +- Scan parquet default.item (19)


(1) Scan parquet default.store_sales
Output [5]: [ss_sold_date_sk#1, ss_item_sk#2, ss_store_sk#3, ss_quantity#4, ss_sales_price#5]
Batched: true
Location [not included in comparison]/{warehouse_dir}/store_sales]
PushedFilters: [IsNotNull(ss_sold_date_sk), IsNotNull(ss_store_sk), IsNotNull(ss_item_sk)]
ReadSchema: struct<ss_sold_date_sk:int,ss_item_sk:int,ss_store_sk:int,ss_quantity:int,ss_sales_price:decimal(7,2)>

(2) ColumnarToRow [codegen id : 3]
Input [5]: [ss_sold_date_sk#1, ss_item_sk#2, ss_store_sk#3, ss_quantity#4, ss_sales_price#5]

(3) Filter [codegen id : 3]
Input [5]: [ss_sold_date_sk#1, ss_item_sk#2, ss_store_sk#3, ss_quantity#4, ss_sales_price#5]
Condition : ((isnotnull(ss_sold_date_sk#1) AND isnotnull(ss_store_sk#3)) AND isnotnull(ss_item_sk#2))

(4) Scan parquet default.date_dim
Output [5]: [d_date_sk#6, d_month_seq#7, d_year#8, d_moy#9, d_qoy#10]
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,d_year:int,d_moy:int,d_qoy:int>

(5) ColumnarToRow [codegen id : 1]
Input [5]: [d_date_sk#6, d_month_seq#7, d_year#8, d_moy#9, d_qoy#10]

(6) Filter [codegen id : 1]
Input [5]: [d_date_sk#6, d_month_seq#7, d_year#8, d_moy#9, d_qoy#10]
Condition : (((isnotnull(d_month_seq#7) AND (d_month_seq#7 >= 1200)) AND (d_month_seq#7 <= 1211)) AND isnotnull(d_date_sk#6))

(7) Project [codegen id : 1]
Output [4]: [d_date_sk#6, d_year#8, d_moy#9, d_qoy#10]
Input [5]: [d_date_sk#6, d_month_seq#7, d_year#8, d_moy#9, d_qoy#10]

(8) BroadcastExchange
Input [4]: [d_date_sk#6, d_year#8, d_moy#9, d_qoy#10]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [id=#11]

(9) BroadcastHashJoin [codegen id : 3]
Left keys [1]: [ss_sold_date_sk#1]
Right keys [1]: [d_date_sk#6]
Join condition: None

(10) Project [codegen id : 3]
Output [7]: [ss_item_sk#2, ss_store_sk#3, ss_quantity#4, ss_sales_price#5, d_year#8, d_moy#9, d_qoy#10]
Input [9]: [ss_sold_date_sk#1, ss_item_sk#2, ss_store_sk#3, ss_quantity#4, ss_sales_price#5, d_date_sk#6, d_year#8, d_moy#9, d_qoy#10]

(11) Scan parquet default.store
Output [2]: [s_store_sk#12, s_store_id#13]
Batched: true
Location [not included in comparison]/{warehouse_dir}/store]
PushedFilters: [IsNotNull(s_store_sk)]
ReadSchema: struct<s_store_sk:int,s_store_id:string>

(12) ColumnarToRow [codegen id : 2]
Input [2]: [s_store_sk#12, s_store_id#13]

(13) Filter [codegen id : 2]
Input [2]: [s_store_sk#12, s_store_id#13]
Condition : isnotnull(s_store_sk#12)

(14) BroadcastExchange
Input [2]: [s_store_sk#12, s_store_id#13]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#14]

(15) BroadcastHashJoin [codegen id : 3]
Left keys [1]: [ss_store_sk#3]
Right keys [1]: [s_store_sk#12]
Join condition: None

(16) Project [codegen id : 3]
Output [7]: [ss_item_sk#2, ss_quantity#4, ss_sales_price#5, d_year#8, d_moy#9, d_qoy#10, s_store_id#13]
Input [9]: [ss_item_sk#2, ss_store_sk#3, ss_quantity#4, ss_sales_price#5, d_year#8, d_moy#9, d_qoy#10, s_store_sk#12, s_store_id#13]

(17) Exchange
Input [7]: [ss_item_sk#2, ss_quantity#4, ss_sales_price#5, d_year#8, d_moy#9, d_qoy#10, s_store_id#13]
Arguments: hashpartitioning(ss_item_sk#2, 5), true, [id=#15]

(18) Sort [codegen id : 4]
Input [7]: [ss_item_sk#2, ss_quantity#4, ss_sales_price#5, d_year#8, d_moy#9, d_qoy#10, s_store_id#13]
Arguments: [ss_item_sk#2 ASC NULLS FIRST], false, 0

(19) Scan parquet default.item
Output [5]: [i_item_sk#16, i_brand#17, i_class#18, i_category#19, i_product_name#20]
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>

(20) ColumnarToRow [codegen id : 5]
Input [5]: [i_item_sk#16, i_brand#17, i_class#18, i_category#19, i_product_name#20]

(21) Filter [codegen id : 5]
Input [5]: [i_item_sk#16, i_brand#17, i_class#18, i_category#19, i_product_name#20]
Condition : isnotnull(i_item_sk#16)

(22) Exchange
Input [5]: [i_item_sk#16, i_brand#17, i_class#18, i_category#19, i_product_name#20]
Arguments: hashpartitioning(i_item_sk#16, 5), true, [id=#21]

(23) Sort [codegen id : 6]
Input [5]: [i_item_sk#16, i_brand#17, i_class#18, i_category#19, i_product_name#20]
Arguments: [i_item_sk#16 ASC NULLS FIRST], false, 0

(24) SortMergeJoin [codegen id : 7]
Left keys [1]: [ss_item_sk#2]
Right keys [1]: [i_item_sk#16]
Join condition: None

(25) Project [codegen id : 7]
Output [10]: [ss_quantity#4, ss_sales_price#5, i_category#19, i_class#18, i_brand#17, i_product_name#20, d_year#8, d_qoy#10, d_moy#9, s_store_id#13]
Input [12]: [ss_item_sk#2, ss_quantity#4, ss_sales_price#5, d_year#8, d_moy#9, d_qoy#10, s_store_id#13, i_item_sk#16, i_brand#17, i_class#18, i_category#19, i_product_name#20]

(26) Expand [codegen id : 7]
Input [10]: [ss_quantity#4, ss_sales_price#5, i_category#19, i_class#18, i_brand#17, i_product_name#20, d_year#8, d_qoy#10, d_moy#9, s_store_id#13]
Arguments: [List(ss_quantity#4, ss_sales_price#5, i_category#19, i_class#18, i_brand#17, i_product_name#20, d_year#8, d_qoy#10, d_moy#9, s_store_id#13, 0), List(ss_quantity#4, ss_sales_price#5, i_category#19, i_class#18, i_brand#17, i_product_name#20, d_year#8, d_qoy#10, d_moy#9, null, 1), List(ss_quantity#4, ss_sales_price#5, i_category#19, i_class#18, i_brand#17, i_product_name#20, d_year#8, d_qoy#10, null, null, 3), List(ss_quantity#4, ss_sales_price#5, i_category#19, i_class#18, i_brand#17, i_product_name#20, d_year#8, null, null, null, 7), List(ss_quantity#4, ss_sales_price#5, i_category#19, i_class#18, i_brand#17, i_product_name#20, null, null, null, null, 15), List(ss_quantity#4, ss_sales_price#5, i_category#19, i_class#18, i_brand#17, null, null, null, null, null, 31), List(ss_quantity#4, ss_sales_price#5, i_category#19, i_class#18, null, null, null, null, null, null, 63), List(ss_quantity#4, ss_sales_price#5, i_category#19, null, null, null, null, null, null, null, 127), List(ss_quantity#4, ss_sales_price#5, null, null, null, null, null, null, null, null, 255)], [ss_quantity#4, ss_sales_price#5, i_category#22, i_class#23, i_brand#24, i_product_name#25, d_year#26, d_qoy#27, d_moy#28, s_store_id#29, spark_grouping_id#30]

(27) HashAggregate [codegen id : 7]
Input [11]: [ss_quantity#4, ss_sales_price#5, i_category#22, i_class#23, i_brand#24, i_product_name#25, d_year#26, d_qoy#27, d_moy#28, s_store_id#29, spark_grouping_id#30]
Keys [9]: [i_category#22, i_class#23, i_brand#24, i_product_name#25, d_year#26, d_qoy#27, d_moy#28, s_store_id#29, spark_grouping_id#30]
Functions [1]: [partial_sum(coalesce(CheckOverflow((promote_precision(cast(ss_sales_price#5 as decimal(12,2))) * promote_precision(cast(cast(ss_quantity#4 as decimal(10,0)) as decimal(12,2)))), DecimalType(18,2), true), 0.00))]
Aggregate Attributes [2]: [sum#31, isEmpty#32]
Results [11]: [i_category#22, i_class#23, i_brand#24, i_product_name#25, d_year#26, d_qoy#27, d_moy#28, s_store_id#29, spark_grouping_id#30, sum#33, isEmpty#34]

(28) Exchange
Input [11]: [i_category#22, i_class#23, i_brand#24, i_product_name#25, d_year#26, d_qoy#27, d_moy#28, s_store_id#29, spark_grouping_id#30, sum#33, isEmpty#34]
Arguments: hashpartitioning(i_category#22, i_class#23, i_brand#24, i_product_name#25, d_year#26, d_qoy#27, d_moy#28, s_store_id#29, spark_grouping_id#30, 5), true, [id=#35]

(29) HashAggregate [codegen id : 8]
Input [11]: [i_category#22, i_class#23, i_brand#24, i_product_name#25, d_year#26, d_qoy#27, d_moy#28, s_store_id#29, spark_grouping_id#30, sum#33, isEmpty#34]
Keys [9]: [i_category#22, i_class#23, i_brand#24, i_product_name#25, d_year#26, d_qoy#27, d_moy#28, s_store_id#29, spark_grouping_id#30]
Functions [1]: [sum(coalesce(CheckOverflow((promote_precision(cast(ss_sales_price#5 as decimal(12,2))) * promote_precision(cast(cast(ss_quantity#4 as decimal(10,0)) as decimal(12,2)))), DecimalType(18,2), true), 0.00))]
Aggregate Attributes [1]: [sum(coalesce(CheckOverflow((promote_precision(cast(ss_sales_price#5 as decimal(12,2))) * promote_precision(cast(cast(ss_quantity#4 as decimal(10,0)) as decimal(12,2)))), DecimalType(18,2), true), 0.00))#36]
Results [9]: [i_category#22, i_class#23, i_brand#24, i_product_name#25, d_year#26, d_qoy#27, d_moy#28, s_store_id#29, sum(coalesce(CheckOverflow((promote_precision(cast(ss_sales_price#5 as decimal(12,2))) * promote_precision(cast(cast(ss_quantity#4 as decimal(10,0)) as decimal(12,2)))), DecimalType(18,2), true), 0.00))#36 AS sumsales#37]

(30) Exchange
Input [9]: [i_category#22, i_class#23, i_brand#24, i_product_name#25, d_year#26, d_qoy#27, d_moy#28, s_store_id#29, sumsales#37]
Arguments: hashpartitioning(i_category#22, 5), true, [id=#38]

(31) Sort [codegen id : 9]
Input [9]: [i_category#22, i_class#23, i_brand#24, i_product_name#25, d_year#26, d_qoy#27, d_moy#28, s_store_id#29, sumsales#37]
Arguments: [i_category#22 ASC NULLS FIRST, sumsales#37 DESC NULLS LAST], false, 0

(32) Window
Input [9]: [i_category#22, i_class#23, i_brand#24, i_product_name#25, d_year#26, d_qoy#27, d_moy#28, s_store_id#29, sumsales#37]
Arguments: [rank(sumsales#37) windowspecdefinition(i_category#22, sumsales#37 DESC NULLS LAST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS rk#39], [i_category#22], [sumsales#37 DESC NULLS LAST]

(33) Filter [codegen id : 10]
Input [10]: [i_category#22, i_class#23, i_brand#24, i_product_name#25, d_year#26, d_qoy#27, d_moy#28, s_store_id#29, sumsales#37, rk#39]
Condition : (isnotnull(rk#39) AND (rk#39 <= 100))

(34) TakeOrderedAndProject
Input [10]: [i_category#22, i_class#23, i_brand#24, i_product_name#25, d_year#26, d_qoy#27, d_moy#28, s_store_id#29, sumsales#37, rk#39]
Arguments: 100, [i_category#22 ASC NULLS FIRST, i_class#23 ASC NULLS FIRST, i_brand#24 ASC NULLS FIRST, i_product_name#25 ASC NULLS FIRST, d_year#26 ASC NULLS FIRST, d_qoy#27 ASC NULLS FIRST, d_moy#28 ASC NULLS FIRST, s_store_id#29 ASC NULLS FIRST, sumsales#37 ASC NULLS FIRST, rk#39 ASC NULLS FIRST], [i_category#22, i_class#23, i_brand#24, i_product_name#25, d_year#26, d_qoy#27, d_moy#28, s_store_id#29, sumsales#37, rk#39]

