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


(1) Scan parquet default.store_sales
Output [5]: [ss_item_sk#1, ss_store_sk#2, ss_quantity#3, ss_sales_price#4, ss_sold_date_sk#5]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#5), dynamicpruningexpression(ss_sold_date_sk#5 IN dynamicpruning#6)]
PushedFilters: [IsNotNull(ss_store_sk), IsNotNull(ss_item_sk)]
ReadSchema: struct<ss_item_sk:int,ss_store_sk:int,ss_quantity:int,ss_sales_price:decimal(7,2)>

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

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

(4) ReusedExchange [Reuses operator id: 32]
Output [4]: [d_date_sk#7, d_year#8, d_moy#9, d_qoy#10]

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

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

(7) Scan parquet default.store
Output [2]: [s_store_sk#11, s_store_id#12]
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>

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

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

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

(11) BroadcastHashJoin [codegen id : 4]
Left keys [1]: [ss_store_sk#2]
Right keys [1]: [s_store_sk#11]
Join condition: None

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

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

(15) Filter [codegen id : 3]
Input [5]: [i_item_sk#14, i_brand#15, i_class#16, i_category#17, i_product_name#18]
Condition : isnotnull(i_item_sk#14)

(16) BroadcastExchange
Input [5]: [i_item_sk#14, i_brand#15, i_class#16, i_category#17, i_product_name#18]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#19]

(17) BroadcastHashJoin [codegen id : 4]
Left keys [1]: [ss_item_sk#1]
Right keys [1]: [i_item_sk#14]
Join condition: None

(18) Project [codegen id : 4]
Output [10]: [ss_quantity#3, ss_sales_price#4, i_category#17, i_class#16, i_brand#15, i_product_name#18, d_year#8, d_qoy#10, d_moy#9, s_store_id#12]
Input [12]: [ss_item_sk#1, ss_quantity#3, ss_sales_price#4, d_year#8, d_moy#9, d_qoy#10, s_store_id#12, i_item_sk#14, i_brand#15, i_class#16, i_category#17, i_product_name#18]

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

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

(21) Exchange
Input [11]: [i_category#20, i_class#21, i_brand#22, i_product_name#23, d_year#24, d_qoy#25, d_moy#26, s_store_id#27, spark_grouping_id#28, sum#31, isEmpty#32]
Arguments: hashpartitioning(i_category#20, i_class#21, i_brand#22, i_product_name#23, d_year#24, d_qoy#25, d_moy#26, s_store_id#27, spark_grouping_id#28, 5), ENSURE_REQUIREMENTS, [id=#33]

(22) HashAggregate [codegen id : 5]
Input [11]: [i_category#20, i_class#21, i_brand#22, i_product_name#23, d_year#24, d_qoy#25, d_moy#26, s_store_id#27, spark_grouping_id#28, sum#31, isEmpty#32]
Keys [9]: [i_category#20, i_class#21, i_brand#22, i_product_name#23, d_year#24, d_qoy#25, d_moy#26, s_store_id#27, spark_grouping_id#28]
Functions [1]: [sum(coalesce(CheckOverflow((promote_precision(cast(ss_sales_price#4 as decimal(12,2))) * promote_precision(cast(cast(ss_quantity#3 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#4 as decimal(12,2))) * promote_precision(cast(cast(ss_quantity#3 as decimal(10,0)) as decimal(12,2)))), DecimalType(18,2), true), 0.00))#34]
Results [9]: [i_category#20, i_class#21, i_brand#22, i_product_name#23, d_year#24, d_qoy#25, d_moy#26, s_store_id#27, sum(coalesce(CheckOverflow((promote_precision(cast(ss_sales_price#4 as decimal(12,2))) * promote_precision(cast(cast(ss_quantity#3 as decimal(10,0)) as decimal(12,2)))), DecimalType(18,2), true), 0.00))#34 AS sumsales#35]

(23) Exchange
Input [9]: [i_category#20, i_class#21, i_brand#22, i_product_name#23, d_year#24, d_qoy#25, d_moy#26, s_store_id#27, sumsales#35]
Arguments: hashpartitioning(i_category#20, 5), ENSURE_REQUIREMENTS, [id=#36]

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

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

(26) Filter [codegen id : 7]
Input [10]: [i_category#20, i_class#21, i_brand#22, i_product_name#23, d_year#24, d_qoy#25, d_moy#26, s_store_id#27, sumsales#35, rk#37]
Condition : (rk#37 <= 100)

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

===== Subqueries =====

Subquery:1 Hosting operator id = 1 Hosting Expression = ss_sold_date_sk#5 IN dynamicpruning#6
BroadcastExchange (32)
+- * Project (31)
   +- * Filter (30)
      +- * ColumnarToRow (29)
         +- Scan parquet default.date_dim (28)


(28) Scan parquet default.date_dim
Output [5]: [d_date_sk#7, d_month_seq#38, 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>

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

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

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

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


