== Physical Plan ==
TakeOrderedAndProject (32)
+- * HashAggregate (31)
   +- Exchange (30)
      +- * HashAggregate (29)
         +- * Project (28)
            +- * SortMergeJoin Inner (27)
               :- * Sort (12)
               :  +- Exchange (11)
               :     +- * Project (10)
               :        +- * BroadcastHashJoin Inner BuildRight (9)
               :           :- * Filter (3)
               :           :  +- * ColumnarToRow (2)
               :           :     +- Scan parquet default.catalog_sales (1)
               :           +- BroadcastExchange (8)
               :              +- * Project (7)
               :                 +- * Filter (6)
               :                    +- * ColumnarToRow (5)
               :                       +- Scan parquet default.date_dim (4)
               +- * Sort (26)
                  +- Exchange (25)
                     +- * Project (24)
                        +- * SortMergeJoin Inner (23)
                           :- * Sort (17)
                           :  +- Exchange (16)
                           :     +- * Filter (15)
                           :        +- * ColumnarToRow (14)
                           :           +- Scan parquet default.customer (13)
                           +- * Sort (22)
                              +- Exchange (21)
                                 +- * Filter (20)
                                    +- * ColumnarToRow (19)
                                       +- Scan parquet default.customer_address (18)


(1) Scan parquet default.catalog_sales
Output [3]: [cs_sold_date_sk#1, cs_bill_customer_sk#2, cs_sales_price#3]
Batched: true
Location [not included in comparison]/{warehouse_dir}/catalog_sales]
PushedFilters: [IsNotNull(cs_bill_customer_sk), IsNotNull(cs_sold_date_sk)]
ReadSchema: struct<cs_sold_date_sk:int,cs_bill_customer_sk:int,cs_sales_price:decimal(7,2)>

(2) ColumnarToRow [codegen id : 2]
Input [3]: [cs_sold_date_sk#1, cs_bill_customer_sk#2, cs_sales_price#3]

(3) Filter [codegen id : 2]
Input [3]: [cs_sold_date_sk#1, cs_bill_customer_sk#2, cs_sales_price#3]
Condition : (isnotnull(cs_bill_customer_sk#2) AND isnotnull(cs_sold_date_sk#1))

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

(5) ColumnarToRow [codegen id : 1]
Input [3]: [d_date_sk#4, d_year#5, d_qoy#6]

(6) Filter [codegen id : 1]
Input [3]: [d_date_sk#4, d_year#5, d_qoy#6]
Condition : ((((isnotnull(d_qoy#6) AND isnotnull(d_year#5)) AND (d_qoy#6 = 2)) AND (d_year#5 = 2001)) AND isnotnull(d_date_sk#4))

(7) Project [codegen id : 1]
Output [1]: [d_date_sk#4]
Input [3]: [d_date_sk#4, d_year#5, d_qoy#6]

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

(9) BroadcastHashJoin [codegen id : 2]
Left keys [1]: [cs_sold_date_sk#1]
Right keys [1]: [d_date_sk#4]
Join condition: None

(10) Project [codegen id : 2]
Output [2]: [cs_bill_customer_sk#2, cs_sales_price#3]
Input [4]: [cs_sold_date_sk#1, cs_bill_customer_sk#2, cs_sales_price#3, d_date_sk#4]

(11) Exchange
Input [2]: [cs_bill_customer_sk#2, cs_sales_price#3]
Arguments: hashpartitioning(cs_bill_customer_sk#2, 5), true, [id=#8]

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

(13) Scan parquet default.customer
Output [2]: [c_customer_sk#9, c_current_addr_sk#10]
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_current_addr_sk:int>

(14) ColumnarToRow [codegen id : 4]
Input [2]: [c_customer_sk#9, c_current_addr_sk#10]

(15) Filter [codegen id : 4]
Input [2]: [c_customer_sk#9, c_current_addr_sk#10]
Condition : (isnotnull(c_customer_sk#9) AND isnotnull(c_current_addr_sk#10))

(16) Exchange
Input [2]: [c_customer_sk#9, c_current_addr_sk#10]
Arguments: hashpartitioning(c_current_addr_sk#10, 5), true, [id=#11]

(17) Sort [codegen id : 5]
Input [2]: [c_customer_sk#9, c_current_addr_sk#10]
Arguments: [c_current_addr_sk#10 ASC NULLS FIRST], false, 0

(18) Scan parquet default.customer_address
Output [3]: [ca_address_sk#12, ca_state#13, ca_zip#14]
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,ca_zip:string>

(19) ColumnarToRow [codegen id : 6]
Input [3]: [ca_address_sk#12, ca_state#13, ca_zip#14]

(20) Filter [codegen id : 6]
Input [3]: [ca_address_sk#12, ca_state#13, ca_zip#14]
Condition : isnotnull(ca_address_sk#12)

(21) Exchange
Input [3]: [ca_address_sk#12, ca_state#13, ca_zip#14]
Arguments: hashpartitioning(ca_address_sk#12, 5), true, [id=#15]

(22) Sort [codegen id : 7]
Input [3]: [ca_address_sk#12, ca_state#13, ca_zip#14]
Arguments: [ca_address_sk#12 ASC NULLS FIRST], false, 0

(23) SortMergeJoin [codegen id : 8]
Left keys [1]: [c_current_addr_sk#10]
Right keys [1]: [ca_address_sk#12]
Join condition: None

(24) Project [codegen id : 8]
Output [3]: [c_customer_sk#9, ca_state#13, ca_zip#14]
Input [5]: [c_customer_sk#9, c_current_addr_sk#10, ca_address_sk#12, ca_state#13, ca_zip#14]

(25) Exchange
Input [3]: [c_customer_sk#9, ca_state#13, ca_zip#14]
Arguments: hashpartitioning(c_customer_sk#9, 5), true, [id=#16]

(26) Sort [codegen id : 9]
Input [3]: [c_customer_sk#9, ca_state#13, ca_zip#14]
Arguments: [c_customer_sk#9 ASC NULLS FIRST], false, 0

(27) SortMergeJoin [codegen id : 10]
Left keys [1]: [cs_bill_customer_sk#2]
Right keys [1]: [c_customer_sk#9]
Join condition: ((substr(ca_zip#14, 1, 5) IN (85669,86197,88274,83405,86475,85392,85460,80348,81792) OR ca_state#13 IN (CA,WA,GA)) OR (cs_sales_price#3 > 500.00))

(28) Project [codegen id : 10]
Output [2]: [cs_sales_price#3, ca_zip#14]
Input [5]: [cs_bill_customer_sk#2, cs_sales_price#3, c_customer_sk#9, ca_state#13, ca_zip#14]

(29) HashAggregate [codegen id : 10]
Input [2]: [cs_sales_price#3, ca_zip#14]
Keys [1]: [ca_zip#14]
Functions [1]: [partial_sum(UnscaledValue(cs_sales_price#3))]
Aggregate Attributes [1]: [sum#17]
Results [2]: [ca_zip#14, sum#18]

(30) Exchange
Input [2]: [ca_zip#14, sum#18]
Arguments: hashpartitioning(ca_zip#14, 5), true, [id=#19]

(31) HashAggregate [codegen id : 11]
Input [2]: [ca_zip#14, sum#18]
Keys [1]: [ca_zip#14]
Functions [1]: [sum(UnscaledValue(cs_sales_price#3))]
Aggregate Attributes [1]: [sum(UnscaledValue(cs_sales_price#3))#20]
Results [2]: [ca_zip#14, MakeDecimal(sum(UnscaledValue(cs_sales_price#3))#20,17,2) AS sum(cs_sales_price)#21]

(32) TakeOrderedAndProject
Input [2]: [ca_zip#14, sum(cs_sales_price)#21]
Arguments: 100, [ca_zip#14 ASC NULLS FIRST], [ca_zip#14, sum(cs_sales_price)#21]

