== Physical Plan ==
* HashAggregate (29)
+- Exchange (28)
   +- * HashAggregate (27)
      +- * Project (26)
         +- * BroadcastHashJoin Inner BuildRight (25)
            :- * Project (23)
            :  +- * BroadcastHashJoin Inner BuildLeft (22)
            :     :- BroadcastExchange (18)
            :     :  +- * Project (17)
            :     :     +- * BroadcastHashJoin Inner BuildLeft (16)
            :     :        :- BroadcastExchange (5)
            :     :        :  +- * Project (4)
            :     :        :     +- * Filter (3)
            :     :        :        +- * ColumnarToRow (2)
            :     :        :           +- Scan parquet spark_catalog.default.item (1)
            :     :        +- * Filter (15)
            :     :           +- * HashAggregate (14)
            :     :              +- Exchange (13)
            :     :                 +- * HashAggregate (12)
            :     :                    +- * Project (11)
            :     :                       +- * BroadcastHashJoin Inner BuildRight (10)
            :     :                          :- * Filter (8)
            :     :                          :  +- * ColumnarToRow (7)
            :     :                          :     +- Scan parquet spark_catalog.default.web_sales (6)
            :     :                          +- ReusedExchange (9)
            :     +- * Filter (21)
            :        +- * ColumnarToRow (20)
            :           +- Scan parquet spark_catalog.default.web_sales (19)
            +- ReusedExchange (24)


(1) Scan parquet spark_catalog.default.item
Output [2]: [i_item_sk#1, i_manufact_id#2]
Batched: true
Location [not included in comparison]/{warehouse_dir}/item]
PushedFilters: [IsNotNull(i_manufact_id), EqualTo(i_manufact_id,350), IsNotNull(i_item_sk)]
ReadSchema: struct<i_item_sk:int,i_manufact_id:int>

(2) ColumnarToRow [codegen id : 1]
Input [2]: [i_item_sk#1, i_manufact_id#2]

(3) Filter [codegen id : 1]
Input [2]: [i_item_sk#1, i_manufact_id#2]
Condition : ((isnotnull(i_manufact_id#2) AND (i_manufact_id#2 = 350)) AND isnotnull(i_item_sk#1))

(4) Project [codegen id : 1]
Output [1]: [i_item_sk#1]
Input [2]: [i_item_sk#1, i_manufact_id#2]

(5) BroadcastExchange
Input [1]: [i_item_sk#1]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [plan_id=1]

(6) Scan parquet spark_catalog.default.web_sales
Output [3]: [ws_item_sk#3, ws_ext_discount_amt#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_item_sk)]
ReadSchema: struct<ws_item_sk:int,ws_ext_discount_amt:decimal(7,2)>

(7) ColumnarToRow [codegen id : 3]
Input [3]: [ws_item_sk#3, ws_ext_discount_amt#4, ws_sold_date_sk#5]

(8) Filter [codegen id : 3]
Input [3]: [ws_item_sk#3, ws_ext_discount_amt#4, ws_sold_date_sk#5]
Condition : (isnotnull(ws_item_sk#3) AND might_contain(Subquery scalar-subquery#7, [id=#2], xxhash64(ws_item_sk#3, 42)))

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

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

(11) Project [codegen id : 3]
Output [2]: [ws_item_sk#3, ws_ext_discount_amt#4]
Input [4]: [ws_item_sk#3, ws_ext_discount_amt#4, ws_sold_date_sk#5, d_date_sk#8]

(12) HashAggregate [codegen id : 3]
Input [2]: [ws_item_sk#3, ws_ext_discount_amt#4]
Keys [1]: [ws_item_sk#3]
Functions [1]: [partial_avg(UnscaledValue(ws_ext_discount_amt#4))]
Aggregate Attributes [2]: [sum#9, count#10]
Results [3]: [ws_item_sk#3, sum#11, count#12]

(13) Exchange
Input [3]: [ws_item_sk#3, sum#11, count#12]
Arguments: hashpartitioning(ws_item_sk#3, 5), ENSURE_REQUIREMENTS, [plan_id=3]

(14) HashAggregate
Input [3]: [ws_item_sk#3, sum#11, count#12]
Keys [1]: [ws_item_sk#3]
Functions [1]: [avg(UnscaledValue(ws_ext_discount_amt#4))]
Aggregate Attributes [1]: [avg(UnscaledValue(ws_ext_discount_amt#4))#13]
Results [2]: [(1.3 * cast((avg(UnscaledValue(ws_ext_discount_amt#4))#13 / 100.0) as decimal(11,6))) AS (1.3 * avg(ws_ext_discount_amt))#14, ws_item_sk#3]

(15) Filter
Input [2]: [(1.3 * avg(ws_ext_discount_amt))#14, ws_item_sk#3]
Condition : isnotnull((1.3 * avg(ws_ext_discount_amt))#14)

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

(17) Project [codegen id : 4]
Output [2]: [i_item_sk#1, (1.3 * avg(ws_ext_discount_amt))#14]
Input [3]: [i_item_sk#1, (1.3 * avg(ws_ext_discount_amt))#14, ws_item_sk#3]

(18) BroadcastExchange
Input [2]: [i_item_sk#1, (1.3 * avg(ws_ext_discount_amt))#14]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [plan_id=4]

(19) Scan parquet spark_catalog.default.web_sales
Output [3]: [ws_item_sk#15, ws_ext_discount_amt#16, ws_sold_date_sk#17]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ws_sold_date_sk#17), dynamicpruningexpression(ws_sold_date_sk#17 IN dynamicpruning#6)]
PushedFilters: [IsNotNull(ws_item_sk), IsNotNull(ws_ext_discount_amt)]
ReadSchema: struct<ws_item_sk:int,ws_ext_discount_amt:decimal(7,2)>

(20) ColumnarToRow
Input [3]: [ws_item_sk#15, ws_ext_discount_amt#16, ws_sold_date_sk#17]

(21) Filter
Input [3]: [ws_item_sk#15, ws_ext_discount_amt#16, ws_sold_date_sk#17]
Condition : (isnotnull(ws_item_sk#15) AND isnotnull(ws_ext_discount_amt#16))

(22) BroadcastHashJoin [codegen id : 6]
Left keys [1]: [i_item_sk#1]
Right keys [1]: [ws_item_sk#15]
Join type: Inner
Join condition: (cast(ws_ext_discount_amt#16 as decimal(14,7)) > (1.3 * avg(ws_ext_discount_amt))#14)

(23) Project [codegen id : 6]
Output [2]: [ws_ext_discount_amt#16, ws_sold_date_sk#17]
Input [5]: [i_item_sk#1, (1.3 * avg(ws_ext_discount_amt))#14, ws_item_sk#15, ws_ext_discount_amt#16, ws_sold_date_sk#17]

(24) ReusedExchange [Reuses operator id: 41]
Output [1]: [d_date_sk#18]

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

(26) Project [codegen id : 6]
Output [1]: [ws_ext_discount_amt#16]
Input [3]: [ws_ext_discount_amt#16, ws_sold_date_sk#17, d_date_sk#18]

(27) HashAggregate [codegen id : 6]
Input [1]: [ws_ext_discount_amt#16]
Keys: []
Functions [1]: [partial_sum(UnscaledValue(ws_ext_discount_amt#16))]
Aggregate Attributes [1]: [sum#19]
Results [1]: [sum#20]

(28) Exchange
Input [1]: [sum#20]
Arguments: SinglePartition, ENSURE_REQUIREMENTS, [plan_id=5]

(29) HashAggregate [codegen id : 7]
Input [1]: [sum#20]
Keys: []
Functions [1]: [sum(UnscaledValue(ws_ext_discount_amt#16))]
Aggregate Attributes [1]: [sum(UnscaledValue(ws_ext_discount_amt#16))#21]
Results [1]: [MakeDecimal(sum(UnscaledValue(ws_ext_discount_amt#16))#21,17,2) AS Excess Discount Amount #22]

===== Subqueries =====

Subquery:1 Hosting operator id = 8 Hosting Expression = Subquery scalar-subquery#7, [id=#2]
ObjectHashAggregate (36)
+- Exchange (35)
   +- ObjectHashAggregate (34)
      +- * Project (33)
         +- * Filter (32)
            +- * ColumnarToRow (31)
               +- Scan parquet spark_catalog.default.item (30)


(30) Scan parquet spark_catalog.default.item
Output [2]: [i_item_sk#1, i_manufact_id#2]
Batched: true
Location [not included in comparison]/{warehouse_dir}/item]
PushedFilters: [IsNotNull(i_manufact_id), EqualTo(i_manufact_id,350), IsNotNull(i_item_sk)]
ReadSchema: struct<i_item_sk:int,i_manufact_id:int>

(31) ColumnarToRow [codegen id : 1]
Input [2]: [i_item_sk#1, i_manufact_id#2]

(32) Filter [codegen id : 1]
Input [2]: [i_item_sk#1, i_manufact_id#2]
Condition : ((isnotnull(i_manufact_id#2) AND (i_manufact_id#2 = 350)) AND isnotnull(i_item_sk#1))

(33) Project [codegen id : 1]
Output [1]: [i_item_sk#1]
Input [2]: [i_item_sk#1, i_manufact_id#2]

(34) ObjectHashAggregate
Input [1]: [i_item_sk#1]
Keys: []
Functions [1]: [partial_bloom_filter_agg(xxhash64(i_item_sk#1, 42), 199, 5556, 0, 0)]
Aggregate Attributes [1]: [buf#23]
Results [1]: [buf#24]

(35) Exchange
Input [1]: [buf#24]
Arguments: SinglePartition, ENSURE_REQUIREMENTS, [plan_id=6]

(36) ObjectHashAggregate
Input [1]: [buf#24]
Keys: []
Functions [1]: [bloom_filter_agg(xxhash64(i_item_sk#1, 42), 199, 5556, 0, 0)]
Aggregate Attributes [1]: [bloom_filter_agg(xxhash64(i_item_sk#1, 42), 199, 5556, 0, 0)#25]
Results [1]: [bloom_filter_agg(xxhash64(i_item_sk#1, 42), 199, 5556, 0, 0)#25 AS bloomFilter#26]

Subquery:2 Hosting operator id = 6 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 [2]: [d_date_sk#8, d_date#27]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_date), GreaterThanOrEqual(d_date,2000-01-27), LessThanOrEqual(d_date,2000-04-26), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_date:date>

(38) ColumnarToRow [codegen id : 1]
Input [2]: [d_date_sk#8, d_date#27]

(39) Filter [codegen id : 1]
Input [2]: [d_date_sk#8, d_date#27]
Condition : (((isnotnull(d_date#27) AND (d_date#27 >= 2000-01-27)) AND (d_date#27 <= 2000-04-26)) AND isnotnull(d_date_sk#8))

(40) Project [codegen id : 1]
Output [1]: [d_date_sk#8]
Input [2]: [d_date_sk#8, d_date#27]

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

Subquery:3 Hosting operator id = 19 Hosting Expression = ws_sold_date_sk#17 IN dynamicpruning#6


