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


(1) Scan parquet spark_catalog.default.store
Output [2]: [s_store_sk#1, s_store_name#2]
Batched: true
Location [not included in comparison]/{warehouse_dir}/store]
PushedFilters: [IsNotNull(s_store_sk)]
ReadSchema: struct<s_store_sk:int,s_store_name:string>

(2) ColumnarToRow [codegen id : 9]
Input [2]: [s_store_sk#1, s_store_name#2]

(3) Filter [codegen id : 9]
Input [2]: [s_store_sk#1, s_store_name#2]
Condition : isnotnull(s_store_sk#1)

(4) Scan parquet spark_catalog.default.store_sales
Output [4]: [ss_item_sk#3, ss_store_sk#4, ss_sales_price#5, ss_sold_date_sk#6]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#6)]
PushedFilters: [IsNotNull(ss_store_sk), IsNotNull(ss_item_sk)]
ReadSchema: struct<ss_item_sk:int,ss_store_sk:int,ss_sales_price:decimal(7,2)>

(5) ColumnarToRow [codegen id : 2]
Input [4]: [ss_item_sk#3, ss_store_sk#4, ss_sales_price#5, ss_sold_date_sk#6]

(6) Filter [codegen id : 2]
Input [4]: [ss_item_sk#3, ss_store_sk#4, ss_sales_price#5, ss_sold_date_sk#6]
Condition : (isnotnull(ss_store_sk#4) AND isnotnull(ss_item_sk#3))

(7) Scan parquet spark_catalog.default.date_dim
Output [2]: [d_date_sk#7, d_month_seq#8]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_month_seq), GreaterThanOrEqual(d_month_seq,1176), LessThanOrEqual(d_month_seq,1187), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_month_seq:int>

(8) ColumnarToRow [codegen id : 1]
Input [2]: [d_date_sk#7, d_month_seq#8]

(9) Filter [codegen id : 1]
Input [2]: [d_date_sk#7, d_month_seq#8]
Condition : (((isnotnull(d_month_seq#8) AND (d_month_seq#8 >= 1176)) AND (d_month_seq#8 <= 1187)) AND isnotnull(d_date_sk#7))

(10) Project [codegen id : 1]
Output [1]: [d_date_sk#7]
Input [2]: [d_date_sk#7, d_month_seq#8]

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

(12) BroadcastHashJoin [codegen id : 2]
Left keys [1]: [ss_sold_date_sk#6]
Right keys [1]: [d_date_sk#7]
Join type: Inner
Join condition: None

(13) Project [codegen id : 2]
Output [3]: [ss_item_sk#3, ss_store_sk#4, ss_sales_price#5]
Input [5]: [ss_item_sk#3, ss_store_sk#4, ss_sales_price#5, ss_sold_date_sk#6, d_date_sk#7]

(14) HashAggregate [codegen id : 2]
Input [3]: [ss_item_sk#3, ss_store_sk#4, ss_sales_price#5]
Keys [2]: [ss_store_sk#4, ss_item_sk#3]
Functions [1]: [partial_sum(UnscaledValue(ss_sales_price#5))]
Aggregate Attributes [1]: [sum#9]
Results [3]: [ss_store_sk#4, ss_item_sk#3, sum#10]

(15) Exchange
Input [3]: [ss_store_sk#4, ss_item_sk#3, sum#10]
Arguments: hashpartitioning(ss_store_sk#4, ss_item_sk#3, 5), ENSURE_REQUIREMENTS, [plan_id=2]

(16) HashAggregate [codegen id : 3]
Input [3]: [ss_store_sk#4, ss_item_sk#3, sum#10]
Keys [2]: [ss_store_sk#4, ss_item_sk#3]
Functions [1]: [sum(UnscaledValue(ss_sales_price#5))]
Aggregate Attributes [1]: [sum(UnscaledValue(ss_sales_price#5))#11]
Results [3]: [ss_store_sk#4, ss_item_sk#3, MakeDecimal(sum(UnscaledValue(ss_sales_price#5))#11,17,2) AS revenue#12]

(17) Filter [codegen id : 3]
Input [3]: [ss_store_sk#4, ss_item_sk#3, revenue#12]
Condition : isnotnull(revenue#12)

(18) BroadcastExchange
Input [3]: [ss_store_sk#4, ss_item_sk#3, revenue#12]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [plan_id=3]

(19) BroadcastHashJoin [codegen id : 9]
Left keys [1]: [s_store_sk#1]
Right keys [1]: [ss_store_sk#4]
Join type: Inner
Join condition: None

(20) Project [codegen id : 9]
Output [4]: [s_store_name#2, ss_store_sk#4, ss_item_sk#3, revenue#12]
Input [5]: [s_store_sk#1, s_store_name#2, ss_store_sk#4, ss_item_sk#3, revenue#12]

(21) Scan parquet spark_catalog.default.item
Output [5]: [i_item_sk#13, i_item_desc#14, i_current_price#15, i_wholesale_cost#16, i_brand#17]
Batched: true
Location [not included in comparison]/{warehouse_dir}/item]
PushedFilters: [IsNotNull(i_item_sk)]
ReadSchema: struct<i_item_sk:int,i_item_desc:string,i_current_price:decimal(7,2),i_wholesale_cost:decimal(7,2),i_brand:string>

(22) ColumnarToRow [codegen id : 4]
Input [5]: [i_item_sk#13, i_item_desc#14, i_current_price#15, i_wholesale_cost#16, i_brand#17]

(23) Filter [codegen id : 4]
Input [5]: [i_item_sk#13, i_item_desc#14, i_current_price#15, i_wholesale_cost#16, i_brand#17]
Condition : isnotnull(i_item_sk#13)

(24) BroadcastExchange
Input [5]: [i_item_sk#13, i_item_desc#14, i_current_price#15, i_wholesale_cost#16, i_brand#17]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=4]

(25) BroadcastHashJoin [codegen id : 9]
Left keys [1]: [ss_item_sk#3]
Right keys [1]: [i_item_sk#13]
Join type: Inner
Join condition: None

(26) Project [codegen id : 9]
Output [7]: [s_store_name#2, ss_store_sk#4, revenue#12, i_item_desc#14, i_current_price#15, i_wholesale_cost#16, i_brand#17]
Input [9]: [s_store_name#2, ss_store_sk#4, ss_item_sk#3, revenue#12, i_item_sk#13, i_item_desc#14, i_current_price#15, i_wholesale_cost#16, i_brand#17]

(27) Scan parquet spark_catalog.default.store_sales
Output [4]: [ss_item_sk#18, ss_store_sk#19, ss_sales_price#20, ss_sold_date_sk#21]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#21)]
PushedFilters: [IsNotNull(ss_store_sk)]
ReadSchema: struct<ss_item_sk:int,ss_store_sk:int,ss_sales_price:decimal(7,2)>

(28) ColumnarToRow [codegen id : 6]
Input [4]: [ss_item_sk#18, ss_store_sk#19, ss_sales_price#20, ss_sold_date_sk#21]

(29) Filter [codegen id : 6]
Input [4]: [ss_item_sk#18, ss_store_sk#19, ss_sales_price#20, ss_sold_date_sk#21]
Condition : isnotnull(ss_store_sk#19)

(30) ReusedExchange [Reuses operator id: 11]
Output [1]: [d_date_sk#22]

(31) BroadcastHashJoin [codegen id : 6]
Left keys [1]: [ss_sold_date_sk#21]
Right keys [1]: [d_date_sk#22]
Join type: Inner
Join condition: None

(32) Project [codegen id : 6]
Output [3]: [ss_item_sk#18, ss_store_sk#19, ss_sales_price#20]
Input [5]: [ss_item_sk#18, ss_store_sk#19, ss_sales_price#20, ss_sold_date_sk#21, d_date_sk#22]

(33) HashAggregate [codegen id : 6]
Input [3]: [ss_item_sk#18, ss_store_sk#19, ss_sales_price#20]
Keys [2]: [ss_store_sk#19, ss_item_sk#18]
Functions [1]: [partial_sum(UnscaledValue(ss_sales_price#20))]
Aggregate Attributes [1]: [sum#23]
Results [3]: [ss_store_sk#19, ss_item_sk#18, sum#24]

(34) Exchange
Input [3]: [ss_store_sk#19, ss_item_sk#18, sum#24]
Arguments: hashpartitioning(ss_store_sk#19, ss_item_sk#18, 5), ENSURE_REQUIREMENTS, [plan_id=5]

(35) HashAggregate [codegen id : 7]
Input [3]: [ss_store_sk#19, ss_item_sk#18, sum#24]
Keys [2]: [ss_store_sk#19, ss_item_sk#18]
Functions [1]: [sum(UnscaledValue(ss_sales_price#20))]
Aggregate Attributes [1]: [sum(UnscaledValue(ss_sales_price#20))#25]
Results [2]: [ss_store_sk#19, MakeDecimal(sum(UnscaledValue(ss_sales_price#20))#25,17,2) AS revenue#26]

(36) HashAggregate [codegen id : 7]
Input [2]: [ss_store_sk#19, revenue#26]
Keys [1]: [ss_store_sk#19]
Functions [1]: [partial_avg(revenue#26)]
Aggregate Attributes [2]: [sum#27, count#28]
Results [3]: [ss_store_sk#19, sum#29, count#30]

(37) Exchange
Input [3]: [ss_store_sk#19, sum#29, count#30]
Arguments: hashpartitioning(ss_store_sk#19, 5), ENSURE_REQUIREMENTS, [plan_id=6]

(38) HashAggregate [codegen id : 8]
Input [3]: [ss_store_sk#19, sum#29, count#30]
Keys [1]: [ss_store_sk#19]
Functions [1]: [avg(revenue#26)]
Aggregate Attributes [1]: [avg(revenue#26)#31]
Results [2]: [ss_store_sk#19, avg(revenue#26)#31 AS ave#32]

(39) Filter [codegen id : 8]
Input [2]: [ss_store_sk#19, ave#32]
Condition : isnotnull(ave#32)

(40) BroadcastExchange
Input [2]: [ss_store_sk#19, ave#32]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [plan_id=7]

(41) BroadcastHashJoin [codegen id : 9]
Left keys [1]: [ss_store_sk#4]
Right keys [1]: [ss_store_sk#19]
Join type: Inner
Join condition: (cast(revenue#12 as decimal(23,7)) <= (0.1 * ave#32))

(42) Project [codegen id : 9]
Output [6]: [s_store_name#2, i_item_desc#14, revenue#12, i_current_price#15, i_wholesale_cost#16, i_brand#17]
Input [9]: [s_store_name#2, ss_store_sk#4, revenue#12, i_item_desc#14, i_current_price#15, i_wholesale_cost#16, i_brand#17, ss_store_sk#19, ave#32]

(43) TakeOrderedAndProject
Input [6]: [s_store_name#2, i_item_desc#14, revenue#12, i_current_price#15, i_wholesale_cost#16, i_brand#17]
Arguments: 100, [s_store_name#2 ASC NULLS FIRST, i_item_desc#14 ASC NULLS FIRST], [s_store_name#2, i_item_desc#14, revenue#12, i_current_price#15, i_wholesale_cost#16, i_brand#17]

