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


(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 : 6]
Input [4]: [ws_item_sk#2, ws_bill_customer_sk#3, ws_sales_price#4, ws_sold_date_sk#5]

(3) Filter [codegen id : 6]
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) Scan parquet spark_catalog.default.customer
Output [2]: [c_customer_sk#7, c_current_addr_sk#8]
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>

(5) ColumnarToRow [codegen id : 1]
Input [2]: [c_customer_sk#7, c_current_addr_sk#8]

(6) Filter [codegen id : 1]
Input [2]: [c_customer_sk#7, c_current_addr_sk#8]
Condition : (isnotnull(c_customer_sk#7) AND isnotnull(c_current_addr_sk#8))

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

(8) BroadcastHashJoin [codegen id : 6]
Left keys [1]: [ws_bill_customer_sk#3]
Right keys [1]: [c_customer_sk#7]
Join type: Inner
Join condition: None

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

(10) Scan parquet spark_catalog.default.customer_address
Output [3]: [ca_address_sk#9, ca_city#10, ca_zip#11]
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>

(11) ColumnarToRow [codegen id : 2]
Input [3]: [ca_address_sk#9, ca_city#10, ca_zip#11]

(12) Filter [codegen id : 2]
Input [3]: [ca_address_sk#9, ca_city#10, ca_zip#11]
Condition : isnotnull(ca_address_sk#9)

(13) BroadcastExchange
Input [3]: [ca_address_sk#9, ca_city#10, ca_zip#11]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=2]

(14) BroadcastHashJoin [codegen id : 6]
Left keys [1]: [c_current_addr_sk#8]
Right keys [1]: [ca_address_sk#9]
Join type: Inner
Join condition: None

(15) Project [codegen id : 6]
Output [5]: [ws_item_sk#2, ws_sales_price#4, ws_sold_date_sk#5, ca_city#10, ca_zip#11]
Input [7]: [ws_item_sk#2, ws_sales_price#4, ws_sold_date_sk#5, c_current_addr_sk#8, ca_address_sk#9, ca_city#10, ca_zip#11]

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

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

(18) Project [codegen id : 6]
Output [4]: [ws_item_sk#2, ws_sales_price#4, ca_city#10, ca_zip#11]
Input [6]: [ws_item_sk#2, ws_sales_price#4, ws_sold_date_sk#5, ca_city#10, ca_zip#11, d_date_sk#12]

(19) Scan parquet spark_catalog.default.item
Output [2]: [i_item_sk#13, i_item_id#14]
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>

(20) ColumnarToRow [codegen id : 4]
Input [2]: [i_item_sk#13, i_item_id#14]

(21) Filter [codegen id : 4]
Input [2]: [i_item_sk#13, i_item_id#14]
Condition : isnotnull(i_item_sk#13)

(22) BroadcastExchange
Input [2]: [i_item_sk#13, i_item_id#14]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=3]

(23) BroadcastHashJoin [codegen id : 6]
Left keys [1]: [ws_item_sk#2]
Right keys [1]: [i_item_sk#13]
Join type: Inner
Join condition: None

(24) Project [codegen id : 6]
Output [4]: [ws_sales_price#4, ca_city#10, ca_zip#11, i_item_id#14]
Input [6]: [ws_item_sk#2, ws_sales_price#4, ca_city#10, ca_zip#11, i_item_sk#13, i_item_id#14]

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

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

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

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

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

(30) BroadcastHashJoin [codegen id : 6]
Left keys [1]: [i_item_id#14]
Right keys [1]: [i_item_id#16]
Join type: ExistenceJoin(exists#1)
Join condition: None

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

(32) Project [codegen id : 6]
Output [3]: [ws_sales_price#4, ca_city#10, ca_zip#11]
Input [5]: [ws_sales_price#4, ca_city#10, ca_zip#11, i_item_id#14, exists#1]

(33) HashAggregate [codegen id : 6]
Input [3]: [ws_sales_price#4, ca_city#10, ca_zip#11]
Keys [2]: [ca_zip#11, ca_city#10]
Functions [1]: [partial_sum(UnscaledValue(ws_sales_price#4))]
Aggregate Attributes [1]: [sum#17]
Results [3]: [ca_zip#11, ca_city#10, sum#18]

(34) Exchange
Input [3]: [ca_zip#11, ca_city#10, sum#18]
Arguments: hashpartitioning(ca_zip#11, ca_city#10, 5), ENSURE_REQUIREMENTS, [plan_id=5]

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

(36) TakeOrderedAndProject
Input [3]: [ca_zip#11, ca_city#10, sum(ws_sales_price)#20]
Arguments: 100, [ca_zip#11 ASC NULLS FIRST, ca_city#10 ASC NULLS FIRST], [ca_zip#11, ca_city#10, sum(ws_sales_price)#20]

===== Subqueries =====

Subquery:1 Hosting operator id = 1 Hosting Expression = ws_sold_date_sk#5 IN dynamicpruning#6
BroadcastExchange (41)
+- * Project (40)
   +- * Filter (39)
      +- * ColumnarToRow (38)
         +- Scan parquet spark_catalog.default.date_dim (37)


(37) Scan parquet spark_catalog.default.date_dim
Output [3]: [d_date_sk#12, 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>

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

(39) Filter [codegen id : 1]
Input [3]: [d_date_sk#12, 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#12))

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

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


