== Physical Plan ==
* ColumnarToRow (48)
+- CometTakeOrderedAndProject (47)
   +- CometProject (46)
      +- CometBroadcastHashJoin (45)
         :- CometProject (40)
         :  +- CometBroadcastHashJoin (39)
         :     :- CometProject (35)
         :     :  +- CometBroadcastHashJoin (34)
         :     :     :- CometFilter (17)
         :     :     :  +- CometHashAggregate (16)
         :     :     :     +- CometExchange (15)
         :     :     :        +- CometHashAggregate (14)
         :     :     :           +- CometProject (13)
         :     :     :              +- CometBroadcastHashJoin (12)
         :     :     :                 :- CometProject (8)
         :     :     :                 :  +- CometBroadcastHashJoin (7)
         :     :     :                 :     :- CometFilter (2)
         :     :     :                 :     :  +- CometScan parquet spark_catalog.default.web_returns (1)
         :     :     :                 :     +- CometBroadcastExchange (6)
         :     :     :                 :        +- CometProject (5)
         :     :     :                 :           +- CometFilter (4)
         :     :     :                 :              +- CometScan parquet spark_catalog.default.date_dim (3)
         :     :     :                 +- CometBroadcastExchange (11)
         :     :     :                    +- CometFilter (10)
         :     :     :                       +- CometScan parquet spark_catalog.default.customer_address (9)
         :     :     +- CometBroadcastExchange (33)
         :     :        +- CometFilter (32)
         :     :           +- CometHashAggregate (31)
         :     :              +- CometExchange (30)
         :     :                 +- CometHashAggregate (29)
         :     :                    +- CometHashAggregate (28)
         :     :                       +- CometExchange (27)
         :     :                          +- CometHashAggregate (26)
         :     :                             +- CometProject (25)
         :     :                                +- CometBroadcastHashJoin (24)
         :     :                                   :- CometProject (22)
         :     :                                   :  +- CometBroadcastHashJoin (21)
         :     :                                   :     :- CometFilter (19)
         :     :                                   :     :  +- CometScan parquet spark_catalog.default.web_returns (18)
         :     :                                   :     +- ReusedExchange (20)
         :     :                                   +- ReusedExchange (23)
         :     +- CometBroadcastExchange (38)
         :        +- CometFilter (37)
         :           +- CometScan parquet spark_catalog.default.customer (36)
         +- CometBroadcastExchange (44)
            +- CometProject (43)
               +- CometFilter (42)
                  +- CometScan parquet spark_catalog.default.customer_address (41)


(1) CometScan parquet spark_catalog.default.web_returns
Output [4]: [wr_returning_customer_sk#1, wr_returning_addr_sk#2, wr_return_amt#3, wr_returned_date_sk#4]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(wr_returned_date_sk#4), dynamicpruningexpression(wr_returned_date_sk#4 IN dynamicpruning#5)]
PushedFilters: [IsNotNull(wr_returning_addr_sk), IsNotNull(wr_returning_customer_sk)]
ReadSchema: struct<wr_returning_customer_sk:int,wr_returning_addr_sk:int,wr_return_amt:decimal(7,2)>

(2) CometFilter
Input [4]: [wr_returning_customer_sk#1, wr_returning_addr_sk#2, wr_return_amt#3, wr_returned_date_sk#4]
Condition : (isnotnull(wr_returning_addr_sk#2) AND isnotnull(wr_returning_customer_sk#1))

(3) CometScan parquet spark_catalog.default.date_dim
Output [2]: [d_date_sk#6, d_year#7]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2002), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_year:int>

(4) CometFilter
Input [2]: [d_date_sk#6, d_year#7]
Condition : ((isnotnull(d_year#7) AND (d_year#7 = 2002)) AND isnotnull(d_date_sk#6))

(5) CometProject
Input [2]: [d_date_sk#6, d_year#7]
Arguments: [d_date_sk#6], [d_date_sk#6]

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

(7) CometBroadcastHashJoin
Left output [4]: [wr_returning_customer_sk#1, wr_returning_addr_sk#2, wr_return_amt#3, wr_returned_date_sk#4]
Right output [1]: [d_date_sk#6]
Arguments: [wr_returned_date_sk#4], [d_date_sk#6], Inner, BuildRight

(8) CometProject
Input [5]: [wr_returning_customer_sk#1, wr_returning_addr_sk#2, wr_return_amt#3, wr_returned_date_sk#4, d_date_sk#6]
Arguments: [wr_returning_customer_sk#1, wr_returning_addr_sk#2, wr_return_amt#3], [wr_returning_customer_sk#1, wr_returning_addr_sk#2, wr_return_amt#3]

(9) CometScan parquet spark_catalog.default.customer_address
Output [2]: [ca_address_sk#8, ca_state#9]
Batched: true
Location [not included in comparison]/{warehouse_dir}/customer_address]
PushedFilters: [IsNotNull(ca_address_sk), IsNotNull(ca_state)]
ReadSchema: struct<ca_address_sk:int,ca_state:string>

(10) CometFilter
Input [2]: [ca_address_sk#8, ca_state#9]
Condition : (isnotnull(ca_address_sk#8) AND isnotnull(ca_state#9))

(11) CometBroadcastExchange
Input [2]: [ca_address_sk#8, ca_state#9]
Arguments: [ca_address_sk#8, ca_state#9]

(12) CometBroadcastHashJoin
Left output [3]: [wr_returning_customer_sk#1, wr_returning_addr_sk#2, wr_return_amt#3]
Right output [2]: [ca_address_sk#8, ca_state#9]
Arguments: [wr_returning_addr_sk#2], [ca_address_sk#8], Inner, BuildRight

(13) CometProject
Input [5]: [wr_returning_customer_sk#1, wr_returning_addr_sk#2, wr_return_amt#3, ca_address_sk#8, ca_state#9]
Arguments: [wr_returning_customer_sk#1, wr_return_amt#3, ca_state#9], [wr_returning_customer_sk#1, wr_return_amt#3, ca_state#9]

(14) CometHashAggregate
Input [3]: [wr_returning_customer_sk#1, wr_return_amt#3, ca_state#9]
Keys [2]: [wr_returning_customer_sk#1, ca_state#9]
Functions [1]: [partial_sum(UnscaledValue(wr_return_amt#3))]

(15) CometExchange
Input [3]: [wr_returning_customer_sk#1, ca_state#9, sum#10]
Arguments: hashpartitioning(wr_returning_customer_sk#1, ca_state#9, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=1]

(16) CometHashAggregate
Input [3]: [wr_returning_customer_sk#1, ca_state#9, sum#10]
Keys [2]: [wr_returning_customer_sk#1, ca_state#9]
Functions [1]: [sum(UnscaledValue(wr_return_amt#3))]

(17) CometFilter
Input [3]: [ctr_customer_sk#11, ctr_state#12, ctr_total_return#13]
Condition : isnotnull(ctr_total_return#13)

(18) CometScan parquet spark_catalog.default.web_returns
Output [4]: [wr_returning_customer_sk#1, wr_returning_addr_sk#2, wr_return_amt#3, wr_returned_date_sk#4]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(wr_returned_date_sk#4), dynamicpruningexpression(wr_returned_date_sk#4 IN dynamicpruning#14)]
PushedFilters: [IsNotNull(wr_returning_addr_sk)]
ReadSchema: struct<wr_returning_customer_sk:int,wr_returning_addr_sk:int,wr_return_amt:decimal(7,2)>

(19) CometFilter
Input [4]: [wr_returning_customer_sk#1, wr_returning_addr_sk#2, wr_return_amt#3, wr_returned_date_sk#4]
Condition : isnotnull(wr_returning_addr_sk#2)

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

(21) CometBroadcastHashJoin
Left output [4]: [wr_returning_customer_sk#1, wr_returning_addr_sk#2, wr_return_amt#3, wr_returned_date_sk#4]
Right output [1]: [d_date_sk#6]
Arguments: [wr_returned_date_sk#4], [d_date_sk#6], Inner, BuildRight

(22) CometProject
Input [5]: [wr_returning_customer_sk#1, wr_returning_addr_sk#2, wr_return_amt#3, wr_returned_date_sk#4, d_date_sk#6]
Arguments: [wr_returning_customer_sk#1, wr_returning_addr_sk#2, wr_return_amt#3], [wr_returning_customer_sk#1, wr_returning_addr_sk#2, wr_return_amt#3]

(23) ReusedExchange [Reuses operator id: 11]
Output [2]: [ca_address_sk#8, ca_state#9]

(24) CometBroadcastHashJoin
Left output [3]: [wr_returning_customer_sk#1, wr_returning_addr_sk#2, wr_return_amt#3]
Right output [2]: [ca_address_sk#8, ca_state#9]
Arguments: [wr_returning_addr_sk#2], [ca_address_sk#8], Inner, BuildRight

(25) CometProject
Input [5]: [wr_returning_customer_sk#1, wr_returning_addr_sk#2, wr_return_amt#3, ca_address_sk#8, ca_state#9]
Arguments: [wr_returning_customer_sk#1, wr_return_amt#3, ca_state#9], [wr_returning_customer_sk#1, wr_return_amt#3, ca_state#9]

(26) CometHashAggregate
Input [3]: [wr_returning_customer_sk#1, wr_return_amt#3, ca_state#9]
Keys [2]: [wr_returning_customer_sk#1, ca_state#9]
Functions [1]: [partial_sum(UnscaledValue(wr_return_amt#3))]

(27) CometExchange
Input [3]: [wr_returning_customer_sk#1, ca_state#9, sum#15]
Arguments: hashpartitioning(wr_returning_customer_sk#1, ca_state#9, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=2]

(28) CometHashAggregate
Input [3]: [wr_returning_customer_sk#1, ca_state#9, sum#15]
Keys [2]: [wr_returning_customer_sk#1, ca_state#9]
Functions [1]: [sum(UnscaledValue(wr_return_amt#3))]

(29) CometHashAggregate
Input [2]: [ctr_state#12, ctr_total_return#13]
Keys [1]: [ctr_state#12]
Functions [1]: [partial_avg(ctr_total_return#13)]

(30) CometExchange
Input [3]: [ctr_state#12, sum#16, count#17]
Arguments: hashpartitioning(ctr_state#12, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=3]

(31) CometHashAggregate
Input [3]: [ctr_state#12, sum#16, count#17]
Keys [1]: [ctr_state#12]
Functions [1]: [avg(ctr_total_return#13)]

(32) CometFilter
Input [2]: [(avg(ctr_total_return) * 1.2)#18, ctr_state#12#19]
Condition : isnotnull((avg(ctr_total_return) * 1.2)#18)

(33) CometBroadcastExchange
Input [2]: [(avg(ctr_total_return) * 1.2)#18, ctr_state#12#19]
Arguments: [(avg(ctr_total_return) * 1.2)#18, ctr_state#12#19]

(34) CometBroadcastHashJoin
Left output [3]: [ctr_customer_sk#11, ctr_state#12, ctr_total_return#13]
Right output [2]: [(avg(ctr_total_return) * 1.2)#18, ctr_state#12#19]
Arguments: [ctr_state#12], [ctr_state#12#19], Inner, (cast(ctr_total_return#13 as decimal(24,7)) > (avg(ctr_total_return) * 1.2)#18), BuildRight

(35) CometProject
Input [5]: [ctr_customer_sk#11, ctr_state#12, ctr_total_return#13, (avg(ctr_total_return) * 1.2)#18, ctr_state#12#19]
Arguments: [ctr_customer_sk#11, ctr_total_return#13], [ctr_customer_sk#11, ctr_total_return#13]

(36) CometScan parquet spark_catalog.default.customer
Output [14]: [c_customer_sk#20, c_customer_id#21, c_current_addr_sk#22, c_salutation#23, c_first_name#24, c_last_name#25, c_preferred_cust_flag#26, c_birth_day#27, c_birth_month#28, c_birth_year#29, c_birth_country#30, c_login#31, c_email_address#32, c_last_review_date#33]
Batched: true
Location [not included in comparison]/{warehouse_dir}/customer]
PushedFilters: [IsNotNull(c_customer_sk), IsNotNull(c_current_addr_sk)]
ReadSchema: struct<c_customer_sk:int,c_customer_id:string,c_current_addr_sk:int,c_salutation:string,c_first_name:string,c_last_name:string,c_preferred_cust_flag:string,c_birth_day:int,c_birth_month:int,c_birth_year:int,c_birth_country:string,c_login:string,c_email_address:string,c_last_review_date:int>

(37) CometFilter
Input [14]: [c_customer_sk#20, c_customer_id#21, c_current_addr_sk#22, c_salutation#23, c_first_name#24, c_last_name#25, c_preferred_cust_flag#26, c_birth_day#27, c_birth_month#28, c_birth_year#29, c_birth_country#30, c_login#31, c_email_address#32, c_last_review_date#33]
Condition : (isnotnull(c_customer_sk#20) AND isnotnull(c_current_addr_sk#22))

(38) CometBroadcastExchange
Input [14]: [c_customer_sk#20, c_customer_id#21, c_current_addr_sk#22, c_salutation#23, c_first_name#24, c_last_name#25, c_preferred_cust_flag#26, c_birth_day#27, c_birth_month#28, c_birth_year#29, c_birth_country#30, c_login#31, c_email_address#32, c_last_review_date#33]
Arguments: [c_customer_sk#20, c_customer_id#21, c_current_addr_sk#22, c_salutation#23, c_first_name#24, c_last_name#25, c_preferred_cust_flag#26, c_birth_day#27, c_birth_month#28, c_birth_year#29, c_birth_country#30, c_login#31, c_email_address#32, c_last_review_date#33]

(39) CometBroadcastHashJoin
Left output [2]: [ctr_customer_sk#11, ctr_total_return#13]
Right output [14]: [c_customer_sk#20, c_customer_id#21, c_current_addr_sk#22, c_salutation#23, c_first_name#24, c_last_name#25, c_preferred_cust_flag#26, c_birth_day#27, c_birth_month#28, c_birth_year#29, c_birth_country#30, c_login#31, c_email_address#32, c_last_review_date#33]
Arguments: [ctr_customer_sk#11], [c_customer_sk#20], Inner, BuildRight

(40) CometProject
Input [16]: [ctr_customer_sk#11, ctr_total_return#13, c_customer_sk#20, c_customer_id#21, c_current_addr_sk#22, c_salutation#23, c_first_name#24, c_last_name#25, c_preferred_cust_flag#26, c_birth_day#27, c_birth_month#28, c_birth_year#29, c_birth_country#30, c_login#31, c_email_address#32, c_last_review_date#33]
Arguments: [ctr_total_return#13, c_customer_id#21, c_current_addr_sk#22, c_salutation#23, c_first_name#24, c_last_name#25, c_preferred_cust_flag#26, c_birth_day#27, c_birth_month#28, c_birth_year#29, c_birth_country#30, c_login#31, c_email_address#32, c_last_review_date#33], [ctr_total_return#13, c_customer_id#21, c_current_addr_sk#22, c_salutation#23, c_first_name#24, c_last_name#25, c_preferred_cust_flag#26, c_birth_day#27, c_birth_month#28, c_birth_year#29, c_birth_country#30, c_login#31, c_email_address#32, c_last_review_date#33]

(41) CometScan parquet spark_catalog.default.customer_address
Output [2]: [ca_address_sk#34, ca_state#35]
Batched: true
Location [not included in comparison]/{warehouse_dir}/customer_address]
PushedFilters: [IsNotNull(ca_state), EqualTo(ca_state,GA), IsNotNull(ca_address_sk)]
ReadSchema: struct<ca_address_sk:int,ca_state:string>

(42) CometFilter
Input [2]: [ca_address_sk#34, ca_state#35]
Condition : ((isnotnull(ca_state#35) AND (ca_state#35 = GA)) AND isnotnull(ca_address_sk#34))

(43) CometProject
Input [2]: [ca_address_sk#34, ca_state#35]
Arguments: [ca_address_sk#34], [ca_address_sk#34]

(44) CometBroadcastExchange
Input [1]: [ca_address_sk#34]
Arguments: [ca_address_sk#34]

(45) CometBroadcastHashJoin
Left output [14]: [ctr_total_return#13, c_customer_id#21, c_current_addr_sk#22, c_salutation#23, c_first_name#24, c_last_name#25, c_preferred_cust_flag#26, c_birth_day#27, c_birth_month#28, c_birth_year#29, c_birth_country#30, c_login#31, c_email_address#32, c_last_review_date#33]
Right output [1]: [ca_address_sk#34]
Arguments: [c_current_addr_sk#22], [ca_address_sk#34], Inner, BuildRight

(46) CometProject
Input [15]: [ctr_total_return#13, c_customer_id#21, c_current_addr_sk#22, c_salutation#23, c_first_name#24, c_last_name#25, c_preferred_cust_flag#26, c_birth_day#27, c_birth_month#28, c_birth_year#29, c_birth_country#30, c_login#31, c_email_address#32, c_last_review_date#33, ca_address_sk#34]
Arguments: [c_customer_id#21, c_salutation#23, c_first_name#24, c_last_name#25, c_preferred_cust_flag#26, c_birth_day#27, c_birth_month#28, c_birth_year#29, c_birth_country#30, c_login#31, c_email_address#32, c_last_review_date#33, ctr_total_return#13], [c_customer_id#21, c_salutation#23, c_first_name#24, c_last_name#25, c_preferred_cust_flag#26, c_birth_day#27, c_birth_month#28, c_birth_year#29, c_birth_country#30, c_login#31, c_email_address#32, c_last_review_date#33, ctr_total_return#13]

(47) CometTakeOrderedAndProject
Input [13]: [c_customer_id#21, c_salutation#23, c_first_name#24, c_last_name#25, c_preferred_cust_flag#26, c_birth_day#27, c_birth_month#28, c_birth_year#29, c_birth_country#30, c_login#31, c_email_address#32, c_last_review_date#33, ctr_total_return#13]
Arguments: TakeOrderedAndProject(limit=100, orderBy=[c_customer_id#21 ASC NULLS FIRST,c_salutation#23 ASC NULLS FIRST,c_first_name#24 ASC NULLS FIRST,c_last_name#25 ASC NULLS FIRST,c_preferred_cust_flag#26 ASC NULLS FIRST,c_birth_day#27 ASC NULLS FIRST,c_birth_month#28 ASC NULLS FIRST,c_birth_year#29 ASC NULLS FIRST,c_birth_country#30 ASC NULLS FIRST,c_login#31 ASC NULLS FIRST,c_email_address#32 ASC NULLS FIRST,c_last_review_date#33 ASC NULLS FIRST,ctr_total_return#13 ASC NULLS FIRST], output=[c_customer_id#21,c_salutation#23,c_first_name#24,c_last_name#25,c_preferred_cust_flag#26,c_birth_day#27,c_birth_month#28,c_birth_year#29,c_birth_country#30,c_login#31,c_email_address#32,c_last_review_date#33,ctr_total_return#13]), [c_customer_id#21, c_salutation#23, c_first_name#24, c_last_name#25, c_preferred_cust_flag#26, c_birth_day#27, c_birth_month#28, c_birth_year#29, c_birth_country#30, c_login#31, c_email_address#32, c_last_review_date#33, ctr_total_return#13], 100, [c_customer_id#21 ASC NULLS FIRST, c_salutation#23 ASC NULLS FIRST, c_first_name#24 ASC NULLS FIRST, c_last_name#25 ASC NULLS FIRST, c_preferred_cust_flag#26 ASC NULLS FIRST, c_birth_day#27 ASC NULLS FIRST, c_birth_month#28 ASC NULLS FIRST, c_birth_year#29 ASC NULLS FIRST, c_birth_country#30 ASC NULLS FIRST, c_login#31 ASC NULLS FIRST, c_email_address#32 ASC NULLS FIRST, c_last_review_date#33 ASC NULLS FIRST, ctr_total_return#13 ASC NULLS FIRST], [c_customer_id#21, c_salutation#23, c_first_name#24, c_last_name#25, c_preferred_cust_flag#26, c_birth_day#27, c_birth_month#28, c_birth_year#29, c_birth_country#30, c_login#31, c_email_address#32, c_last_review_date#33, ctr_total_return#13]

(48) ColumnarToRow [codegen id : 1]
Input [13]: [c_customer_id#21, c_salutation#23, c_first_name#24, c_last_name#25, c_preferred_cust_flag#26, c_birth_day#27, c_birth_month#28, c_birth_year#29, c_birth_country#30, c_login#31, c_email_address#32, c_last_review_date#33, ctr_total_return#13]

===== Subqueries =====

Subquery:1 Hosting operator id = 1 Hosting Expression = wr_returned_date_sk#4 IN dynamicpruning#5
BroadcastExchange (53)
+- * ColumnarToRow (52)
   +- CometProject (51)
      +- CometFilter (50)
         +- CometScan parquet spark_catalog.default.date_dim (49)


(49) CometScan parquet spark_catalog.default.date_dim
Output [2]: [d_date_sk#6, d_year#7]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2002), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_year:int>

(50) CometFilter
Input [2]: [d_date_sk#6, d_year#7]
Condition : ((isnotnull(d_year#7) AND (d_year#7 = 2002)) AND isnotnull(d_date_sk#6))

(51) CometProject
Input [2]: [d_date_sk#6, d_year#7]
Arguments: [d_date_sk#6], [d_date_sk#6]

(52) ColumnarToRow [codegen id : 1]
Input [1]: [d_date_sk#6]

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

Subquery:2 Hosting operator id = 18 Hosting Expression = wr_returned_date_sk#4 IN dynamicpruning#5


