== Physical Plan ==
* CometColumnarToRow (40)
+- CometTakeOrderedAndProject (39)
   +- CometHashAggregate (38)
      +- CometExchange (37)
         +- CometHashAggregate (36)
            +- CometProject (35)
               +- CometBroadcastHashJoin (34)
                  :- CometProject (29)
                  :  +- CometBroadcastHashJoin (28)
                  :     :- CometProject (23)
                  :     :  +- CometBroadcastHashJoin (22)
                  :     :     :- CometBroadcastHashJoin (11)
                  :     :     :  :- CometFilter (2)
                  :     :     :  :  +- CometScan [native_iceberg_compat] parquet spark_catalog.default.customer (1)
                  :     :     :  +- CometBroadcastExchange (10)
                  :     :     :     +- CometProject (9)
                  :     :     :        +- CometBroadcastHashJoin (8)
                  :     :     :           :- CometScan [native_iceberg_compat] parquet spark_catalog.default.store_sales (3)
                  :     :     :           +- CometBroadcastExchange (7)
                  :     :     :              +- CometProject (6)
                  :     :     :                 +- CometFilter (5)
                  :     :     :                    +- CometScan [native_iceberg_compat] parquet spark_catalog.default.date_dim (4)
                  :     :     +- CometBroadcastExchange (21)
                  :     :        +- CometUnion (20)
                  :     :           :- CometProject (15)
                  :     :           :  +- CometBroadcastHashJoin (14)
                  :     :           :     :- CometScan [native_iceberg_compat] parquet spark_catalog.default.web_sales (12)
                  :     :           :     +- ReusedExchange (13)
                  :     :           +- CometProject (19)
                  :     :              +- CometBroadcastHashJoin (18)
                  :     :                 :- CometScan [native_iceberg_compat] parquet spark_catalog.default.catalog_sales (16)
                  :     :                 +- ReusedExchange (17)
                  :     +- CometBroadcastExchange (27)
                  :        +- CometProject (26)
                  :           +- CometFilter (25)
                  :              +- CometScan [native_iceberg_compat] parquet spark_catalog.default.customer_address (24)
                  +- CometBroadcastExchange (33)
                     +- CometProject (32)
                        +- CometFilter (31)
                           +- CometScan [native_iceberg_compat] parquet spark_catalog.default.customer_demographics (30)


(1) CometScan [native_iceberg_compat] 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) CometScan [native_iceberg_compat] 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>

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

(5) CometFilter
Input [3]: [d_date_sk#7, d_year#8, d_qoy#9]
Condition : ((((isnotnull(d_year#8) AND isnotnull(d_qoy#9)) AND (d_year#8 = 1999)) AND (d_qoy#9 < 4)) AND isnotnull(d_date_sk#7))

(6) CometProject
Input [3]: [d_date_sk#7, d_year#8, d_qoy#9]
Arguments: [d_date_sk#7], [d_date_sk#7]

(7) CometBroadcastExchange
Input [1]: [d_date_sk#7]
Arguments: [d_date_sk#7]

(8) CometBroadcastHashJoin
Left output [2]: [ss_customer_sk#4, ss_sold_date_sk#5]
Right output [1]: [d_date_sk#7]
Arguments: [ss_sold_date_sk#5], [d_date_sk#7], Inner, BuildRight

(9) CometProject
Input [3]: [ss_customer_sk#4, ss_sold_date_sk#5, d_date_sk#7]
Arguments: [ss_customer_sk#4], [ss_customer_sk#4]

(10) CometBroadcastExchange
Input [1]: [ss_customer_sk#4]
Arguments: [ss_customer_sk#4]

(11) CometBroadcastHashJoin
Left output [3]: [c_customer_sk#1, c_current_cdemo_sk#2, c_current_addr_sk#3]
Right output [1]: [ss_customer_sk#4]
Arguments: [c_customer_sk#1], [ss_customer_sk#4], LeftSemi, BuildRight

(12) CometScan [native_iceberg_compat] 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#12)]
ReadSchema: struct<ws_bill_customer_sk:int>

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

(14) CometBroadcastHashJoin
Left output [2]: [ws_bill_customer_sk#10, ws_sold_date_sk#11]
Right output [1]: [d_date_sk#7]
Arguments: [ws_sold_date_sk#11], [d_date_sk#7], Inner, BuildRight

(15) CometProject
Input [3]: [ws_bill_customer_sk#10, ws_sold_date_sk#11, d_date_sk#7]
Arguments: [customsk#13], [ws_bill_customer_sk#10 AS customsk#13]

(16) CometScan [native_iceberg_compat] 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), dynamicpruningexpression(cs_sold_date_sk#15 IN dynamicpruning#16)]
ReadSchema: struct<cs_ship_customer_sk:int>

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

(18) CometBroadcastHashJoin
Left output [2]: [cs_ship_customer_sk#14, cs_sold_date_sk#15]
Right output [1]: [d_date_sk#17]
Arguments: [cs_sold_date_sk#15], [d_date_sk#17], Inner, BuildRight

(19) CometProject
Input [3]: [cs_ship_customer_sk#14, cs_sold_date_sk#15, d_date_sk#17]
Arguments: [customsk#18], [cs_ship_customer_sk#14 AS customsk#18]

(20) CometUnion
Child 0 Input [1]: [customsk#13]
Child 1 Input [1]: [customsk#18]

(21) CometBroadcastExchange
Input [1]: [customsk#13]
Arguments: [customsk#13]

(22) CometBroadcastHashJoin
Left output [3]: [c_customer_sk#1, c_current_cdemo_sk#2, c_current_addr_sk#3]
Right output [1]: [customsk#13]
Arguments: [c_customer_sk#1], [customsk#13], LeftSemi, BuildRight

(23) CometProject
Input [3]: [c_customer_sk#1, c_current_cdemo_sk#2, c_current_addr_sk#3]
Arguments: [c_current_cdemo_sk#2, c_current_addr_sk#3], [c_current_cdemo_sk#2, c_current_addr_sk#3]

(24) CometScan [native_iceberg_compat] parquet spark_catalog.default.customer_address
Output [2]: [ca_address_sk#19, ca_state#20]
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>

(25) CometFilter
Input [2]: [ca_address_sk#19, ca_state#20]
Condition : isnotnull(ca_address_sk#19)

(26) CometProject
Input [2]: [ca_address_sk#19, ca_state#20]
Arguments: [ca_address_sk#19, ca_state#21], [ca_address_sk#19, staticinvoke(class org.apache.spark.sql.catalyst.util.CharVarcharCodegenUtils, StringType, readSidePadding, ca_state#20, 2, true, false, true) AS ca_state#21]

(27) CometBroadcastExchange
Input [2]: [ca_address_sk#19, ca_state#21]
Arguments: [ca_address_sk#19, ca_state#21]

(28) CometBroadcastHashJoin
Left output [2]: [c_current_cdemo_sk#2, c_current_addr_sk#3]
Right output [2]: [ca_address_sk#19, ca_state#21]
Arguments: [c_current_addr_sk#3], [ca_address_sk#19], Inner, BuildRight

(29) CometProject
Input [4]: [c_current_cdemo_sk#2, c_current_addr_sk#3, ca_address_sk#19, ca_state#21]
Arguments: [c_current_cdemo_sk#2, ca_state#21], [c_current_cdemo_sk#2, ca_state#21]

(30) CometScan [native_iceberg_compat] parquet spark_catalog.default.customer_demographics
Output [6]: [cd_demo_sk#22, cd_gender#23, cd_marital_status#24, cd_dep_count#25, cd_dep_employed_count#26, cd_dep_college_count#27]
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>

(31) CometFilter
Input [6]: [cd_demo_sk#22, cd_gender#23, cd_marital_status#24, cd_dep_count#25, cd_dep_employed_count#26, cd_dep_college_count#27]
Condition : isnotnull(cd_demo_sk#22)

(32) CometProject
Input [6]: [cd_demo_sk#22, cd_gender#23, cd_marital_status#24, cd_dep_count#25, cd_dep_employed_count#26, cd_dep_college_count#27]
Arguments: [cd_demo_sk#22, cd_gender#28, cd_marital_status#29, cd_dep_count#25, cd_dep_employed_count#26, cd_dep_college_count#27], [cd_demo_sk#22, staticinvoke(class org.apache.spark.sql.catalyst.util.CharVarcharCodegenUtils, StringType, readSidePadding, cd_gender#23, 1, true, false, true) AS cd_gender#28, staticinvoke(class org.apache.spark.sql.catalyst.util.CharVarcharCodegenUtils, StringType, readSidePadding, cd_marital_status#24, 1, true, false, true) AS cd_marital_status#29, cd_dep_count#25, cd_dep_employed_count#26, cd_dep_college_count#27]

(33) CometBroadcastExchange
Input [6]: [cd_demo_sk#22, cd_gender#28, cd_marital_status#29, cd_dep_count#25, cd_dep_employed_count#26, cd_dep_college_count#27]
Arguments: [cd_demo_sk#22, cd_gender#28, cd_marital_status#29, cd_dep_count#25, cd_dep_employed_count#26, cd_dep_college_count#27]

(34) CometBroadcastHashJoin
Left output [2]: [c_current_cdemo_sk#2, ca_state#21]
Right output [6]: [cd_demo_sk#22, cd_gender#28, cd_marital_status#29, cd_dep_count#25, cd_dep_employed_count#26, cd_dep_college_count#27]
Arguments: [c_current_cdemo_sk#2], [cd_demo_sk#22], Inner, BuildRight

(35) CometProject
Input [8]: [c_current_cdemo_sk#2, ca_state#21, cd_demo_sk#22, cd_gender#28, cd_marital_status#29, cd_dep_count#25, cd_dep_employed_count#26, cd_dep_college_count#27]
Arguments: [ca_state#21, cd_gender#28, cd_marital_status#29, cd_dep_count#25, cd_dep_employed_count#26, cd_dep_college_count#27], [ca_state#21, cd_gender#28, cd_marital_status#29, cd_dep_count#25, cd_dep_employed_count#26, cd_dep_college_count#27]

(36) CometHashAggregate
Input [6]: [ca_state#21, cd_gender#28, cd_marital_status#29, cd_dep_count#25, cd_dep_employed_count#26, cd_dep_college_count#27]
Keys [6]: [ca_state#21, cd_gender#28, cd_marital_status#29, cd_dep_count#25, cd_dep_employed_count#26, cd_dep_college_count#27]
Functions [10]: [partial_count(1), partial_avg(cd_dep_count#25), partial_max(cd_dep_count#25), partial_sum(cd_dep_count#25), partial_avg(cd_dep_employed_count#26), partial_max(cd_dep_employed_count#26), partial_sum(cd_dep_employed_count#26), partial_avg(cd_dep_college_count#27), partial_max(cd_dep_college_count#27), partial_sum(cd_dep_college_count#27)]

(37) CometExchange
Input [19]: [ca_state#21, cd_gender#28, cd_marital_status#29, cd_dep_count#25, cd_dep_employed_count#26, cd_dep_college_count#27, count#30, sum#31, count#32, max#33, sum#34, sum#35, count#36, max#37, sum#38, sum#39, count#40, max#41, sum#42]
Arguments: hashpartitioning(ca_state#21, cd_gender#28, cd_marital_status#29, cd_dep_count#25, cd_dep_employed_count#26, cd_dep_college_count#27, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=1]

(38) CometHashAggregate
Input [19]: [ca_state#21, cd_gender#28, cd_marital_status#29, cd_dep_count#25, cd_dep_employed_count#26, cd_dep_college_count#27, count#30, sum#31, count#32, max#33, sum#34, sum#35, count#36, max#37, sum#38, sum#39, count#40, max#41, sum#42]
Keys [6]: [ca_state#21, cd_gender#28, cd_marital_status#29, cd_dep_count#25, cd_dep_employed_count#26, cd_dep_college_count#27]
Functions [10]: [count(1), avg(cd_dep_count#25), max(cd_dep_count#25), sum(cd_dep_count#25), avg(cd_dep_employed_count#26), max(cd_dep_employed_count#26), sum(cd_dep_employed_count#26), avg(cd_dep_college_count#27), max(cd_dep_college_count#27), sum(cd_dep_college_count#27)]

(39) CometTakeOrderedAndProject
Input [18]: [ca_state#21, cd_gender#28, cd_marital_status#29, cd_dep_count#25, cnt1#43, avg(cd_dep_count)#44, max(cd_dep_count)#45, sum(cd_dep_count)#46, cd_dep_employed_count#26, cnt2#47, avg(cd_dep_employed_count)#48, max(cd_dep_employed_count)#49, sum(cd_dep_employed_count)#50, cd_dep_college_count#27, cnt3#51, avg(cd_dep_college_count)#52, max(cd_dep_college_count)#53, sum(cd_dep_college_count)#54]
Arguments: TakeOrderedAndProject(limit=100, orderBy=[ca_state#21 ASC NULLS FIRST,cd_gender#28 ASC NULLS FIRST,cd_marital_status#29 ASC NULLS FIRST,cd_dep_count#25 ASC NULLS FIRST,cd_dep_employed_count#26 ASC NULLS FIRST,cd_dep_college_count#27 ASC NULLS FIRST], output=[ca_state#21,cd_gender#28,cd_marital_status#29,cd_dep_count#25,cnt1#43,avg(cd_dep_count)#44,max(cd_dep_count)#45,sum(cd_dep_count)#46,cd_dep_employed_count#26,cnt2#47,avg(cd_dep_employed_count)#48,max(cd_dep_employed_count)#49,sum(cd_dep_employed_count)#50,cd_dep_college_count#27,cnt3#51,avg(cd_dep_college_count)#52,max(cd_dep_college_count)#53,sum(cd_dep_college_count)#54]), [ca_state#21, cd_gender#28, cd_marital_status#29, cd_dep_count#25, cnt1#43, avg(cd_dep_count)#44, max(cd_dep_count)#45, sum(cd_dep_count)#46, cd_dep_employed_count#26, cnt2#47, avg(cd_dep_employed_count)#48, max(cd_dep_employed_count)#49, sum(cd_dep_employed_count)#50, cd_dep_college_count#27, cnt3#51, avg(cd_dep_college_count)#52, max(cd_dep_college_count)#53, sum(cd_dep_college_count)#54], 100, 0, [ca_state#21 ASC NULLS FIRST, cd_gender#28 ASC NULLS FIRST, cd_marital_status#29 ASC NULLS FIRST, cd_dep_count#25 ASC NULLS FIRST, cd_dep_employed_count#26 ASC NULLS FIRST, cd_dep_college_count#27 ASC NULLS FIRST], [ca_state#21, cd_gender#28, cd_marital_status#29, cd_dep_count#25, cnt1#43, avg(cd_dep_count)#44, max(cd_dep_count)#45, sum(cd_dep_count)#46, cd_dep_employed_count#26, cnt2#47, avg(cd_dep_employed_count)#48, max(cd_dep_employed_count)#49, sum(cd_dep_employed_count)#50, cd_dep_college_count#27, cnt3#51, avg(cd_dep_college_count)#52, max(cd_dep_college_count)#53, sum(cd_dep_college_count)#54]

(40) CometColumnarToRow [codegen id : 1]
Input [18]: [ca_state#21, cd_gender#28, cd_marital_status#29, cd_dep_count#25, cnt1#43, avg(cd_dep_count)#44, max(cd_dep_count)#45, sum(cd_dep_count)#46, cd_dep_employed_count#26, cnt2#47, avg(cd_dep_employed_count)#48, max(cd_dep_employed_count)#49, sum(cd_dep_employed_count)#50, cd_dep_college_count#27, cnt3#51, avg(cd_dep_college_count)#52, max(cd_dep_college_count)#53, sum(cd_dep_college_count)#54]

===== Subqueries =====

Subquery:1 Hosting operator id = 3 Hosting Expression = ss_sold_date_sk#5 IN dynamicpruning#6
BroadcastExchange (45)
+- * CometColumnarToRow (44)
   +- CometProject (43)
      +- CometFilter (42)
         +- CometScan [native_iceberg_compat] parquet spark_catalog.default.date_dim (41)


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

(42) CometFilter
Input [3]: [d_date_sk#7, d_year#8, d_qoy#9]
Condition : ((((isnotnull(d_year#8) AND isnotnull(d_qoy#9)) AND (d_year#8 = 1999)) AND (d_qoy#9 < 4)) AND isnotnull(d_date_sk#7))

(43) CometProject
Input [3]: [d_date_sk#7, d_year#8, d_qoy#9]
Arguments: [d_date_sk#7], [d_date_sk#7]

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

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

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

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


