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


(1) Scan parquet default.catalog_sales
Output [3]: [cs_sold_date_sk#1, cs_item_sk#2, cs_ext_sales_price#3]
Batched: true
Location [not included in comparison]/{warehouse_dir}/catalog_sales]
PushedFilters: [IsNotNull(cs_item_sk), IsNotNull(cs_sold_date_sk)]
ReadSchema: struct<cs_sold_date_sk:int,cs_item_sk:int,cs_ext_sales_price:decimal(7,2)>

(2) ColumnarToRow [codegen id : 1]
Input [3]: [cs_sold_date_sk#1, cs_item_sk#2, cs_ext_sales_price#3]

(3) Filter [codegen id : 1]
Input [3]: [cs_sold_date_sk#1, cs_item_sk#2, cs_ext_sales_price#3]
Condition : (isnotnull(cs_item_sk#2) AND isnotnull(cs_sold_date_sk#1))

(4) Exchange
Input [3]: [cs_sold_date_sk#1, cs_item_sk#2, cs_ext_sales_price#3]
Arguments: hashpartitioning(cs_item_sk#2, 5), ENSURE_REQUIREMENTS, [id=#4]

(5) Sort [codegen id : 2]
Input [3]: [cs_sold_date_sk#1, cs_item_sk#2, cs_ext_sales_price#3]
Arguments: [cs_item_sk#2 ASC NULLS FIRST], false, 0

(6) Scan parquet default.item
Output [6]: [i_item_sk#5, i_item_id#6, i_item_desc#7, i_current_price#8, i_class#9, i_category#10]
Batched: true
Location [not included in comparison]/{warehouse_dir}/item]
PushedFilters: [In(i_category, [Sports                                            ,Books                                             ,Home                                              ]), 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#5, i_item_id#6, i_item_desc#7, i_current_price#8, i_class#9, i_category#10]

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

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

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

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

(12) Project [codegen id : 6]
Output [7]: [cs_sold_date_sk#1, cs_ext_sales_price#3, i_item_id#6, i_item_desc#7, i_current_price#8, i_class#9, i_category#10]
Input [9]: [cs_sold_date_sk#1, cs_item_sk#2, cs_ext_sales_price#3, i_item_sk#5, i_item_id#6, i_item_desc#7, i_current_price#8, i_class#9, i_category#10]

(13) Scan parquet default.date_dim
Output [2]: [d_date_sk#12, d_date#13]
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>

(14) ColumnarToRow [codegen id : 5]
Input [2]: [d_date_sk#12, d_date#13]

(15) Filter [codegen id : 5]
Input [2]: [d_date_sk#12, d_date#13]
Condition : (((isnotnull(d_date#13) AND (d_date#13 >= 10644)) AND (d_date#13 <= 10674)) AND isnotnull(d_date_sk#12))

(16) Project [codegen id : 5]
Output [1]: [d_date_sk#12]
Input [2]: [d_date_sk#12, d_date#13]

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

(18) BroadcastHashJoin [codegen id : 6]
Left keys [1]: [cs_sold_date_sk#1]
Right keys [1]: [d_date_sk#12]
Join condition: None

(19) Project [codegen id : 6]
Output [6]: [cs_ext_sales_price#3, i_item_id#6, i_item_desc#7, i_current_price#8, i_class#9, i_category#10]
Input [8]: [cs_sold_date_sk#1, cs_ext_sales_price#3, i_item_id#6, i_item_desc#7, i_current_price#8, i_class#9, i_category#10, d_date_sk#12]

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

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

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

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

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

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

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

(27) TakeOrderedAndProject
Input [7]: [i_item_id#6, i_item_desc#7, i_category#10, i_class#9, i_current_price#8, itemrevenue#19, revenueratio#24]
Arguments: 100, [i_category#10 ASC NULLS FIRST, i_class#9 ASC NULLS FIRST, i_item_id#6 ASC NULLS FIRST, i_item_desc#7 ASC NULLS FIRST, revenueratio#24 ASC NULLS FIRST], [i_item_id#6, i_item_desc#7, i_category#10, i_class#9, i_current_price#8, itemrevenue#19, revenueratio#24]

