== Physical Plan ==
TakeOrderedAndProject (23)
+- * Project (22)
   +- Window (21)
      +- * CometColumnarToRow (20)
         +- CometSort (19)
            +- CometColumnarExchange (18)
               +- * HashAggregate (17)
                  +- * CometColumnarToRow (16)
                     +- CometColumnarExchange (15)
                        +- * HashAggregate (14)
                           +- * Project (13)
                              +- * BroadcastHashJoin Inner BuildRight (12)
                                 :- * Project (10)
                                 :  +- * BroadcastHashJoin Inner BuildRight (9)
                                 :     :- * Filter (3)
                                 :     :  +- * ColumnarToRow (2)
                                 :     :     +- Scan parquet spark_catalog.default.web_sales (1)
                                 :     +- BroadcastExchange (8)
                                 :        +- * CometColumnarToRow (7)
                                 :           +- CometProject (6)
                                 :              +- CometFilter (5)
                                 :                 +- CometNativeScan parquet spark_catalog.default.item (4)
                                 +- ReusedExchange (11)


(1) Scan parquet spark_catalog.default.web_sales
Output [3]: [ws_item_sk#1, ws_ext_sales_price#2, ws_sold_date_sk#3]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ws_sold_date_sk#3), dynamicpruningexpression(ws_sold_date_sk#3 IN dynamicpruning#4)]
PushedFilters: [IsNotNull(ws_item_sk)]
ReadSchema: struct<ws_item_sk:int,ws_ext_sales_price:decimal(7,2)>

(2) ColumnarToRow [codegen id : 3]
Input [3]: [ws_item_sk#1, ws_ext_sales_price#2, ws_sold_date_sk#3]

(3) Filter [codegen id : 3]
Input [3]: [ws_item_sk#1, ws_ext_sales_price#2, ws_sold_date_sk#3]
Condition : isnotnull(ws_item_sk#1)

(4) CometNativeScan parquet spark_catalog.default.item
Output [6]: [i_item_sk#5, i_item_id#6, i_item_desc#7, i_current_price#8, i_class#9, i_category#10]
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,i_item_desc:string,i_current_price:decimal(7,2),i_class:string,i_category:string>

(5) CometFilter
Input [6]: [i_item_sk#5, i_item_id#6, i_item_desc#7, i_current_price#8, i_class#9, i_category#10]
Condition : (staticinvoke(class org.apache.spark.sql.catalyst.util.CharVarcharCodegenUtils, StringType, readSidePadding, i_category#10, 50, true, false, true) IN (Sports                                            ,Books                                             ,Home                                              ) AND isnotnull(i_item_sk#5))

(6) CometProject
Input [6]: [i_item_sk#5, i_item_id#6, i_item_desc#7, i_current_price#8, i_class#9, i_category#10]
Arguments: [i_item_sk#5, i_item_id#11, i_item_desc#7, i_current_price#8, i_class#12, i_category#13], [i_item_sk#5, staticinvoke(class org.apache.spark.sql.catalyst.util.CharVarcharCodegenUtils, StringType, readSidePadding, i_item_id#6, 16, true, false, true) AS i_item_id#11, i_item_desc#7, i_current_price#8, staticinvoke(class org.apache.spark.sql.catalyst.util.CharVarcharCodegenUtils, StringType, readSidePadding, i_class#9, 50, true, false, true) AS i_class#12, staticinvoke(class org.apache.spark.sql.catalyst.util.CharVarcharCodegenUtils, StringType, readSidePadding, i_category#10, 50, true, false, true) AS i_category#13]

(7) CometColumnarToRow [codegen id : 1]
Input [6]: [i_item_sk#5, i_item_id#11, i_item_desc#7, i_current_price#8, i_class#12, i_category#13]

(8) BroadcastExchange
Input [6]: [i_item_sk#5, i_item_id#11, i_item_desc#7, i_current_price#8, i_class#12, i_category#13]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [plan_id=1]

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

(10) Project [codegen id : 3]
Output [7]: [ws_ext_sales_price#2, ws_sold_date_sk#3, i_item_id#11, i_item_desc#7, i_current_price#8, i_class#12, i_category#13]
Input [9]: [ws_item_sk#1, ws_ext_sales_price#2, ws_sold_date_sk#3, i_item_sk#5, i_item_id#11, i_item_desc#7, i_current_price#8, i_class#12, i_category#13]

(11) ReusedExchange [Reuses operator id: 28]
Output [1]: [d_date_sk#14]

(12) BroadcastHashJoin [codegen id : 3]
Left keys [1]: [ws_sold_date_sk#3]
Right keys [1]: [d_date_sk#14]
Join type: Inner
Join condition: None

(13) Project [codegen id : 3]
Output [6]: [ws_ext_sales_price#2, i_item_id#11, i_item_desc#7, i_current_price#8, i_class#12, i_category#13]
Input [8]: [ws_ext_sales_price#2, ws_sold_date_sk#3, i_item_id#11, i_item_desc#7, i_current_price#8, i_class#12, i_category#13, d_date_sk#14]

(14) HashAggregate [codegen id : 3]
Input [6]: [ws_ext_sales_price#2, i_item_id#11, i_item_desc#7, i_current_price#8, i_class#12, i_category#13]
Keys [5]: [i_item_id#11, i_item_desc#7, i_category#13, i_class#12, i_current_price#8]
Functions [1]: [partial_sum(UnscaledValue(ws_ext_sales_price#2))]
Aggregate Attributes [1]: [sum#15]
Results [6]: [i_item_id#11, i_item_desc#7, i_category#13, i_class#12, i_current_price#8, sum#16]

(15) CometColumnarExchange
Input [6]: [i_item_id#11, i_item_desc#7, i_category#13, i_class#12, i_current_price#8, sum#16]
Arguments: hashpartitioning(i_item_id#11, i_item_desc#7, i_category#13, i_class#12, i_current_price#8, 5), ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=2]

(16) CometColumnarToRow [codegen id : 4]
Input [6]: [i_item_id#11, i_item_desc#7, i_category#13, i_class#12, i_current_price#8, sum#16]

(17) HashAggregate [codegen id : 4]
Input [6]: [i_item_id#11, i_item_desc#7, i_category#13, i_class#12, i_current_price#8, sum#16]
Keys [5]: [i_item_id#11, i_item_desc#7, i_category#13, i_class#12, i_current_price#8]
Functions [1]: [sum(UnscaledValue(ws_ext_sales_price#2))]
Aggregate Attributes [1]: [sum(UnscaledValue(ws_ext_sales_price#2))#17]
Results [7]: [i_item_desc#7, i_category#13, i_class#12, i_current_price#8, MakeDecimal(sum(UnscaledValue(ws_ext_sales_price#2))#17,17,2) AS itemrevenue#18, MakeDecimal(sum(UnscaledValue(ws_ext_sales_price#2))#17,17,2) AS _w0#19, i_item_id#11]

(18) CometColumnarExchange
Input [7]: [i_item_desc#7, i_category#13, i_class#12, i_current_price#8, itemrevenue#18, _w0#19, i_item_id#11]
Arguments: hashpartitioning(i_class#12, 5), ENSURE_REQUIREMENTS, CometColumnarShuffle, [plan_id=3]

(19) CometSort
Input [7]: [i_item_desc#7, i_category#13, i_class#12, i_current_price#8, itemrevenue#18, _w0#19, i_item_id#11]
Arguments: [i_item_desc#7, i_category#13, i_class#12, i_current_price#8, itemrevenue#18, _w0#19, i_item_id#11], [i_class#12 ASC NULLS FIRST]

(20) CometColumnarToRow [codegen id : 5]
Input [7]: [i_item_desc#7, i_category#13, i_class#12, i_current_price#8, itemrevenue#18, _w0#19, i_item_id#11]

(21) Window
Input [7]: [i_item_desc#7, i_category#13, i_class#12, i_current_price#8, itemrevenue#18, _w0#19, i_item_id#11]
Arguments: [sum(_w0#19) windowspecdefinition(i_class#12, specifiedwindowframe(RowFrame, unboundedpreceding$(), unboundedfollowing$())) AS _we0#20], [i_class#12]

(22) Project [codegen id : 6]
Output [7]: [i_item_desc#7, i_category#13, i_class#12, i_current_price#8, itemrevenue#18, ((_w0#19 * 100) / _we0#20) AS revenueratio#21, i_item_id#11]
Input [8]: [i_item_desc#7, i_category#13, i_class#12, i_current_price#8, itemrevenue#18, _w0#19, i_item_id#11, _we0#20]

(23) TakeOrderedAndProject
Input [7]: [i_item_desc#7, i_category#13, i_class#12, i_current_price#8, itemrevenue#18, revenueratio#21, i_item_id#11]
Arguments: 100, [i_category#13 ASC NULLS FIRST, i_class#12 ASC NULLS FIRST, i_item_id#11 ASC NULLS FIRST, i_item_desc#7 ASC NULLS FIRST, revenueratio#21 ASC NULLS FIRST], [i_item_desc#7, i_category#13, i_class#12, i_current_price#8, itemrevenue#18, revenueratio#21]

===== Subqueries =====

Subquery:1 Hosting operator id = 1 Hosting Expression = ws_sold_date_sk#3 IN dynamicpruning#4
BroadcastExchange (28)
+- * CometColumnarToRow (27)
   +- CometProject (26)
      +- CometFilter (25)
         +- CometNativeScan parquet spark_catalog.default.date_dim (24)


(24) CometNativeScan parquet spark_catalog.default.date_dim
Output [2]: [d_date_sk#14, d_date#22]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [IsNotNull(d_date), GreaterThanOrEqual(d_date,1999-02-22), LessThanOrEqual(d_date,1999-03-24), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_date:date>

(25) CometFilter
Input [2]: [d_date_sk#14, d_date#22]
Condition : (((isnotnull(d_date#22) AND (d_date#22 >= 1999-02-22)) AND (d_date#22 <= 1999-03-24)) AND isnotnull(d_date_sk#14))

(26) CometProject
Input [2]: [d_date_sk#14, d_date#22]
Arguments: [d_date_sk#14], [d_date_sk#14]

(27) CometColumnarToRow [codegen id : 1]
Input [1]: [d_date_sk#14]

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


