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


(1) Scan parquet spark_catalog.default.web_sales
Output [4]: [ws_item_sk#2, ws_bill_customer_sk#3, ws_sales_price#4, ws_sold_date_sk#5]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ws_sold_date_sk#5), dynamicpruningexpression(ws_sold_date_sk#5 IN dynamicpruning#6)]
PushedFilters: [IsNotNull(ws_bill_customer_sk), IsNotNull(ws_item_sk)]
ReadSchema: struct<ws_item_sk:int,ws_bill_customer_sk:int,ws_sales_price:decimal(7,2)>

(2) ColumnarToRow [codegen id : 3]
Input [4]: [ws_item_sk#2, ws_bill_customer_sk#3, ws_sales_price#4, ws_sold_date_sk#5]

(3) Filter [codegen id : 3]
Input [4]: [ws_item_sk#2, ws_bill_customer_sk#3, ws_sales_price#4, ws_sold_date_sk#5]
Condition : (isnotnull(ws_bill_customer_sk#3) AND isnotnull(ws_item_sk#2))

(4) ReusedExchange [Reuses operator id: 47]
Output [1]: [d_date_sk#7]

(5) BroadcastHashJoin [codegen id : 3]
Left keys [1]: [ws_sold_date_sk#5]
Right keys [1]: [d_date_sk#7]
Join type: Inner
Join condition: None

(6) Project [codegen id : 3]
Output [3]: [ws_item_sk#2, ws_bill_customer_sk#3, ws_sales_price#4]
Input [5]: [ws_item_sk#2, ws_bill_customer_sk#3, ws_sales_price#4, ws_sold_date_sk#5, d_date_sk#7]

(7) Scan parquet spark_catalog.default.item
Output [2]: [i_item_sk#8, i_item_id#9]
Batched: true
Location [not included in comparison]/{warehouse_dir}/item]
PushedFilters: [IsNotNull(i_item_sk)]
ReadSchema: struct<i_item_sk:int,i_item_id:string>

(8) ColumnarToRow [codegen id : 2]
Input [2]: [i_item_sk#8, i_item_id#9]

(9) Filter [codegen id : 2]
Input [2]: [i_item_sk#8, i_item_id#9]
Condition : isnotnull(i_item_sk#8)

(10) BroadcastExchange
Input [2]: [i_item_sk#8, i_item_id#9]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=1]

(11) BroadcastHashJoin [codegen id : 3]
Left keys [1]: [ws_item_sk#2]
Right keys [1]: [i_item_sk#8]
Join type: Inner
Join condition: None

(12) Project [codegen id : 3]
Output [3]: [ws_bill_customer_sk#3, ws_sales_price#4, i_item_id#9]
Input [5]: [ws_item_sk#2, ws_bill_customer_sk#3, ws_sales_price#4, i_item_sk#8, i_item_id#9]

(13) Exchange
Input [3]: [ws_bill_customer_sk#3, ws_sales_price#4, i_item_id#9]
Arguments: hashpartitioning(ws_bill_customer_sk#3, 5), ENSURE_REQUIREMENTS, [plan_id=2]

(14) Sort [codegen id : 4]
Input [3]: [ws_bill_customer_sk#3, ws_sales_price#4, i_item_id#9]
Arguments: [ws_bill_customer_sk#3 ASC NULLS FIRST], false, 0

(15) Scan parquet spark_catalog.default.customer
Output [2]: [c_customer_sk#10, c_current_addr_sk#11]
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>

(16) ColumnarToRow [codegen id : 5]
Input [2]: [c_customer_sk#10, c_current_addr_sk#11]

(17) Filter [codegen id : 5]
Input [2]: [c_customer_sk#10, c_current_addr_sk#11]
Condition : (isnotnull(c_customer_sk#10) AND isnotnull(c_current_addr_sk#11))

(18) Exchange
Input [2]: [c_customer_sk#10, c_current_addr_sk#11]
Arguments: hashpartitioning(c_current_addr_sk#11, 5), ENSURE_REQUIREMENTS, [plan_id=3]

(19) Sort [codegen id : 6]
Input [2]: [c_customer_sk#10, c_current_addr_sk#11]
Arguments: [c_current_addr_sk#11 ASC NULLS FIRST], false, 0

(20) Scan parquet spark_catalog.default.customer_address
Output [3]: [ca_address_sk#12, ca_city#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_city:string,ca_zip:string>

(21) ColumnarToRow [codegen id : 7]
Input [3]: [ca_address_sk#12, ca_city#13, ca_zip#14]

(22) Filter [codegen id : 7]
Input [3]: [ca_address_sk#12, ca_city#13, ca_zip#14]
Condition : isnotnull(ca_address_sk#12)

(23) Exchange
Input [3]: [ca_address_sk#12, ca_city#13, ca_zip#14]
Arguments: hashpartitioning(ca_address_sk#12, 5), ENSURE_REQUIREMENTS, [plan_id=4]

(24) Sort [codegen id : 8]
Input [3]: [ca_address_sk#12, ca_city#13, ca_zip#14]
Arguments: [ca_address_sk#12 ASC NULLS FIRST], false, 0

(25) SortMergeJoin [codegen id : 9]
Left keys [1]: [c_current_addr_sk#11]
Right keys [1]: [ca_address_sk#12]
Join type: Inner
Join condition: None

(26) Project [codegen id : 9]
Output [3]: [c_customer_sk#10, ca_city#13, ca_zip#14]
Input [5]: [c_customer_sk#10, c_current_addr_sk#11, ca_address_sk#12, ca_city#13, ca_zip#14]

(27) Exchange
Input [3]: [c_customer_sk#10, ca_city#13, ca_zip#14]
Arguments: hashpartitioning(c_customer_sk#10, 5), ENSURE_REQUIREMENTS, [plan_id=5]

(28) Sort [codegen id : 10]
Input [3]: [c_customer_sk#10, ca_city#13, ca_zip#14]
Arguments: [c_customer_sk#10 ASC NULLS FIRST], false, 0

(29) SortMergeJoin [codegen id : 12]
Left keys [1]: [ws_bill_customer_sk#3]
Right keys [1]: [c_customer_sk#10]
Join type: Inner
Join condition: None

(30) Project [codegen id : 12]
Output [4]: [ws_sales_price#4, ca_city#13, ca_zip#14, i_item_id#9]
Input [6]: [ws_bill_customer_sk#3, ws_sales_price#4, i_item_id#9, c_customer_sk#10, ca_city#13, ca_zip#14]

(31) Scan parquet spark_catalog.default.item
Output [2]: [i_item_sk#15, i_item_id#16]
Batched: true
Location [not included in comparison]/{warehouse_dir}/item]
PushedFilters: [In(i_item_sk, [11,13,17,19,2,23,29,3,5,7])]
ReadSchema: struct<i_item_sk:int,i_item_id:string>

(32) ColumnarToRow [codegen id : 11]
Input [2]: [i_item_sk#15, i_item_id#16]

(33) Filter [codegen id : 11]
Input [2]: [i_item_sk#15, i_item_id#16]
Condition : i_item_sk#15 IN (2,3,5,7,11,13,17,19,23,29)

(34) Project [codegen id : 11]
Output [1]: [i_item_id#16]
Input [2]: [i_item_sk#15, i_item_id#16]

(35) BroadcastExchange
Input [1]: [i_item_id#16]
Arguments: HashedRelationBroadcastMode(List(input[0, string, true]),false), [plan_id=6]

(36) BroadcastHashJoin [codegen id : 12]
Left keys [1]: [i_item_id#9]
Right keys [1]: [i_item_id#16]
Join type: ExistenceJoin(exists#1)
Join condition: None

(37) Filter [codegen id : 12]
Input [5]: [ws_sales_price#4, ca_city#13, ca_zip#14, i_item_id#9, exists#1]
Condition : (substr(ca_zip#14, 1, 5) IN (85669,86197,88274,83405,86475,85392,85460,80348,81792) OR exists#1)

(38) Project [codegen id : 12]
Output [3]: [ws_sales_price#4, ca_city#13, ca_zip#14]
Input [5]: [ws_sales_price#4, ca_city#13, ca_zip#14, i_item_id#9, exists#1]

(39) HashAggregate [codegen id : 12]
Input [3]: [ws_sales_price#4, ca_city#13, ca_zip#14]
Keys [2]: [ca_zip#14, ca_city#13]
Functions [1]: [partial_sum(UnscaledValue(ws_sales_price#4))]
Aggregate Attributes [1]: [sum#17]
Results [3]: [ca_zip#14, ca_city#13, sum#18]

(40) Exchange
Input [3]: [ca_zip#14, ca_city#13, sum#18]
Arguments: hashpartitioning(ca_zip#14, ca_city#13, 5), ENSURE_REQUIREMENTS, [plan_id=7]

(41) HashAggregate [codegen id : 13]
Input [3]: [ca_zip#14, ca_city#13, sum#18]
Keys [2]: [ca_zip#14, ca_city#13]
Functions [1]: [sum(UnscaledValue(ws_sales_price#4))]
Aggregate Attributes [1]: [sum(UnscaledValue(ws_sales_price#4))#19]
Results [3]: [ca_zip#14, ca_city#13, MakeDecimal(sum(UnscaledValue(ws_sales_price#4))#19,17,2) AS sum(ws_sales_price)#20]

(42) TakeOrderedAndProject
Input [3]: [ca_zip#14, ca_city#13, sum(ws_sales_price)#20]
Arguments: 100, [ca_zip#14 ASC NULLS FIRST, ca_city#13 ASC NULLS FIRST], [ca_zip#14, ca_city#13, sum(ws_sales_price)#20]

===== Subqueries =====

Subquery:1 Hosting operator id = 1 Hosting Expression = ws_sold_date_sk#5 IN dynamicpruning#6
BroadcastExchange (47)
+- * Project (46)
   +- * Filter (45)
      +- * ColumnarToRow (44)
         +- Scan parquet spark_catalog.default.date_dim (43)


(43) Scan parquet spark_catalog.default.date_dim
Output [3]: [d_date_sk#7, d_year#21, d_qoy#22]
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>

(44) ColumnarToRow [codegen id : 1]
Input [3]: [d_date_sk#7, d_year#21, d_qoy#22]

(45) Filter [codegen id : 1]
Input [3]: [d_date_sk#7, d_year#21, d_qoy#22]
Condition : ((((isnotnull(d_qoy#22) AND isnotnull(d_year#21)) AND (d_qoy#22 = 2)) AND (d_year#21 = 2001)) AND isnotnull(d_date_sk#7))

(46) Project [codegen id : 1]
Output [1]: [d_date_sk#7]
Input [3]: [d_date_sk#7, d_year#21, d_qoy#22]

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


