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


(1) Scan parquet spark_catalog.default.customer
Output [3]: [c_customer_sk#3, c_current_cdemo_sk#4, c_current_addr_sk#5]
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 : 9]
Input [3]: [c_customer_sk#3, c_current_cdemo_sk#4, c_current_addr_sk#5]

(3) Filter [codegen id : 9]
Input [3]: [c_customer_sk#3, c_current_cdemo_sk#4, c_current_addr_sk#5]
Condition : (isnotnull(c_current_addr_sk#5) AND isnotnull(c_current_cdemo_sk#4))

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

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

(6) ReusedExchange [Reuses operator id: 47]
Output [1]: [d_date_sk#9]

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

(8) Project [codegen id : 2]
Output [1]: [ss_customer_sk#6]
Input [3]: [ss_customer_sk#6, ss_sold_date_sk#7, d_date_sk#9]

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

(10) BroadcastHashJoin [codegen id : 9]
Left keys [1]: [c_customer_sk#3]
Right keys [1]: [ss_customer_sk#6]
Join type: LeftSemi
Join condition: None

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

(12) ColumnarToRow [codegen id : 4]
Input [2]: [ws_bill_customer_sk#10, ws_sold_date_sk#11]

(13) ReusedExchange [Reuses operator id: 47]
Output [1]: [d_date_sk#12]

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

(15) Project [codegen id : 4]
Output [1]: [ws_bill_customer_sk#10]
Input [3]: [ws_bill_customer_sk#10, ws_sold_date_sk#11, d_date_sk#12]

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

(17) BroadcastHashJoin [codegen id : 9]
Left keys [1]: [c_customer_sk#3]
Right keys [1]: [ws_bill_customer_sk#10]
Join type: ExistenceJoin(exists#2)
Join condition: None

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

(19) ColumnarToRow [codegen id : 6]
Input [2]: [cs_ship_customer_sk#13, cs_sold_date_sk#14]

(20) ReusedExchange [Reuses operator id: 47]
Output [1]: [d_date_sk#15]

(21) BroadcastHashJoin [codegen id : 6]
Left keys [1]: [cs_sold_date_sk#14]
Right keys [1]: [d_date_sk#15]
Join type: Inner
Join condition: None

(22) Project [codegen id : 6]
Output [1]: [cs_ship_customer_sk#13]
Input [3]: [cs_ship_customer_sk#13, cs_sold_date_sk#14, d_date_sk#15]

(23) BroadcastExchange
Input [1]: [cs_ship_customer_sk#13]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [plan_id=3]

(24) BroadcastHashJoin [codegen id : 9]
Left keys [1]: [c_customer_sk#3]
Right keys [1]: [cs_ship_customer_sk#13]
Join type: ExistenceJoin(exists#1)
Join condition: None

(25) Filter [codegen id : 9]
Input [5]: [c_customer_sk#3, c_current_cdemo_sk#4, c_current_addr_sk#5, exists#2, exists#1]
Condition : (exists#2 OR exists#1)

(26) Project [codegen id : 9]
Output [2]: [c_current_cdemo_sk#4, c_current_addr_sk#5]
Input [5]: [c_customer_sk#3, c_current_cdemo_sk#4, c_current_addr_sk#5, exists#2, exists#1]

(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_address_sk)]
ReadSchema: struct<ca_address_sk:int,ca_state:string>

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

(29) Filter [codegen id : 7]
Input [2]: [ca_address_sk#16, ca_state#17]
Condition : isnotnull(ca_address_sk#16)

(30) BroadcastExchange
Input [2]: [ca_address_sk#16, ca_state#17]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=4]

(31) BroadcastHashJoin [codegen id : 9]
Left keys [1]: [c_current_addr_sk#5]
Right keys [1]: [ca_address_sk#16]
Join type: Inner
Join condition: None

(32) Project [codegen id : 9]
Output [2]: [c_current_cdemo_sk#4, ca_state#17]
Input [4]: [c_current_cdemo_sk#4, c_current_addr_sk#5, ca_address_sk#16, ca_state#17]

(33) Scan parquet spark_catalog.default.customer_demographics
Output [6]: [cd_demo_sk#18, cd_gender#19, cd_marital_status#20, cd_dep_count#21, cd_dep_employed_count#22, cd_dep_college_count#23]
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_dep_count:int,cd_dep_employed_count:int,cd_dep_college_count:int>

(34) ColumnarToRow [codegen id : 8]
Input [6]: [cd_demo_sk#18, cd_gender#19, cd_marital_status#20, cd_dep_count#21, cd_dep_employed_count#22, cd_dep_college_count#23]

(35) Filter [codegen id : 8]
Input [6]: [cd_demo_sk#18, cd_gender#19, cd_marital_status#20, cd_dep_count#21, cd_dep_employed_count#22, cd_dep_college_count#23]
Condition : isnotnull(cd_demo_sk#18)

(36) BroadcastExchange
Input [6]: [cd_demo_sk#18, cd_gender#19, cd_marital_status#20, cd_dep_count#21, cd_dep_employed_count#22, cd_dep_college_count#23]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=5]

(37) BroadcastHashJoin [codegen id : 9]
Left keys [1]: [c_current_cdemo_sk#4]
Right keys [1]: [cd_demo_sk#18]
Join type: Inner
Join condition: None

(38) Project [codegen id : 9]
Output [6]: [ca_state#17, cd_gender#19, cd_marital_status#20, cd_dep_count#21, cd_dep_employed_count#22, cd_dep_college_count#23]
Input [8]: [c_current_cdemo_sk#4, ca_state#17, cd_demo_sk#18, cd_gender#19, cd_marital_status#20, cd_dep_count#21, cd_dep_employed_count#22, cd_dep_college_count#23]

(39) HashAggregate [codegen id : 9]
Input [6]: [ca_state#17, cd_gender#19, cd_marital_status#20, cd_dep_count#21, cd_dep_employed_count#22, cd_dep_college_count#23]
Keys [6]: [ca_state#17, cd_gender#19, cd_marital_status#20, cd_dep_count#21, cd_dep_employed_count#22, cd_dep_college_count#23]
Functions [10]: [partial_count(1), partial_avg(cd_dep_count#21), partial_max(cd_dep_count#21), partial_sum(cd_dep_count#21), partial_avg(cd_dep_employed_count#22), partial_max(cd_dep_employed_count#22), partial_sum(cd_dep_employed_count#22), partial_avg(cd_dep_college_count#23), partial_max(cd_dep_college_count#23), partial_sum(cd_dep_college_count#23)]
Aggregate Attributes [13]: [count#24, sum#25, count#26, max#27, sum#28, sum#29, count#30, max#31, sum#32, sum#33, count#34, max#35, sum#36]
Results [19]: [ca_state#17, cd_gender#19, cd_marital_status#20, cd_dep_count#21, cd_dep_employed_count#22, cd_dep_college_count#23, count#37, sum#38, count#39, max#40, sum#41, sum#42, count#43, max#44, sum#45, sum#46, count#47, max#48, sum#49]

(40) Exchange
Input [19]: [ca_state#17, cd_gender#19, cd_marital_status#20, cd_dep_count#21, cd_dep_employed_count#22, cd_dep_college_count#23, count#37, sum#38, count#39, max#40, sum#41, sum#42, count#43, max#44, sum#45, sum#46, count#47, max#48, sum#49]
Arguments: hashpartitioning(ca_state#17, cd_gender#19, cd_marital_status#20, cd_dep_count#21, cd_dep_employed_count#22, cd_dep_college_count#23, 5), ENSURE_REQUIREMENTS, [plan_id=6]

(41) HashAggregate [codegen id : 10]
Input [19]: [ca_state#17, cd_gender#19, cd_marital_status#20, cd_dep_count#21, cd_dep_employed_count#22, cd_dep_college_count#23, count#37, sum#38, count#39, max#40, sum#41, sum#42, count#43, max#44, sum#45, sum#46, count#47, max#48, sum#49]
Keys [6]: [ca_state#17, cd_gender#19, cd_marital_status#20, cd_dep_count#21, cd_dep_employed_count#22, cd_dep_college_count#23]
Functions [10]: [count(1), avg(cd_dep_count#21), max(cd_dep_count#21), sum(cd_dep_count#21), avg(cd_dep_employed_count#22), max(cd_dep_employed_count#22), sum(cd_dep_employed_count#22), avg(cd_dep_college_count#23), max(cd_dep_college_count#23), sum(cd_dep_college_count#23)]
Aggregate Attributes [10]: [count(1)#50, avg(cd_dep_count#21)#51, max(cd_dep_count#21)#52, sum(cd_dep_count#21)#53, avg(cd_dep_employed_count#22)#54, max(cd_dep_employed_count#22)#55, sum(cd_dep_employed_count#22)#56, avg(cd_dep_college_count#23)#57, max(cd_dep_college_count#23)#58, sum(cd_dep_college_count#23)#59]
Results [18]: [ca_state#17, cd_gender#19, cd_marital_status#20, cd_dep_count#21, count(1)#50 AS cnt1#60, avg(cd_dep_count#21)#51 AS avg(cd_dep_count)#61, max(cd_dep_count#21)#52 AS max(cd_dep_count)#62, sum(cd_dep_count#21)#53 AS sum(cd_dep_count)#63, cd_dep_employed_count#22, count(1)#50 AS cnt2#64, avg(cd_dep_employed_count#22)#54 AS avg(cd_dep_employed_count)#65, max(cd_dep_employed_count#22)#55 AS max(cd_dep_employed_count)#66, sum(cd_dep_employed_count#22)#56 AS sum(cd_dep_employed_count)#67, cd_dep_college_count#23, count(1)#50 AS cnt3#68, avg(cd_dep_college_count#23)#57 AS avg(cd_dep_college_count)#69, max(cd_dep_college_count#23)#58 AS max(cd_dep_college_count)#70, sum(cd_dep_college_count#23)#59 AS sum(cd_dep_college_count)#71]

(42) TakeOrderedAndProject
Input [18]: [ca_state#17, cd_gender#19, cd_marital_status#20, cd_dep_count#21, cnt1#60, avg(cd_dep_count)#61, max(cd_dep_count)#62, sum(cd_dep_count)#63, cd_dep_employed_count#22, cnt2#64, avg(cd_dep_employed_count)#65, max(cd_dep_employed_count)#66, sum(cd_dep_employed_count)#67, cd_dep_college_count#23, cnt3#68, avg(cd_dep_college_count)#69, max(cd_dep_college_count)#70, sum(cd_dep_college_count)#71]
Arguments: 100, [ca_state#17 ASC NULLS FIRST, cd_gender#19 ASC NULLS FIRST, cd_marital_status#20 ASC NULLS FIRST, cd_dep_count#21 ASC NULLS FIRST, cd_dep_employed_count#22 ASC NULLS FIRST, cd_dep_college_count#23 ASC NULLS FIRST], [ca_state#17, cd_gender#19, cd_marital_status#20, cd_dep_count#21, cnt1#60, avg(cd_dep_count)#61, max(cd_dep_count)#62, sum(cd_dep_count)#63, cd_dep_employed_count#22, cnt2#64, avg(cd_dep_employed_count)#65, max(cd_dep_employed_count)#66, sum(cd_dep_employed_count)#67, cd_dep_college_count#23, cnt3#68, avg(cd_dep_college_count)#69, max(cd_dep_college_count)#70, sum(cd_dep_college_count)#71]

===== Subqueries =====

Subquery:1 Hosting operator id = 4 Hosting Expression = ss_sold_date_sk#7 IN dynamicpruning#8
BroadcastExchange (47)
+- * Project (46)
   +- * Filter (45)
      +- * ColumnarToRow (44)
         +- Scan parquet spark_catalog.default.date_dim (43)


(43) Scan parquet spark_catalog.default.date_dim
Output [3]: [d_date_sk#9, d_year#72, d_qoy#73]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_year), IsNotNull(d_qoy), EqualTo(d_year,2002), LessThan(d_qoy,4), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_year:int,d_qoy:int>

(44) ColumnarToRow [codegen id : 1]
Input [3]: [d_date_sk#9, d_year#72, d_qoy#73]

(45) Filter [codegen id : 1]
Input [3]: [d_date_sk#9, d_year#72, d_qoy#73]
Condition : ((((isnotnull(d_year#72) AND isnotnull(d_qoy#73)) AND (d_year#72 = 2002)) AND (d_qoy#73 < 4)) AND isnotnull(d_date_sk#9))

(46) Project [codegen id : 1]
Output [1]: [d_date_sk#9]
Input [3]: [d_date_sk#9, d_year#72, d_qoy#73]

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

Subquery:2 Hosting operator id = 11 Hosting Expression = ws_sold_date_sk#11 IN dynamicpruning#8

Subquery:3 Hosting operator id = 18 Hosting Expression = cs_sold_date_sk#14 IN dynamicpruning#8


