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


(1) Scan parquet 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) ColumnarToRow [codegen id : 1]
Input [3]: [c_customer_sk#1, c_current_cdemo_sk#2, c_current_addr_sk#3]

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

(4) Exchange
Input [3]: [c_customer_sk#1, c_current_cdemo_sk#2, c_current_addr_sk#3]
Arguments: hashpartitioning(c_customer_sk#1, 5), ENSURE_REQUIREMENTS, [id=#4]

(5) Sort [codegen id : 2]
Input [3]: [c_customer_sk#1, c_current_cdemo_sk#2, c_current_addr_sk#3]
Arguments: [c_customer_sk#1 ASC NULLS FIRST], false, 0

(6) Scan parquet default.store_sales
Output [2]: [ss_customer_sk#5, ss_sold_date_sk#6]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#6), dynamicpruningexpression(ss_sold_date_sk#6 IN dynamicpruning#7)]
ReadSchema: struct<ss_customer_sk:int>

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

(8) ReusedExchange [Reuses operator id: 55]
Output [1]: [d_date_sk#8]

(9) BroadcastHashJoin [codegen id : 4]
Left keys [1]: [ss_sold_date_sk#6]
Right keys [1]: [d_date_sk#8]
Join condition: None

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

(11) Exchange
Input [1]: [ss_customer_sk#5]
Arguments: hashpartitioning(ss_customer_sk#5, 5), ENSURE_REQUIREMENTS, [id=#9]

(12) Sort [codegen id : 5]
Input [1]: [ss_customer_sk#5]
Arguments: [ss_customer_sk#5 ASC NULLS FIRST], false, 0

(13) SortMergeJoin [codegen id : 6]
Left keys [1]: [c_customer_sk#1]
Right keys [1]: [ss_customer_sk#5]
Join condition: None

(14) Scan parquet 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#7)]
ReadSchema: struct<ws_bill_customer_sk:int>

(15) ColumnarToRow [codegen id : 8]
Input [2]: [ws_bill_customer_sk#10, ws_sold_date_sk#11]

(16) ReusedExchange [Reuses operator id: 55]
Output [1]: [d_date_sk#12]

(17) BroadcastHashJoin [codegen id : 8]
Left keys [1]: [ws_sold_date_sk#11]
Right keys [1]: [d_date_sk#12]
Join condition: None

(18) Project [codegen id : 8]
Output [1]: [ws_bill_customer_sk#10 AS customsk#13]
Input [3]: [ws_bill_customer_sk#10, ws_sold_date_sk#11, d_date_sk#12]

(19) Scan parquet 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#7)]
ReadSchema: struct<cs_ship_customer_sk:int>

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

(21) ReusedExchange [Reuses operator id: 55]
Output [1]: [d_date_sk#16]

(22) BroadcastHashJoin [codegen id : 10]
Left keys [1]: [cs_sold_date_sk#15]
Right keys [1]: [d_date_sk#16]
Join condition: None

(23) Project [codegen id : 10]
Output [1]: [cs_ship_customer_sk#14 AS customsk#17]
Input [3]: [cs_ship_customer_sk#14, cs_sold_date_sk#15, d_date_sk#16]

(24) Union

(25) Exchange
Input [1]: [customsk#13]
Arguments: hashpartitioning(customsk#13, 5), ENSURE_REQUIREMENTS, [id=#18]

(26) Sort [codegen id : 11]
Input [1]: [customsk#13]
Arguments: [customsk#13 ASC NULLS FIRST], false, 0

(27) SortMergeJoin [codegen id : 12]
Left keys [1]: [c_customer_sk#1]
Right keys [1]: [customsk#13]
Join condition: None

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

(29) Exchange
Input [2]: [c_current_cdemo_sk#2, c_current_addr_sk#3]
Arguments: hashpartitioning(c_current_addr_sk#3, 5), ENSURE_REQUIREMENTS, [id=#19]

(30) Sort [codegen id : 13]
Input [2]: [c_current_cdemo_sk#2, c_current_addr_sk#3]
Arguments: [c_current_addr_sk#3 ASC NULLS FIRST], false, 0

(31) Scan parquet default.customer_address
Output [2]: [ca_address_sk#20, ca_state#21]
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 : 14]
Input [2]: [ca_address_sk#20, ca_state#21]

(33) Filter [codegen id : 14]
Input [2]: [ca_address_sk#20, ca_state#21]
Condition : isnotnull(ca_address_sk#20)

(34) Exchange
Input [2]: [ca_address_sk#20, ca_state#21]
Arguments: hashpartitioning(ca_address_sk#20, 5), ENSURE_REQUIREMENTS, [id=#22]

(35) Sort [codegen id : 15]
Input [2]: [ca_address_sk#20, ca_state#21]
Arguments: [ca_address_sk#20 ASC NULLS FIRST], false, 0

(36) SortMergeJoin [codegen id : 16]
Left keys [1]: [c_current_addr_sk#3]
Right keys [1]: [ca_address_sk#20]
Join condition: None

(37) Project [codegen id : 16]
Output [2]: [c_current_cdemo_sk#2, ca_state#21]
Input [4]: [c_current_cdemo_sk#2, c_current_addr_sk#3, ca_address_sk#20, ca_state#21]

(38) Exchange
Input [2]: [c_current_cdemo_sk#2, ca_state#21]
Arguments: hashpartitioning(c_current_cdemo_sk#2, 5), ENSURE_REQUIREMENTS, [id=#23]

(39) Sort [codegen id : 17]
Input [2]: [c_current_cdemo_sk#2, ca_state#21]
Arguments: [c_current_cdemo_sk#2 ASC NULLS FIRST], false, 0

(40) Scan parquet default.customer_demographics
Output [6]: [cd_demo_sk#24, cd_gender#25, cd_marital_status#26, cd_dep_count#27, cd_dep_employed_count#28, cd_dep_college_count#29]
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>

(41) ColumnarToRow [codegen id : 18]
Input [6]: [cd_demo_sk#24, cd_gender#25, cd_marital_status#26, cd_dep_count#27, cd_dep_employed_count#28, cd_dep_college_count#29]

(42) Filter [codegen id : 18]
Input [6]: [cd_demo_sk#24, cd_gender#25, cd_marital_status#26, cd_dep_count#27, cd_dep_employed_count#28, cd_dep_college_count#29]
Condition : isnotnull(cd_demo_sk#24)

(43) Exchange
Input [6]: [cd_demo_sk#24, cd_gender#25, cd_marital_status#26, cd_dep_count#27, cd_dep_employed_count#28, cd_dep_college_count#29]
Arguments: hashpartitioning(cd_demo_sk#24, 5), ENSURE_REQUIREMENTS, [id=#30]

(44) Sort [codegen id : 19]
Input [6]: [cd_demo_sk#24, cd_gender#25, cd_marital_status#26, cd_dep_count#27, cd_dep_employed_count#28, cd_dep_college_count#29]
Arguments: [cd_demo_sk#24 ASC NULLS FIRST], false, 0

(45) SortMergeJoin [codegen id : 20]
Left keys [1]: [c_current_cdemo_sk#2]
Right keys [1]: [cd_demo_sk#24]
Join condition: None

(46) Project [codegen id : 20]
Output [6]: [ca_state#21, cd_gender#25, cd_marital_status#26, cd_dep_count#27, cd_dep_employed_count#28, cd_dep_college_count#29]
Input [8]: [c_current_cdemo_sk#2, ca_state#21, cd_demo_sk#24, cd_gender#25, cd_marital_status#26, cd_dep_count#27, cd_dep_employed_count#28, cd_dep_college_count#29]

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

(48) Exchange
Input [19]: [ca_state#21, cd_gender#25, cd_marital_status#26, cd_dep_count#27, cd_dep_employed_count#28, cd_dep_college_count#29, count#44, sum#45, count#46, max#47, sum#48, sum#49, count#50, max#51, sum#52, sum#53, count#54, max#55, sum#56]
Arguments: hashpartitioning(ca_state#21, cd_gender#25, cd_marital_status#26, cd_dep_count#27, cd_dep_employed_count#28, cd_dep_college_count#29, 5), ENSURE_REQUIREMENTS, [id=#57]

(49) HashAggregate [codegen id : 21]
Input [19]: [ca_state#21, cd_gender#25, cd_marital_status#26, cd_dep_count#27, cd_dep_employed_count#28, cd_dep_college_count#29, count#44, sum#45, count#46, max#47, sum#48, sum#49, count#50, max#51, sum#52, sum#53, count#54, max#55, sum#56]
Keys [6]: [ca_state#21, cd_gender#25, cd_marital_status#26, cd_dep_count#27, cd_dep_employed_count#28, cd_dep_college_count#29]
Functions [10]: [count(1), avg(cd_dep_count#27), max(cd_dep_count#27), sum(cd_dep_count#27), avg(cd_dep_employed_count#28), max(cd_dep_employed_count#28), sum(cd_dep_employed_count#28), avg(cd_dep_college_count#29), max(cd_dep_college_count#29), sum(cd_dep_college_count#29)]
Aggregate Attributes [10]: [count(1)#58, avg(cd_dep_count#27)#59, max(cd_dep_count#27)#60, sum(cd_dep_count#27)#61, avg(cd_dep_employed_count#28)#62, max(cd_dep_employed_count#28)#63, sum(cd_dep_employed_count#28)#64, avg(cd_dep_college_count#29)#65, max(cd_dep_college_count#29)#66, sum(cd_dep_college_count#29)#67]
Results [18]: [ca_state#21, cd_gender#25, cd_marital_status#26, cd_dep_count#27, count(1)#58 AS cnt1#68, avg(cd_dep_count#27)#59 AS avg(cd_dep_count)#69, max(cd_dep_count#27)#60 AS max(cd_dep_count)#70, sum(cd_dep_count#27)#61 AS sum(cd_dep_count)#71, cd_dep_employed_count#28, count(1)#58 AS cnt2#72, avg(cd_dep_employed_count#28)#62 AS avg(cd_dep_employed_count)#73, max(cd_dep_employed_count#28)#63 AS max(cd_dep_employed_count)#74, sum(cd_dep_employed_count#28)#64 AS sum(cd_dep_employed_count)#75, cd_dep_college_count#29, count(1)#58 AS cnt3#76, avg(cd_dep_college_count#29)#65 AS avg(cd_dep_college_count)#77, max(cd_dep_college_count#29)#66 AS max(cd_dep_college_count)#78, sum(cd_dep_college_count#29)#67 AS sum(cd_dep_college_count)#79]

(50) TakeOrderedAndProject
Input [18]: [ca_state#21, cd_gender#25, cd_marital_status#26, cd_dep_count#27, cnt1#68, avg(cd_dep_count)#69, max(cd_dep_count)#70, sum(cd_dep_count)#71, cd_dep_employed_count#28, cnt2#72, avg(cd_dep_employed_count)#73, max(cd_dep_employed_count)#74, sum(cd_dep_employed_count)#75, cd_dep_college_count#29, cnt3#76, avg(cd_dep_college_count)#77, max(cd_dep_college_count)#78, sum(cd_dep_college_count)#79]
Arguments: 100, [ca_state#21 ASC NULLS FIRST, cd_gender#25 ASC NULLS FIRST, cd_marital_status#26 ASC NULLS FIRST, cd_dep_count#27 ASC NULLS FIRST, cd_dep_employed_count#28 ASC NULLS FIRST, cd_dep_college_count#29 ASC NULLS FIRST], [ca_state#21, cd_gender#25, cd_marital_status#26, cd_dep_count#27, cnt1#68, avg(cd_dep_count)#69, max(cd_dep_count)#70, sum(cd_dep_count)#71, cd_dep_employed_count#28, cnt2#72, avg(cd_dep_employed_count)#73, max(cd_dep_employed_count)#74, sum(cd_dep_employed_count)#75, cd_dep_college_count#29, cnt3#76, avg(cd_dep_college_count)#77, max(cd_dep_college_count)#78, sum(cd_dep_college_count)#79]

===== Subqueries =====

Subquery:1 Hosting operator id = 6 Hosting Expression = ss_sold_date_sk#6 IN dynamicpruning#7
BroadcastExchange (55)
+- * Project (54)
   +- * Filter (53)
      +- * ColumnarToRow (52)
         +- Scan parquet default.date_dim (51)


(51) Scan parquet default.date_dim
Output [3]: [d_date_sk#8, d_year#80, d_qoy#81]
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>

(52) ColumnarToRow [codegen id : 1]
Input [3]: [d_date_sk#8, d_year#80, d_qoy#81]

(53) Filter [codegen id : 1]
Input [3]: [d_date_sk#8, d_year#80, d_qoy#81]
Condition : ((((isnotnull(d_year#80) AND isnotnull(d_qoy#81)) AND (d_year#80 = 1999)) AND (d_qoy#81 < 4)) AND isnotnull(d_date_sk#8))

(54) Project [codegen id : 1]
Output [1]: [d_date_sk#8]
Input [3]: [d_date_sk#8, d_year#80, d_qoy#81]

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

Subquery:2 Hosting operator id = 14 Hosting Expression = ws_sold_date_sk#11 IN dynamicpruning#7

Subquery:3 Hosting operator id = 19 Hosting Expression = cs_sold_date_sk#15 IN dynamicpruning#7


