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


(1) Scan parquet spark_catalog.default.web_sales
Output [2]: [ws_ext_sales_price#1, ws_sold_date_sk#2]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ws_sold_date_sk#2)]
ReadSchema: struct<ws_ext_sales_price:decimal(7,2)>

(2) ColumnarToRow [codegen id : 2]
Input [2]: [ws_ext_sales_price#1, ws_sold_date_sk#2]

(3) Project [codegen id : 2]
Output [2]: [ws_sold_date_sk#2 AS sold_date_sk#3, ws_ext_sales_price#1 AS sales_price#4]
Input [2]: [ws_ext_sales_price#1, ws_sold_date_sk#2]

(4) Scan parquet spark_catalog.default.date_dim
Output [3]: [d_date_sk#5, d_week_seq#6, d_day_name#7]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_date_sk), IsNotNull(d_week_seq)]
ReadSchema: struct<d_date_sk:int,d_week_seq:int,d_day_name:string>

(5) ColumnarToRow [codegen id : 1]
Input [3]: [d_date_sk#5, d_week_seq#6, d_day_name#7]

(6) Filter [codegen id : 1]
Input [3]: [d_date_sk#5, d_week_seq#6, d_day_name#7]
Condition : (isnotnull(d_date_sk#5) AND isnotnull(d_week_seq#6))

(7) BroadcastExchange
Input [3]: [d_date_sk#5, d_week_seq#6, d_day_name#7]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=1]

(8) BroadcastHashJoin [codegen id : 2]
Left keys [1]: [sold_date_sk#3]
Right keys [1]: [d_date_sk#5]
Join type: Inner
Join condition: None

(9) Project [codegen id : 2]
Output [3]: [sales_price#4, d_week_seq#6, d_day_name#7]
Input [5]: [sold_date_sk#3, sales_price#4, d_date_sk#5, d_week_seq#6, d_day_name#7]

(10) Scan parquet spark_catalog.default.catalog_sales
Output [2]: [cs_ext_sales_price#8, cs_sold_date_sk#9]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(cs_sold_date_sk#9)]
ReadSchema: struct<cs_ext_sales_price:decimal(7,2)>

(11) ColumnarToRow [codegen id : 4]
Input [2]: [cs_ext_sales_price#8, cs_sold_date_sk#9]

(12) Project [codegen id : 4]
Output [2]: [cs_sold_date_sk#9 AS sold_date_sk#10, cs_ext_sales_price#8 AS sales_price#11]
Input [2]: [cs_ext_sales_price#8, cs_sold_date_sk#9]

(13) ReusedExchange [Reuses operator id: 7]
Output [3]: [d_date_sk#12, d_week_seq#13, d_day_name#14]

(14) BroadcastHashJoin [codegen id : 4]
Left keys [1]: [sold_date_sk#10]
Right keys [1]: [d_date_sk#12]
Join type: Inner
Join condition: None

(15) Project [codegen id : 4]
Output [3]: [sales_price#11, d_week_seq#13, d_day_name#14]
Input [5]: [sold_date_sk#10, sales_price#11, d_date_sk#12, d_week_seq#13, d_day_name#14]

(16) Union

(17) HashAggregate [codegen id : 5]
Input [3]: [sales_price#4, d_week_seq#6, d_day_name#7]
Keys [1]: [d_week_seq#6]
Functions [7]: [partial_sum(UnscaledValue(CASE WHEN (d_day_name#7 = Sunday   ) THEN sales_price#4 END)), partial_sum(UnscaledValue(CASE WHEN (d_day_name#7 = Monday   ) THEN sales_price#4 END)), partial_sum(UnscaledValue(CASE WHEN (d_day_name#7 = Tuesday  ) THEN sales_price#4 END)), partial_sum(UnscaledValue(CASE WHEN (d_day_name#7 = Wednesday) THEN sales_price#4 END)), partial_sum(UnscaledValue(CASE WHEN (d_day_name#7 = Thursday ) THEN sales_price#4 END)), partial_sum(UnscaledValue(CASE WHEN (d_day_name#7 = Friday   ) THEN sales_price#4 END)), partial_sum(UnscaledValue(CASE WHEN (d_day_name#7 = Saturday ) THEN sales_price#4 END))]
Aggregate Attributes [7]: [sum#15, sum#16, sum#17, sum#18, sum#19, sum#20, sum#21]
Results [8]: [d_week_seq#6, sum#22, sum#23, sum#24, sum#25, sum#26, sum#27, sum#28]

(18) Exchange
Input [8]: [d_week_seq#6, sum#22, sum#23, sum#24, sum#25, sum#26, sum#27, sum#28]
Arguments: hashpartitioning(d_week_seq#6, 5), ENSURE_REQUIREMENTS, [plan_id=2]

(19) HashAggregate [codegen id : 14]
Input [8]: [d_week_seq#6, sum#22, sum#23, sum#24, sum#25, sum#26, sum#27, sum#28]
Keys [1]: [d_week_seq#6]
Functions [7]: [sum(UnscaledValue(CASE WHEN (d_day_name#7 = Sunday   ) THEN sales_price#4 END)), sum(UnscaledValue(CASE WHEN (d_day_name#7 = Monday   ) THEN sales_price#4 END)), sum(UnscaledValue(CASE WHEN (d_day_name#7 = Tuesday  ) THEN sales_price#4 END)), sum(UnscaledValue(CASE WHEN (d_day_name#7 = Wednesday) THEN sales_price#4 END)), sum(UnscaledValue(CASE WHEN (d_day_name#7 = Thursday ) THEN sales_price#4 END)), sum(UnscaledValue(CASE WHEN (d_day_name#7 = Friday   ) THEN sales_price#4 END)), sum(UnscaledValue(CASE WHEN (d_day_name#7 = Saturday ) THEN sales_price#4 END))]
Aggregate Attributes [7]: [sum(UnscaledValue(CASE WHEN (d_day_name#7 = Sunday   ) THEN sales_price#4 END))#29, sum(UnscaledValue(CASE WHEN (d_day_name#7 = Monday   ) THEN sales_price#4 END))#30, sum(UnscaledValue(CASE WHEN (d_day_name#7 = Tuesday  ) THEN sales_price#4 END))#31, sum(UnscaledValue(CASE WHEN (d_day_name#7 = Wednesday) THEN sales_price#4 END))#32, sum(UnscaledValue(CASE WHEN (d_day_name#7 = Thursday ) THEN sales_price#4 END))#33, sum(UnscaledValue(CASE WHEN (d_day_name#7 = Friday   ) THEN sales_price#4 END))#34, sum(UnscaledValue(CASE WHEN (d_day_name#7 = Saturday ) THEN sales_price#4 END))#35]
Results [8]: [d_week_seq#6, MakeDecimal(sum(UnscaledValue(CASE WHEN (d_day_name#7 = Sunday   ) THEN sales_price#4 END))#29,17,2) AS sun_sales#36, MakeDecimal(sum(UnscaledValue(CASE WHEN (d_day_name#7 = Monday   ) THEN sales_price#4 END))#30,17,2) AS mon_sales#37, MakeDecimal(sum(UnscaledValue(CASE WHEN (d_day_name#7 = Tuesday  ) THEN sales_price#4 END))#31,17,2) AS tue_sales#38, MakeDecimal(sum(UnscaledValue(CASE WHEN (d_day_name#7 = Wednesday) THEN sales_price#4 END))#32,17,2) AS wed_sales#39, MakeDecimal(sum(UnscaledValue(CASE WHEN (d_day_name#7 = Thursday ) THEN sales_price#4 END))#33,17,2) AS thu_sales#40, MakeDecimal(sum(UnscaledValue(CASE WHEN (d_day_name#7 = Friday   ) THEN sales_price#4 END))#34,17,2) AS fri_sales#41, MakeDecimal(sum(UnscaledValue(CASE WHEN (d_day_name#7 = Saturday ) THEN sales_price#4 END))#35,17,2) AS sat_sales#42]

(20) Scan parquet spark_catalog.default.date_dim
Output [2]: [d_week_seq#43, d_year#44]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2001), IsNotNull(d_week_seq)]
ReadSchema: struct<d_week_seq:int,d_year:int>

(21) ColumnarToRow [codegen id : 6]
Input [2]: [d_week_seq#43, d_year#44]

(22) Filter [codegen id : 6]
Input [2]: [d_week_seq#43, d_year#44]
Condition : ((isnotnull(d_year#44) AND (d_year#44 = 2001)) AND isnotnull(d_week_seq#43))

(23) Project [codegen id : 6]
Output [1]: [d_week_seq#43]
Input [2]: [d_week_seq#43, d_year#44]

(24) BroadcastExchange
Input [1]: [d_week_seq#43]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [plan_id=3]

(25) BroadcastHashJoin [codegen id : 14]
Left keys [1]: [d_week_seq#6]
Right keys [1]: [d_week_seq#43]
Join type: Inner
Join condition: None

(26) Project [codegen id : 14]
Output [8]: [d_week_seq#6 AS d_week_seq1#45, sun_sales#36 AS sun_sales1#46, mon_sales#37 AS mon_sales1#47, tue_sales#38 AS tue_sales1#48, wed_sales#39 AS wed_sales1#49, thu_sales#40 AS thu_sales1#50, fri_sales#41 AS fri_sales1#51, sat_sales#42 AS sat_sales1#52]
Input [9]: [d_week_seq#6, sun_sales#36, mon_sales#37, tue_sales#38, wed_sales#39, thu_sales#40, fri_sales#41, sat_sales#42, d_week_seq#43]

(27) ReusedExchange [Reuses operator id: 18]
Output [8]: [d_week_seq#53, sum#54, sum#55, sum#56, sum#57, sum#58, sum#59, sum#60]

(28) HashAggregate [codegen id : 13]
Input [8]: [d_week_seq#53, sum#54, sum#55, sum#56, sum#57, sum#58, sum#59, sum#60]
Keys [1]: [d_week_seq#53]
Functions [7]: [sum(UnscaledValue(CASE WHEN (d_day_name#61 = Sunday   ) THEN sales_price#62 END)), sum(UnscaledValue(CASE WHEN (d_day_name#61 = Monday   ) THEN sales_price#62 END)), sum(UnscaledValue(CASE WHEN (d_day_name#61 = Tuesday  ) THEN sales_price#62 END)), sum(UnscaledValue(CASE WHEN (d_day_name#61 = Wednesday) THEN sales_price#62 END)), sum(UnscaledValue(CASE WHEN (d_day_name#61 = Thursday ) THEN sales_price#62 END)), sum(UnscaledValue(CASE WHEN (d_day_name#61 = Friday   ) THEN sales_price#62 END)), sum(UnscaledValue(CASE WHEN (d_day_name#61 = Saturday ) THEN sales_price#62 END))]
Aggregate Attributes [7]: [sum(UnscaledValue(CASE WHEN (d_day_name#61 = Sunday   ) THEN sales_price#62 END))#29, sum(UnscaledValue(CASE WHEN (d_day_name#61 = Monday   ) THEN sales_price#62 END))#30, sum(UnscaledValue(CASE WHEN (d_day_name#61 = Tuesday  ) THEN sales_price#62 END))#31, sum(UnscaledValue(CASE WHEN (d_day_name#61 = Wednesday) THEN sales_price#62 END))#32, sum(UnscaledValue(CASE WHEN (d_day_name#61 = Thursday ) THEN sales_price#62 END))#33, sum(UnscaledValue(CASE WHEN (d_day_name#61 = Friday   ) THEN sales_price#62 END))#34, sum(UnscaledValue(CASE WHEN (d_day_name#61 = Saturday ) THEN sales_price#62 END))#35]
Results [8]: [d_week_seq#53, MakeDecimal(sum(UnscaledValue(CASE WHEN (d_day_name#61 = Sunday   ) THEN sales_price#62 END))#29,17,2) AS sun_sales#63, MakeDecimal(sum(UnscaledValue(CASE WHEN (d_day_name#61 = Monday   ) THEN sales_price#62 END))#30,17,2) AS mon_sales#64, MakeDecimal(sum(UnscaledValue(CASE WHEN (d_day_name#61 = Tuesday  ) THEN sales_price#62 END))#31,17,2) AS tue_sales#65, MakeDecimal(sum(UnscaledValue(CASE WHEN (d_day_name#61 = Wednesday) THEN sales_price#62 END))#32,17,2) AS wed_sales#66, MakeDecimal(sum(UnscaledValue(CASE WHEN (d_day_name#61 = Thursday ) THEN sales_price#62 END))#33,17,2) AS thu_sales#67, MakeDecimal(sum(UnscaledValue(CASE WHEN (d_day_name#61 = Friday   ) THEN sales_price#62 END))#34,17,2) AS fri_sales#68, MakeDecimal(sum(UnscaledValue(CASE WHEN (d_day_name#61 = Saturday ) THEN sales_price#62 END))#35,17,2) AS sat_sales#69]

(29) Scan parquet spark_catalog.default.date_dim
Output [2]: [d_week_seq#70, d_year#71]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2002), IsNotNull(d_week_seq)]
ReadSchema: struct<d_week_seq:int,d_year:int>

(30) ColumnarToRow [codegen id : 12]
Input [2]: [d_week_seq#70, d_year#71]

(31) Filter [codegen id : 12]
Input [2]: [d_week_seq#70, d_year#71]
Condition : ((isnotnull(d_year#71) AND (d_year#71 = 2002)) AND isnotnull(d_week_seq#70))

(32) Project [codegen id : 12]
Output [1]: [d_week_seq#70]
Input [2]: [d_week_seq#70, d_year#71]

(33) BroadcastExchange
Input [1]: [d_week_seq#70]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [plan_id=4]

(34) BroadcastHashJoin [codegen id : 13]
Left keys [1]: [d_week_seq#53]
Right keys [1]: [d_week_seq#70]
Join type: Inner
Join condition: None

(35) Project [codegen id : 13]
Output [8]: [d_week_seq#53 AS d_week_seq2#72, sun_sales#63 AS sun_sales2#73, mon_sales#64 AS mon_sales2#74, tue_sales#65 AS tue_sales2#75, wed_sales#66 AS wed_sales2#76, thu_sales#67 AS thu_sales2#77, fri_sales#68 AS fri_sales2#78, sat_sales#69 AS sat_sales2#79]
Input [9]: [d_week_seq#53, sun_sales#63, mon_sales#64, tue_sales#65, wed_sales#66, thu_sales#67, fri_sales#68, sat_sales#69, d_week_seq#70]

(36) BroadcastExchange
Input [8]: [d_week_seq2#72, sun_sales2#73, mon_sales2#74, tue_sales2#75, wed_sales2#76, thu_sales2#77, fri_sales2#78, sat_sales2#79]
Arguments: HashedRelationBroadcastMode(List(cast((input[0, int, true] - 53) as bigint)),false), [plan_id=5]

(37) BroadcastHashJoin [codegen id : 14]
Left keys [1]: [d_week_seq1#45]
Right keys [1]: [(d_week_seq2#72 - 53)]
Join type: Inner
Join condition: None

(38) Project [codegen id : 14]
Output [8]: [d_week_seq1#45, round((sun_sales1#46 / sun_sales2#73), 2) AS round((sun_sales1 / sun_sales2), 2)#80, round((mon_sales1#47 / mon_sales2#74), 2) AS round((mon_sales1 / mon_sales2), 2)#81, round((tue_sales1#48 / tue_sales2#75), 2) AS round((tue_sales1 / tue_sales2), 2)#82, round((wed_sales1#49 / wed_sales2#76), 2) AS round((wed_sales1 / wed_sales2), 2)#83, round((thu_sales1#50 / thu_sales2#77), 2) AS round((thu_sales1 / thu_sales2), 2)#84, round((fri_sales1#51 / fri_sales2#78), 2) AS round((fri_sales1 / fri_sales2), 2)#85, round((sat_sales1#52 / sat_sales2#79), 2) AS round((sat_sales1 / sat_sales2), 2)#86]
Input [16]: [d_week_seq1#45, sun_sales1#46, mon_sales1#47, tue_sales1#48, wed_sales1#49, thu_sales1#50, fri_sales1#51, sat_sales1#52, d_week_seq2#72, sun_sales2#73, mon_sales2#74, tue_sales2#75, wed_sales2#76, thu_sales2#77, fri_sales2#78, sat_sales2#79]

(39) Exchange
Input [8]: [d_week_seq1#45, round((sun_sales1 / sun_sales2), 2)#80, round((mon_sales1 / mon_sales2), 2)#81, round((tue_sales1 / tue_sales2), 2)#82, round((wed_sales1 / wed_sales2), 2)#83, round((thu_sales1 / thu_sales2), 2)#84, round((fri_sales1 / fri_sales2), 2)#85, round((sat_sales1 / sat_sales2), 2)#86]
Arguments: rangepartitioning(d_week_seq1#45 ASC NULLS FIRST, 5), ENSURE_REQUIREMENTS, [plan_id=6]

(40) Sort [codegen id : 15]
Input [8]: [d_week_seq1#45, round((sun_sales1 / sun_sales2), 2)#80, round((mon_sales1 / mon_sales2), 2)#81, round((tue_sales1 / tue_sales2), 2)#82, round((wed_sales1 / wed_sales2), 2)#83, round((thu_sales1 / thu_sales2), 2)#84, round((fri_sales1 / fri_sales2), 2)#85, round((sat_sales1 / sat_sales2), 2)#86]
Arguments: [d_week_seq1#45 ASC NULLS FIRST], true, 0

