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


(1) CometNativeScan: `spark_catalog`.`default`.`customer`
Output [3]: [c_customer_sk#3, c_current_cdemo_sk#4, c_current_addr_sk#5]
Arguments: [c_customer_sk#3, c_current_cdemo_sk#4, c_current_addr_sk#5]

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

(3) CometNativeScan: `spark_catalog`.`default`.`store_sales`
Output [2]: [ss_customer_sk#6, ss_sold_date_sk#7]
Arguments: [ss_customer_sk#6, ss_sold_date_sk#7]

(4) CometNativeScan: `spark_catalog`.`default`.`date_dim`
Output [3]: [d_date_sk#8, d_year#9, d_qoy#10]
Arguments: [d_date_sk#8, d_year#9, d_qoy#10]

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

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

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

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

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

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

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

(12) ColumnarToRow [codegen id : 5]
Input [3]: [c_customer_sk#3, c_current_cdemo_sk#4, c_current_addr_sk#5]

(13) CometNativeScan: `spark_catalog`.`default`.`web_sales`
Output [2]: [ws_bill_customer_sk#11, ws_sold_date_sk#12]
Arguments: [ws_bill_customer_sk#11, ws_sold_date_sk#12]

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

(15) CometBroadcastHashJoin
Left output [2]: [ws_bill_customer_sk#11, ws_sold_date_sk#12]
Right output [1]: [d_date_sk#13]
Arguments: [ws_sold_date_sk#12], [d_date_sk#13], Inner, BuildRight

(16) CometProject
Input [3]: [ws_bill_customer_sk#11, ws_sold_date_sk#12, d_date_sk#13]
Arguments: [ws_bill_customer_sk#11], [ws_bill_customer_sk#11]

(17) ColumnarToRow [codegen id : 1]
Input [1]: [ws_bill_customer_sk#11]

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

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

(20) ReusedExchange [Reuses operator id: 18]
Output [1]: [cs_ship_customer_sk#14]

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

(22) Filter [codegen id : 5]
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)

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

(24) CometNativeScan: `spark_catalog`.`default`.`customer_address`
Output [2]: [ca_address_sk#15, ca_state#16]
Arguments: [ca_address_sk#15, ca_state#16]

(25) CometFilter
Input [2]: [ca_address_sk#15, ca_state#16]
Condition : isnotnull(ca_address_sk#15)

(26) ColumnarToRow [codegen id : 3]
Input [2]: [ca_address_sk#15, ca_state#16]

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

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

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

(30) CometNativeScan: `spark_catalog`.`default`.`customer_demographics`
Output [6]: [cd_demo_sk#17, cd_gender#18, cd_marital_status#19, cd_dep_count#20, cd_dep_employed_count#21, cd_dep_college_count#22]
Arguments: [cd_demo_sk#17, cd_gender#18, cd_marital_status#19, cd_dep_count#20, cd_dep_employed_count#21, cd_dep_college_count#22]

(31) CometFilter
Input [6]: [cd_demo_sk#17, cd_gender#18, cd_marital_status#19, cd_dep_count#20, cd_dep_employed_count#21, cd_dep_college_count#22]
Condition : isnotnull(cd_demo_sk#17)

(32) ColumnarToRow [codegen id : 4]
Input [6]: [cd_demo_sk#17, cd_gender#18, cd_marital_status#19, cd_dep_count#20, cd_dep_employed_count#21, cd_dep_college_count#22]

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

(34) BroadcastHashJoin [codegen id : 5]
Left keys [1]: [c_current_cdemo_sk#4]
Right keys [1]: [cd_demo_sk#17]
Join type: Inner
Join condition: None

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

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

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

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

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

