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


(1) Scan parquet default.store_sales
Output [4]: [ss_item_sk#1, ss_store_sk#2, ss_sales_price#3, ss_sold_date_sk#4]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#4), (ss_sold_date_sk#4 >= 2451911), (ss_sold_date_sk#4 <= 2452275), dynamicpruningexpression(ss_sold_date_sk#4 IN dynamicpruning#5)]
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)>

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

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

(4) ReusedExchange [Reuses operator id: 43]
Output [1]: [d_date_sk#6]

(5) BroadcastHashJoin [codegen id : 2]
Left keys [1]: [ss_sold_date_sk#4]
Right keys [1]: [d_date_sk#6]
Join condition: None

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

(7) HashAggregate [codegen id : 2]
Input [3]: [ss_item_sk#1, ss_store_sk#2, ss_sales_price#3]
Keys [2]: [ss_store_sk#2, ss_item_sk#1]
Functions [1]: [partial_sum(UnscaledValue(ss_sales_price#3))]
Aggregate Attributes [1]: [sum#7]
Results [3]: [ss_store_sk#2, ss_item_sk#1, sum#8]

(8) Exchange
Input [3]: [ss_store_sk#2, ss_item_sk#1, sum#8]
Arguments: hashpartitioning(ss_store_sk#2, ss_item_sk#1, 5), ENSURE_REQUIREMENTS, [id=#9]

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

(10) Filter [codegen id : 7]
Input [3]: [ss_store_sk#2, ss_item_sk#1, revenue#11]
Condition : isnotnull(revenue#11)

(11) Scan parquet default.store_sales
Output [4]: [ss_item_sk#12, ss_store_sk#13, ss_sales_price#14, ss_sold_date_sk#15]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#15), (ss_sold_date_sk#15 >= 2451911), (ss_sold_date_sk#15 <= 2452275), dynamicpruningexpression(ss_sold_date_sk#15 IN dynamicpruning#5)]
PushedFilters: [IsNotNull(ss_store_sk)]
ReadSchema: struct<ss_item_sk:int,ss_store_sk:int,ss_sales_price:decimal(7,2)>

(12) ColumnarToRow [codegen id : 4]
Input [4]: [ss_item_sk#12, ss_store_sk#13, ss_sales_price#14, ss_sold_date_sk#15]

(13) Filter [codegen id : 4]
Input [4]: [ss_item_sk#12, ss_store_sk#13, ss_sales_price#14, ss_sold_date_sk#15]
Condition : isnotnull(ss_store_sk#13)

(14) ReusedExchange [Reuses operator id: 43]
Output [1]: [d_date_sk#16]

(15) BroadcastHashJoin [codegen id : 4]
Left keys [1]: [ss_sold_date_sk#15]
Right keys [1]: [d_date_sk#16]
Join condition: None

(16) Project [codegen id : 4]
Output [3]: [ss_item_sk#12, ss_store_sk#13, ss_sales_price#14]
Input [5]: [ss_item_sk#12, ss_store_sk#13, ss_sales_price#14, ss_sold_date_sk#15, d_date_sk#16]

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

(18) Exchange
Input [3]: [ss_store_sk#13, ss_item_sk#12, sum#18]
Arguments: hashpartitioning(ss_store_sk#13, ss_item_sk#12, 5), ENSURE_REQUIREMENTS, [id=#19]

(19) HashAggregate [codegen id : 5]
Input [3]: [ss_store_sk#13, ss_item_sk#12, sum#18]
Keys [2]: [ss_store_sk#13, ss_item_sk#12]
Functions [1]: [sum(UnscaledValue(ss_sales_price#14))]
Aggregate Attributes [1]: [sum(UnscaledValue(ss_sales_price#14))#20]
Results [2]: [ss_store_sk#13, MakeDecimal(sum(UnscaledValue(ss_sales_price#14))#20,17,2) AS revenue#21]

(20) HashAggregate [codegen id : 5]
Input [2]: [ss_store_sk#13, revenue#21]
Keys [1]: [ss_store_sk#13]
Functions [1]: [partial_avg(revenue#21)]
Aggregate Attributes [2]: [sum#22, count#23]
Results [3]: [ss_store_sk#13, sum#24, count#25]

(21) Exchange
Input [3]: [ss_store_sk#13, sum#24, count#25]
Arguments: hashpartitioning(ss_store_sk#13, 5), ENSURE_REQUIREMENTS, [id=#26]

(22) HashAggregate [codegen id : 6]
Input [3]: [ss_store_sk#13, sum#24, count#25]
Keys [1]: [ss_store_sk#13]
Functions [1]: [avg(revenue#21)]
Aggregate Attributes [1]: [avg(revenue#21)#27]
Results [2]: [ss_store_sk#13, avg(revenue#21)#27 AS ave#28]

(23) BroadcastExchange
Input [2]: [ss_store_sk#13, ave#28]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [id=#29]

(24) BroadcastHashJoin [codegen id : 7]
Left keys [1]: [ss_store_sk#2]
Right keys [1]: [ss_store_sk#13]
Join condition: (cast(revenue#11 as decimal(23,7)) <= CheckOverflow((0.100000 * promote_precision(ave#28)), DecimalType(23,7), true))

(25) Project [codegen id : 7]
Output [3]: [ss_store_sk#2, ss_item_sk#1, revenue#11]
Input [5]: [ss_store_sk#2, ss_item_sk#1, revenue#11, ss_store_sk#13, ave#28]

(26) BroadcastExchange
Input [3]: [ss_store_sk#2, ss_item_sk#1, revenue#11]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [id=#30]

(27) Scan parquet default.store
Output [2]: [s_store_sk#31, s_store_name#32]
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>

(28) ColumnarToRow
Input [2]: [s_store_sk#31, s_store_name#32]

(29) Filter
Input [2]: [s_store_sk#31, s_store_name#32]
Condition : isnotnull(s_store_sk#31)

(30) BroadcastHashJoin [codegen id : 8]
Left keys [1]: [ss_store_sk#2]
Right keys [1]: [s_store_sk#31]
Join condition: None

(31) Project [codegen id : 8]
Output [3]: [ss_item_sk#1, revenue#11, s_store_name#32]
Input [5]: [ss_store_sk#2, ss_item_sk#1, revenue#11, s_store_sk#31, s_store_name#32]

(32) BroadcastExchange
Input [3]: [ss_item_sk#1, revenue#11, s_store_name#32]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [id=#33]

(33) Scan parquet default.item
Output [5]: [i_item_sk#34, i_item_desc#35, i_current_price#36, i_wholesale_cost#37, i_brand#38]
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>

(34) ColumnarToRow
Input [5]: [i_item_sk#34, i_item_desc#35, i_current_price#36, i_wholesale_cost#37, i_brand#38]

(35) Filter
Input [5]: [i_item_sk#34, i_item_desc#35, i_current_price#36, i_wholesale_cost#37, i_brand#38]
Condition : isnotnull(i_item_sk#34)

(36) BroadcastHashJoin [codegen id : 9]
Left keys [1]: [ss_item_sk#1]
Right keys [1]: [i_item_sk#34]
Join condition: None

(37) Project [codegen id : 9]
Output [6]: [s_store_name#32, i_item_desc#35, revenue#11, i_current_price#36, i_wholesale_cost#37, i_brand#38]
Input [8]: [ss_item_sk#1, revenue#11, s_store_name#32, i_item_sk#34, i_item_desc#35, i_current_price#36, i_wholesale_cost#37, i_brand#38]

(38) TakeOrderedAndProject
Input [6]: [s_store_name#32, i_item_desc#35, revenue#11, i_current_price#36, i_wholesale_cost#37, i_brand#38]
Arguments: 100, [s_store_name#32 ASC NULLS FIRST, i_item_desc#35 ASC NULLS FIRST], [s_store_name#32, i_item_desc#35, revenue#11, i_current_price#36, i_wholesale_cost#37, i_brand#38]

===== Subqueries =====

Subquery:1 Hosting operator id = 1 Hosting Expression = ss_sold_date_sk#4 IN dynamicpruning#5
BroadcastExchange (43)
+- * Project (42)
   +- * Filter (41)
      +- * ColumnarToRow (40)
         +- Scan parquet default.date_dim (39)


(39) Scan parquet default.date_dim
Output [2]: [d_date_sk#6, d_month_seq#39]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_month_seq), GreaterThanOrEqual(d_month_seq,1212), LessThanOrEqual(d_month_seq,1223), GreaterThanOrEqual(d_date_sk,2451911), LessThanOrEqual(d_date_sk,2452275), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_month_seq:int>

(40) ColumnarToRow [codegen id : 1]
Input [2]: [d_date_sk#6, d_month_seq#39]

(41) Filter [codegen id : 1]
Input [2]: [d_date_sk#6, d_month_seq#39]
Condition : (((((isnotnull(d_month_seq#39) AND (d_month_seq#39 >= 1212)) AND (d_month_seq#39 <= 1223)) AND (d_date_sk#6 >= 2451911)) AND (d_date_sk#6 <= 2452275)) AND isnotnull(d_date_sk#6))

(42) Project [codegen id : 1]
Output [1]: [d_date_sk#6]
Input [2]: [d_date_sk#6, d_month_seq#39]

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

Subquery:2 Hosting operator id = 11 Hosting Expression = ss_sold_date_sk#15 IN dynamicpruning#5


