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


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

(2) ColumnarToRow [codegen id : 2]
Input [3]: [ws_sold_date_sk#1, ws_item_sk#2, ws_sales_price#3]

(3) Filter [codegen id : 2]
Input [3]: [ws_sold_date_sk#1, ws_item_sk#2, ws_sales_price#3]
Condition : (isnotnull(ws_item_sk#2) AND isnotnull(ws_sold_date_sk#1))

(4) Scan parquet default.date_dim
Output [3]: [d_date_sk#4, d_date#5, d_month_seq#6]
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_date:date,d_month_seq:int>

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

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

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

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

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

(10) Project [codegen id : 2]
Output [3]: [ws_item_sk#2, ws_sales_price#3, d_date#5]
Input [5]: [ws_sold_date_sk#1, ws_item_sk#2, ws_sales_price#3, d_date_sk#4, d_date#5]

(11) HashAggregate [codegen id : 2]
Input [3]: [ws_item_sk#2, ws_sales_price#3, d_date#5]
Keys [2]: [ws_item_sk#2, d_date#5]
Functions [1]: [partial_sum(UnscaledValue(ws_sales_price#3))]
Aggregate Attributes [1]: [sum#8]
Results [3]: [ws_item_sk#2, d_date#5, sum#9]

(12) Exchange
Input [3]: [ws_item_sk#2, d_date#5, sum#9]
Arguments: hashpartitioning(ws_item_sk#2, d_date#5, 5), true, [id=#10]

(13) HashAggregate [codegen id : 3]
Input [3]: [ws_item_sk#2, d_date#5, sum#9]
Keys [2]: [ws_item_sk#2, d_date#5]
Functions [1]: [sum(UnscaledValue(ws_sales_price#3))]
Aggregate Attributes [1]: [sum(UnscaledValue(ws_sales_price#3))#11]
Results [4]: [ws_item_sk#2 AS item_sk#12, d_date#5, MakeDecimal(sum(UnscaledValue(ws_sales_price#3))#11,17,2) AS _w0#13, ws_item_sk#2]

(14) Exchange
Input [4]: [item_sk#12, d_date#5, _w0#13, ws_item_sk#2]
Arguments: hashpartitioning(ws_item_sk#2, 5), true, [id=#14]

(15) Sort [codegen id : 4]
Input [4]: [item_sk#12, d_date#5, _w0#13, ws_item_sk#2]
Arguments: [ws_item_sk#2 ASC NULLS FIRST, d_date#5 ASC NULLS FIRST], false, 0

(16) Window
Input [4]: [item_sk#12, d_date#5, _w0#13, ws_item_sk#2]
Arguments: [sum(_w0#13) windowspecdefinition(ws_item_sk#2, d_date#5 ASC NULLS FIRST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS cume_sales#15], [ws_item_sk#2], [d_date#5 ASC NULLS FIRST]

(17) Project [codegen id : 5]
Output [3]: [item_sk#12, d_date#5, cume_sales#15]
Input [5]: [item_sk#12, d_date#5, _w0#13, ws_item_sk#2, cume_sales#15]

(18) Exchange
Input [3]: [item_sk#12, d_date#5, cume_sales#15]
Arguments: hashpartitioning(item_sk#12, d_date#5, 5), true, [id=#16]

(19) Sort [codegen id : 6]
Input [3]: [item_sk#12, d_date#5, cume_sales#15]
Arguments: [item_sk#12 ASC NULLS FIRST, d_date#5 ASC NULLS FIRST], false, 0

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

(21) ColumnarToRow [codegen id : 8]
Input [3]: [ss_sold_date_sk#17, ss_item_sk#18, ss_sales_price#19]

(22) Filter [codegen id : 8]
Input [3]: [ss_sold_date_sk#17, ss_item_sk#18, ss_sales_price#19]
Condition : (isnotnull(ss_item_sk#18) AND isnotnull(ss_sold_date_sk#17))

(23) ReusedExchange [Reuses operator id: 8]
Output [2]: [d_date_sk#20, d_date#21]

(24) BroadcastHashJoin [codegen id : 8]
Left keys [1]: [ss_sold_date_sk#17]
Right keys [1]: [d_date_sk#20]
Join condition: None

(25) Project [codegen id : 8]
Output [3]: [ss_item_sk#18, ss_sales_price#19, d_date#21]
Input [5]: [ss_sold_date_sk#17, ss_item_sk#18, ss_sales_price#19, d_date_sk#20, d_date#21]

(26) HashAggregate [codegen id : 8]
Input [3]: [ss_item_sk#18, ss_sales_price#19, d_date#21]
Keys [2]: [ss_item_sk#18, d_date#21]
Functions [1]: [partial_sum(UnscaledValue(ss_sales_price#19))]
Aggregate Attributes [1]: [sum#22]
Results [3]: [ss_item_sk#18, d_date#21, sum#23]

(27) Exchange
Input [3]: [ss_item_sk#18, d_date#21, sum#23]
Arguments: hashpartitioning(ss_item_sk#18, d_date#21, 5), true, [id=#24]

(28) HashAggregate [codegen id : 9]
Input [3]: [ss_item_sk#18, d_date#21, sum#23]
Keys [2]: [ss_item_sk#18, d_date#21]
Functions [1]: [sum(UnscaledValue(ss_sales_price#19))]
Aggregate Attributes [1]: [sum(UnscaledValue(ss_sales_price#19))#25]
Results [4]: [ss_item_sk#18 AS item_sk#26, d_date#21, MakeDecimal(sum(UnscaledValue(ss_sales_price#19))#25,17,2) AS _w0#27, ss_item_sk#18]

(29) Exchange
Input [4]: [item_sk#26, d_date#21, _w0#27, ss_item_sk#18]
Arguments: hashpartitioning(ss_item_sk#18, 5), true, [id=#28]

(30) Sort [codegen id : 10]
Input [4]: [item_sk#26, d_date#21, _w0#27, ss_item_sk#18]
Arguments: [ss_item_sk#18 ASC NULLS FIRST, d_date#21 ASC NULLS FIRST], false, 0

(31) Window
Input [4]: [item_sk#26, d_date#21, _w0#27, ss_item_sk#18]
Arguments: [sum(_w0#27) windowspecdefinition(ss_item_sk#18, d_date#21 ASC NULLS FIRST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS cume_sales#29], [ss_item_sk#18], [d_date#21 ASC NULLS FIRST]

(32) Project [codegen id : 11]
Output [3]: [item_sk#26, d_date#21, cume_sales#29]
Input [5]: [item_sk#26, d_date#21, _w0#27, ss_item_sk#18, cume_sales#29]

(33) Exchange
Input [3]: [item_sk#26, d_date#21, cume_sales#29]
Arguments: hashpartitioning(item_sk#26, d_date#21, 5), true, [id=#30]

(34) Sort [codegen id : 12]
Input [3]: [item_sk#26, d_date#21, cume_sales#29]
Arguments: [item_sk#26 ASC NULLS FIRST, d_date#21 ASC NULLS FIRST], false, 0

(35) SortMergeJoin
Left keys [2]: [item_sk#12, d_date#5]
Right keys [2]: [item_sk#26, d_date#21]
Join condition: None

(36) Project [codegen id : 13]
Output [4]: [CASE WHEN isnotnull(item_sk#12) THEN item_sk#12 ELSE item_sk#26 END AS item_sk#31, CASE WHEN isnotnull(d_date#5) THEN d_date#5 ELSE d_date#21 END AS d_date#32, cume_sales#15 AS web_sales#33, cume_sales#29 AS store_sales#34]
Input [6]: [item_sk#12, d_date#5, cume_sales#15, item_sk#26, d_date#21, cume_sales#29]

(37) Exchange
Input [4]: [item_sk#31, d_date#32, web_sales#33, store_sales#34]
Arguments: hashpartitioning(item_sk#31, 5), true, [id=#35]

(38) Sort [codegen id : 14]
Input [4]: [item_sk#31, d_date#32, web_sales#33, store_sales#34]
Arguments: [item_sk#31 ASC NULLS FIRST, d_date#32 ASC NULLS FIRST], false, 0

(39) Window
Input [4]: [item_sk#31, d_date#32, web_sales#33, store_sales#34]
Arguments: [max(web_sales#33) windowspecdefinition(item_sk#31, d_date#32 ASC NULLS FIRST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS web_cumulative#36, max(store_sales#34) windowspecdefinition(item_sk#31, d_date#32 ASC NULLS FIRST, specifiedwindowframe(RowFrame, unboundedpreceding$(), currentrow$())) AS store_cumulative#37], [item_sk#31], [d_date#32 ASC NULLS FIRST]

(40) Filter [codegen id : 15]
Input [6]: [item_sk#31, d_date#32, web_sales#33, store_sales#34, web_cumulative#36, store_cumulative#37]
Condition : ((isnotnull(web_cumulative#36) AND isnotnull(store_cumulative#37)) AND (web_cumulative#36 > store_cumulative#37))

(41) TakeOrderedAndProject
Input [6]: [item_sk#31, d_date#32, web_sales#33, store_sales#34, web_cumulative#36, store_cumulative#37]
Arguments: 100, [item_sk#31 ASC NULLS FIRST, d_date#32 ASC NULLS FIRST], [item_sk#31, d_date#32, web_sales#33, store_sales#34, web_cumulative#36, store_cumulative#37]

