== Physical Plan ==
TakeOrderedAndProject (30)
+- * Project (29)
   +- * BroadcastHashJoin Inner BuildRight (28)
      :- * HashAggregate (23)
      :  +- Exchange (22)
      :     +- * HashAggregate (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)
      +- BroadcastExchange (27)
         +- * Filter (26)
            +- * ColumnarToRow (25)
               +- Scan parquet spark_catalog.default.customer (24)


(1) Scan parquet spark_catalog.default.store_sales
Output [8]: [ss_customer_sk#1, ss_hdemo_sk#2, ss_addr_sk#3, ss_store_sk#4, ss_ticket_number#5, ss_coupon_amt#6, ss_net_profit#7, ss_sold_date_sk#8]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#8), (ss_sold_date_sk#8 >= 2450819), (ss_sold_date_sk#8 <= 2451904), dynamicpruningexpression(ss_sold_date_sk#8 IN dynamicpruning#9)]
PushedFilters: [IsNotNull(ss_store_sk), IsNotNull(ss_hdemo_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_coupon_amt:decimal(7,2),ss_net_profit:decimal(7,2)>

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

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

(4) ReusedExchange [Reuses operator id: 35]
Output [1]: [d_date_sk#10]

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

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

(7) Scan parquet spark_catalog.default.store
Output [3]: [s_store_sk#11, s_number_employees#12, s_city#13]
Batched: true
Location [not included in comparison]/{warehouse_dir}/store]
PushedFilters: [IsNotNull(s_number_employees), GreaterThanOrEqual(s_number_employees,200), LessThanOrEqual(s_number_employees,295), IsNotNull(s_store_sk)]
ReadSchema: struct<s_store_sk:int,s_number_employees:int,s_city:string>

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

(9) Filter [codegen id : 2]
Input [3]: [s_store_sk#11, s_number_employees#12, s_city#13]
Condition : (((isnotnull(s_number_employees#12) AND (s_number_employees#12 >= 200)) AND (s_number_employees#12 <= 295)) AND isnotnull(s_store_sk#11))

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

(11) BroadcastExchange
Input [2]: [s_store_sk#11, s_city#13]
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#11]
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_coupon_amt#6, ss_net_profit#7, s_city#13]
Input [9]: [ss_customer_sk#1, ss_hdemo_sk#2, ss_addr_sk#3, ss_store_sk#4, ss_ticket_number#5, ss_coupon_amt#6, ss_net_profit#7, s_store_sk#11, s_city#13]

(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,8),GreaterThan(hd_vehicle_count,0)), 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 = 8) OR (hd_vehicle_count#16 > 0)) 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_coupon_amt#6, ss_net_profit#7, s_city#13]
Input [8]: [ss_customer_sk#1, ss_hdemo_sk#2, ss_addr_sk#3, ss_ticket_number#5, ss_coupon_amt#6, ss_net_profit#7, s_city#13, hd_demo_sk#14]

(21) HashAggregate [codegen id : 4]
Input [6]: [ss_customer_sk#1, ss_addr_sk#3, ss_ticket_number#5, ss_coupon_amt#6, ss_net_profit#7, s_city#13]
Keys [4]: [ss_ticket_number#5, ss_customer_sk#1, ss_addr_sk#3, s_city#13]
Functions [2]: [partial_sum(UnscaledValue(ss_coupon_amt#6)), partial_sum(UnscaledValue(ss_net_profit#7))]
Aggregate Attributes [2]: [sum#17, sum#18]
Results [6]: [ss_ticket_number#5, ss_customer_sk#1, ss_addr_sk#3, s_city#13, sum#19, sum#20]

(22) Exchange
Input [6]: [ss_ticket_number#5, ss_customer_sk#1, ss_addr_sk#3, s_city#13, sum#19, sum#20]
Arguments: hashpartitioning(ss_ticket_number#5, ss_customer_sk#1, ss_addr_sk#3, s_city#13, 5), ENSURE_REQUIREMENTS, [plan_id=3]

(23) HashAggregate [codegen id : 6]
Input [6]: [ss_ticket_number#5, ss_customer_sk#1, ss_addr_sk#3, s_city#13, sum#19, sum#20]
Keys [4]: [ss_ticket_number#5, ss_customer_sk#1, ss_addr_sk#3, s_city#13]
Functions [2]: [sum(UnscaledValue(ss_coupon_amt#6)), sum(UnscaledValue(ss_net_profit#7))]
Aggregate Attributes [2]: [sum(UnscaledValue(ss_coupon_amt#6))#21, sum(UnscaledValue(ss_net_profit#7))#22]
Results [5]: [ss_ticket_number#5, ss_customer_sk#1, s_city#13, MakeDecimal(sum(UnscaledValue(ss_coupon_amt#6))#21,17,2) AS amt#23, MakeDecimal(sum(UnscaledValue(ss_net_profit#7))#22,17,2) AS profit#24]

(24) Scan parquet spark_catalog.default.customer
Output [3]: [c_customer_sk#25, c_first_name#26, c_last_name#27]
Batched: true
Location [not included in comparison]/{warehouse_dir}/customer]
PushedFilters: [IsNotNull(c_customer_sk)]
ReadSchema: struct<c_customer_sk:int,c_first_name:string,c_last_name:string>

(25) ColumnarToRow [codegen id : 5]
Input [3]: [c_customer_sk#25, c_first_name#26, c_last_name#27]

(26) Filter [codegen id : 5]
Input [3]: [c_customer_sk#25, c_first_name#26, c_last_name#27]
Condition : isnotnull(c_customer_sk#25)

(27) BroadcastExchange
Input [3]: [c_customer_sk#25, c_first_name#26, c_last_name#27]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=4]

(28) BroadcastHashJoin [codegen id : 6]
Left keys [1]: [ss_customer_sk#1]
Right keys [1]: [c_customer_sk#25]
Join type: Inner
Join condition: None

(29) Project [codegen id : 6]
Output [7]: [c_last_name#27, c_first_name#26, substr(s_city#13, 1, 30) AS substr(s_city, 1, 30)#28, ss_ticket_number#5, amt#23, profit#24, s_city#13]
Input [8]: [ss_ticket_number#5, ss_customer_sk#1, s_city#13, amt#23, profit#24, c_customer_sk#25, c_first_name#26, c_last_name#27]

(30) TakeOrderedAndProject
Input [7]: [c_last_name#27, c_first_name#26, substr(s_city, 1, 30)#28, ss_ticket_number#5, amt#23, profit#24, s_city#13]
Arguments: 100, [c_last_name#27 ASC NULLS FIRST, c_first_name#26 ASC NULLS FIRST, substr(s_city#13, 1, 30) ASC NULLS FIRST, profit#24 ASC NULLS FIRST], [c_last_name#27, c_first_name#26, substr(s_city, 1, 30)#28, ss_ticket_number#5, amt#23, profit#24]

===== Subqueries =====

Subquery:1 Hosting operator id = 1 Hosting Expression = ss_sold_date_sk#8 IN dynamicpruning#9
BroadcastExchange (35)
+- * Project (34)
   +- * Filter (33)
      +- * ColumnarToRow (32)
         +- Scan parquet spark_catalog.default.date_dim (31)


(31) Scan parquet spark_catalog.default.date_dim
Output [3]: [d_date_sk#10, d_year#29, d_dow#30]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_dow), EqualTo(d_dow,1), In(d_year, [1998,1999,2000]), GreaterThanOrEqual(d_date_sk,2450819), LessThanOrEqual(d_date_sk,2451904), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_year:int,d_dow:int>

(32) ColumnarToRow [codegen id : 1]
Input [3]: [d_date_sk#10, d_year#29, d_dow#30]

(33) Filter [codegen id : 1]
Input [3]: [d_date_sk#10, d_year#29, d_dow#30]
Condition : (((((isnotnull(d_dow#30) AND (d_dow#30 = 1)) AND d_year#29 IN (1998,1999,2000)) AND (d_date_sk#10 >= 2450819)) AND (d_date_sk#10 <= 2451904)) AND isnotnull(d_date_sk#10))

(34) Project [codegen id : 1]
Output [1]: [d_date_sk#10]
Input [3]: [d_date_sk#10, d_year#29, d_dow#30]

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


