== Physical Plan ==
TakeOrderedAndProject (30)
+- * HashAggregate (29)
   +- Exchange (28)
      +- * HashAggregate (27)
         +- * ColumnarToRow (26)
            +- CometProject (25)
               +- CometBroadcastHashJoin (24)
                  :- CometProject (19)
                  :  +- CometBroadcastHashJoin (18)
                  :     :- CometProject (14)
                  :     :  +- CometBroadcastHashJoin (13)
                  :     :     :- CometProject (8)
                  :     :     :  +- CometBroadcastHashJoin (7)
                  :     :     :     :- CometFilter (2)
                  :     :     :     :  +- CometNativeScan: `spark_catalog`.`default`.`catalog_sales` (1)
                  :     :     :     +- CometBroadcastExchange (6)
                  :     :     :        +- CometProject (5)
                  :     :     :           +- CometFilter (4)
                  :     :     :              +- CometNativeScan: `spark_catalog`.`default`.`customer_demographics` (3)
                  :     :     +- CometBroadcastExchange (12)
                  :     :        +- CometProject (11)
                  :     :           +- CometFilter (10)
                  :     :              +- CometNativeScan: `spark_catalog`.`default`.`date_dim` (9)
                  :     +- CometBroadcastExchange (17)
                  :        +- CometFilter (16)
                  :           +- CometNativeScan: `spark_catalog`.`default`.`item` (15)
                  +- CometBroadcastExchange (23)
                     +- CometProject (22)
                        +- CometFilter (21)
                           +- CometNativeScan: `spark_catalog`.`default`.`promotion` (20)


(1) CometNativeScan: `spark_catalog`.`default`.`catalog_sales`
Output [8]: [cs_bill_cdemo_sk#1, cs_item_sk#2, cs_promo_sk#3, cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7, cs_sold_date_sk#8]
Arguments: [cs_bill_cdemo_sk#1, cs_item_sk#2, cs_promo_sk#3, cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7, cs_sold_date_sk#8]

(2) CometFilter
Input [8]: [cs_bill_cdemo_sk#1, cs_item_sk#2, cs_promo_sk#3, cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7, cs_sold_date_sk#8]
Condition : ((isnotnull(cs_bill_cdemo_sk#1) AND isnotnull(cs_item_sk#2)) AND isnotnull(cs_promo_sk#3))

(3) CometNativeScan: `spark_catalog`.`default`.`customer_demographics`
Output [4]: [cd_demo_sk#9, cd_gender#10, cd_marital_status#11, cd_education_status#12]
Arguments: [cd_demo_sk#9, cd_gender#10, cd_marital_status#11, cd_education_status#12]

(4) CometFilter
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))

(5) CometProject
Input [4]: [cd_demo_sk#9, cd_gender#10, cd_marital_status#11, cd_education_status#12]
Arguments: [cd_demo_sk#9], [cd_demo_sk#9]

(6) CometBroadcastExchange
Input [1]: [cd_demo_sk#9]
Arguments: [cd_demo_sk#9]

(7) CometBroadcastHashJoin
Left output [8]: [cs_bill_cdemo_sk#1, cs_item_sk#2, cs_promo_sk#3, cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7, cs_sold_date_sk#8]
Right output [1]: [cd_demo_sk#9]
Arguments: [cs_bill_cdemo_sk#1], [cd_demo_sk#9], Inner, BuildRight

(8) CometProject
Input [9]: [cs_bill_cdemo_sk#1, cs_item_sk#2, cs_promo_sk#3, cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7, cs_sold_date_sk#8, cd_demo_sk#9]
Arguments: [cs_item_sk#2, cs_promo_sk#3, cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7, cs_sold_date_sk#8], [cs_item_sk#2, cs_promo_sk#3, cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7, cs_sold_date_sk#8]

(9) CometNativeScan: `spark_catalog`.`default`.`date_dim`
Output [2]: [d_date_sk#13, d_year#14]
Arguments: [d_date_sk#13, d_year#14]

(10) CometFilter
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))

(11) CometProject
Input [2]: [d_date_sk#13, d_year#14]
Arguments: [d_date_sk#13], [d_date_sk#13]

(12) CometBroadcastExchange
Input [1]: [d_date_sk#13]
Arguments: [d_date_sk#13]

(13) CometBroadcastHashJoin
Left output [7]: [cs_item_sk#2, cs_promo_sk#3, cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7, cs_sold_date_sk#8]
Right output [1]: [d_date_sk#13]
Arguments: [cs_sold_date_sk#8], [d_date_sk#13], Inner, BuildRight

(14) CometProject
Input [8]: [cs_item_sk#2, cs_promo_sk#3, cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7, cs_sold_date_sk#8, d_date_sk#13]
Arguments: [cs_item_sk#2, cs_promo_sk#3, cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7], [cs_item_sk#2, cs_promo_sk#3, cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7]

(15) CometNativeScan: `spark_catalog`.`default`.`item`
Output [2]: [i_item_sk#15, i_item_id#16]
Arguments: [i_item_sk#15, i_item_id#16]

(16) CometFilter
Input [2]: [i_item_sk#15, i_item_id#16]
Condition : isnotnull(i_item_sk#15)

(17) CometBroadcastExchange
Input [2]: [i_item_sk#15, i_item_id#16]
Arguments: [i_item_sk#15, i_item_id#16]

(18) CometBroadcastHashJoin
Left output [6]: [cs_item_sk#2, cs_promo_sk#3, cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7]
Right output [2]: [i_item_sk#15, i_item_id#16]
Arguments: [cs_item_sk#2], [i_item_sk#15], Inner, BuildRight

(19) CometProject
Input [8]: [cs_item_sk#2, cs_promo_sk#3, cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7, i_item_sk#15, i_item_id#16]
Arguments: [cs_promo_sk#3, cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7, i_item_id#16], [cs_promo_sk#3, cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7, i_item_id#16]

(20) CometNativeScan: `spark_catalog`.`default`.`promotion`
Output [3]: [p_promo_sk#17, p_channel_email#18, p_channel_event#19]
Arguments: [p_promo_sk#17, p_channel_email#18, p_channel_event#19]

(21) CometFilter
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))

(22) CometProject
Input [3]: [p_promo_sk#17, p_channel_email#18, p_channel_event#19]
Arguments: [p_promo_sk#17], [p_promo_sk#17]

(23) CometBroadcastExchange
Input [1]: [p_promo_sk#17]
Arguments: [p_promo_sk#17]

(24) CometBroadcastHashJoin
Left output [6]: [cs_promo_sk#3, cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7, i_item_id#16]
Right output [1]: [p_promo_sk#17]
Arguments: [cs_promo_sk#3], [p_promo_sk#17], Inner, BuildRight

(25) CometProject
Input [7]: [cs_promo_sk#3, cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7, i_item_id#16, p_promo_sk#17]
Arguments: [cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7, i_item_id#16], [cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7, i_item_id#16]

(26) ColumnarToRow [codegen id : 1]
Input [5]: [cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7, i_item_id#16]

(27) HashAggregate [codegen id : 1]
Input [5]: [cs_quantity#4, cs_list_price#5, cs_sales_price#6, cs_coupon_amt#7, i_item_id#16]
Keys [1]: [i_item_id#16]
Functions [4]: [partial_avg(cs_quantity#4), partial_avg(UnscaledValue(cs_list_price#5)), partial_avg(UnscaledValue(cs_coupon_amt#7)), partial_avg(UnscaledValue(cs_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]

(28) 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=1]

(29) HashAggregate [codegen id : 2]
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(cs_quantity#4), avg(UnscaledValue(cs_list_price#5)), avg(UnscaledValue(cs_coupon_amt#7)), avg(UnscaledValue(cs_sales_price#6))]
Aggregate Attributes [4]: [avg(cs_quantity#4)#36, avg(UnscaledValue(cs_list_price#5))#37, avg(UnscaledValue(cs_coupon_amt#7))#38, avg(UnscaledValue(cs_sales_price#6))#39]
Results [5]: [i_item_id#16, avg(cs_quantity#4)#36 AS agg1#40, cast((avg(UnscaledValue(cs_list_price#5))#37 / 100.0) as decimal(11,6)) AS agg2#41, cast((avg(UnscaledValue(cs_coupon_amt#7))#38 / 100.0) as decimal(11,6)) AS agg3#42, cast((avg(UnscaledValue(cs_sales_price#6))#39 / 100.0) as decimal(11,6)) AS agg4#43]

(30) 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]

