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


(1) Scan parquet spark_catalog.default.store_sales
Output [9]: [ss_customer_sk#1, ss_hdemo_sk#2, ss_addr_sk#3, ss_store_sk#4, ss_ticket_number#5, ss_ext_sales_price#6, ss_ext_list_price#7, ss_ext_tax#8, ss_sold_date_sk#9]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [ss_sold_date_sk#9 INSET 2451180, 2451181, 2451211, 2451212, 2451239, 2451240, 2451270, 2451271, 2451300, 2451301, 2451331, 2451332, 2451361, 2451362, 2451392, 2451393, 2451423, 2451424, 2451453, 2451454, 2451484, 2451485, 2451514, 2451515, 2451545, 2451546, 2451576, 2451577, 2451605, 2451606, 2451636, 2451637, 2451666, 2451667, 2451697, 2451698, 2451727, 2451728, 2451758, 2451759, 2451789, 2451790, 2451819, 2451820, 2451850, 2451851, 2451880, 2451881, 2451911, 2451912, 2451942, 2451943, 2451970, 2451971, 2452001, 2452002, 2452031, 2452032, 2452062, 2452063, 2452092, 2452093, 2452123, 2452124, 2452154, 2452155, 2452184, 2452185, 2452215, 2452216, 2452245, 2452246, isnotnull(ss_sold_date_sk#9), dynamicpruningexpression(ss_sold_date_sk#9 IN dynamicpruning#10)]
PushedFilters: [IsNotNull(ss_store_sk), IsNotNull(ss_hdemo_sk), IsNotNull(ss_addr_sk), IsNotNull(ss_customer_sk)]
ReadSchema: struct<ss_customer_sk:int,ss_hdemo_sk:int,ss_addr_sk:int,ss_store_sk:int,ss_ticket_number:int,ss_ext_sales_price:decimal(7,2),ss_ext_list_price:decimal(7,2),ss_ext_tax:decimal(7,2)>

(2) ColumnarToRow [codegen id : 4]
Input [9]: [ss_customer_sk#1, ss_hdemo_sk#2, ss_addr_sk#3, ss_store_sk#4, ss_ticket_number#5, ss_ext_sales_price#6, ss_ext_list_price#7, ss_ext_tax#8, ss_sold_date_sk#9]

(3) Filter [codegen id : 4]
Input [9]: [ss_customer_sk#1, ss_hdemo_sk#2, ss_addr_sk#3, ss_store_sk#4, ss_ticket_number#5, ss_ext_sales_price#6, ss_ext_list_price#7, ss_ext_tax#8, ss_sold_date_sk#9]
Condition : (((isnotnull(ss_store_sk#4) AND isnotnull(ss_hdemo_sk#2)) AND isnotnull(ss_addr_sk#3)) AND isnotnull(ss_customer_sk#1))

(4) ReusedExchange [Reuses operator id: 50]
Output [1]: [d_date_sk#11]

(5) BroadcastHashJoin [codegen id : 4]
Left keys [1]: [ss_sold_date_sk#9]
Right keys [1]: [d_date_sk#11]
Join type: Inner
Join condition: None

(6) Project [codegen id : 4]
Output [8]: [ss_customer_sk#1, ss_hdemo_sk#2, ss_addr_sk#3, ss_store_sk#4, ss_ticket_number#5, ss_ext_sales_price#6, ss_ext_list_price#7, ss_ext_tax#8]
Input [10]: [ss_customer_sk#1, ss_hdemo_sk#2, ss_addr_sk#3, ss_store_sk#4, ss_ticket_number#5, ss_ext_sales_price#6, ss_ext_list_price#7, ss_ext_tax#8, ss_sold_date_sk#9, d_date_sk#11]

(7) Scan parquet spark_catalog.default.store
Output [2]: [s_store_sk#12, s_city#13]
Batched: true
Location [not included in comparison]/{warehouse_dir}/store]
PushedFilters: [In(s_city, [Fairview,Midway]), IsNotNull(s_store_sk)]
ReadSchema: struct<s_store_sk:int,s_city:string>

(8) ColumnarToRow [codegen id : 2]
Input [2]: [s_store_sk#12, s_city#13]

(9) Filter [codegen id : 2]
Input [2]: [s_store_sk#12, s_city#13]
Condition : (s_city#13 IN (Midway,Fairview) AND isnotnull(s_store_sk#12))

(10) Project [codegen id : 2]
Output [1]: [s_store_sk#12]
Input [2]: [s_store_sk#12, s_city#13]

(11) BroadcastExchange
Input [1]: [s_store_sk#12]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [plan_id=1]

(12) BroadcastHashJoin [codegen id : 4]
Left keys [1]: [ss_store_sk#4]
Right keys [1]: [s_store_sk#12]
Join type: Inner
Join condition: None

(13) Project [codegen id : 4]
Output [7]: [ss_customer_sk#1, ss_hdemo_sk#2, ss_addr_sk#3, ss_ticket_number#5, ss_ext_sales_price#6, ss_ext_list_price#7, ss_ext_tax#8]
Input [9]: [ss_customer_sk#1, ss_hdemo_sk#2, ss_addr_sk#3, ss_store_sk#4, ss_ticket_number#5, ss_ext_sales_price#6, ss_ext_list_price#7, ss_ext_tax#8, s_store_sk#12]

(14) Scan parquet spark_catalog.default.household_demographics
Output [3]: [hd_demo_sk#14, hd_dep_count#15, hd_vehicle_count#16]
Batched: true
Location [not included in comparison]/{warehouse_dir}/household_demographics]
PushedFilters: [Or(EqualTo(hd_dep_count,5),EqualTo(hd_vehicle_count,3)), IsNotNull(hd_demo_sk)]
ReadSchema: struct<hd_demo_sk:int,hd_dep_count:int,hd_vehicle_count:int>

(15) ColumnarToRow [codegen id : 3]
Input [3]: [hd_demo_sk#14, hd_dep_count#15, hd_vehicle_count#16]

(16) Filter [codegen id : 3]
Input [3]: [hd_demo_sk#14, hd_dep_count#15, hd_vehicle_count#16]
Condition : (((hd_dep_count#15 = 5) OR (hd_vehicle_count#16 = 3)) AND isnotnull(hd_demo_sk#14))

(17) Project [codegen id : 3]
Output [1]: [hd_demo_sk#14]
Input [3]: [hd_demo_sk#14, hd_dep_count#15, hd_vehicle_count#16]

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

(19) BroadcastHashJoin [codegen id : 4]
Left keys [1]: [ss_hdemo_sk#2]
Right keys [1]: [hd_demo_sk#14]
Join type: Inner
Join condition: None

(20) Project [codegen id : 4]
Output [6]: [ss_customer_sk#1, ss_addr_sk#3, ss_ticket_number#5, ss_ext_sales_price#6, ss_ext_list_price#7, ss_ext_tax#8]
Input [8]: [ss_customer_sk#1, ss_hdemo_sk#2, ss_addr_sk#3, ss_ticket_number#5, ss_ext_sales_price#6, ss_ext_list_price#7, ss_ext_tax#8, hd_demo_sk#14]

(21) BroadcastExchange
Input [6]: [ss_customer_sk#1, ss_addr_sk#3, ss_ticket_number#5, ss_ext_sales_price#6, ss_ext_list_price#7, ss_ext_tax#8]
Arguments: HashedRelationBroadcastMode(List(cast(input[1, int, true] as bigint)),false), [plan_id=3]

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

(23) ColumnarToRow
Input [2]: [ca_address_sk#17, ca_city#18]

(24) Filter
Input [2]: [ca_address_sk#17, ca_city#18]
Condition : (isnotnull(ca_address_sk#17) AND isnotnull(ca_city#18))

(25) BroadcastHashJoin [codegen id : 5]
Left keys [1]: [ss_addr_sk#3]
Right keys [1]: [ca_address_sk#17]
Join type: Inner
Join condition: None

(26) Project [codegen id : 5]
Output [7]: [ss_customer_sk#1, ss_addr_sk#3, ss_ticket_number#5, ss_ext_sales_price#6, ss_ext_list_price#7, ss_ext_tax#8, ca_city#18]
Input [8]: [ss_customer_sk#1, ss_addr_sk#3, ss_ticket_number#5, ss_ext_sales_price#6, ss_ext_list_price#7, ss_ext_tax#8, ca_address_sk#17, ca_city#18]

(27) HashAggregate [codegen id : 5]
Input [7]: [ss_customer_sk#1, ss_addr_sk#3, ss_ticket_number#5, ss_ext_sales_price#6, ss_ext_list_price#7, ss_ext_tax#8, ca_city#18]
Keys [4]: [ss_ticket_number#5, ss_customer_sk#1, ss_addr_sk#3, ca_city#18]
Functions [3]: [partial_sum(UnscaledValue(ss_ext_sales_price#6)), partial_sum(UnscaledValue(ss_ext_list_price#7)), partial_sum(UnscaledValue(ss_ext_tax#8))]
Aggregate Attributes [3]: [sum#19, sum#20, sum#21]
Results [7]: [ss_ticket_number#5, ss_customer_sk#1, ss_addr_sk#3, ca_city#18, sum#22, sum#23, sum#24]

(28) Exchange
Input [7]: [ss_ticket_number#5, ss_customer_sk#1, ss_addr_sk#3, ca_city#18, sum#22, sum#23, sum#24]
Arguments: hashpartitioning(ss_ticket_number#5, ss_customer_sk#1, ss_addr_sk#3, ca_city#18, 5), ENSURE_REQUIREMENTS, [plan_id=4]

(29) HashAggregate [codegen id : 6]
Input [7]: [ss_ticket_number#5, ss_customer_sk#1, ss_addr_sk#3, ca_city#18, sum#22, sum#23, sum#24]
Keys [4]: [ss_ticket_number#5, ss_customer_sk#1, ss_addr_sk#3, ca_city#18]
Functions [3]: [sum(UnscaledValue(ss_ext_sales_price#6)), sum(UnscaledValue(ss_ext_list_price#7)), sum(UnscaledValue(ss_ext_tax#8))]
Aggregate Attributes [3]: [sum(UnscaledValue(ss_ext_sales_price#6))#25, sum(UnscaledValue(ss_ext_list_price#7))#26, sum(UnscaledValue(ss_ext_tax#8))#27]
Results [6]: [ss_ticket_number#5, ss_customer_sk#1, ca_city#18 AS bought_city#28, MakeDecimal(sum(UnscaledValue(ss_ext_sales_price#6))#25,17,2) AS extended_price#29, MakeDecimal(sum(UnscaledValue(ss_ext_list_price#7))#26,17,2) AS list_price#30, MakeDecimal(sum(UnscaledValue(ss_ext_tax#8))#27,17,2) AS extended_tax#31]

(30) BroadcastExchange
Input [6]: [ss_ticket_number#5, ss_customer_sk#1, bought_city#28, extended_price#29, list_price#30, extended_tax#31]
Arguments: HashedRelationBroadcastMode(List(cast(input[1, int, true] as bigint)),false), [plan_id=5]

(31) Scan parquet spark_catalog.default.customer
Output [4]: [c_customer_sk#32, c_current_addr_sk#33, c_first_name#34, c_last_name#35]
Batched: true
Location [not included in comparison]/{warehouse_dir}/customer]
PushedFilters: [IsNotNull(c_customer_sk), IsNotNull(c_current_addr_sk)]
ReadSchema: struct<c_customer_sk:int,c_current_addr_sk:int,c_first_name:string,c_last_name:string>

(32) ColumnarToRow
Input [4]: [c_customer_sk#32, c_current_addr_sk#33, c_first_name#34, c_last_name#35]

(33) Filter
Input [4]: [c_customer_sk#32, c_current_addr_sk#33, c_first_name#34, c_last_name#35]
Condition : (isnotnull(c_customer_sk#32) AND isnotnull(c_current_addr_sk#33))

(34) BroadcastHashJoin [codegen id : 7]
Left keys [1]: [ss_customer_sk#1]
Right keys [1]: [c_customer_sk#32]
Join type: Inner
Join condition: None

(35) Project [codegen id : 7]
Output [8]: [ss_ticket_number#5, bought_city#28, extended_price#29, list_price#30, extended_tax#31, c_current_addr_sk#33, c_first_name#34, c_last_name#35]
Input [10]: [ss_ticket_number#5, ss_customer_sk#1, bought_city#28, extended_price#29, list_price#30, extended_tax#31, c_customer_sk#32, c_current_addr_sk#33, c_first_name#34, c_last_name#35]

(36) Exchange
Input [8]: [ss_ticket_number#5, bought_city#28, extended_price#29, list_price#30, extended_tax#31, c_current_addr_sk#33, c_first_name#34, c_last_name#35]
Arguments: hashpartitioning(c_current_addr_sk#33, 5), ENSURE_REQUIREMENTS, [plan_id=6]

(37) Sort [codegen id : 8]
Input [8]: [ss_ticket_number#5, bought_city#28, extended_price#29, list_price#30, extended_tax#31, c_current_addr_sk#33, c_first_name#34, c_last_name#35]
Arguments: [c_current_addr_sk#33 ASC NULLS FIRST], false, 0

(38) Scan parquet spark_catalog.default.customer_address
Output [2]: [ca_address_sk#36, ca_city#37]
Batched: true
Location [not included in comparison]/{warehouse_dir}/customer_address]
PushedFilters: [IsNotNull(ca_address_sk), IsNotNull(ca_city)]
ReadSchema: struct<ca_address_sk:int,ca_city:string>

(39) ColumnarToRow [codegen id : 9]
Input [2]: [ca_address_sk#36, ca_city#37]

(40) Filter [codegen id : 9]
Input [2]: [ca_address_sk#36, ca_city#37]
Condition : (isnotnull(ca_address_sk#36) AND isnotnull(ca_city#37))

(41) Exchange
Input [2]: [ca_address_sk#36, ca_city#37]
Arguments: hashpartitioning(ca_address_sk#36, 5), ENSURE_REQUIREMENTS, [plan_id=7]

(42) Sort [codegen id : 10]
Input [2]: [ca_address_sk#36, ca_city#37]
Arguments: [ca_address_sk#36 ASC NULLS FIRST], false, 0

(43) SortMergeJoin [codegen id : 11]
Left keys [1]: [c_current_addr_sk#33]
Right keys [1]: [ca_address_sk#36]
Join type: Inner
Join condition: NOT (ca_city#37 = bought_city#28)

(44) Project [codegen id : 11]
Output [8]: [c_last_name#35, c_first_name#34, ca_city#37, bought_city#28, ss_ticket_number#5, extended_price#29, extended_tax#31, list_price#30]
Input [10]: [ss_ticket_number#5, bought_city#28, extended_price#29, list_price#30, extended_tax#31, c_current_addr_sk#33, c_first_name#34, c_last_name#35, ca_address_sk#36, ca_city#37]

(45) TakeOrderedAndProject
Input [8]: [c_last_name#35, c_first_name#34, ca_city#37, bought_city#28, ss_ticket_number#5, extended_price#29, extended_tax#31, list_price#30]
Arguments: 100, [c_last_name#35 ASC NULLS FIRST, ss_ticket_number#5 ASC NULLS FIRST], [c_last_name#35, c_first_name#34, ca_city#37, bought_city#28, ss_ticket_number#5, extended_price#29, extended_tax#31, list_price#30]

===== Subqueries =====

Subquery:1 Hosting operator id = 1 Hosting Expression = ss_sold_date_sk#9 IN dynamicpruning#10
BroadcastExchange (50)
+- * Project (49)
   +- * Filter (48)
      +- * ColumnarToRow (47)
         +- Scan parquet spark_catalog.default.date_dim (46)


(46) Scan parquet spark_catalog.default.date_dim
Output [3]: [d_date_sk#11, d_year#38, d_dom#39]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_dom), GreaterThanOrEqual(d_dom,1), LessThanOrEqual(d_dom,2), In(d_year, [1999,2000,2001]), In(d_date_sk, [2451180,2451181,2451211,2451212,2451239,2451240,2451270,2451271,2451300,2451301,2451331,2451332,2451361,2451362,2451392,2451393,2451423,2451424,2451453,2451454,2451484,2451485,2451514,2451515,2451545,2451546,2451576,2451577,2451605,2451606,2451636,2451637,2451666,2451667,2451697,2451698,2451727,2451728,2451758,2451759,2451789,2451790,2451819,2451820,2451850,2451851,2451880,2451881,2451911,2451912,2451942,2451943,2451970,2451971,2452001,2452002,2452031,2452032,2452062,2452063,2452092,2452093,2452123,2452124,2452154,2452155,2452184,2452185,2452215,2452216,2452245,2452246]), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_year:int,d_dom:int>

(47) ColumnarToRow [codegen id : 1]
Input [3]: [d_date_sk#11, d_year#38, d_dom#39]

(48) Filter [codegen id : 1]
Input [3]: [d_date_sk#11, d_year#38, d_dom#39]
Condition : (((((isnotnull(d_dom#39) AND (d_dom#39 >= 1)) AND (d_dom#39 <= 2)) AND d_year#38 IN (1999,2000,2001)) AND d_date_sk#11 INSET 2451180, 2451181, 2451211, 2451212, 2451239, 2451240, 2451270, 2451271, 2451300, 2451301, 2451331, 2451332, 2451361, 2451362, 2451392, 2451393, 2451423, 2451424, 2451453, 2451454, 2451484, 2451485, 2451514, 2451515, 2451545, 2451546, 2451576, 2451577, 2451605, 2451606, 2451636, 2451637, 2451666, 2451667, 2451697, 2451698, 2451727, 2451728, 2451758, 2451759, 2451789, 2451790, 2451819, 2451820, 2451850, 2451851, 2451880, 2451881, 2451911, 2451912, 2451942, 2451943, 2451970, 2451971, 2452001, 2452002, 2452031, 2452032, 2452062, 2452063, 2452092, 2452093, 2452123, 2452124, 2452154, 2452155, 2452184, 2452185, 2452215, 2452216, 2452245, 2452246) AND isnotnull(d_date_sk#11))

(49) Project [codegen id : 1]
Output [1]: [d_date_sk#11]
Input [3]: [d_date_sk#11, d_year#38, d_dom#39]

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


