== Physical Plan ==
TakeOrderedAndProject (43)
+- * HashAggregate (42)
   +- * CometColumnarToRow (41)
      +- CometColumnarExchange (40)
         +- * HashAggregate (39)
            +- * Project (38)
               +- * BroadcastHashJoin Inner BuildRight (37)
                  :- * Project (31)
                  :  +- * BroadcastHashJoin Inner BuildRight (30)
                  :     :- * Project (24)
                  :     :  +- * BroadcastHashJoin LeftSemi BuildRight (23)
                  :     :     :- * BroadcastHashJoin LeftSemi BuildRight (10)
                  :     :     :  :- * CometColumnarToRow (3)
                  :     :     :  :  +- CometFilter (2)
                  :     :     :  :     +- CometNativeScan 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 (22)
                  :     :        +- Union (21)
                  :     :           :- * Project (15)
                  :     :           :  +- * BroadcastHashJoin Inner BuildRight (14)
                  :     :           :     :- * ColumnarToRow (12)
                  :     :           :     :  +- Scan parquet spark_catalog.default.web_sales (11)
                  :     :           :     +- ReusedExchange (13)
                  :     :           +- * Project (20)
                  :     :              +- * BroadcastHashJoin Inner BuildRight (19)
                  :     :                 :- * ColumnarToRow (17)
                  :     :                 :  +- Scan parquet spark_catalog.default.catalog_sales (16)
                  :     :                 +- ReusedExchange (18)
                  :     +- BroadcastExchange (29)
                  :        +- * CometColumnarToRow (28)
                  :           +- CometProject (27)
                  :              +- CometFilter (26)
                  :                 +- CometNativeScan parquet spark_catalog.default.customer_address (25)
                  +- BroadcastExchange (36)
                     +- * CometColumnarToRow (35)
                        +- CometProject (34)
                           +- CometFilter (33)
                              +- CometNativeScan parquet spark_catalog.default.customer_demographics (32)


(1) CometNativeScan parquet spark_catalog.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) CometFilter
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))

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

(4) Scan parquet spark_catalog.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>

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

(6) ReusedExchange [Reuses operator id: 48]
Output [1]: [d_date_sk#7]

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

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

(9) BroadcastExchange
Input [1]: [ss_customer_sk#4]
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#1]
Right keys [1]: [ss_customer_sk#4]
Join type: LeftSemi
Join condition: None

(11) Scan parquet spark_catalog.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>

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

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

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

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

(16) Scan parquet spark_catalog.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>

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

(18) ReusedExchange [Reuses operator id: 48]
Output [1]: [d_date_sk#14]

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

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

(21) Union

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

(23) BroadcastHashJoin [codegen id : 9]
Left keys [1]: [c_customer_sk#1]
Right keys [1]: [customsk#11]
Join type: LeftSemi
Join condition: None

(24) Project [codegen id : 9]
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]

(25) CometNativeScan 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>

(26) CometFilter
Input [2]: [ca_address_sk#16, ca_state#17]
Condition : isnotnull(ca_address_sk#16)

(27) CometProject
Input [2]: [ca_address_sk#16, ca_state#17]
Arguments: [ca_address_sk#16, ca_state#18], [ca_address_sk#16, static_invoke(CharVarcharCodegenUtils.readSidePadding(ca_state#17, 2)) AS ca_state#18]

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

(29) BroadcastExchange
Input [2]: [ca_address_sk#16, ca_state#18]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [plan_id=3]

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

(31) Project [codegen id : 9]
Output [2]: [c_current_cdemo_sk#2, ca_state#18]
Input [4]: [c_current_cdemo_sk#2, c_current_addr_sk#3, ca_address_sk#16, ca_state#18]

(32) CometNativeScan 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>

(33) CometFilter
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)

(34) CometProject
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: [cd_demo_sk#19, cd_gender#25, cd_marital_status#26, cd_dep_count#22, cd_dep_employed_count#23, cd_dep_college_count#24], [cd_demo_sk#19, static_invoke(CharVarcharCodegenUtils.readSidePadding(cd_gender#20, 1)) AS cd_gender#25, static_invoke(CharVarcharCodegenUtils.readSidePadding(cd_marital_status#21, 1)) AS cd_marital_status#26, cd_dep_count#22, cd_dep_employed_count#23, cd_dep_college_count#24]

(35) CometColumnarToRow [codegen id : 8]
Input [6]: [cd_demo_sk#19, cd_gender#25, cd_marital_status#26, cd_dep_count#22, cd_dep_employed_count#23, cd_dep_college_count#24]

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

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

(38) Project [codegen id : 9]
Output [6]: [ca_state#18, cd_gender#25, cd_marital_status#26, cd_dep_count#22, cd_dep_employed_count#23, cd_dep_college_count#24]
Input [8]: [c_current_cdemo_sk#2, ca_state#18, cd_demo_sk#19, cd_gender#25, cd_marital_status#26, cd_dep_count#22, cd_dep_employed_count#23, cd_dep_college_count#24]

(39) HashAggregate [codegen id : 9]
Input [6]: [ca_state#18, cd_gender#25, cd_marital_status#26, cd_dep_count#22, cd_dep_employed_count#23, cd_dep_college_count#24]
Keys [6]: [ca_state#18, cd_gender#25, cd_marital_status#26, 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#27, sum#28, count#29, max#30, sum#31, sum#32, count#33, max#34, sum#35, sum#36, count#37, max#38, sum#39]
Results [19]: [ca_state#18, cd_gender#25, cd_marital_status#26, cd_dep_count#22, cd_dep_employed_count#23, cd_dep_college_count#24, count#40, sum#41, count#42, max#43, sum#44, sum#45, count#46, max#47, sum#48, sum#49, count#50, max#51, sum#52]

(40) CometColumnarExchange
Input [19]: [ca_state#18, cd_gender#25, cd_marital_status#26, cd_dep_count#22, cd_dep_employed_count#23, cd_dep_college_count#24, count#40, sum#41, count#42, max#43, sum#44, sum#45, count#46, max#47, sum#48, sum#49, count#50, max#51, sum#52]
Arguments: hashpartitioning(ca_state#18, cd_gender#25, cd_marital_status#26, cd_dep_count#22, cd_dep_employed_count#23, cd_dep_college_count#24, 5), ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=5]

(41) CometColumnarToRow [codegen id : 10]
Input [19]: [ca_state#18, cd_gender#25, cd_marital_status#26, cd_dep_count#22, cd_dep_employed_count#23, cd_dep_college_count#24, count#40, sum#41, count#42, max#43, sum#44, sum#45, count#46, max#47, sum#48, sum#49, count#50, max#51, sum#52]

(42) HashAggregate [codegen id : 10]
Input [19]: [ca_state#18, cd_gender#25, cd_marital_status#26, cd_dep_count#22, cd_dep_employed_count#23, cd_dep_college_count#24, count#40, sum#41, count#42, max#43, sum#44, sum#45, count#46, max#47, sum#48, sum#49, count#50, max#51, sum#52]
Keys [6]: [ca_state#18, cd_gender#25, cd_marital_status#26, 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)#53, avg(cd_dep_count#22)#54, max(cd_dep_count#22)#55, sum(cd_dep_count#22)#56, avg(cd_dep_employed_count#23)#57, max(cd_dep_employed_count#23)#58, sum(cd_dep_employed_count#23)#59, avg(cd_dep_college_count#24)#60, max(cd_dep_college_count#24)#61, sum(cd_dep_college_count#24)#62]
Results [18]: [ca_state#18, cd_gender#25, cd_marital_status#26, cd_dep_count#22, count(1)#53 AS cnt1#63, avg(cd_dep_count#22)#54 AS avg(cd_dep_count)#64, max(cd_dep_count#22)#55 AS max(cd_dep_count)#65, sum(cd_dep_count#22)#56 AS sum(cd_dep_count)#66, cd_dep_employed_count#23, count(1)#53 AS cnt2#67, avg(cd_dep_employed_count#23)#57 AS avg(cd_dep_employed_count)#68, max(cd_dep_employed_count#23)#58 AS max(cd_dep_employed_count)#69, sum(cd_dep_employed_count#23)#59 AS sum(cd_dep_employed_count)#70, cd_dep_college_count#24, count(1)#53 AS cnt3#71, avg(cd_dep_college_count#24)#60 AS avg(cd_dep_college_count)#72, max(cd_dep_college_count#24)#61 AS max(cd_dep_college_count)#73, sum(cd_dep_college_count#24)#62 AS sum(cd_dep_college_count)#74]

(43) TakeOrderedAndProject
Input [18]: [ca_state#18, cd_gender#25, cd_marital_status#26, cd_dep_count#22, cnt1#63, avg(cd_dep_count)#64, max(cd_dep_count)#65, sum(cd_dep_count)#66, cd_dep_employed_count#23, cnt2#67, avg(cd_dep_employed_count)#68, max(cd_dep_employed_count)#69, sum(cd_dep_employed_count)#70, cd_dep_college_count#24, cnt3#71, avg(cd_dep_college_count)#72, max(cd_dep_college_count)#73, sum(cd_dep_college_count)#74]
Arguments: 100, [ca_state#18 ASC NULLS FIRST, cd_gender#25 ASC NULLS FIRST, cd_marital_status#26 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#25, cd_marital_status#26, cd_dep_count#22, cnt1#63, avg(cd_dep_count)#64, max(cd_dep_count)#65, sum(cd_dep_count)#66, cd_dep_employed_count#23, cnt2#67, avg(cd_dep_employed_count)#68, max(cd_dep_employed_count)#69, sum(cd_dep_employed_count)#70, cd_dep_college_count#24, cnt3#71, avg(cd_dep_college_count)#72, max(cd_dep_college_count)#73, sum(cd_dep_college_count)#74]

===== Subqueries =====

Subquery:1 Hosting operator id = 4 Hosting Expression = ss_sold_date_sk#5 IN dynamicpruning#6
BroadcastExchange (48)
+- * CometColumnarToRow (47)
   +- CometProject (46)
      +- CometFilter (45)
         +- CometNativeScan parquet spark_catalog.default.date_dim (44)


(44) CometNativeScan parquet spark_catalog.default.date_dim
Output [3]: [d_date_sk#7, d_year#75, d_qoy#76]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_year), IsNotNull(d_qoy), EqualTo(d_year,1999), LessThan(d_qoy,4), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_year:int,d_qoy:int>

(45) CometFilter
Input [3]: [d_date_sk#7, d_year#75, d_qoy#76]
Condition : ((((isnotnull(d_year#75) AND isnotnull(d_qoy#76)) AND (d_year#75 = 1999)) AND (d_qoy#76 < 4)) AND isnotnull(d_date_sk#7))

(46) CometProject
Input [3]: [d_date_sk#7, d_year#75, d_qoy#76]
Arguments: [d_date_sk#7], [d_date_sk#7]

(47) CometColumnarToRow [codegen id : 1]
Input [1]: [d_date_sk#7]

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

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

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


