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


(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)]
ReadSchema: struct<ss_customer_sk:int>

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

(6) Scan parquet spark_catalog.default.date_dim
Output [3]: [d_date_sk#8, d_year#9, d_qoy#10]
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>

(7) ColumnarToRow [codegen id : 1]
Input [3]: [d_date_sk#8, d_year#9, d_qoy#10]

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

(9) Project [codegen id : 1]
Output [1]: [d_date_sk#8]
Input [3]: [d_date_sk#8, d_year#9, d_qoy#10]

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

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

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

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

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

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

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

(17) ReusedExchange [Reuses operator id: 10]
Output [1]: [d_date_sk#13]

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

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

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

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

(22) Scan parquet spark_catalog.default.catalog_sales
Output [2]: [cs_ship_customer_sk#14, cs_sold_date_sk#15]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(cs_sold_date_sk#15)]
ReadSchema: struct<cs_ship_customer_sk:int>

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

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

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

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

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

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

(29) 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)

(30) 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]

(31) Scan parquet spark_catalog.default.customer_address
Output [2]: [ca_address_sk#17, ca_state#18]
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>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

