== Physical Plan ==
* Sort (32)
+- Exchange (31)
   +- * Project (30)
      +- * BroadcastHashJoin Inner BuildRight (29)
         :- * Filter (24)
         :  +- * 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 default.store_sales (1)
         :                 :     :     +- ReusedExchange (4)
         :                 :     +- BroadcastExchange (11)
         :                 :        +- * Project (10)
         :                 :           +- * Filter (9)
         :                 :              +- * ColumnarToRow (8)
         :                 :                 +- Scan parquet default.store (7)
         :                 +- BroadcastExchange (18)
         :                    +- * Project (17)
         :                       +- * Filter (16)
         :                          +- * ColumnarToRow (15)
         :                             +- Scan parquet default.household_demographics (14)
         +- BroadcastExchange (28)
            +- * Filter (27)
               +- * ColumnarToRow (26)
                  +- Scan parquet default.customer (25)


(1) Scan parquet default.store_sales
Output [5]: [ss_customer_sk#1, ss_hdemo_sk#2, ss_store_sk#3, ss_ticket_number#4, ss_sold_date_sk#5]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [ss_sold_date_sk#5 INSET 2450815, 2450816, 2450846, 2450847, 2450874, 2450875, 2450905, 2450906, 2450935, 2450936, 2450966, 2450967, 2450996, 2450997, 2451027, 2451028, 2451058, 2451059, 2451088, 2451089, 2451119, 2451120, 2451149, 2451150, 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, isnotnull(ss_sold_date_sk#5), dynamicpruningexpression(ss_sold_date_sk#5 IN dynamicpruning#6)]
PushedFilters: [IsNotNull(ss_store_sk), IsNotNull(ss_hdemo_sk), IsNotNull(ss_customer_sk)]
ReadSchema: struct<ss_customer_sk:int,ss_hdemo_sk:int,ss_store_sk:int,ss_ticket_number:int>

(2) ColumnarToRow [codegen id : 4]
Input [5]: [ss_customer_sk#1, ss_hdemo_sk#2, ss_store_sk#3, ss_ticket_number#4, ss_sold_date_sk#5]

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

(4) ReusedExchange [Reuses operator id: 37]
Output [1]: [d_date_sk#7]

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

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

(7) Scan parquet default.store
Output [2]: [s_store_sk#8, s_county#9]
Batched: true
Location [not included in comparison]/{warehouse_dir}/store]
PushedFilters: [In(s_county, [Barrow County,Bronx County,Fairfield County,Ziebach County]), IsNotNull(s_store_sk)]
ReadSchema: struct<s_store_sk:int,s_county:string>

(8) ColumnarToRow [codegen id : 2]
Input [2]: [s_store_sk#8, s_county#9]

(9) Filter [codegen id : 2]
Input [2]: [s_store_sk#8, s_county#9]
Condition : (s_county#9 IN (Fairfield County,Ziebach County,Bronx County,Barrow County) AND isnotnull(s_store_sk#8))

(10) Project [codegen id : 2]
Output [1]: [s_store_sk#8]
Input [2]: [s_store_sk#8, s_county#9]

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

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

(13) Project [codegen id : 4]
Output [3]: [ss_customer_sk#1, ss_hdemo_sk#2, ss_ticket_number#4]
Input [5]: [ss_customer_sk#1, ss_hdemo_sk#2, ss_store_sk#3, ss_ticket_number#4, s_store_sk#8]

(14) Scan parquet default.household_demographics
Output [4]: [hd_demo_sk#11, hd_buy_potential#12, hd_dep_count#13, hd_vehicle_count#14]
Batched: true
Location [not included in comparison]/{warehouse_dir}/household_demographics]
PushedFilters: [IsNotNull(hd_vehicle_count), IsNotNull(hd_dep_count), Or(EqualTo(hd_buy_potential,>10000         ),EqualTo(hd_buy_potential,Unknown        )), GreaterThan(hd_vehicle_count,0), IsNotNull(hd_demo_sk)]
ReadSchema: struct<hd_demo_sk:int,hd_buy_potential:string,hd_dep_count:int,hd_vehicle_count:int>

(15) ColumnarToRow [codegen id : 3]
Input [4]: [hd_demo_sk#11, hd_buy_potential#12, hd_dep_count#13, hd_vehicle_count#14]

(16) Filter [codegen id : 3]
Input [4]: [hd_demo_sk#11, hd_buy_potential#12, hd_dep_count#13, hd_vehicle_count#14]
Condition : (((((isnotnull(hd_vehicle_count#14) AND isnotnull(hd_dep_count#13)) AND ((hd_buy_potential#12 = >10000         ) OR (hd_buy_potential#12 = Unknown        ))) AND (hd_vehicle_count#14 > 0)) AND ((cast(hd_dep_count#13 as double) / cast(hd_vehicle_count#14 as double)) > 1.0)) AND isnotnull(hd_demo_sk#11))

(17) Project [codegen id : 3]
Output [1]: [hd_demo_sk#11]
Input [4]: [hd_demo_sk#11, hd_buy_potential#12, hd_dep_count#13, hd_vehicle_count#14]

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

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

(20) Project [codegen id : 4]
Output [2]: [ss_customer_sk#1, ss_ticket_number#4]
Input [4]: [ss_customer_sk#1, ss_hdemo_sk#2, ss_ticket_number#4, hd_demo_sk#11]

(21) HashAggregate [codegen id : 4]
Input [2]: [ss_customer_sk#1, ss_ticket_number#4]
Keys [2]: [ss_ticket_number#4, ss_customer_sk#1]
Functions [1]: [partial_count(1)]
Aggregate Attributes [1]: [count#16]
Results [3]: [ss_ticket_number#4, ss_customer_sk#1, count#17]

(22) Exchange
Input [3]: [ss_ticket_number#4, ss_customer_sk#1, count#17]
Arguments: hashpartitioning(ss_ticket_number#4, ss_customer_sk#1, 5), ENSURE_REQUIREMENTS, [id=#18]

(23) HashAggregate [codegen id : 6]
Input [3]: [ss_ticket_number#4, ss_customer_sk#1, count#17]
Keys [2]: [ss_ticket_number#4, ss_customer_sk#1]
Functions [1]: [count(1)]
Aggregate Attributes [1]: [count(1)#19]
Results [3]: [ss_ticket_number#4, ss_customer_sk#1, count(1)#19 AS cnt#20]

(24) Filter [codegen id : 6]
Input [3]: [ss_ticket_number#4, ss_customer_sk#1, cnt#20]
Condition : ((cnt#20 >= 1) AND (cnt#20 <= 5))

(25) Scan parquet default.customer
Output [5]: [c_customer_sk#21, c_salutation#22, c_first_name#23, c_last_name#24, c_preferred_cust_flag#25]
Batched: true
Location [not included in comparison]/{warehouse_dir}/customer]
PushedFilters: [IsNotNull(c_customer_sk)]
ReadSchema: struct<c_customer_sk:int,c_salutation:string,c_first_name:string,c_last_name:string,c_preferred_cust_flag:string>

(26) ColumnarToRow [codegen id : 5]
Input [5]: [c_customer_sk#21, c_salutation#22, c_first_name#23, c_last_name#24, c_preferred_cust_flag#25]

(27) Filter [codegen id : 5]
Input [5]: [c_customer_sk#21, c_salutation#22, c_first_name#23, c_last_name#24, c_preferred_cust_flag#25]
Condition : isnotnull(c_customer_sk#21)

(28) BroadcastExchange
Input [5]: [c_customer_sk#21, c_salutation#22, c_first_name#23, c_last_name#24, c_preferred_cust_flag#25]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [id=#26]

(29) BroadcastHashJoin [codegen id : 6]
Left keys [1]: [ss_customer_sk#1]
Right keys [1]: [c_customer_sk#21]
Join condition: None

(30) Project [codegen id : 6]
Output [6]: [c_last_name#24, c_first_name#23, c_salutation#22, c_preferred_cust_flag#25, ss_ticket_number#4, cnt#20]
Input [8]: [ss_ticket_number#4, ss_customer_sk#1, cnt#20, c_customer_sk#21, c_salutation#22, c_first_name#23, c_last_name#24, c_preferred_cust_flag#25]

(31) Exchange
Input [6]: [c_last_name#24, c_first_name#23, c_salutation#22, c_preferred_cust_flag#25, ss_ticket_number#4, cnt#20]
Arguments: rangepartitioning(cnt#20 DESC NULLS LAST, 5), ENSURE_REQUIREMENTS, [id=#27]

(32) Sort [codegen id : 7]
Input [6]: [c_last_name#24, c_first_name#23, c_salutation#22, c_preferred_cust_flag#25, ss_ticket_number#4, cnt#20]
Arguments: [cnt#20 DESC NULLS LAST], true, 0

===== Subqueries =====

Subquery:1 Hosting operator id = 1 Hosting Expression = ss_sold_date_sk#5 IN dynamicpruning#6
BroadcastExchange (37)
+- * Project (36)
   +- * Filter (35)
      +- * ColumnarToRow (34)
         +- Scan parquet default.date_dim (33)


(33) Scan parquet default.date_dim
Output [3]: [d_date_sk#7, d_year#28, d_dom#29]
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, [1998,1999,2000]), In(d_date_sk, [2450815,2450816,2450846,2450847,2450874,2450875,2450905,2450906,2450935,2450936,2450966,2450967,2450996,2450997,2451027,2451028,2451058,2451059,2451088,2451089,2451119,2451120,2451149,2451150,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]), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_year:int,d_dom:int>

(34) ColumnarToRow [codegen id : 1]
Input [3]: [d_date_sk#7, d_year#28, d_dom#29]

(35) Filter [codegen id : 1]
Input [3]: [d_date_sk#7, d_year#28, d_dom#29]
Condition : (((((isnotnull(d_dom#29) AND (d_dom#29 >= 1)) AND (d_dom#29 <= 2)) AND d_year#28 IN (1998,1999,2000)) AND d_date_sk#7 INSET 2450815, 2450816, 2450846, 2450847, 2450874, 2450875, 2450905, 2450906, 2450935, 2450936, 2450966, 2450967, 2450996, 2450997, 2451027, 2451028, 2451058, 2451059, 2451088, 2451089, 2451119, 2451120, 2451149, 2451150, 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) AND isnotnull(d_date_sk#7))

(36) Project [codegen id : 1]
Output [1]: [d_date_sk#7]
Input [3]: [d_date_sk#7, d_year#28, d_dom#29]

(37) BroadcastExchange
Input [1]: [d_date_sk#7]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [id=#30]


