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


(1) Scan parquet spark_catalog.default.inventory
Output [4]: [inv_item_sk#1, inv_warehouse_sk#2, inv_quantity_on_hand#3, inv_date_sk#4]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(inv_date_sk#4)]
PushedFilters: [IsNotNull(inv_warehouse_sk), IsNotNull(inv_item_sk)]
ReadSchema: struct<inv_item_sk:int,inv_warehouse_sk:int,inv_quantity_on_hand:int>

(2) ColumnarToRow [codegen id : 4]
Input [4]: [inv_item_sk#1, inv_warehouse_sk#2, inv_quantity_on_hand#3, inv_date_sk#4]

(3) Filter [codegen id : 4]
Input [4]: [inv_item_sk#1, inv_warehouse_sk#2, inv_quantity_on_hand#3, inv_date_sk#4]
Condition : (isnotnull(inv_warehouse_sk#2) AND isnotnull(inv_item_sk#1))

(4) Scan parquet spark_catalog.default.warehouse
Output [2]: [w_warehouse_sk#5, w_warehouse_name#6]
Batched: true
Location [not included in comparison]/{warehouse_dir}/warehouse]
PushedFilters: [IsNotNull(w_warehouse_sk)]
ReadSchema: struct<w_warehouse_sk:int,w_warehouse_name:string>

(5) ColumnarToRow [codegen id : 1]
Input [2]: [w_warehouse_sk#5, w_warehouse_name#6]

(6) Filter [codegen id : 1]
Input [2]: [w_warehouse_sk#5, w_warehouse_name#6]
Condition : isnotnull(w_warehouse_sk#5)

(7) BroadcastExchange
Input [2]: [w_warehouse_sk#5, w_warehouse_name#6]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=1]

(8) BroadcastHashJoin [codegen id : 4]
Left keys [1]: [inv_warehouse_sk#2]
Right keys [1]: [w_warehouse_sk#5]
Join type: Inner
Join condition: None

(9) Project [codegen id : 4]
Output [4]: [inv_item_sk#1, inv_quantity_on_hand#3, inv_date_sk#4, w_warehouse_name#6]
Input [6]: [inv_item_sk#1, inv_warehouse_sk#2, inv_quantity_on_hand#3, inv_date_sk#4, w_warehouse_sk#5, w_warehouse_name#6]

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

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

(12) Filter [codegen id : 2]
Input [3]: [i_item_sk#7, i_item_id#8, i_current_price#9]
Condition : (((isnotnull(i_current_price#9) AND (i_current_price#9 >= 0.99)) AND (i_current_price#9 <= 1.49)) AND isnotnull(i_item_sk#7))

(13) Project [codegen id : 2]
Output [2]: [i_item_sk#7, i_item_id#8]
Input [3]: [i_item_sk#7, i_item_id#8, i_current_price#9]

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

(15) BroadcastHashJoin [codegen id : 4]
Left keys [1]: [inv_item_sk#1]
Right keys [1]: [i_item_sk#7]
Join type: Inner
Join condition: None

(16) Project [codegen id : 4]
Output [4]: [inv_quantity_on_hand#3, inv_date_sk#4, w_warehouse_name#6, i_item_id#8]
Input [6]: [inv_item_sk#1, inv_quantity_on_hand#3, inv_date_sk#4, w_warehouse_name#6, i_item_sk#7, i_item_id#8]

(17) Scan parquet spark_catalog.default.date_dim
Output [2]: [d_date_sk#10, d_date#11]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_date), GreaterThanOrEqual(d_date,2000-02-10), LessThanOrEqual(d_date,2000-04-10), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_date:date>

(18) ColumnarToRow [codegen id : 3]
Input [2]: [d_date_sk#10, d_date#11]

(19) Filter [codegen id : 3]
Input [2]: [d_date_sk#10, d_date#11]
Condition : (((isnotnull(d_date#11) AND (d_date#11 >= 2000-02-10)) AND (d_date#11 <= 2000-04-10)) AND isnotnull(d_date_sk#10))

(20) BroadcastExchange
Input [2]: [d_date_sk#10, d_date#11]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=3]

(21) BroadcastHashJoin [codegen id : 4]
Left keys [1]: [inv_date_sk#4]
Right keys [1]: [d_date_sk#10]
Join type: Inner
Join condition: None

(22) Project [codegen id : 4]
Output [4]: [inv_quantity_on_hand#3, w_warehouse_name#6, i_item_id#8, d_date#11]
Input [6]: [inv_quantity_on_hand#3, inv_date_sk#4, w_warehouse_name#6, i_item_id#8, d_date_sk#10, d_date#11]

(23) HashAggregate [codegen id : 4]
Input [4]: [inv_quantity_on_hand#3, w_warehouse_name#6, i_item_id#8, d_date#11]
Keys [2]: [w_warehouse_name#6, i_item_id#8]
Functions [2]: [partial_sum(CASE WHEN (d_date#11 < 2000-03-11) THEN inv_quantity_on_hand#3 ELSE 0 END), partial_sum(CASE WHEN (d_date#11 >= 2000-03-11) THEN inv_quantity_on_hand#3 ELSE 0 END)]
Aggregate Attributes [2]: [sum#12, sum#13]
Results [4]: [w_warehouse_name#6, i_item_id#8, sum#14, sum#15]

(24) Exchange
Input [4]: [w_warehouse_name#6, i_item_id#8, sum#14, sum#15]
Arguments: hashpartitioning(w_warehouse_name#6, i_item_id#8, 5), ENSURE_REQUIREMENTS, [plan_id=4]

(25) HashAggregate [codegen id : 5]
Input [4]: [w_warehouse_name#6, i_item_id#8, sum#14, sum#15]
Keys [2]: [w_warehouse_name#6, i_item_id#8]
Functions [2]: [sum(CASE WHEN (d_date#11 < 2000-03-11) THEN inv_quantity_on_hand#3 ELSE 0 END), sum(CASE WHEN (d_date#11 >= 2000-03-11) THEN inv_quantity_on_hand#3 ELSE 0 END)]
Aggregate Attributes [2]: [sum(CASE WHEN (d_date#11 < 2000-03-11) THEN inv_quantity_on_hand#3 ELSE 0 END)#16, sum(CASE WHEN (d_date#11 >= 2000-03-11) THEN inv_quantity_on_hand#3 ELSE 0 END)#17]
Results [4]: [w_warehouse_name#6, i_item_id#8, sum(CASE WHEN (d_date#11 < 2000-03-11) THEN inv_quantity_on_hand#3 ELSE 0 END)#16 AS inv_before#18, sum(CASE WHEN (d_date#11 >= 2000-03-11) THEN inv_quantity_on_hand#3 ELSE 0 END)#17 AS inv_after#19]

(26) Filter [codegen id : 5]
Input [4]: [w_warehouse_name#6, i_item_id#8, inv_before#18, inv_after#19]
Condition : (CASE WHEN (inv_before#18 > 0) THEN ((cast(inv_after#19 as double) / cast(inv_before#18 as double)) >= 0.666667) END AND CASE WHEN (inv_before#18 > 0) THEN ((cast(inv_after#19 as double) / cast(inv_before#18 as double)) <= 1.5) END)

(27) TakeOrderedAndProject
Input [4]: [w_warehouse_name#6, i_item_id#8, inv_before#18, inv_after#19]
Arguments: 100, [w_warehouse_name#6 ASC NULLS FIRST, i_item_id#8 ASC NULLS FIRST], [w_warehouse_name#6, i_item_id#8, inv_before#18, inv_after#19]

