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


(1) Scan parquet default.customer
Output [3]: [c_customer_sk#1, c_current_cdemo_sk#2, c_current_addr_sk#3]
Batched: true
Location [not included in comparison]/{warehouse_dir}/customer]
PushedFilters: [IsNotNull(c_current_addr_sk), IsNotNull(c_current_cdemo_sk)]
ReadSchema: struct<c_customer_sk:int,c_current_cdemo_sk:int,c_current_addr_sk:int>

(2) ColumnarToRow [codegen id : 1]
Input [3]: [c_customer_sk#1, c_current_cdemo_sk#2, c_current_addr_sk#3]

(3) Filter [codegen id : 1]
Input [3]: [c_customer_sk#1, c_current_cdemo_sk#2, c_current_addr_sk#3]
Condition : (isnotnull(c_current_addr_sk#3) AND isnotnull(c_current_cdemo_sk#2))

(4) Exchange
Input [3]: [c_customer_sk#1, c_current_cdemo_sk#2, c_current_addr_sk#3]
Arguments: hashpartitioning(c_customer_sk#1, 5), ENSURE_REQUIREMENTS, [plan_id=1]

(5) Sort [codegen id : 2]
Input [3]: [c_customer_sk#1, c_current_cdemo_sk#2, c_current_addr_sk#3]
Arguments: [c_customer_sk#1 ASC NULLS FIRST], false, 0

(6) Scan parquet default.store_sales
Output [2]: [ss_customer_sk#4, ss_sold_date_sk#5]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#5), dynamicpruningexpression(ss_sold_date_sk#5 IN dynamicpruning#6)]
ReadSchema: struct<ss_customer_sk:int>

(7) ColumnarToRow [codegen id : 4]
Input [2]: [ss_customer_sk#4, ss_sold_date_sk#5]

(8) ReusedExchange [Reuses operator id: 50]
Output [1]: [d_date_sk#7]

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

(10) Project [codegen id : 4]
Output [1]: [ss_customer_sk#4]
Input [3]: [ss_customer_sk#4, ss_sold_date_sk#5, d_date_sk#7]

(11) Exchange
Input [1]: [ss_customer_sk#4]
Arguments: hashpartitioning(ss_customer_sk#4, 5), ENSURE_REQUIREMENTS, [plan_id=2]

(12) Sort [codegen id : 5]
Input [1]: [ss_customer_sk#4]
Arguments: [ss_customer_sk#4 ASC NULLS FIRST], false, 0

(13) SortMergeJoin [codegen id : 6]
Left keys [1]: [c_customer_sk#1]
Right keys [1]: [ss_customer_sk#4]
Join condition: None

(14) Scan parquet default.web_sales
Output [2]: [ws_bill_customer_sk#8, ws_sold_date_sk#9]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ws_sold_date_sk#9), dynamicpruningexpression(ws_sold_date_sk#9 IN dynamicpruning#6)]
ReadSchema: struct<ws_bill_customer_sk:int>

(15) ColumnarToRow [codegen id : 8]
Input [2]: [ws_bill_customer_sk#8, ws_sold_date_sk#9]

(16) ReusedExchange [Reuses operator id: 50]
Output [1]: [d_date_sk#10]

(17) BroadcastHashJoin [codegen id : 8]
Left keys [1]: [ws_sold_date_sk#9]
Right keys [1]: [d_date_sk#10]
Join condition: None

(18) Project [codegen id : 8]
Output [1]: [ws_bill_customer_sk#8 AS customer_sk#11]
Input [3]: [ws_bill_customer_sk#8, ws_sold_date_sk#9, d_date_sk#10]

(19) Scan parquet default.catalog_sales
Output [2]: [cs_ship_customer_sk#12, cs_sold_date_sk#13]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(cs_sold_date_sk#13), dynamicpruningexpression(cs_sold_date_sk#13 IN dynamicpruning#6)]
ReadSchema: struct<cs_ship_customer_sk:int>

(20) ColumnarToRow [codegen id : 10]
Input [2]: [cs_ship_customer_sk#12, cs_sold_date_sk#13]

(21) ReusedExchange [Reuses operator id: 50]
Output [1]: [d_date_sk#14]

(22) BroadcastHashJoin [codegen id : 10]
Left keys [1]: [cs_sold_date_sk#13]
Right keys [1]: [d_date_sk#14]
Join condition: None

(23) Project [codegen id : 10]
Output [1]: [cs_ship_customer_sk#12 AS customer_sk#15]
Input [3]: [cs_ship_customer_sk#12, cs_sold_date_sk#13, d_date_sk#14]

(24) Union

(25) Exchange
Input [1]: [customer_sk#11]
Arguments: hashpartitioning(customer_sk#11, 5), ENSURE_REQUIREMENTS, [plan_id=3]

(26) Sort [codegen id : 11]
Input [1]: [customer_sk#11]
Arguments: [customer_sk#11 ASC NULLS FIRST], false, 0

(27) SortMergeJoin [codegen id : 13]
Left keys [1]: [c_customer_sk#1]
Right keys [1]: [customer_sk#11]
Join condition: None

(28) Project [codegen id : 13]
Output [2]: [c_current_cdemo_sk#2, c_current_addr_sk#3]
Input [3]: [c_customer_sk#1, c_current_cdemo_sk#2, c_current_addr_sk#3]

(29) Scan parquet default.customer_address
Output [2]: [ca_address_sk#16, ca_county#17]
Batched: true
Location [not included in comparison]/{warehouse_dir}/customer_address]
PushedFilters: [In(ca_county, [Dona Ana County,Douglas County,Gaines County,Richland County,Walker County]), IsNotNull(ca_address_sk)]
ReadSchema: struct<ca_address_sk:int,ca_county:string>

(30) ColumnarToRow [codegen id : 12]
Input [2]: [ca_address_sk#16, ca_county#17]

(31) Filter [codegen id : 12]
Input [2]: [ca_address_sk#16, ca_county#17]
Condition : (ca_county#17 IN (Walker County,Richland County,Gaines County,Douglas County,Dona Ana County) AND isnotnull(ca_address_sk#16))

(32) Project [codegen id : 12]
Output [1]: [ca_address_sk#16]
Input [2]: [ca_address_sk#16, ca_county#17]

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

(34) BroadcastHashJoin [codegen id : 13]
Left keys [1]: [c_current_addr_sk#3]
Right keys [1]: [ca_address_sk#16]
Join condition: None

(35) Project [codegen id : 13]
Output [1]: [c_current_cdemo_sk#2]
Input [3]: [c_current_cdemo_sk#2, c_current_addr_sk#3, ca_address_sk#16]

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

(37) Scan parquet default.customer_demographics
Output [9]: [cd_demo_sk#18, cd_gender#19, cd_marital_status#20, cd_education_status#21, cd_purchase_estimate#22, cd_credit_rating#23, cd_dep_count#24, cd_dep_employed_count#25, cd_dep_college_count#26]
Batched: true
Location [not included in comparison]/{warehouse_dir}/customer_demographics]
PushedFilters: [IsNotNull(cd_demo_sk)]
ReadSchema: struct<cd_demo_sk:int,cd_gender:string,cd_marital_status:string,cd_education_status:string,cd_purchase_estimate:int,cd_credit_rating:string,cd_dep_count:int,cd_dep_employed_count:int,cd_dep_college_count:int>

(38) ColumnarToRow
Input [9]: [cd_demo_sk#18, cd_gender#19, cd_marital_status#20, cd_education_status#21, cd_purchase_estimate#22, cd_credit_rating#23, cd_dep_count#24, cd_dep_employed_count#25, cd_dep_college_count#26]

(39) Filter
Input [9]: [cd_demo_sk#18, cd_gender#19, cd_marital_status#20, cd_education_status#21, cd_purchase_estimate#22, cd_credit_rating#23, cd_dep_count#24, cd_dep_employed_count#25, cd_dep_college_count#26]
Condition : isnotnull(cd_demo_sk#18)

(40) BroadcastHashJoin [codegen id : 14]
Left keys [1]: [c_current_cdemo_sk#2]
Right keys [1]: [cd_demo_sk#18]
Join condition: None

(41) Project [codegen id : 14]
Output [8]: [cd_gender#19, cd_marital_status#20, cd_education_status#21, cd_purchase_estimate#22, cd_credit_rating#23, cd_dep_count#24, cd_dep_employed_count#25, cd_dep_college_count#26]
Input [10]: [c_current_cdemo_sk#2, cd_demo_sk#18, cd_gender#19, cd_marital_status#20, cd_education_status#21, cd_purchase_estimate#22, cd_credit_rating#23, cd_dep_count#24, cd_dep_employed_count#25, cd_dep_college_count#26]

(42) HashAggregate [codegen id : 14]
Input [8]: [cd_gender#19, cd_marital_status#20, cd_education_status#21, cd_purchase_estimate#22, cd_credit_rating#23, cd_dep_count#24, cd_dep_employed_count#25, cd_dep_college_count#26]
Keys [8]: [cd_gender#19, cd_marital_status#20, cd_education_status#21, cd_purchase_estimate#22, cd_credit_rating#23, cd_dep_count#24, cd_dep_employed_count#25, cd_dep_college_count#26]
Functions [1]: [partial_count(1)]
Aggregate Attributes [1]: [count#27]
Results [9]: [cd_gender#19, cd_marital_status#20, cd_education_status#21, cd_purchase_estimate#22, cd_credit_rating#23, cd_dep_count#24, cd_dep_employed_count#25, cd_dep_college_count#26, count#28]

(43) Exchange
Input [9]: [cd_gender#19, cd_marital_status#20, cd_education_status#21, cd_purchase_estimate#22, cd_credit_rating#23, cd_dep_count#24, cd_dep_employed_count#25, cd_dep_college_count#26, count#28]
Arguments: hashpartitioning(cd_gender#19, cd_marital_status#20, cd_education_status#21, cd_purchase_estimate#22, cd_credit_rating#23, cd_dep_count#24, cd_dep_employed_count#25, cd_dep_college_count#26, 5), ENSURE_REQUIREMENTS, [plan_id=6]

(44) HashAggregate [codegen id : 15]
Input [9]: [cd_gender#19, cd_marital_status#20, cd_education_status#21, cd_purchase_estimate#22, cd_credit_rating#23, cd_dep_count#24, cd_dep_employed_count#25, cd_dep_college_count#26, count#28]
Keys [8]: [cd_gender#19, cd_marital_status#20, cd_education_status#21, cd_purchase_estimate#22, cd_credit_rating#23, cd_dep_count#24, cd_dep_employed_count#25, cd_dep_college_count#26]
Functions [1]: [count(1)]
Aggregate Attributes [1]: [count(1)#29]
Results [14]: [cd_gender#19, cd_marital_status#20, cd_education_status#21, count(1)#29 AS cnt1#30, cd_purchase_estimate#22, count(1)#29 AS cnt2#31, cd_credit_rating#23, count(1)#29 AS cnt3#32, cd_dep_count#24, count(1)#29 AS cnt4#33, cd_dep_employed_count#25, count(1)#29 AS cnt5#34, cd_dep_college_count#26, count(1)#29 AS cnt6#35]

(45) TakeOrderedAndProject
Input [14]: [cd_gender#19, cd_marital_status#20, cd_education_status#21, cnt1#30, cd_purchase_estimate#22, cnt2#31, cd_credit_rating#23, cnt3#32, cd_dep_count#24, cnt4#33, cd_dep_employed_count#25, cnt5#34, cd_dep_college_count#26, cnt6#35]
Arguments: 100, [cd_gender#19 ASC NULLS FIRST, cd_marital_status#20 ASC NULLS FIRST, cd_education_status#21 ASC NULLS FIRST, cd_purchase_estimate#22 ASC NULLS FIRST, cd_credit_rating#23 ASC NULLS FIRST, cd_dep_count#24 ASC NULLS FIRST, cd_dep_employed_count#25 ASC NULLS FIRST, cd_dep_college_count#26 ASC NULLS FIRST], [cd_gender#19, cd_marital_status#20, cd_education_status#21, cnt1#30, cd_purchase_estimate#22, cnt2#31, cd_credit_rating#23, cnt3#32, cd_dep_count#24, cnt4#33, cd_dep_employed_count#25, cnt5#34, cd_dep_college_count#26, cnt6#35]

===== Subqueries =====

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


(46) Scan parquet default.date_dim
Output [3]: [d_date_sk#7, d_year#36, d_moy#37]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_year), IsNotNull(d_moy), EqualTo(d_year,2002), GreaterThanOrEqual(d_moy,4), LessThanOrEqual(d_moy,7), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_year:int,d_moy:int>

(47) ColumnarToRow [codegen id : 1]
Input [3]: [d_date_sk#7, d_year#36, d_moy#37]

(48) Filter [codegen id : 1]
Input [3]: [d_date_sk#7, d_year#36, d_moy#37]
Condition : (((((isnotnull(d_year#36) AND isnotnull(d_moy#37)) AND (d_year#36 = 2002)) AND (d_moy#37 >= 4)) AND (d_moy#37 <= 7)) AND isnotnull(d_date_sk#7))

(49) Project [codegen id : 1]
Output [1]: [d_date_sk#7]
Input [3]: [d_date_sk#7, d_year#36, d_moy#37]

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

Subquery:2 Hosting operator id = 14 Hosting Expression = ws_sold_date_sk#9 IN dynamicpruning#6

Subquery:3 Hosting operator id = 19 Hosting Expression = cs_sold_date_sk#13 IN dynamicpruning#6


