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


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

(2) ColumnarToRow [codegen id : 5]
Input [8]: [ss_item_sk#1, ss_cdemo_sk#2, ss_promo_sk#3, ss_quantity#4, ss_list_price#5, ss_sales_price#6, ss_coupon_amt#7, ss_sold_date_sk#8]

(3) Filter [codegen id : 5]
Input [8]: [ss_item_sk#1, ss_cdemo_sk#2, ss_promo_sk#3, ss_quantity#4, ss_list_price#5, ss_sales_price#6, ss_coupon_amt#7, ss_sold_date_sk#8]
Condition : ((isnotnull(ss_cdemo_sk#2) AND isnotnull(ss_item_sk#1)) AND isnotnull(ss_promo_sk#3))

(4) Scan parquet spark_catalog.default.customer_demographics
Output [4]: [cd_demo_sk#9, cd_gender#10, cd_marital_status#11, cd_education_status#12]
Batched: true
Location [not included in comparison]/{warehouse_dir}/customer_demographics]
PushedFilters: [IsNotNull(cd_gender), IsNotNull(cd_marital_status), IsNotNull(cd_education_status), EqualTo(cd_gender,M), EqualTo(cd_marital_status,S), EqualTo(cd_education_status,College             ), IsNotNull(cd_demo_sk)]
ReadSchema: struct<cd_demo_sk:int,cd_gender:string,cd_marital_status:string,cd_education_status:string>

(5) ColumnarToRow [codegen id : 1]
Input [4]: [cd_demo_sk#9, cd_gender#10, cd_marital_status#11, cd_education_status#12]

(6) Filter [codegen id : 1]
Input [4]: [cd_demo_sk#9, cd_gender#10, cd_marital_status#11, cd_education_status#12]
Condition : ((((((isnotnull(cd_gender#10) AND isnotnull(cd_marital_status#11)) AND isnotnull(cd_education_status#12)) AND (cd_gender#10 = M)) AND (cd_marital_status#11 = S)) AND (cd_education_status#12 = College             )) AND isnotnull(cd_demo_sk#9))

(7) Project [codegen id : 1]
Output [1]: [cd_demo_sk#9]
Input [4]: [cd_demo_sk#9, cd_gender#10, cd_marital_status#11, cd_education_status#12]

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

(9) BroadcastHashJoin [codegen id : 5]
Left keys [1]: [ss_cdemo_sk#2]
Right keys [1]: [cd_demo_sk#9]
Join type: Inner
Join condition: None

(10) Project [codegen id : 5]
Output [7]: [ss_item_sk#1, ss_promo_sk#3, ss_quantity#4, ss_list_price#5, ss_sales_price#6, ss_coupon_amt#7, ss_sold_date_sk#8]
Input [9]: [ss_item_sk#1, ss_cdemo_sk#2, ss_promo_sk#3, ss_quantity#4, ss_list_price#5, ss_sales_price#6, ss_coupon_amt#7, ss_sold_date_sk#8, cd_demo_sk#9]

(11) Scan parquet spark_catalog.default.date_dim
Output [2]: [d_date_sk#13, d_year#14]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2000), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_year:int>

(12) ColumnarToRow [codegen id : 2]
Input [2]: [d_date_sk#13, d_year#14]

(13) Filter [codegen id : 2]
Input [2]: [d_date_sk#13, d_year#14]
Condition : ((isnotnull(d_year#14) AND (d_year#14 = 2000)) AND isnotnull(d_date_sk#13))

(14) Project [codegen id : 2]
Output [1]: [d_date_sk#13]
Input [2]: [d_date_sk#13, d_year#14]

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

(16) BroadcastHashJoin [codegen id : 5]
Left keys [1]: [ss_sold_date_sk#8]
Right keys [1]: [d_date_sk#13]
Join type: Inner
Join condition: None

(17) Project [codegen id : 5]
Output [6]: [ss_item_sk#1, ss_promo_sk#3, ss_quantity#4, ss_list_price#5, ss_sales_price#6, ss_coupon_amt#7]
Input [8]: [ss_item_sk#1, ss_promo_sk#3, ss_quantity#4, ss_list_price#5, ss_sales_price#6, ss_coupon_amt#7, ss_sold_date_sk#8, d_date_sk#13]

(18) 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: [IsNotNull(i_item_sk)]
ReadSchema: struct<i_item_sk:int,i_item_id:string>

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

(20) Filter [codegen id : 3]
Input [2]: [i_item_sk#15, i_item_id#16]
Condition : isnotnull(i_item_sk#15)

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

(22) BroadcastHashJoin [codegen id : 5]
Left keys [1]: [ss_item_sk#1]
Right keys [1]: [i_item_sk#15]
Join type: Inner
Join condition: None

(23) Project [codegen id : 5]
Output [6]: [ss_promo_sk#3, ss_quantity#4, ss_list_price#5, ss_sales_price#6, ss_coupon_amt#7, i_item_id#16]
Input [8]: [ss_item_sk#1, ss_promo_sk#3, ss_quantity#4, ss_list_price#5, ss_sales_price#6, ss_coupon_amt#7, i_item_sk#15, i_item_id#16]

(24) Scan parquet spark_catalog.default.promotion
Output [3]: [p_promo_sk#17, p_channel_email#18, p_channel_event#19]
Batched: true
Location [not included in comparison]/{warehouse_dir}/promotion]
PushedFilters: [Or(EqualTo(p_channel_email,N),EqualTo(p_channel_event,N)), IsNotNull(p_promo_sk)]
ReadSchema: struct<p_promo_sk:int,p_channel_email:string,p_channel_event:string>

(25) ColumnarToRow [codegen id : 4]
Input [3]: [p_promo_sk#17, p_channel_email#18, p_channel_event#19]

(26) Filter [codegen id : 4]
Input [3]: [p_promo_sk#17, p_channel_email#18, p_channel_event#19]
Condition : (((p_channel_email#18 = N) OR (p_channel_event#19 = N)) AND isnotnull(p_promo_sk#17))

(27) Project [codegen id : 4]
Output [1]: [p_promo_sk#17]
Input [3]: [p_promo_sk#17, p_channel_email#18, p_channel_event#19]

(28) BroadcastExchange
Input [1]: [p_promo_sk#17]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [plan_id=4]

(29) BroadcastHashJoin [codegen id : 5]
Left keys [1]: [ss_promo_sk#3]
Right keys [1]: [p_promo_sk#17]
Join type: Inner
Join condition: None

(30) Project [codegen id : 5]
Output [5]: [ss_quantity#4, ss_list_price#5, ss_sales_price#6, ss_coupon_amt#7, i_item_id#16]
Input [7]: [ss_promo_sk#3, ss_quantity#4, ss_list_price#5, ss_sales_price#6, ss_coupon_amt#7, i_item_id#16, p_promo_sk#17]

(31) HashAggregate [codegen id : 5]
Input [5]: [ss_quantity#4, ss_list_price#5, ss_sales_price#6, ss_coupon_amt#7, i_item_id#16]
Keys [1]: [i_item_id#16]
Functions [4]: [partial_avg(ss_quantity#4), partial_avg(UnscaledValue(ss_list_price#5)), partial_avg(UnscaledValue(ss_coupon_amt#7)), partial_avg(UnscaledValue(ss_sales_price#6))]
Aggregate Attributes [8]: [sum#20, count#21, sum#22, count#23, sum#24, count#25, sum#26, count#27]
Results [9]: [i_item_id#16, sum#28, count#29, sum#30, count#31, sum#32, count#33, sum#34, count#35]

(32) Exchange
Input [9]: [i_item_id#16, sum#28, count#29, sum#30, count#31, sum#32, count#33, sum#34, count#35]
Arguments: hashpartitioning(i_item_id#16, 5), ENSURE_REQUIREMENTS, [plan_id=5]

(33) HashAggregate [codegen id : 6]
Input [9]: [i_item_id#16, sum#28, count#29, sum#30, count#31, sum#32, count#33, sum#34, count#35]
Keys [1]: [i_item_id#16]
Functions [4]: [avg(ss_quantity#4), avg(UnscaledValue(ss_list_price#5)), avg(UnscaledValue(ss_coupon_amt#7)), avg(UnscaledValue(ss_sales_price#6))]
Aggregate Attributes [4]: [avg(ss_quantity#4)#36, avg(UnscaledValue(ss_list_price#5))#37, avg(UnscaledValue(ss_coupon_amt#7))#38, avg(UnscaledValue(ss_sales_price#6))#39]
Results [5]: [i_item_id#16, avg(ss_quantity#4)#36 AS agg1#40, cast((avg(UnscaledValue(ss_list_price#5))#37 / 100.0) as decimal(11,6)) AS agg2#41, cast((avg(UnscaledValue(ss_coupon_amt#7))#38 / 100.0) as decimal(11,6)) AS agg3#42, cast((avg(UnscaledValue(ss_sales_price#6))#39 / 100.0) as decimal(11,6)) AS agg4#43]

(34) TakeOrderedAndProject
Input [5]: [i_item_id#16, agg1#40, agg2#41, agg3#42, agg4#43]
Arguments: 100, [i_item_id#16 ASC NULLS FIRST], [i_item_id#16, agg1#40, agg2#41, agg3#42, agg4#43]

