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


(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), true, [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_sold_date_sk#5, ss_customer_sk#6]
Batched: true
Location [not included in comparison]/{warehouse_dir}/store_sales]
PushedFilters: [IsNotNull(ss_sold_date_sk)]
ReadSchema: struct<ss_sold_date_sk:int,ss_customer_sk:int>

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

(8) Filter [codegen id : 4]
Input [2]: [ss_sold_date_sk#5, ss_customer_sk#6]
Condition : isnotnull(ss_sold_date_sk#5)

(9) Scan parquet 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>

(10) ColumnarToRow [codegen id : 3]
Input [3]: [d_date_sk#7, d_year#8, d_qoy#9]

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

(12) Project [codegen id : 3]
Output [1]: [d_date_sk#7]
Input [3]: [d_date_sk#7, d_year#8, d_qoy#9]

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

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

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

(16) Exchange
Input [1]: [ss_customer_sk#6]
Arguments: hashpartitioning(ss_customer_sk#6, 5), true, [id=#11]

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

(18) SortMergeJoin
Left keys [1]: [c_customer_sk#1]
Right keys [1]: [ss_customer_sk#6]
Join condition: None

(19) Scan parquet default.web_sales
Output [2]: [ws_sold_date_sk#12, ws_bill_customer_sk#13]
Batched: true
Location [not included in comparison]/{warehouse_dir}/web_sales]
PushedFilters: [IsNotNull(ws_sold_date_sk)]
ReadSchema: struct<ws_sold_date_sk:int,ws_bill_customer_sk:int>

(20) ColumnarToRow [codegen id : 7]
Input [2]: [ws_sold_date_sk#12, ws_bill_customer_sk#13]

(21) Filter [codegen id : 7]
Input [2]: [ws_sold_date_sk#12, ws_bill_customer_sk#13]
Condition : isnotnull(ws_sold_date_sk#12)

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

(23) BroadcastHashJoin [codegen id : 7]
Left keys [1]: [ws_sold_date_sk#12]
Right keys [1]: [d_date_sk#7]
Join condition: None

(24) Project [codegen id : 7]
Output [1]: [ws_bill_customer_sk#13 AS customsk#14]
Input [3]: [ws_sold_date_sk#12, ws_bill_customer_sk#13, d_date_sk#7]

(25) Scan parquet default.catalog_sales
Output [2]: [cs_sold_date_sk#15, cs_ship_customer_sk#16]
Batched: true
Location [not included in comparison]/{warehouse_dir}/catalog_sales]
PushedFilters: [IsNotNull(cs_sold_date_sk)]
ReadSchema: struct<cs_sold_date_sk:int,cs_ship_customer_sk:int>

(26) ColumnarToRow [codegen id : 9]
Input [2]: [cs_sold_date_sk#15, cs_ship_customer_sk#16]

(27) Filter [codegen id : 9]
Input [2]: [cs_sold_date_sk#15, cs_ship_customer_sk#16]
Condition : isnotnull(cs_sold_date_sk#15)

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

(29) BroadcastHashJoin [codegen id : 9]
Left keys [1]: [cs_sold_date_sk#15]
Right keys [1]: [d_date_sk#7]
Join condition: None

(30) Project [codegen id : 9]
Output [1]: [cs_ship_customer_sk#16 AS customsk#17]
Input [3]: [cs_sold_date_sk#15, cs_ship_customer_sk#16, d_date_sk#7]

(31) Union

(32) Exchange
Input [1]: [customsk#14]
Arguments: hashpartitioning(customsk#14, 5), true, [id=#18]

(33) Sort [codegen id : 10]
Input [1]: [customsk#14]
Arguments: [customsk#14 ASC NULLS FIRST], false, 0

(34) SortMergeJoin
Left keys [1]: [c_customer_sk#1]
Right keys [1]: [customsk#14]
Join condition: None

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

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

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

(38) 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>

(39) ColumnarToRow [codegen id : 13]
Input [2]: [ca_address_sk#20, ca_state#21]

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

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

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

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

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

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

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

(47) 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>

(48) ColumnarToRow [codegen id : 17]
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]

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

(50) 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), true, [id=#30]

(51) Sort [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]
Arguments: [cd_demo_sk#24 ASC NULLS FIRST], false, 0

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

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

(54) HashAggregate [codegen id : 19]
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(cast(cd_dep_count#27 as bigint)), partial_max(cd_dep_count#27), partial_sum(cast(cd_dep_count#27 as bigint)), partial_avg(cast(cd_dep_employed_count#28 as bigint)), partial_max(cd_dep_employed_count#28), partial_sum(cast(cd_dep_employed_count#28 as bigint)), partial_avg(cast(cd_dep_college_count#29 as bigint)), partial_max(cd_dep_college_count#29), partial_sum(cast(cd_dep_college_count#29 as bigint))]
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]

(55) 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), true, [id=#57]

(56) HashAggregate [codegen id : 20]
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(cast(cd_dep_count#27 as bigint)), max(cd_dep_count#27), sum(cast(cd_dep_count#27 as bigint)), avg(cast(cd_dep_employed_count#28 as bigint)), max(cd_dep_employed_count#28), sum(cast(cd_dep_employed_count#28 as bigint)), avg(cast(cd_dep_college_count#29 as bigint)), max(cd_dep_college_count#29), sum(cast(cd_dep_college_count#29 as bigint))]
Aggregate Attributes [10]: [count(1)#58, avg(cast(cd_dep_count#27 as bigint))#59, max(cd_dep_count#27)#60, sum(cast(cd_dep_count#27 as bigint))#61, avg(cast(cd_dep_employed_count#28 as bigint))#62, max(cd_dep_employed_count#28)#63, sum(cast(cd_dep_employed_count#28 as bigint))#64, avg(cast(cd_dep_college_count#29 as bigint))#65, max(cd_dep_college_count#29)#66, sum(cast(cd_dep_college_count#29 as bigint))#67]
Results [18]: [ca_state#21, cd_gender#25, cd_marital_status#26, cd_dep_count#27, count(1)#58 AS cnt1#68, avg(cast(cd_dep_count#27 as bigint))#59 AS avg(cd_dep_count)#69, max(cd_dep_count#27)#60 AS max(cd_dep_count)#70, sum(cast(cd_dep_count#27 as bigint))#61 AS sum(cd_dep_count)#71, cd_dep_employed_count#28, count(1)#58 AS cnt2#72, avg(cast(cd_dep_employed_count#28 as bigint))#62 AS avg(cd_dep_employed_count)#73, max(cd_dep_employed_count#28)#63 AS max(cd_dep_employed_count)#74, sum(cast(cd_dep_employed_count#28 as bigint))#64 AS sum(cd_dep_employed_count)#75, cd_dep_college_count#29, count(1)#58 AS cnt3#76, avg(cast(cd_dep_college_count#29 as bigint))#65 AS avg(cd_dep_college_count)#77, max(cd_dep_college_count#29)#66 AS max(cd_dep_college_count)#78, sum(cast(cd_dep_college_count#29 as bigint))#67 AS sum(cd_dep_college_count)#79]

(57) 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]

