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


(1) Scan parquet spark_catalog.default.catalog_sales
Output [8]: [cs_ship_date_sk#1, cs_ship_addr_sk#2, cs_call_center_sk#3, cs_warehouse_sk#4, cs_order_number#5, cs_ext_ship_cost#6, cs_net_profit#7, cs_sold_date_sk#8]
Batched: true
Location [not included in comparison]/{warehouse_dir}/catalog_sales]
PushedFilters: [IsNotNull(cs_ship_date_sk), IsNotNull(cs_ship_addr_sk), IsNotNull(cs_call_center_sk)]
ReadSchema: struct<cs_ship_date_sk:int,cs_ship_addr_sk:int,cs_call_center_sk:int,cs_warehouse_sk:int,cs_order_number:int,cs_ext_ship_cost:decimal(7,2),cs_net_profit:decimal(7,2)>

(2) ColumnarToRow [codegen id : 1]
Input [8]: [cs_ship_date_sk#1, cs_ship_addr_sk#2, cs_call_center_sk#3, cs_warehouse_sk#4, cs_order_number#5, cs_ext_ship_cost#6, cs_net_profit#7, cs_sold_date_sk#8]

(3) Filter [codegen id : 1]
Input [8]: [cs_ship_date_sk#1, cs_ship_addr_sk#2, cs_call_center_sk#3, cs_warehouse_sk#4, cs_order_number#5, cs_ext_ship_cost#6, cs_net_profit#7, cs_sold_date_sk#8]
Condition : ((isnotnull(cs_ship_date_sk#1) AND isnotnull(cs_ship_addr_sk#2)) AND isnotnull(cs_call_center_sk#3))

(4) Project [codegen id : 1]
Output [7]: [cs_ship_date_sk#1, cs_ship_addr_sk#2, cs_call_center_sk#3, cs_warehouse_sk#4, cs_order_number#5, cs_ext_ship_cost#6, cs_net_profit#7]
Input [8]: [cs_ship_date_sk#1, cs_ship_addr_sk#2, cs_call_center_sk#3, cs_warehouse_sk#4, cs_order_number#5, cs_ext_ship_cost#6, cs_net_profit#7, cs_sold_date_sk#8]

(5) Exchange
Input [7]: [cs_ship_date_sk#1, cs_ship_addr_sk#2, cs_call_center_sk#3, cs_warehouse_sk#4, cs_order_number#5, cs_ext_ship_cost#6, cs_net_profit#7]
Arguments: hashpartitioning(cs_order_number#5, 5), ENSURE_REQUIREMENTS, [plan_id=1]

(6) Sort [codegen id : 2]
Input [7]: [cs_ship_date_sk#1, cs_ship_addr_sk#2, cs_call_center_sk#3, cs_warehouse_sk#4, cs_order_number#5, cs_ext_ship_cost#6, cs_net_profit#7]
Arguments: [cs_order_number#5 ASC NULLS FIRST], false, 0

(7) Scan parquet spark_catalog.default.catalog_sales
Output [3]: [cs_warehouse_sk#9, cs_order_number#10, cs_sold_date_sk#11]
Batched: true
Location [not included in comparison]/{warehouse_dir}/catalog_sales]
ReadSchema: struct<cs_warehouse_sk:int,cs_order_number:int>

(8) ColumnarToRow [codegen id : 3]
Input [3]: [cs_warehouse_sk#9, cs_order_number#10, cs_sold_date_sk#11]

(9) Project [codegen id : 3]
Output [2]: [cs_warehouse_sk#9, cs_order_number#10]
Input [3]: [cs_warehouse_sk#9, cs_order_number#10, cs_sold_date_sk#11]

(10) Exchange
Input [2]: [cs_warehouse_sk#9, cs_order_number#10]
Arguments: hashpartitioning(cs_order_number#10, 5), ENSURE_REQUIREMENTS, [plan_id=2]

(11) Sort [codegen id : 4]
Input [2]: [cs_warehouse_sk#9, cs_order_number#10]
Arguments: [cs_order_number#10 ASC NULLS FIRST], false, 0

(12) SortMergeJoin [codegen id : 5]
Left keys [1]: [cs_order_number#5]
Right keys [1]: [cs_order_number#10]
Join type: LeftSemi
Join condition: NOT (cs_warehouse_sk#4 = cs_warehouse_sk#9)

(13) Project [codegen id : 5]
Output [6]: [cs_ship_date_sk#1, cs_ship_addr_sk#2, cs_call_center_sk#3, cs_order_number#5, cs_ext_ship_cost#6, cs_net_profit#7]
Input [7]: [cs_ship_date_sk#1, cs_ship_addr_sk#2, cs_call_center_sk#3, cs_warehouse_sk#4, cs_order_number#5, cs_ext_ship_cost#6, cs_net_profit#7]

(14) Scan parquet spark_catalog.default.catalog_returns
Output [2]: [cr_order_number#12, cr_returned_date_sk#13]
Batched: true
Location [not included in comparison]/{warehouse_dir}/catalog_returns]
ReadSchema: struct<cr_order_number:int>

(15) ColumnarToRow [codegen id : 6]
Input [2]: [cr_order_number#12, cr_returned_date_sk#13]

(16) Project [codegen id : 6]
Output [1]: [cr_order_number#12]
Input [2]: [cr_order_number#12, cr_returned_date_sk#13]

(17) Exchange
Input [1]: [cr_order_number#12]
Arguments: hashpartitioning(cr_order_number#12, 5), ENSURE_REQUIREMENTS, [plan_id=3]

(18) Sort [codegen id : 7]
Input [1]: [cr_order_number#12]
Arguments: [cr_order_number#12 ASC NULLS FIRST], false, 0

(19) SortMergeJoin [codegen id : 11]
Left keys [1]: [cs_order_number#5]
Right keys [1]: [cr_order_number#12]
Join type: LeftAnti
Join condition: None

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

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

(22) Filter [codegen id : 8]
Input [2]: [d_date_sk#14, d_date#15]
Condition : (((isnotnull(d_date#15) AND (d_date#15 >= 2002-02-01)) AND (d_date#15 <= 2002-04-02)) AND isnotnull(d_date_sk#14))

(23) Project [codegen id : 8]
Output [1]: [d_date_sk#14]
Input [2]: [d_date_sk#14, d_date#15]

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

(25) BroadcastHashJoin [codegen id : 11]
Left keys [1]: [cs_ship_date_sk#1]
Right keys [1]: [d_date_sk#14]
Join type: Inner
Join condition: None

(26) Project [codegen id : 11]
Output [5]: [cs_ship_addr_sk#2, cs_call_center_sk#3, cs_order_number#5, cs_ext_ship_cost#6, cs_net_profit#7]
Input [7]: [cs_ship_date_sk#1, cs_ship_addr_sk#2, cs_call_center_sk#3, cs_order_number#5, cs_ext_ship_cost#6, cs_net_profit#7, d_date_sk#14]

(27) Scan parquet spark_catalog.default.customer_address
Output [2]: [ca_address_sk#16, ca_state#17]
Batched: true
Location [not included in comparison]/{warehouse_dir}/customer_address]
PushedFilters: [IsNotNull(ca_state), EqualTo(ca_state,GA), IsNotNull(ca_address_sk)]
ReadSchema: struct<ca_address_sk:int,ca_state:string>

(28) ColumnarToRow [codegen id : 9]
Input [2]: [ca_address_sk#16, ca_state#17]

(29) Filter [codegen id : 9]
Input [2]: [ca_address_sk#16, ca_state#17]
Condition : ((isnotnull(ca_state#17) AND (ca_state#17 = GA)) AND isnotnull(ca_address_sk#16))

(30) Project [codegen id : 9]
Output [1]: [ca_address_sk#16]
Input [2]: [ca_address_sk#16, ca_state#17]

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

(32) BroadcastHashJoin [codegen id : 11]
Left keys [1]: [cs_ship_addr_sk#2]
Right keys [1]: [ca_address_sk#16]
Join type: Inner
Join condition: None

(33) Project [codegen id : 11]
Output [4]: [cs_call_center_sk#3, cs_order_number#5, cs_ext_ship_cost#6, cs_net_profit#7]
Input [6]: [cs_ship_addr_sk#2, cs_call_center_sk#3, cs_order_number#5, cs_ext_ship_cost#6, cs_net_profit#7, ca_address_sk#16]

(34) Scan parquet spark_catalog.default.call_center
Output [2]: [cc_call_center_sk#18, cc_county#19]
Batched: true
Location [not included in comparison]/{warehouse_dir}/call_center]
PushedFilters: [IsNotNull(cc_county), EqualTo(cc_county,Williamson County), IsNotNull(cc_call_center_sk)]
ReadSchema: struct<cc_call_center_sk:int,cc_county:string>

(35) ColumnarToRow [codegen id : 10]
Input [2]: [cc_call_center_sk#18, cc_county#19]

(36) Filter [codegen id : 10]
Input [2]: [cc_call_center_sk#18, cc_county#19]
Condition : ((isnotnull(cc_county#19) AND (cc_county#19 = Williamson County)) AND isnotnull(cc_call_center_sk#18))

(37) Project [codegen id : 10]
Output [1]: [cc_call_center_sk#18]
Input [2]: [cc_call_center_sk#18, cc_county#19]

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

(39) BroadcastHashJoin [codegen id : 11]
Left keys [1]: [cs_call_center_sk#3]
Right keys [1]: [cc_call_center_sk#18]
Join type: Inner
Join condition: None

(40) Project [codegen id : 11]
Output [3]: [cs_order_number#5, cs_ext_ship_cost#6, cs_net_profit#7]
Input [5]: [cs_call_center_sk#3, cs_order_number#5, cs_ext_ship_cost#6, cs_net_profit#7, cc_call_center_sk#18]

(41) HashAggregate [codegen id : 11]
Input [3]: [cs_order_number#5, cs_ext_ship_cost#6, cs_net_profit#7]
Keys [1]: [cs_order_number#5]
Functions [2]: [partial_sum(UnscaledValue(cs_ext_ship_cost#6)), partial_sum(UnscaledValue(cs_net_profit#7))]
Aggregate Attributes [2]: [sum(UnscaledValue(cs_ext_ship_cost#6))#20, sum(UnscaledValue(cs_net_profit#7))#21]
Results [3]: [cs_order_number#5, sum#22, sum#23]

(42) HashAggregate [codegen id : 11]
Input [3]: [cs_order_number#5, sum#22, sum#23]
Keys [1]: [cs_order_number#5]
Functions [2]: [merge_sum(UnscaledValue(cs_ext_ship_cost#6)), merge_sum(UnscaledValue(cs_net_profit#7))]
Aggregate Attributes [2]: [sum(UnscaledValue(cs_ext_ship_cost#6))#20, sum(UnscaledValue(cs_net_profit#7))#21]
Results [3]: [cs_order_number#5, sum#22, sum#23]

(43) HashAggregate [codegen id : 11]
Input [3]: [cs_order_number#5, sum#22, sum#23]
Keys: []
Functions [3]: [merge_sum(UnscaledValue(cs_ext_ship_cost#6)), merge_sum(UnscaledValue(cs_net_profit#7)), partial_count(distinct cs_order_number#5)]
Aggregate Attributes [3]: [sum(UnscaledValue(cs_ext_ship_cost#6))#20, sum(UnscaledValue(cs_net_profit#7))#21, count(cs_order_number#5)#24]
Results [3]: [sum#22, sum#23, count#25]

(44) Exchange
Input [3]: [sum#22, sum#23, count#25]
Arguments: SinglePartition, ENSURE_REQUIREMENTS, [plan_id=7]

(45) HashAggregate [codegen id : 12]
Input [3]: [sum#22, sum#23, count#25]
Keys: []
Functions [3]: [sum(UnscaledValue(cs_ext_ship_cost#6)), sum(UnscaledValue(cs_net_profit#7)), count(distinct cs_order_number#5)]
Aggregate Attributes [3]: [sum(UnscaledValue(cs_ext_ship_cost#6))#20, sum(UnscaledValue(cs_net_profit#7))#21, count(cs_order_number#5)#24]
Results [3]: [count(cs_order_number#5)#24 AS order count #26, MakeDecimal(sum(UnscaledValue(cs_ext_ship_cost#6))#20,17,2) AS total shipping cost #27, MakeDecimal(sum(UnscaledValue(cs_net_profit#7))#21,17,2) AS total net profit #28]

