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


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

(2) ColumnarToRow [codegen id : 1]
Input [3]: [ss_item_sk#1, ss_ext_sales_price#2, ss_sold_date_sk#3]

(3) Filter [codegen id : 1]
Input [3]: [ss_item_sk#1, ss_ext_sales_price#2, ss_sold_date_sk#3]
Condition : isnotnull(ss_item_sk#1)

(4) Exchange
Input [3]: [ss_item_sk#1, ss_ext_sales_price#2, ss_sold_date_sk#3]
Arguments: hashpartitioning(ss_item_sk#1, 5), ENSURE_REQUIREMENTS, [id=#5]

(5) Sort [codegen id : 2]
Input [3]: [ss_item_sk#1, ss_ext_sales_price#2, ss_sold_date_sk#3]
Arguments: [ss_item_sk#1 ASC NULLS FIRST], false, 0

(6) Scan parquet default.item
Output [6]: [i_item_sk#6, i_item_id#7, i_item_desc#8, i_current_price#9, i_class#10, i_category#11]
Batched: true
Location [not included in comparison]/{warehouse_dir}/item]
PushedFilters: [In(i_category, [Books                                             ,Home                                              ,Sports                                            ]), IsNotNull(i_item_sk)]
ReadSchema: struct<i_item_sk:int,i_item_id:string,i_item_desc:string,i_current_price:decimal(7,2),i_class:string,i_category:string>

(7) ColumnarToRow [codegen id : 3]
Input [6]: [i_item_sk#6, i_item_id#7, i_item_desc#8, i_current_price#9, i_class#10, i_category#11]

(8) Filter [codegen id : 3]
Input [6]: [i_item_sk#6, i_item_id#7, i_item_desc#8, i_current_price#9, i_class#10, i_category#11]
Condition : (i_category#11 IN (Sports                                            ,Books                                             ,Home                                              ) AND isnotnull(i_item_sk#6))

(9) Exchange
Input [6]: [i_item_sk#6, i_item_id#7, i_item_desc#8, i_current_price#9, i_class#10, i_category#11]
Arguments: hashpartitioning(i_item_sk#6, 5), ENSURE_REQUIREMENTS, [id=#12]

(10) Sort [codegen id : 4]
Input [6]: [i_item_sk#6, i_item_id#7, i_item_desc#8, i_current_price#9, i_class#10, i_category#11]
Arguments: [i_item_sk#6 ASC NULLS FIRST], false, 0

(11) SortMergeJoin [codegen id : 6]
Left keys [1]: [ss_item_sk#1]
Right keys [1]: [i_item_sk#6]
Join condition: None

(12) Project [codegen id : 6]
Output [7]: [ss_ext_sales_price#2, ss_sold_date_sk#3, i_item_id#7, i_item_desc#8, i_current_price#9, i_class#10, i_category#11]
Input [9]: [ss_item_sk#1, ss_ext_sales_price#2, ss_sold_date_sk#3, i_item_sk#6, i_item_id#7, i_item_desc#8, i_current_price#9, i_class#10, i_category#11]

(13) ReusedExchange [Reuses operator id: 29]
Output [1]: [d_date_sk#13]

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

(15) Project [codegen id : 6]
Output [6]: [ss_ext_sales_price#2, i_item_id#7, i_item_desc#8, i_current_price#9, i_class#10, i_category#11]
Input [8]: [ss_ext_sales_price#2, ss_sold_date_sk#3, i_item_id#7, i_item_desc#8, i_current_price#9, i_class#10, i_category#11, d_date_sk#13]

(16) HashAggregate [codegen id : 6]
Input [6]: [ss_ext_sales_price#2, i_item_id#7, i_item_desc#8, i_current_price#9, i_class#10, i_category#11]
Keys [5]: [i_item_id#7, i_item_desc#8, i_category#11, i_class#10, i_current_price#9]
Functions [1]: [partial_sum(UnscaledValue(ss_ext_sales_price#2))]
Aggregate Attributes [1]: [sum#14]
Results [6]: [i_item_id#7, i_item_desc#8, i_category#11, i_class#10, i_current_price#9, sum#15]

(17) Exchange
Input [6]: [i_item_id#7, i_item_desc#8, i_category#11, i_class#10, i_current_price#9, sum#15]
Arguments: hashpartitioning(i_item_id#7, i_item_desc#8, i_category#11, i_class#10, i_current_price#9, 5), ENSURE_REQUIREMENTS, [id=#16]

(18) HashAggregate [codegen id : 7]
Input [6]: [i_item_id#7, i_item_desc#8, i_category#11, i_class#10, i_current_price#9, sum#15]
Keys [5]: [i_item_id#7, i_item_desc#8, i_category#11, i_class#10, i_current_price#9]
Functions [1]: [sum(UnscaledValue(ss_ext_sales_price#2))]
Aggregate Attributes [1]: [sum(UnscaledValue(ss_ext_sales_price#2))#17]
Results [8]: [i_item_id#7, i_item_desc#8, i_category#11, i_class#10, i_current_price#9, MakeDecimal(sum(UnscaledValue(ss_ext_sales_price#2))#17,17,2) AS itemrevenue#18, MakeDecimal(sum(UnscaledValue(ss_ext_sales_price#2))#17,17,2) AS _w0#19, MakeDecimal(sum(UnscaledValue(ss_ext_sales_price#2))#17,17,2) AS _w1#20]

(19) Exchange
Input [8]: [i_item_id#7, i_item_desc#8, i_category#11, i_class#10, i_current_price#9, itemrevenue#18, _w0#19, _w1#20]
Arguments: hashpartitioning(i_class#10, 5), ENSURE_REQUIREMENTS, [id=#21]

(20) Sort [codegen id : 8]
Input [8]: [i_item_id#7, i_item_desc#8, i_category#11, i_class#10, i_current_price#9, itemrevenue#18, _w0#19, _w1#20]
Arguments: [i_class#10 ASC NULLS FIRST], false, 0

(21) Window
Input [8]: [i_item_id#7, i_item_desc#8, i_category#11, i_class#10, i_current_price#9, itemrevenue#18, _w0#19, _w1#20]
Arguments: [sum(_w1#20) windowspecdefinition(i_class#10, specifiedwindowframe(RowFrame, unboundedpreceding$(), unboundedfollowing$())) AS _we0#22], [i_class#10]

(22) Project [codegen id : 9]
Output [7]: [i_item_id#7, i_item_desc#8, i_category#11, i_class#10, i_current_price#9, itemrevenue#18, CheckOverflow((promote_precision(cast(CheckOverflow((promote_precision(_w0#19) * 100.00), DecimalType(21,2), true) as decimal(27,2))) / promote_precision(_we0#22)), DecimalType(38,17), true) AS revenueratio#23]
Input [9]: [i_item_id#7, i_item_desc#8, i_category#11, i_class#10, i_current_price#9, itemrevenue#18, _w0#19, _w1#20, _we0#22]

(23) Exchange
Input [7]: [i_item_id#7, i_item_desc#8, i_category#11, i_class#10, i_current_price#9, itemrevenue#18, revenueratio#23]
Arguments: rangepartitioning(i_category#11 ASC NULLS FIRST, i_class#10 ASC NULLS FIRST, i_item_id#7 ASC NULLS FIRST, i_item_desc#8 ASC NULLS FIRST, revenueratio#23 ASC NULLS FIRST, 5), ENSURE_REQUIREMENTS, [id=#24]

(24) Sort [codegen id : 10]
Input [7]: [i_item_id#7, i_item_desc#8, i_category#11, i_class#10, i_current_price#9, itemrevenue#18, revenueratio#23]
Arguments: [i_category#11 ASC NULLS FIRST, i_class#10 ASC NULLS FIRST, i_item_id#7 ASC NULLS FIRST, i_item_desc#8 ASC NULLS FIRST, revenueratio#23 ASC NULLS FIRST], true, 0

===== Subqueries =====

Subquery:1 Hosting operator id = 1 Hosting Expression = ss_sold_date_sk#3 IN dynamicpruning#4
BroadcastExchange (29)
+- * Project (28)
   +- * Filter (27)
      +- * ColumnarToRow (26)
         +- Scan parquet default.date_dim (25)


(25) Scan parquet default.date_dim
Output [2]: [d_date_sk#13, d_date#25]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_date), GreaterThanOrEqual(d_date,1999-02-22), LessThanOrEqual(d_date,1999-03-24), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_date:date>

(26) ColumnarToRow [codegen id : 1]
Input [2]: [d_date_sk#13, d_date#25]

(27) Filter [codegen id : 1]
Input [2]: [d_date_sk#13, d_date#25]
Condition : (((isnotnull(d_date#25) AND (d_date#25 >= 1999-02-22)) AND (d_date#25 <= 1999-03-24)) AND isnotnull(d_date_sk#13))

(28) Project [codegen id : 1]
Output [1]: [d_date_sk#13]
Input [2]: [d_date_sk#13, d_date#25]

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


