== Physical Plan ==
TakeOrderedAndProject (124)
+- * HashAggregate (123)
   +- Exchange (122)
      +- * HashAggregate (121)
         +- Union (120)
            :- * HashAggregate (109)
            :  +- Exchange (108)
            :     +- * HashAggregate (107)
            :        +- Union (106)
            :           :- * HashAggregate (43)
            :           :  +- Exchange (42)
            :           :     +- * HashAggregate (41)
            :           :        +- * Project (40)
            :           :           +- * BroadcastHashJoin Inner BuildRight (39)
            :           :              :- * Project (33)
            :           :              :  +- * BroadcastHashJoin Inner BuildRight (32)
            :           :              :     :- * Project (26)
            :           :              :     :  +- * BroadcastHashJoin Inner BuildRight (25)
            :           :              :     :     :- * Project (20)
            :           :              :     :     :  +- * BroadcastHashJoin Inner BuildRight (19)
            :           :              :     :     :     :- * Project (13)
            :           :              :     :     :     :  +- * SortMergeJoin LeftOuter (12)
            :           :              :     :     :     :     :- * Sort (5)
            :           :              :     :     :     :     :  +- Exchange (4)
            :           :              :     :     :     :     :     +- * Filter (3)
            :           :              :     :     :     :     :        +- * ColumnarToRow (2)
            :           :              :     :     :     :     :           +- Scan parquet spark_catalog.default.store_sales (1)
            :           :              :     :     :     :     +- * Sort (11)
            :           :              :     :     :     :        +- Exchange (10)
            :           :              :     :     :     :           +- * Project (9)
            :           :              :     :     :     :              +- * Filter (8)
            :           :              :     :     :     :                 +- * ColumnarToRow (7)
            :           :              :     :     :     :                    +- Scan parquet spark_catalog.default.store_returns (6)
            :           :              :     :     :     +- BroadcastExchange (18)
            :           :              :     :     :        +- * Project (17)
            :           :              :     :     :           +- * Filter (16)
            :           :              :     :     :              +- * ColumnarToRow (15)
            :           :              :     :     :                 +- Scan parquet spark_catalog.default.date_dim (14)
            :           :              :     :     +- BroadcastExchange (24)
            :           :              :     :        +- * Filter (23)
            :           :              :     :           +- * ColumnarToRow (22)
            :           :              :     :              +- Scan parquet spark_catalog.default.store (21)
            :           :              :     +- BroadcastExchange (31)
            :           :              :        +- * Project (30)
            :           :              :           +- * Filter (29)
            :           :              :              +- * ColumnarToRow (28)
            :           :              :                 +- Scan parquet spark_catalog.default.item (27)
            :           :              +- BroadcastExchange (38)
            :           :                 +- * Project (37)
            :           :                    +- * Filter (36)
            :           :                       +- * ColumnarToRow (35)
            :           :                          +- Scan parquet spark_catalog.default.promotion (34)
            :           :- * HashAggregate (74)
            :           :  +- Exchange (73)
            :           :     +- * HashAggregate (72)
            :           :        +- * Project (71)
            :           :           +- * BroadcastHashJoin Inner BuildRight (70)
            :           :              :- * Project (68)
            :           :              :  +- * BroadcastHashJoin Inner BuildRight (67)
            :           :              :     :- * Project (65)
            :           :              :     :  +- * BroadcastHashJoin Inner BuildRight (64)
            :           :              :     :     :- * Project (59)
            :           :              :     :     :  +- * BroadcastHashJoin Inner BuildRight (58)
            :           :              :     :     :     :- * Project (56)
            :           :              :     :     :     :  +- * SortMergeJoin LeftOuter (55)
            :           :              :     :     :     :     :- * Sort (48)
            :           :              :     :     :     :     :  +- Exchange (47)
            :           :              :     :     :     :     :     +- * Filter (46)
            :           :              :     :     :     :     :        +- * ColumnarToRow (45)
            :           :              :     :     :     :     :           +- Scan parquet spark_catalog.default.catalog_sales (44)
            :           :              :     :     :     :     +- * Sort (54)
            :           :              :     :     :     :        +- Exchange (53)
            :           :              :     :     :     :           +- * Project (52)
            :           :              :     :     :     :              +- * Filter (51)
            :           :              :     :     :     :                 +- * ColumnarToRow (50)
            :           :              :     :     :     :                    +- Scan parquet spark_catalog.default.catalog_returns (49)
            :           :              :     :     :     +- ReusedExchange (57)
            :           :              :     :     +- BroadcastExchange (63)
            :           :              :     :        +- * Filter (62)
            :           :              :     :           +- * ColumnarToRow (61)
            :           :              :     :              +- Scan parquet spark_catalog.default.catalog_page (60)
            :           :              :     +- ReusedExchange (66)
            :           :              +- ReusedExchange (69)
            :           +- * HashAggregate (105)
            :              +- Exchange (104)
            :                 +- * HashAggregate (103)
            :                    +- * Project (102)
            :                       +- * BroadcastHashJoin Inner BuildRight (101)
            :                          :- * Project (99)
            :                          :  +- * BroadcastHashJoin Inner BuildRight (98)
            :                          :     :- * Project (96)
            :                          :     :  +- * BroadcastHashJoin Inner BuildRight (95)
            :                          :     :     :- * Project (90)
            :                          :     :     :  +- * BroadcastHashJoin Inner BuildRight (89)
            :                          :     :     :     :- * Project (87)
            :                          :     :     :     :  +- * SortMergeJoin LeftOuter (86)
            :                          :     :     :     :     :- * Sort (79)
            :                          :     :     :     :     :  +- Exchange (78)
            :                          :     :     :     :     :     +- * Filter (77)
            :                          :     :     :     :     :        +- * ColumnarToRow (76)
            :                          :     :     :     :     :           +- Scan parquet spark_catalog.default.web_sales (75)
            :                          :     :     :     :     +- * Sort (85)
            :                          :     :     :     :        +- Exchange (84)
            :                          :     :     :     :           +- * Project (83)
            :                          :     :     :     :              +- * Filter (82)
            :                          :     :     :     :                 +- * ColumnarToRow (81)
            :                          :     :     :     :                    +- Scan parquet spark_catalog.default.web_returns (80)
            :                          :     :     :     +- ReusedExchange (88)
            :                          :     :     +- BroadcastExchange (94)
            :                          :     :        +- * Filter (93)
            :                          :     :           +- * ColumnarToRow (92)
            :                          :     :              +- Scan parquet spark_catalog.default.web_site (91)
            :                          :     +- ReusedExchange (97)
            :                          +- ReusedExchange (100)
            :- * HashAggregate (114)
            :  +- Exchange (113)
            :     +- * HashAggregate (112)
            :        +- * HashAggregate (111)
            :           +- ReusedExchange (110)
            +- * HashAggregate (119)
               +- Exchange (118)
                  +- * HashAggregate (117)
                     +- * HashAggregate (116)
                        +- ReusedExchange (115)


(1) Scan parquet spark_catalog.default.store_sales
Output [7]: [ss_item_sk#1, ss_store_sk#2, ss_promo_sk#3, ss_ticket_number#4, ss_ext_sales_price#5, ss_net_profit#6, ss_sold_date_sk#7]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#7)]
PushedFilters: [IsNotNull(ss_store_sk), IsNotNull(ss_item_sk), IsNotNull(ss_promo_sk)]
ReadSchema: struct<ss_item_sk:int,ss_store_sk:int,ss_promo_sk:int,ss_ticket_number:int,ss_ext_sales_price:decimal(7,2),ss_net_profit:decimal(7,2)>

(2) ColumnarToRow [codegen id : 1]
Input [7]: [ss_item_sk#1, ss_store_sk#2, ss_promo_sk#3, ss_ticket_number#4, ss_ext_sales_price#5, ss_net_profit#6, ss_sold_date_sk#7]

(3) Filter [codegen id : 1]
Input [7]: [ss_item_sk#1, ss_store_sk#2, ss_promo_sk#3, ss_ticket_number#4, ss_ext_sales_price#5, ss_net_profit#6, ss_sold_date_sk#7]
Condition : ((isnotnull(ss_store_sk#2) AND isnotnull(ss_item_sk#1)) AND isnotnull(ss_promo_sk#3))

(4) Exchange
Input [7]: [ss_item_sk#1, ss_store_sk#2, ss_promo_sk#3, ss_ticket_number#4, ss_ext_sales_price#5, ss_net_profit#6, ss_sold_date_sk#7]
Arguments: hashpartitioning(ss_item_sk#1, ss_ticket_number#4, 5), ENSURE_REQUIREMENTS, [plan_id=1]

(5) Sort [codegen id : 2]
Input [7]: [ss_item_sk#1, ss_store_sk#2, ss_promo_sk#3, ss_ticket_number#4, ss_ext_sales_price#5, ss_net_profit#6, ss_sold_date_sk#7]
Arguments: [ss_item_sk#1 ASC NULLS FIRST, ss_ticket_number#4 ASC NULLS FIRST], false, 0

(6) Scan parquet spark_catalog.default.store_returns
Output [5]: [sr_item_sk#8, sr_ticket_number#9, sr_return_amt#10, sr_net_loss#11, sr_returned_date_sk#12]
Batched: true
Location [not included in comparison]/{warehouse_dir}/store_returns]
PushedFilters: [IsNotNull(sr_item_sk), IsNotNull(sr_ticket_number)]
ReadSchema: struct<sr_item_sk:int,sr_ticket_number:int,sr_return_amt:decimal(7,2),sr_net_loss:decimal(7,2)>

(7) ColumnarToRow [codegen id : 3]
Input [5]: [sr_item_sk#8, sr_ticket_number#9, sr_return_amt#10, sr_net_loss#11, sr_returned_date_sk#12]

(8) Filter [codegen id : 3]
Input [5]: [sr_item_sk#8, sr_ticket_number#9, sr_return_amt#10, sr_net_loss#11, sr_returned_date_sk#12]
Condition : (isnotnull(sr_item_sk#8) AND isnotnull(sr_ticket_number#9))

(9) Project [codegen id : 3]
Output [4]: [sr_item_sk#8, sr_ticket_number#9, sr_return_amt#10, sr_net_loss#11]
Input [5]: [sr_item_sk#8, sr_ticket_number#9, sr_return_amt#10, sr_net_loss#11, sr_returned_date_sk#12]

(10) Exchange
Input [4]: [sr_item_sk#8, sr_ticket_number#9, sr_return_amt#10, sr_net_loss#11]
Arguments: hashpartitioning(sr_item_sk#8, sr_ticket_number#9, 5), ENSURE_REQUIREMENTS, [plan_id=2]

(11) Sort [codegen id : 4]
Input [4]: [sr_item_sk#8, sr_ticket_number#9, sr_return_amt#10, sr_net_loss#11]
Arguments: [sr_item_sk#8 ASC NULLS FIRST, sr_ticket_number#9 ASC NULLS FIRST], false, 0

(12) SortMergeJoin [codegen id : 9]
Left keys [2]: [ss_item_sk#1, ss_ticket_number#4]
Right keys [2]: [sr_item_sk#8, sr_ticket_number#9]
Join type: LeftOuter
Join condition: None

(13) Project [codegen id : 9]
Output [8]: [ss_item_sk#1, ss_store_sk#2, ss_promo_sk#3, ss_ext_sales_price#5, ss_net_profit#6, ss_sold_date_sk#7, sr_return_amt#10, sr_net_loss#11]
Input [11]: [ss_item_sk#1, ss_store_sk#2, ss_promo_sk#3, ss_ticket_number#4, ss_ext_sales_price#5, ss_net_profit#6, ss_sold_date_sk#7, sr_item_sk#8, sr_ticket_number#9, sr_return_amt#10, sr_net_loss#11]

(14) Scan parquet spark_catalog.default.date_dim
Output [2]: [d_date_sk#13, d_date#14]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_date), GreaterThanOrEqual(d_date,1998-08-04), LessThanOrEqual(d_date,1998-09-03), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_date:date>

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

(16) Filter [codegen id : 5]
Input [2]: [d_date_sk#13, d_date#14]
Condition : (((isnotnull(d_date#14) AND (d_date#14 >= 1998-08-04)) AND (d_date#14 <= 1998-09-03)) AND isnotnull(d_date_sk#13))

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

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

(19) BroadcastHashJoin [codegen id : 9]
Left keys [1]: [ss_sold_date_sk#7]
Right keys [1]: [d_date_sk#13]
Join type: Inner
Join condition: None

(20) Project [codegen id : 9]
Output [7]: [ss_item_sk#1, ss_store_sk#2, ss_promo_sk#3, ss_ext_sales_price#5, ss_net_profit#6, sr_return_amt#10, sr_net_loss#11]
Input [9]: [ss_item_sk#1, ss_store_sk#2, ss_promo_sk#3, ss_ext_sales_price#5, ss_net_profit#6, ss_sold_date_sk#7, sr_return_amt#10, sr_net_loss#11, d_date_sk#13]

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

(22) ColumnarToRow [codegen id : 6]
Input [2]: [s_store_sk#15, s_store_id#16]

(23) Filter [codegen id : 6]
Input [2]: [s_store_sk#15, s_store_id#16]
Condition : isnotnull(s_store_sk#15)

(24) BroadcastExchange
Input [2]: [s_store_sk#15, s_store_id#16]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=4]

(25) BroadcastHashJoin [codegen id : 9]
Left keys [1]: [ss_store_sk#2]
Right keys [1]: [s_store_sk#15]
Join type: Inner
Join condition: None

(26) Project [codegen id : 9]
Output [7]: [ss_item_sk#1, ss_promo_sk#3, ss_ext_sales_price#5, ss_net_profit#6, sr_return_amt#10, sr_net_loss#11, s_store_id#16]
Input [9]: [ss_item_sk#1, ss_store_sk#2, ss_promo_sk#3, ss_ext_sales_price#5, ss_net_profit#6, sr_return_amt#10, sr_net_loss#11, s_store_sk#15, s_store_id#16]

(27) Scan parquet spark_catalog.default.item
Output [2]: [i_item_sk#17, i_current_price#18]
Batched: true
Location [not included in comparison]/{warehouse_dir}/item]
PushedFilters: [IsNotNull(i_current_price), GreaterThan(i_current_price,50.00), IsNotNull(i_item_sk)]
ReadSchema: struct<i_item_sk:int,i_current_price:decimal(7,2)>

(28) ColumnarToRow [codegen id : 7]
Input [2]: [i_item_sk#17, i_current_price#18]

(29) Filter [codegen id : 7]
Input [2]: [i_item_sk#17, i_current_price#18]
Condition : ((isnotnull(i_current_price#18) AND (i_current_price#18 > 50.00)) AND isnotnull(i_item_sk#17))

(30) Project [codegen id : 7]
Output [1]: [i_item_sk#17]
Input [2]: [i_item_sk#17, i_current_price#18]

(31) BroadcastExchange
Input [1]: [i_item_sk#17]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [plan_id=5]

(32) BroadcastHashJoin [codegen id : 9]
Left keys [1]: [ss_item_sk#1]
Right keys [1]: [i_item_sk#17]
Join type: Inner
Join condition: None

(33) Project [codegen id : 9]
Output [6]: [ss_promo_sk#3, ss_ext_sales_price#5, ss_net_profit#6, sr_return_amt#10, sr_net_loss#11, s_store_id#16]
Input [8]: [ss_item_sk#1, ss_promo_sk#3, ss_ext_sales_price#5, ss_net_profit#6, sr_return_amt#10, sr_net_loss#11, s_store_id#16, i_item_sk#17]

(34) Scan parquet spark_catalog.default.promotion
Output [2]: [p_promo_sk#19, p_channel_tv#20]
Batched: true
Location [not included in comparison]/{warehouse_dir}/promotion]
PushedFilters: [IsNotNull(p_channel_tv), EqualTo(p_channel_tv,N), IsNotNull(p_promo_sk)]
ReadSchema: struct<p_promo_sk:int,p_channel_tv:string>

(35) ColumnarToRow [codegen id : 8]
Input [2]: [p_promo_sk#19, p_channel_tv#20]

(36) Filter [codegen id : 8]
Input [2]: [p_promo_sk#19, p_channel_tv#20]
Condition : ((isnotnull(p_channel_tv#20) AND (p_channel_tv#20 = N)) AND isnotnull(p_promo_sk#19))

(37) Project [codegen id : 8]
Output [1]: [p_promo_sk#19]
Input [2]: [p_promo_sk#19, p_channel_tv#20]

(38) BroadcastExchange
Input [1]: [p_promo_sk#19]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [plan_id=6]

(39) BroadcastHashJoin [codegen id : 9]
Left keys [1]: [ss_promo_sk#3]
Right keys [1]: [p_promo_sk#19]
Join type: Inner
Join condition: None

(40) Project [codegen id : 9]
Output [5]: [ss_ext_sales_price#5, ss_net_profit#6, sr_return_amt#10, sr_net_loss#11, s_store_id#16]
Input [7]: [ss_promo_sk#3, ss_ext_sales_price#5, ss_net_profit#6, sr_return_amt#10, sr_net_loss#11, s_store_id#16, p_promo_sk#19]

(41) HashAggregate [codegen id : 9]
Input [5]: [ss_ext_sales_price#5, ss_net_profit#6, sr_return_amt#10, sr_net_loss#11, s_store_id#16]
Keys [1]: [s_store_id#16]
Functions [3]: [partial_sum(UnscaledValue(ss_ext_sales_price#5)), partial_sum(coalesce(cast(sr_return_amt#10 as decimal(12,2)), 0.00)), partial_sum((ss_net_profit#6 - coalesce(cast(sr_net_loss#11 as decimal(12,2)), 0.00)))]
Aggregate Attributes [5]: [sum#21, sum#22, isEmpty#23, sum#24, isEmpty#25]
Results [6]: [s_store_id#16, sum#26, sum#27, isEmpty#28, sum#29, isEmpty#30]

(42) Exchange
Input [6]: [s_store_id#16, sum#26, sum#27, isEmpty#28, sum#29, isEmpty#30]
Arguments: hashpartitioning(s_store_id#16, 5), ENSURE_REQUIREMENTS, [plan_id=7]

(43) HashAggregate [codegen id : 10]
Input [6]: [s_store_id#16, sum#26, sum#27, isEmpty#28, sum#29, isEmpty#30]
Keys [1]: [s_store_id#16]
Functions [3]: [sum(UnscaledValue(ss_ext_sales_price#5)), sum(coalesce(cast(sr_return_amt#10 as decimal(12,2)), 0.00)), sum((ss_net_profit#6 - coalesce(cast(sr_net_loss#11 as decimal(12,2)), 0.00)))]
Aggregate Attributes [3]: [sum(UnscaledValue(ss_ext_sales_price#5))#31, sum(coalesce(cast(sr_return_amt#10 as decimal(12,2)), 0.00))#32, sum((ss_net_profit#6 - coalesce(cast(sr_net_loss#11 as decimal(12,2)), 0.00)))#33]
Results [5]: [store channel AS channel#34, concat(store, s_store_id#16) AS id#35, MakeDecimal(sum(UnscaledValue(ss_ext_sales_price#5))#31,17,2) AS sales#36, sum(coalesce(cast(sr_return_amt#10 as decimal(12,2)), 0.00))#32 AS returns#37, sum((ss_net_profit#6 - coalesce(cast(sr_net_loss#11 as decimal(12,2)), 0.00)))#33 AS profit#38]

(44) Scan parquet spark_catalog.default.catalog_sales
Output [7]: [cs_catalog_page_sk#39, cs_item_sk#40, cs_promo_sk#41, cs_order_number#42, cs_ext_sales_price#43, cs_net_profit#44, cs_sold_date_sk#45]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(cs_sold_date_sk#45)]
PushedFilters: [IsNotNull(cs_catalog_page_sk), IsNotNull(cs_item_sk), IsNotNull(cs_promo_sk)]
ReadSchema: struct<cs_catalog_page_sk:int,cs_item_sk:int,cs_promo_sk:int,cs_order_number:int,cs_ext_sales_price:decimal(7,2),cs_net_profit:decimal(7,2)>

(45) ColumnarToRow [codegen id : 11]
Input [7]: [cs_catalog_page_sk#39, cs_item_sk#40, cs_promo_sk#41, cs_order_number#42, cs_ext_sales_price#43, cs_net_profit#44, cs_sold_date_sk#45]

(46) Filter [codegen id : 11]
Input [7]: [cs_catalog_page_sk#39, cs_item_sk#40, cs_promo_sk#41, cs_order_number#42, cs_ext_sales_price#43, cs_net_profit#44, cs_sold_date_sk#45]
Condition : ((isnotnull(cs_catalog_page_sk#39) AND isnotnull(cs_item_sk#40)) AND isnotnull(cs_promo_sk#41))

(47) Exchange
Input [7]: [cs_catalog_page_sk#39, cs_item_sk#40, cs_promo_sk#41, cs_order_number#42, cs_ext_sales_price#43, cs_net_profit#44, cs_sold_date_sk#45]
Arguments: hashpartitioning(cs_item_sk#40, cs_order_number#42, 5), ENSURE_REQUIREMENTS, [plan_id=8]

(48) Sort [codegen id : 12]
Input [7]: [cs_catalog_page_sk#39, cs_item_sk#40, cs_promo_sk#41, cs_order_number#42, cs_ext_sales_price#43, cs_net_profit#44, cs_sold_date_sk#45]
Arguments: [cs_item_sk#40 ASC NULLS FIRST, cs_order_number#42 ASC NULLS FIRST], false, 0

(49) Scan parquet spark_catalog.default.catalog_returns
Output [5]: [cr_item_sk#46, cr_order_number#47, cr_return_amount#48, cr_net_loss#49, cr_returned_date_sk#50]
Batched: true
Location [not included in comparison]/{warehouse_dir}/catalog_returns]
PushedFilters: [IsNotNull(cr_item_sk), IsNotNull(cr_order_number)]
ReadSchema: struct<cr_item_sk:int,cr_order_number:int,cr_return_amount:decimal(7,2),cr_net_loss:decimal(7,2)>

(50) ColumnarToRow [codegen id : 13]
Input [5]: [cr_item_sk#46, cr_order_number#47, cr_return_amount#48, cr_net_loss#49, cr_returned_date_sk#50]

(51) Filter [codegen id : 13]
Input [5]: [cr_item_sk#46, cr_order_number#47, cr_return_amount#48, cr_net_loss#49, cr_returned_date_sk#50]
Condition : (isnotnull(cr_item_sk#46) AND isnotnull(cr_order_number#47))

(52) Project [codegen id : 13]
Output [4]: [cr_item_sk#46, cr_order_number#47, cr_return_amount#48, cr_net_loss#49]
Input [5]: [cr_item_sk#46, cr_order_number#47, cr_return_amount#48, cr_net_loss#49, cr_returned_date_sk#50]

(53) Exchange
Input [4]: [cr_item_sk#46, cr_order_number#47, cr_return_amount#48, cr_net_loss#49]
Arguments: hashpartitioning(cr_item_sk#46, cr_order_number#47, 5), ENSURE_REQUIREMENTS, [plan_id=9]

(54) Sort [codegen id : 14]
Input [4]: [cr_item_sk#46, cr_order_number#47, cr_return_amount#48, cr_net_loss#49]
Arguments: [cr_item_sk#46 ASC NULLS FIRST, cr_order_number#47 ASC NULLS FIRST], false, 0

(55) SortMergeJoin [codegen id : 19]
Left keys [2]: [cs_item_sk#40, cs_order_number#42]
Right keys [2]: [cr_item_sk#46, cr_order_number#47]
Join type: LeftOuter
Join condition: None

(56) Project [codegen id : 19]
Output [8]: [cs_catalog_page_sk#39, cs_item_sk#40, cs_promo_sk#41, cs_ext_sales_price#43, cs_net_profit#44, cs_sold_date_sk#45, cr_return_amount#48, cr_net_loss#49]
Input [11]: [cs_catalog_page_sk#39, cs_item_sk#40, cs_promo_sk#41, cs_order_number#42, cs_ext_sales_price#43, cs_net_profit#44, cs_sold_date_sk#45, cr_item_sk#46, cr_order_number#47, cr_return_amount#48, cr_net_loss#49]

(57) ReusedExchange [Reuses operator id: 18]
Output [1]: [d_date_sk#51]

(58) BroadcastHashJoin [codegen id : 19]
Left keys [1]: [cs_sold_date_sk#45]
Right keys [1]: [d_date_sk#51]
Join type: Inner
Join condition: None

(59) Project [codegen id : 19]
Output [7]: [cs_catalog_page_sk#39, cs_item_sk#40, cs_promo_sk#41, cs_ext_sales_price#43, cs_net_profit#44, cr_return_amount#48, cr_net_loss#49]
Input [9]: [cs_catalog_page_sk#39, cs_item_sk#40, cs_promo_sk#41, cs_ext_sales_price#43, cs_net_profit#44, cs_sold_date_sk#45, cr_return_amount#48, cr_net_loss#49, d_date_sk#51]

(60) Scan parquet spark_catalog.default.catalog_page
Output [2]: [cp_catalog_page_sk#52, cp_catalog_page_id#53]
Batched: true
Location [not included in comparison]/{warehouse_dir}/catalog_page]
PushedFilters: [IsNotNull(cp_catalog_page_sk)]
ReadSchema: struct<cp_catalog_page_sk:int,cp_catalog_page_id:string>

(61) ColumnarToRow [codegen id : 16]
Input [2]: [cp_catalog_page_sk#52, cp_catalog_page_id#53]

(62) Filter [codegen id : 16]
Input [2]: [cp_catalog_page_sk#52, cp_catalog_page_id#53]
Condition : isnotnull(cp_catalog_page_sk#52)

(63) BroadcastExchange
Input [2]: [cp_catalog_page_sk#52, cp_catalog_page_id#53]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=10]

(64) BroadcastHashJoin [codegen id : 19]
Left keys [1]: [cs_catalog_page_sk#39]
Right keys [1]: [cp_catalog_page_sk#52]
Join type: Inner
Join condition: None

(65) Project [codegen id : 19]
Output [7]: [cs_item_sk#40, cs_promo_sk#41, cs_ext_sales_price#43, cs_net_profit#44, cr_return_amount#48, cr_net_loss#49, cp_catalog_page_id#53]
Input [9]: [cs_catalog_page_sk#39, cs_item_sk#40, cs_promo_sk#41, cs_ext_sales_price#43, cs_net_profit#44, cr_return_amount#48, cr_net_loss#49, cp_catalog_page_sk#52, cp_catalog_page_id#53]

(66) ReusedExchange [Reuses operator id: 31]
Output [1]: [i_item_sk#54]

(67) BroadcastHashJoin [codegen id : 19]
Left keys [1]: [cs_item_sk#40]
Right keys [1]: [i_item_sk#54]
Join type: Inner
Join condition: None

(68) Project [codegen id : 19]
Output [6]: [cs_promo_sk#41, cs_ext_sales_price#43, cs_net_profit#44, cr_return_amount#48, cr_net_loss#49, cp_catalog_page_id#53]
Input [8]: [cs_item_sk#40, cs_promo_sk#41, cs_ext_sales_price#43, cs_net_profit#44, cr_return_amount#48, cr_net_loss#49, cp_catalog_page_id#53, i_item_sk#54]

(69) ReusedExchange [Reuses operator id: 38]
Output [1]: [p_promo_sk#55]

(70) BroadcastHashJoin [codegen id : 19]
Left keys [1]: [cs_promo_sk#41]
Right keys [1]: [p_promo_sk#55]
Join type: Inner
Join condition: None

(71) Project [codegen id : 19]
Output [5]: [cs_ext_sales_price#43, cs_net_profit#44, cr_return_amount#48, cr_net_loss#49, cp_catalog_page_id#53]
Input [7]: [cs_promo_sk#41, cs_ext_sales_price#43, cs_net_profit#44, cr_return_amount#48, cr_net_loss#49, cp_catalog_page_id#53, p_promo_sk#55]

(72) HashAggregate [codegen id : 19]
Input [5]: [cs_ext_sales_price#43, cs_net_profit#44, cr_return_amount#48, cr_net_loss#49, cp_catalog_page_id#53]
Keys [1]: [cp_catalog_page_id#53]
Functions [3]: [partial_sum(UnscaledValue(cs_ext_sales_price#43)), partial_sum(coalesce(cast(cr_return_amount#48 as decimal(12,2)), 0.00)), partial_sum((cs_net_profit#44 - coalesce(cast(cr_net_loss#49 as decimal(12,2)), 0.00)))]
Aggregate Attributes [5]: [sum#56, sum#57, isEmpty#58, sum#59, isEmpty#60]
Results [6]: [cp_catalog_page_id#53, sum#61, sum#62, isEmpty#63, sum#64, isEmpty#65]

(73) Exchange
Input [6]: [cp_catalog_page_id#53, sum#61, sum#62, isEmpty#63, sum#64, isEmpty#65]
Arguments: hashpartitioning(cp_catalog_page_id#53, 5), ENSURE_REQUIREMENTS, [plan_id=11]

(74) HashAggregate [codegen id : 20]
Input [6]: [cp_catalog_page_id#53, sum#61, sum#62, isEmpty#63, sum#64, isEmpty#65]
Keys [1]: [cp_catalog_page_id#53]
Functions [3]: [sum(UnscaledValue(cs_ext_sales_price#43)), sum(coalesce(cast(cr_return_amount#48 as decimal(12,2)), 0.00)), sum((cs_net_profit#44 - coalesce(cast(cr_net_loss#49 as decimal(12,2)), 0.00)))]
Aggregate Attributes [3]: [sum(UnscaledValue(cs_ext_sales_price#43))#66, sum(coalesce(cast(cr_return_amount#48 as decimal(12,2)), 0.00))#67, sum((cs_net_profit#44 - coalesce(cast(cr_net_loss#49 as decimal(12,2)), 0.00)))#68]
Results [5]: [catalog channel AS channel#69, concat(catalog_page, cp_catalog_page_id#53) AS id#70, MakeDecimal(sum(UnscaledValue(cs_ext_sales_price#43))#66,17,2) AS sales#71, sum(coalesce(cast(cr_return_amount#48 as decimal(12,2)), 0.00))#67 AS returns#72, sum((cs_net_profit#44 - coalesce(cast(cr_net_loss#49 as decimal(12,2)), 0.00)))#68 AS profit#73]

(75) Scan parquet spark_catalog.default.web_sales
Output [7]: [ws_item_sk#74, ws_web_site_sk#75, ws_promo_sk#76, ws_order_number#77, ws_ext_sales_price#78, ws_net_profit#79, ws_sold_date_sk#80]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ws_sold_date_sk#80)]
PushedFilters: [IsNotNull(ws_web_site_sk), IsNotNull(ws_item_sk), IsNotNull(ws_promo_sk)]
ReadSchema: struct<ws_item_sk:int,ws_web_site_sk:int,ws_promo_sk:int,ws_order_number:int,ws_ext_sales_price:decimal(7,2),ws_net_profit:decimal(7,2)>

(76) ColumnarToRow [codegen id : 21]
Input [7]: [ws_item_sk#74, ws_web_site_sk#75, ws_promo_sk#76, ws_order_number#77, ws_ext_sales_price#78, ws_net_profit#79, ws_sold_date_sk#80]

(77) Filter [codegen id : 21]
Input [7]: [ws_item_sk#74, ws_web_site_sk#75, ws_promo_sk#76, ws_order_number#77, ws_ext_sales_price#78, ws_net_profit#79, ws_sold_date_sk#80]
Condition : ((isnotnull(ws_web_site_sk#75) AND isnotnull(ws_item_sk#74)) AND isnotnull(ws_promo_sk#76))

(78) Exchange
Input [7]: [ws_item_sk#74, ws_web_site_sk#75, ws_promo_sk#76, ws_order_number#77, ws_ext_sales_price#78, ws_net_profit#79, ws_sold_date_sk#80]
Arguments: hashpartitioning(ws_item_sk#74, ws_order_number#77, 5), ENSURE_REQUIREMENTS, [plan_id=12]

(79) Sort [codegen id : 22]
Input [7]: [ws_item_sk#74, ws_web_site_sk#75, ws_promo_sk#76, ws_order_number#77, ws_ext_sales_price#78, ws_net_profit#79, ws_sold_date_sk#80]
Arguments: [ws_item_sk#74 ASC NULLS FIRST, ws_order_number#77 ASC NULLS FIRST], false, 0

(80) Scan parquet spark_catalog.default.web_returns
Output [5]: [wr_item_sk#81, wr_order_number#82, wr_return_amt#83, wr_net_loss#84, wr_returned_date_sk#85]
Batched: true
Location [not included in comparison]/{warehouse_dir}/web_returns]
PushedFilters: [IsNotNull(wr_item_sk), IsNotNull(wr_order_number)]
ReadSchema: struct<wr_item_sk:int,wr_order_number:int,wr_return_amt:decimal(7,2),wr_net_loss:decimal(7,2)>

(81) ColumnarToRow [codegen id : 23]
Input [5]: [wr_item_sk#81, wr_order_number#82, wr_return_amt#83, wr_net_loss#84, wr_returned_date_sk#85]

(82) Filter [codegen id : 23]
Input [5]: [wr_item_sk#81, wr_order_number#82, wr_return_amt#83, wr_net_loss#84, wr_returned_date_sk#85]
Condition : (isnotnull(wr_item_sk#81) AND isnotnull(wr_order_number#82))

(83) Project [codegen id : 23]
Output [4]: [wr_item_sk#81, wr_order_number#82, wr_return_amt#83, wr_net_loss#84]
Input [5]: [wr_item_sk#81, wr_order_number#82, wr_return_amt#83, wr_net_loss#84, wr_returned_date_sk#85]

(84) Exchange
Input [4]: [wr_item_sk#81, wr_order_number#82, wr_return_amt#83, wr_net_loss#84]
Arguments: hashpartitioning(wr_item_sk#81, wr_order_number#82, 5), ENSURE_REQUIREMENTS, [plan_id=13]

(85) Sort [codegen id : 24]
Input [4]: [wr_item_sk#81, wr_order_number#82, wr_return_amt#83, wr_net_loss#84]
Arguments: [wr_item_sk#81 ASC NULLS FIRST, wr_order_number#82 ASC NULLS FIRST], false, 0

(86) SortMergeJoin [codegen id : 29]
Left keys [2]: [ws_item_sk#74, ws_order_number#77]
Right keys [2]: [wr_item_sk#81, wr_order_number#82]
Join type: LeftOuter
Join condition: None

(87) Project [codegen id : 29]
Output [8]: [ws_item_sk#74, ws_web_site_sk#75, ws_promo_sk#76, ws_ext_sales_price#78, ws_net_profit#79, ws_sold_date_sk#80, wr_return_amt#83, wr_net_loss#84]
Input [11]: [ws_item_sk#74, ws_web_site_sk#75, ws_promo_sk#76, ws_order_number#77, ws_ext_sales_price#78, ws_net_profit#79, ws_sold_date_sk#80, wr_item_sk#81, wr_order_number#82, wr_return_amt#83, wr_net_loss#84]

(88) ReusedExchange [Reuses operator id: 18]
Output [1]: [d_date_sk#86]

(89) BroadcastHashJoin [codegen id : 29]
Left keys [1]: [ws_sold_date_sk#80]
Right keys [1]: [d_date_sk#86]
Join type: Inner
Join condition: None

(90) Project [codegen id : 29]
Output [7]: [ws_item_sk#74, ws_web_site_sk#75, ws_promo_sk#76, ws_ext_sales_price#78, ws_net_profit#79, wr_return_amt#83, wr_net_loss#84]
Input [9]: [ws_item_sk#74, ws_web_site_sk#75, ws_promo_sk#76, ws_ext_sales_price#78, ws_net_profit#79, ws_sold_date_sk#80, wr_return_amt#83, wr_net_loss#84, d_date_sk#86]

(91) Scan parquet spark_catalog.default.web_site
Output [2]: [web_site_sk#87, web_site_id#88]
Batched: true
Location [not included in comparison]/{warehouse_dir}/web_site]
PushedFilters: [IsNotNull(web_site_sk)]
ReadSchema: struct<web_site_sk:int,web_site_id:string>

(92) ColumnarToRow [codegen id : 26]
Input [2]: [web_site_sk#87, web_site_id#88]

(93) Filter [codegen id : 26]
Input [2]: [web_site_sk#87, web_site_id#88]
Condition : isnotnull(web_site_sk#87)

(94) BroadcastExchange
Input [2]: [web_site_sk#87, web_site_id#88]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=14]

(95) BroadcastHashJoin [codegen id : 29]
Left keys [1]: [ws_web_site_sk#75]
Right keys [1]: [web_site_sk#87]
Join type: Inner
Join condition: None

(96) Project [codegen id : 29]
Output [7]: [ws_item_sk#74, ws_promo_sk#76, ws_ext_sales_price#78, ws_net_profit#79, wr_return_amt#83, wr_net_loss#84, web_site_id#88]
Input [9]: [ws_item_sk#74, ws_web_site_sk#75, ws_promo_sk#76, ws_ext_sales_price#78, ws_net_profit#79, wr_return_amt#83, wr_net_loss#84, web_site_sk#87, web_site_id#88]

(97) ReusedExchange [Reuses operator id: 31]
Output [1]: [i_item_sk#89]

(98) BroadcastHashJoin [codegen id : 29]
Left keys [1]: [ws_item_sk#74]
Right keys [1]: [i_item_sk#89]
Join type: Inner
Join condition: None

(99) Project [codegen id : 29]
Output [6]: [ws_promo_sk#76, ws_ext_sales_price#78, ws_net_profit#79, wr_return_amt#83, wr_net_loss#84, web_site_id#88]
Input [8]: [ws_item_sk#74, ws_promo_sk#76, ws_ext_sales_price#78, ws_net_profit#79, wr_return_amt#83, wr_net_loss#84, web_site_id#88, i_item_sk#89]

(100) ReusedExchange [Reuses operator id: 38]
Output [1]: [p_promo_sk#90]

(101) BroadcastHashJoin [codegen id : 29]
Left keys [1]: [ws_promo_sk#76]
Right keys [1]: [p_promo_sk#90]
Join type: Inner
Join condition: None

(102) Project [codegen id : 29]
Output [5]: [ws_ext_sales_price#78, ws_net_profit#79, wr_return_amt#83, wr_net_loss#84, web_site_id#88]
Input [7]: [ws_promo_sk#76, ws_ext_sales_price#78, ws_net_profit#79, wr_return_amt#83, wr_net_loss#84, web_site_id#88, p_promo_sk#90]

(103) HashAggregate [codegen id : 29]
Input [5]: [ws_ext_sales_price#78, ws_net_profit#79, wr_return_amt#83, wr_net_loss#84, web_site_id#88]
Keys [1]: [web_site_id#88]
Functions [3]: [partial_sum(UnscaledValue(ws_ext_sales_price#78)), partial_sum(coalesce(cast(wr_return_amt#83 as decimal(12,2)), 0.00)), partial_sum((ws_net_profit#79 - coalesce(cast(wr_net_loss#84 as decimal(12,2)), 0.00)))]
Aggregate Attributes [5]: [sum#91, sum#92, isEmpty#93, sum#94, isEmpty#95]
Results [6]: [web_site_id#88, sum#96, sum#97, isEmpty#98, sum#99, isEmpty#100]

(104) Exchange
Input [6]: [web_site_id#88, sum#96, sum#97, isEmpty#98, sum#99, isEmpty#100]
Arguments: hashpartitioning(web_site_id#88, 5), ENSURE_REQUIREMENTS, [plan_id=15]

(105) HashAggregate [codegen id : 30]
Input [6]: [web_site_id#88, sum#96, sum#97, isEmpty#98, sum#99, isEmpty#100]
Keys [1]: [web_site_id#88]
Functions [3]: [sum(UnscaledValue(ws_ext_sales_price#78)), sum(coalesce(cast(wr_return_amt#83 as decimal(12,2)), 0.00)), sum((ws_net_profit#79 - coalesce(cast(wr_net_loss#84 as decimal(12,2)), 0.00)))]
Aggregate Attributes [3]: [sum(UnscaledValue(ws_ext_sales_price#78))#101, sum(coalesce(cast(wr_return_amt#83 as decimal(12,2)), 0.00))#102, sum((ws_net_profit#79 - coalesce(cast(wr_net_loss#84 as decimal(12,2)), 0.00)))#103]
Results [5]: [web channel AS channel#104, concat(web_site, web_site_id#88) AS id#105, MakeDecimal(sum(UnscaledValue(ws_ext_sales_price#78))#101,17,2) AS sales#106, sum(coalesce(cast(wr_return_amt#83 as decimal(12,2)), 0.00))#102 AS returns#107, sum((ws_net_profit#79 - coalesce(cast(wr_net_loss#84 as decimal(12,2)), 0.00)))#103 AS profit#108]

(106) Union

(107) HashAggregate [codegen id : 31]
Input [5]: [channel#34, id#35, sales#36, returns#37, profit#38]
Keys [2]: [channel#34, id#35]
Functions [3]: [partial_sum(sales#36), partial_sum(returns#37), partial_sum(profit#38)]
Aggregate Attributes [6]: [sum#109, isEmpty#110, sum#111, isEmpty#112, sum#113, isEmpty#114]
Results [8]: [channel#34, id#35, sum#115, isEmpty#116, sum#117, isEmpty#118, sum#119, isEmpty#120]

(108) Exchange
Input [8]: [channel#34, id#35, sum#115, isEmpty#116, sum#117, isEmpty#118, sum#119, isEmpty#120]
Arguments: hashpartitioning(channel#34, id#35, 5), ENSURE_REQUIREMENTS, [plan_id=16]

(109) HashAggregate [codegen id : 32]
Input [8]: [channel#34, id#35, sum#115, isEmpty#116, sum#117, isEmpty#118, sum#119, isEmpty#120]
Keys [2]: [channel#34, id#35]
Functions [3]: [sum(sales#36), sum(returns#37), sum(profit#38)]
Aggregate Attributes [3]: [sum(sales#36)#121, sum(returns#37)#122, sum(profit#38)#123]
Results [5]: [channel#34, id#35, cast(sum(sales#36)#121 as decimal(37,2)) AS sales#124, cast(sum(returns#37)#122 as decimal(38,2)) AS returns#125, cast(sum(profit#38)#123 as decimal(38,2)) AS profit#126]

(110) ReusedExchange [Reuses operator id: 108]
Output [8]: [channel#34, id#35, sum#115, isEmpty#116, sum#117, isEmpty#118, sum#119, isEmpty#120]

(111) HashAggregate [codegen id : 64]
Input [8]: [channel#34, id#35, sum#115, isEmpty#116, sum#117, isEmpty#118, sum#119, isEmpty#120]
Keys [2]: [channel#34, id#35]
Functions [3]: [sum(sales#36), sum(returns#37), sum(profit#38)]
Aggregate Attributes [3]: [sum(sales#36)#121, sum(returns#37)#122, sum(profit#38)#123]
Results [4]: [channel#34, sum(sales#36)#121 AS sales#127, sum(returns#37)#122 AS returns#128, sum(profit#38)#123 AS profit#129]

(112) HashAggregate [codegen id : 64]
Input [4]: [channel#34, sales#127, returns#128, profit#129]
Keys [1]: [channel#34]
Functions [3]: [partial_sum(sales#127), partial_sum(returns#128), partial_sum(profit#129)]
Aggregate Attributes [6]: [sum#130, isEmpty#131, sum#132, isEmpty#133, sum#134, isEmpty#135]
Results [7]: [channel#34, sum#136, isEmpty#137, sum#138, isEmpty#139, sum#140, isEmpty#141]

(113) Exchange
Input [7]: [channel#34, sum#136, isEmpty#137, sum#138, isEmpty#139, sum#140, isEmpty#141]
Arguments: hashpartitioning(channel#34, 5), ENSURE_REQUIREMENTS, [plan_id=17]

(114) HashAggregate [codegen id : 65]
Input [7]: [channel#34, sum#136, isEmpty#137, sum#138, isEmpty#139, sum#140, isEmpty#141]
Keys [1]: [channel#34]
Functions [3]: [sum(sales#127), sum(returns#128), sum(profit#129)]
Aggregate Attributes [3]: [sum(sales#127)#142, sum(returns#128)#143, sum(profit#129)#144]
Results [5]: [channel#34, null AS id#145, sum(sales#127)#142 AS sales#146, sum(returns#128)#143 AS returns#147, sum(profit#129)#144 AS profit#148]

(115) ReusedExchange [Reuses operator id: 108]
Output [8]: [channel#34, id#35, sum#115, isEmpty#116, sum#117, isEmpty#118, sum#119, isEmpty#120]

(116) HashAggregate [codegen id : 97]
Input [8]: [channel#34, id#35, sum#115, isEmpty#116, sum#117, isEmpty#118, sum#119, isEmpty#120]
Keys [2]: [channel#34, id#35]
Functions [3]: [sum(sales#36), sum(returns#37), sum(profit#38)]
Aggregate Attributes [3]: [sum(sales#36)#121, sum(returns#37)#122, sum(profit#38)#123]
Results [3]: [sum(sales#36)#121 AS sales#127, sum(returns#37)#122 AS returns#128, sum(profit#38)#123 AS profit#129]

(117) HashAggregate [codegen id : 97]
Input [3]: [sales#127, returns#128, profit#129]
Keys: []
Functions [3]: [partial_sum(sales#127), partial_sum(returns#128), partial_sum(profit#129)]
Aggregate Attributes [6]: [sum#149, isEmpty#150, sum#151, isEmpty#152, sum#153, isEmpty#154]
Results [6]: [sum#155, isEmpty#156, sum#157, isEmpty#158, sum#159, isEmpty#160]

(118) Exchange
Input [6]: [sum#155, isEmpty#156, sum#157, isEmpty#158, sum#159, isEmpty#160]
Arguments: SinglePartition, ENSURE_REQUIREMENTS, [plan_id=18]

(119) HashAggregate [codegen id : 98]
Input [6]: [sum#155, isEmpty#156, sum#157, isEmpty#158, sum#159, isEmpty#160]
Keys: []
Functions [3]: [sum(sales#127), sum(returns#128), sum(profit#129)]
Aggregate Attributes [3]: [sum(sales#127)#161, sum(returns#128)#162, sum(profit#129)#163]
Results [5]: [null AS channel#164, null AS id#165, sum(sales#127)#161 AS sales#166, sum(returns#128)#162 AS returns#167, sum(profit#129)#163 AS profit#168]

(120) Union

(121) HashAggregate [codegen id : 99]
Input [5]: [channel#34, id#35, sales#124, returns#125, profit#126]
Keys [5]: [channel#34, id#35, sales#124, returns#125, profit#126]
Functions: []
Aggregate Attributes: []
Results [5]: [channel#34, id#35, sales#124, returns#125, profit#126]

(122) Exchange
Input [5]: [channel#34, id#35, sales#124, returns#125, profit#126]
Arguments: hashpartitioning(channel#34, id#35, sales#124, returns#125, profit#126, 5), ENSURE_REQUIREMENTS, [plan_id=19]

(123) HashAggregate [codegen id : 100]
Input [5]: [channel#34, id#35, sales#124, returns#125, profit#126]
Keys [5]: [channel#34, id#35, sales#124, returns#125, profit#126]
Functions: []
Aggregate Attributes: []
Results [5]: [channel#34, id#35, sales#124, returns#125, profit#126]

(124) TakeOrderedAndProject
Input [5]: [channel#34, id#35, sales#124, returns#125, profit#126]
Arguments: 100, [channel#34 ASC NULLS FIRST, id#35 ASC NULLS FIRST], [channel#34, id#35, sales#124, returns#125, profit#126]

