== Physical Plan ==
TakeOrderedAndProject (69)
+- * Project (68)
   +- * SortMergeJoin Inner (67)
      :- * Project (45)
      :  +- * SortMergeJoin Inner (44)
      :     :- * Sort (22)
      :     :  +- * HashAggregate (21)
      :     :     +- * CometColumnarToRow (20)
      :     :        +- CometExchange (19)
      :     :           +- CometHashAggregate (18)
      :     :              +- CometProject (17)
      :     :                 +- CometBroadcastHashJoin (16)
      :     :                    :- CometProject (12)
      :     :                    :  +- CometFilter (11)
      :     :                    :     +- CometSortMergeJoin (10)
      :     :                    :        :- CometSort (4)
      :     :                    :        :  +- CometExchange (3)
      :     :                    :        :     +- CometFilter (2)
      :     :                    :        :        +- CometScan [native_iceberg_compat] parquet spark_catalog.default.store_sales (1)
      :     :                    :        +- CometSort (9)
      :     :                    :           +- CometExchange (8)
      :     :                    :              +- CometProject (7)
      :     :                    :                 +- CometFilter (6)
      :     :                    :                    +- CometScan [native_iceberg_compat] parquet spark_catalog.default.store_returns (5)
      :     :                    +- CometBroadcastExchange (15)
      :     :                       +- CometFilter (14)
      :     :                          +- CometScan [native_iceberg_compat] parquet spark_catalog.default.date_dim (13)
      :     +- * Sort (43)
      :        +- * Filter (42)
      :           +- * HashAggregate (41)
      :              +- * CometColumnarToRow (40)
      :                 +- CometExchange (39)
      :                    +- CometHashAggregate (38)
      :                       +- CometProject (37)
      :                          +- CometBroadcastHashJoin (36)
      :                             :- CometProject (34)
      :                             :  +- CometFilter (33)
      :                             :     +- CometSortMergeJoin (32)
      :                             :        :- CometSort (26)
      :                             :        :  +- CometExchange (25)
      :                             :        :     +- CometFilter (24)
      :                             :        :        +- CometScan [native_iceberg_compat] parquet spark_catalog.default.web_sales (23)
      :                             :        +- CometSort (31)
      :                             :           +- CometExchange (30)
      :                             :              +- CometProject (29)
      :                             :                 +- CometFilter (28)
      :                             :                    +- CometScan [native_iceberg_compat] parquet spark_catalog.default.web_returns (27)
      :                             +- ReusedExchange (35)
      +- * Sort (66)
         +- * Filter (65)
            +- * HashAggregate (64)
               +- * CometColumnarToRow (63)
                  +- CometExchange (62)
                     +- CometHashAggregate (61)
                        +- CometProject (60)
                           +- CometBroadcastHashJoin (59)
                              :- CometProject (57)
                              :  +- CometFilter (56)
                              :     +- CometSortMergeJoin (55)
                              :        :- CometSort (49)
                              :        :  +- CometExchange (48)
                              :        :     +- CometFilter (47)
                              :        :        +- CometScan [native_iceberg_compat] parquet spark_catalog.default.catalog_sales (46)
                              :        +- CometSort (54)
                              :           +- CometExchange (53)
                              :              +- CometProject (52)
                              :                 +- CometFilter (51)
                              :                    +- CometScan [native_iceberg_compat] parquet spark_catalog.default.catalog_returns (50)
                              +- ReusedExchange (58)


(1) CometScan [native_iceberg_compat] parquet spark_catalog.default.store_sales
Output [7]: [ss_item_sk#1, ss_customer_sk#2, ss_ticket_number#3, ss_quantity#4, ss_wholesale_cost#5, ss_sales_price#6, ss_sold_date_sk#7]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#7), dynamicpruningexpression(ss_sold_date_sk#7 IN dynamicpruning#8)]
PushedFilters: [IsNotNull(ss_item_sk), IsNotNull(ss_customer_sk)]
ReadSchema: struct<ss_item_sk:int,ss_customer_sk:int,ss_ticket_number:int,ss_quantity:int,ss_wholesale_cost:decimal(7,2),ss_sales_price:decimal(7,2)>

(2) CometFilter
Input [7]: [ss_item_sk#1, ss_customer_sk#2, ss_ticket_number#3, ss_quantity#4, ss_wholesale_cost#5, ss_sales_price#6, ss_sold_date_sk#7]
Condition : (isnotnull(ss_item_sk#1) AND isnotnull(ss_customer_sk#2))

(3) CometExchange
Input [7]: [ss_item_sk#1, ss_customer_sk#2, ss_ticket_number#3, ss_quantity#4, ss_wholesale_cost#5, ss_sales_price#6, ss_sold_date_sk#7]
Arguments: hashpartitioning(ss_ticket_number#3, ss_item_sk#1, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=1]

(4) CometSort
Input [7]: [ss_item_sk#1, ss_customer_sk#2, ss_ticket_number#3, ss_quantity#4, ss_wholesale_cost#5, ss_sales_price#6, ss_sold_date_sk#7]
Arguments: [ss_item_sk#1, ss_customer_sk#2, ss_ticket_number#3, ss_quantity#4, ss_wholesale_cost#5, ss_sales_price#6, ss_sold_date_sk#7], [ss_ticket_number#3 ASC NULLS FIRST, ss_item_sk#1 ASC NULLS FIRST]

(5) CometScan [native_iceberg_compat] parquet spark_catalog.default.store_returns
Output [3]: [sr_item_sk#9, sr_ticket_number#10, sr_returned_date_sk#11]
Batched: true
Location [not included in comparison]/{warehouse_dir}/store_returns]
PushedFilters: [IsNotNull(sr_ticket_number), IsNotNull(sr_item_sk)]
ReadSchema: struct<sr_item_sk:int,sr_ticket_number:int>

(6) CometFilter
Input [3]: [sr_item_sk#9, sr_ticket_number#10, sr_returned_date_sk#11]
Condition : (isnotnull(sr_ticket_number#10) AND isnotnull(sr_item_sk#9))

(7) CometProject
Input [3]: [sr_item_sk#9, sr_ticket_number#10, sr_returned_date_sk#11]
Arguments: [sr_item_sk#9, sr_ticket_number#10], [sr_item_sk#9, sr_ticket_number#10]

(8) CometExchange
Input [2]: [sr_item_sk#9, sr_ticket_number#10]
Arguments: hashpartitioning(sr_ticket_number#10, sr_item_sk#9, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=2]

(9) CometSort
Input [2]: [sr_item_sk#9, sr_ticket_number#10]
Arguments: [sr_item_sk#9, sr_ticket_number#10], [sr_ticket_number#10 ASC NULLS FIRST, sr_item_sk#9 ASC NULLS FIRST]

(10) CometSortMergeJoin
Left output [7]: [ss_item_sk#1, ss_customer_sk#2, ss_ticket_number#3, ss_quantity#4, ss_wholesale_cost#5, ss_sales_price#6, ss_sold_date_sk#7]
Right output [2]: [sr_item_sk#9, sr_ticket_number#10]
Arguments: [ss_ticket_number#3, ss_item_sk#1], [sr_ticket_number#10, sr_item_sk#9], LeftOuter

(11) CometFilter
Input [9]: [ss_item_sk#1, ss_customer_sk#2, ss_ticket_number#3, ss_quantity#4, ss_wholesale_cost#5, ss_sales_price#6, ss_sold_date_sk#7, sr_item_sk#9, sr_ticket_number#10]
Condition : isnull(sr_ticket_number#10)

(12) CometProject
Input [9]: [ss_item_sk#1, ss_customer_sk#2, ss_ticket_number#3, ss_quantity#4, ss_wholesale_cost#5, ss_sales_price#6, ss_sold_date_sk#7, sr_item_sk#9, sr_ticket_number#10]
Arguments: [ss_item_sk#1, ss_customer_sk#2, ss_quantity#4, ss_wholesale_cost#5, ss_sales_price#6, ss_sold_date_sk#7], [ss_item_sk#1, ss_customer_sk#2, ss_quantity#4, ss_wholesale_cost#5, ss_sales_price#6, ss_sold_date_sk#7]

(13) CometScan [native_iceberg_compat] parquet spark_catalog.default.date_dim
Output [2]: [d_date_sk#12, d_year#13]
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>

(14) CometFilter
Input [2]: [d_date_sk#12, d_year#13]
Condition : ((isnotnull(d_year#13) AND (d_year#13 = 2000)) AND isnotnull(d_date_sk#12))

(15) CometBroadcastExchange
Input [2]: [d_date_sk#12, d_year#13]
Arguments: [d_date_sk#12, d_year#13]

(16) CometBroadcastHashJoin
Left output [6]: [ss_item_sk#1, ss_customer_sk#2, ss_quantity#4, ss_wholesale_cost#5, ss_sales_price#6, ss_sold_date_sk#7]
Right output [2]: [d_date_sk#12, d_year#13]
Arguments: [ss_sold_date_sk#7], [d_date_sk#12], Inner, BuildRight

(17) CometProject
Input [8]: [ss_item_sk#1, ss_customer_sk#2, ss_quantity#4, ss_wholesale_cost#5, ss_sales_price#6, ss_sold_date_sk#7, d_date_sk#12, d_year#13]
Arguments: [ss_item_sk#1, ss_customer_sk#2, ss_quantity#4, ss_wholesale_cost#5, ss_sales_price#6, d_year#13], [ss_item_sk#1, ss_customer_sk#2, ss_quantity#4, ss_wholesale_cost#5, ss_sales_price#6, d_year#13]

(18) CometHashAggregate
Input [6]: [ss_item_sk#1, ss_customer_sk#2, ss_quantity#4, ss_wholesale_cost#5, ss_sales_price#6, d_year#13]
Keys [3]: [d_year#13, ss_item_sk#1, ss_customer_sk#2]
Functions [3]: [partial_sum(ss_quantity#4), partial_sum(UnscaledValue(ss_wholesale_cost#5)), partial_sum(UnscaledValue(ss_sales_price#6))]

(19) CometExchange
Input [6]: [d_year#13, ss_item_sk#1, ss_customer_sk#2, sum#14, sum#15, sum#16]
Arguments: hashpartitioning(d_year#13, ss_item_sk#1, ss_customer_sk#2, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=3]

(20) CometColumnarToRow [codegen id : 1]
Input [6]: [d_year#13, ss_item_sk#1, ss_customer_sk#2, sum#14, sum#15, sum#16]

(21) HashAggregate [codegen id : 1]
Input [6]: [d_year#13, ss_item_sk#1, ss_customer_sk#2, sum#14, sum#15, sum#16]
Keys [3]: [d_year#13, ss_item_sk#1, ss_customer_sk#2]
Functions [3]: [sum(ss_quantity#4), sum(UnscaledValue(ss_wholesale_cost#5)), sum(UnscaledValue(ss_sales_price#6))]
Aggregate Attributes [3]: [sum(ss_quantity#4)#17, sum(UnscaledValue(ss_wholesale_cost#5))#18, sum(UnscaledValue(ss_sales_price#6))#19]
Results [6]: [d_year#13 AS ss_sold_year#20, ss_item_sk#1, ss_customer_sk#2, sum(ss_quantity#4)#17 AS ss_qty#21, MakeDecimal(sum(UnscaledValue(ss_wholesale_cost#5))#18,17,2) AS ss_wc#22, MakeDecimal(sum(UnscaledValue(ss_sales_price#6))#19,17,2) AS ss_sp#23]

(22) Sort [codegen id : 1]
Input [6]: [ss_sold_year#20, ss_item_sk#1, ss_customer_sk#2, ss_qty#21, ss_wc#22, ss_sp#23]
Arguments: [ss_sold_year#20 ASC NULLS FIRST, ss_item_sk#1 ASC NULLS FIRST, ss_customer_sk#2 ASC NULLS FIRST], false, 0

(23) CometScan [native_iceberg_compat] parquet spark_catalog.default.web_sales
Output [7]: [ws_item_sk#24, ws_bill_customer_sk#25, ws_order_number#26, ws_quantity#27, ws_wholesale_cost#28, ws_sales_price#29, ws_sold_date_sk#30]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ws_sold_date_sk#30), dynamicpruningexpression(ws_sold_date_sk#30 IN dynamicpruning#31)]
PushedFilters: [IsNotNull(ws_item_sk), IsNotNull(ws_bill_customer_sk)]
ReadSchema: struct<ws_item_sk:int,ws_bill_customer_sk:int,ws_order_number:int,ws_quantity:int,ws_wholesale_cost:decimal(7,2),ws_sales_price:decimal(7,2)>

(24) CometFilter
Input [7]: [ws_item_sk#24, ws_bill_customer_sk#25, ws_order_number#26, ws_quantity#27, ws_wholesale_cost#28, ws_sales_price#29, ws_sold_date_sk#30]
Condition : (isnotnull(ws_item_sk#24) AND isnotnull(ws_bill_customer_sk#25))

(25) CometExchange
Input [7]: [ws_item_sk#24, ws_bill_customer_sk#25, ws_order_number#26, ws_quantity#27, ws_wholesale_cost#28, ws_sales_price#29, ws_sold_date_sk#30]
Arguments: hashpartitioning(ws_order_number#26, ws_item_sk#24, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=4]

(26) CometSort
Input [7]: [ws_item_sk#24, ws_bill_customer_sk#25, ws_order_number#26, ws_quantity#27, ws_wholesale_cost#28, ws_sales_price#29, ws_sold_date_sk#30]
Arguments: [ws_item_sk#24, ws_bill_customer_sk#25, ws_order_number#26, ws_quantity#27, ws_wholesale_cost#28, ws_sales_price#29, ws_sold_date_sk#30], [ws_order_number#26 ASC NULLS FIRST, ws_item_sk#24 ASC NULLS FIRST]

(27) CometScan [native_iceberg_compat] parquet spark_catalog.default.web_returns
Output [3]: [wr_item_sk#32, wr_order_number#33, wr_returned_date_sk#34]
Batched: true
Location [not included in comparison]/{warehouse_dir}/web_returns]
PushedFilters: [IsNotNull(wr_order_number), IsNotNull(wr_item_sk)]
ReadSchema: struct<wr_item_sk:int,wr_order_number:int>

(28) CometFilter
Input [3]: [wr_item_sk#32, wr_order_number#33, wr_returned_date_sk#34]
Condition : (isnotnull(wr_order_number#33) AND isnotnull(wr_item_sk#32))

(29) CometProject
Input [3]: [wr_item_sk#32, wr_order_number#33, wr_returned_date_sk#34]
Arguments: [wr_item_sk#32, wr_order_number#33], [wr_item_sk#32, wr_order_number#33]

(30) CometExchange
Input [2]: [wr_item_sk#32, wr_order_number#33]
Arguments: hashpartitioning(wr_order_number#33, wr_item_sk#32, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=5]

(31) CometSort
Input [2]: [wr_item_sk#32, wr_order_number#33]
Arguments: [wr_item_sk#32, wr_order_number#33], [wr_order_number#33 ASC NULLS FIRST, wr_item_sk#32 ASC NULLS FIRST]

(32) CometSortMergeJoin
Left output [7]: [ws_item_sk#24, ws_bill_customer_sk#25, ws_order_number#26, ws_quantity#27, ws_wholesale_cost#28, ws_sales_price#29, ws_sold_date_sk#30]
Right output [2]: [wr_item_sk#32, wr_order_number#33]
Arguments: [ws_order_number#26, ws_item_sk#24], [wr_order_number#33, wr_item_sk#32], LeftOuter

(33) CometFilter
Input [9]: [ws_item_sk#24, ws_bill_customer_sk#25, ws_order_number#26, ws_quantity#27, ws_wholesale_cost#28, ws_sales_price#29, ws_sold_date_sk#30, wr_item_sk#32, wr_order_number#33]
Condition : isnull(wr_order_number#33)

(34) CometProject
Input [9]: [ws_item_sk#24, ws_bill_customer_sk#25, ws_order_number#26, ws_quantity#27, ws_wholesale_cost#28, ws_sales_price#29, ws_sold_date_sk#30, wr_item_sk#32, wr_order_number#33]
Arguments: [ws_item_sk#24, ws_bill_customer_sk#25, ws_quantity#27, ws_wholesale_cost#28, ws_sales_price#29, ws_sold_date_sk#30], [ws_item_sk#24, ws_bill_customer_sk#25, ws_quantity#27, ws_wholesale_cost#28, ws_sales_price#29, ws_sold_date_sk#30]

(35) ReusedExchange [Reuses operator id: 15]
Output [2]: [d_date_sk#35, d_year#36]

(36) CometBroadcastHashJoin
Left output [6]: [ws_item_sk#24, ws_bill_customer_sk#25, ws_quantity#27, ws_wholesale_cost#28, ws_sales_price#29, ws_sold_date_sk#30]
Right output [2]: [d_date_sk#35, d_year#36]
Arguments: [ws_sold_date_sk#30], [d_date_sk#35], Inner, BuildRight

(37) CometProject
Input [8]: [ws_item_sk#24, ws_bill_customer_sk#25, ws_quantity#27, ws_wholesale_cost#28, ws_sales_price#29, ws_sold_date_sk#30, d_date_sk#35, d_year#36]
Arguments: [ws_item_sk#24, ws_bill_customer_sk#25, ws_quantity#27, ws_wholesale_cost#28, ws_sales_price#29, d_year#36], [ws_item_sk#24, ws_bill_customer_sk#25, ws_quantity#27, ws_wholesale_cost#28, ws_sales_price#29, d_year#36]

(38) CometHashAggregate
Input [6]: [ws_item_sk#24, ws_bill_customer_sk#25, ws_quantity#27, ws_wholesale_cost#28, ws_sales_price#29, d_year#36]
Keys [3]: [d_year#36, ws_item_sk#24, ws_bill_customer_sk#25]
Functions [3]: [partial_sum(ws_quantity#27), partial_sum(UnscaledValue(ws_wholesale_cost#28)), partial_sum(UnscaledValue(ws_sales_price#29))]

(39) CometExchange
Input [6]: [d_year#36, ws_item_sk#24, ws_bill_customer_sk#25, sum#37, sum#38, sum#39]
Arguments: hashpartitioning(d_year#36, ws_item_sk#24, ws_bill_customer_sk#25, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=6]

(40) CometColumnarToRow [codegen id : 2]
Input [6]: [d_year#36, ws_item_sk#24, ws_bill_customer_sk#25, sum#37, sum#38, sum#39]

(41) HashAggregate [codegen id : 2]
Input [6]: [d_year#36, ws_item_sk#24, ws_bill_customer_sk#25, sum#37, sum#38, sum#39]
Keys [3]: [d_year#36, ws_item_sk#24, ws_bill_customer_sk#25]
Functions [3]: [sum(ws_quantity#27), sum(UnscaledValue(ws_wholesale_cost#28)), sum(UnscaledValue(ws_sales_price#29))]
Aggregate Attributes [3]: [sum(ws_quantity#27)#40, sum(UnscaledValue(ws_wholesale_cost#28))#41, sum(UnscaledValue(ws_sales_price#29))#42]
Results [6]: [d_year#36 AS ws_sold_year#43, ws_item_sk#24, ws_bill_customer_sk#25 AS ws_customer_sk#44, sum(ws_quantity#27)#40 AS ws_qty#45, MakeDecimal(sum(UnscaledValue(ws_wholesale_cost#28))#41,17,2) AS ws_wc#46, MakeDecimal(sum(UnscaledValue(ws_sales_price#29))#42,17,2) AS ws_sp#47]

(42) Filter [codegen id : 2]
Input [6]: [ws_sold_year#43, ws_item_sk#24, ws_customer_sk#44, ws_qty#45, ws_wc#46, ws_sp#47]
Condition : (coalesce(ws_qty#45, 0) > 0)

(43) Sort [codegen id : 2]
Input [6]: [ws_sold_year#43, ws_item_sk#24, ws_customer_sk#44, ws_qty#45, ws_wc#46, ws_sp#47]
Arguments: [ws_sold_year#43 ASC NULLS FIRST, ws_item_sk#24 ASC NULLS FIRST, ws_customer_sk#44 ASC NULLS FIRST], false, 0

(44) SortMergeJoin [codegen id : 3]
Left keys [3]: [ss_sold_year#20, ss_item_sk#1, ss_customer_sk#2]
Right keys [3]: [ws_sold_year#43, ws_item_sk#24, ws_customer_sk#44]
Join type: Inner
Join condition: None

(45) Project [codegen id : 3]
Output [9]: [ss_sold_year#20, ss_item_sk#1, ss_customer_sk#2, ss_qty#21, ss_wc#22, ss_sp#23, ws_qty#45, ws_wc#46, ws_sp#47]
Input [12]: [ss_sold_year#20, ss_item_sk#1, ss_customer_sk#2, ss_qty#21, ss_wc#22, ss_sp#23, ws_sold_year#43, ws_item_sk#24, ws_customer_sk#44, ws_qty#45, ws_wc#46, ws_sp#47]

(46) CometScan [native_iceberg_compat] parquet spark_catalog.default.catalog_sales
Output [7]: [cs_bill_customer_sk#48, cs_item_sk#49, cs_order_number#50, cs_quantity#51, cs_wholesale_cost#52, cs_sales_price#53, cs_sold_date_sk#54]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(cs_sold_date_sk#54), dynamicpruningexpression(cs_sold_date_sk#54 IN dynamicpruning#55)]
PushedFilters: [IsNotNull(cs_item_sk), IsNotNull(cs_bill_customer_sk)]
ReadSchema: struct<cs_bill_customer_sk:int,cs_item_sk:int,cs_order_number:int,cs_quantity:int,cs_wholesale_cost:decimal(7,2),cs_sales_price:decimal(7,2)>

(47) CometFilter
Input [7]: [cs_bill_customer_sk#48, cs_item_sk#49, cs_order_number#50, cs_quantity#51, cs_wholesale_cost#52, cs_sales_price#53, cs_sold_date_sk#54]
Condition : (isnotnull(cs_item_sk#49) AND isnotnull(cs_bill_customer_sk#48))

(48) CometExchange
Input [7]: [cs_bill_customer_sk#48, cs_item_sk#49, cs_order_number#50, cs_quantity#51, cs_wholesale_cost#52, cs_sales_price#53, cs_sold_date_sk#54]
Arguments: hashpartitioning(cs_order_number#50, cs_item_sk#49, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=7]

(49) CometSort
Input [7]: [cs_bill_customer_sk#48, cs_item_sk#49, cs_order_number#50, cs_quantity#51, cs_wholesale_cost#52, cs_sales_price#53, cs_sold_date_sk#54]
Arguments: [cs_bill_customer_sk#48, cs_item_sk#49, cs_order_number#50, cs_quantity#51, cs_wholesale_cost#52, cs_sales_price#53, cs_sold_date_sk#54], [cs_order_number#50 ASC NULLS FIRST, cs_item_sk#49 ASC NULLS FIRST]

(50) CometScan [native_iceberg_compat] parquet spark_catalog.default.catalog_returns
Output [3]: [cr_item_sk#56, cr_order_number#57, cr_returned_date_sk#58]
Batched: true
Location [not included in comparison]/{warehouse_dir}/catalog_returns]
PushedFilters: [IsNotNull(cr_order_number), IsNotNull(cr_item_sk)]
ReadSchema: struct<cr_item_sk:int,cr_order_number:int>

(51) CometFilter
Input [3]: [cr_item_sk#56, cr_order_number#57, cr_returned_date_sk#58]
Condition : (isnotnull(cr_order_number#57) AND isnotnull(cr_item_sk#56))

(52) CometProject
Input [3]: [cr_item_sk#56, cr_order_number#57, cr_returned_date_sk#58]
Arguments: [cr_item_sk#56, cr_order_number#57], [cr_item_sk#56, cr_order_number#57]

(53) CometExchange
Input [2]: [cr_item_sk#56, cr_order_number#57]
Arguments: hashpartitioning(cr_order_number#57, cr_item_sk#56, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=8]

(54) CometSort
Input [2]: [cr_item_sk#56, cr_order_number#57]
Arguments: [cr_item_sk#56, cr_order_number#57], [cr_order_number#57 ASC NULLS FIRST, cr_item_sk#56 ASC NULLS FIRST]

(55) CometSortMergeJoin
Left output [7]: [cs_bill_customer_sk#48, cs_item_sk#49, cs_order_number#50, cs_quantity#51, cs_wholesale_cost#52, cs_sales_price#53, cs_sold_date_sk#54]
Right output [2]: [cr_item_sk#56, cr_order_number#57]
Arguments: [cs_order_number#50, cs_item_sk#49], [cr_order_number#57, cr_item_sk#56], LeftOuter

(56) CometFilter
Input [9]: [cs_bill_customer_sk#48, cs_item_sk#49, cs_order_number#50, cs_quantity#51, cs_wholesale_cost#52, cs_sales_price#53, cs_sold_date_sk#54, cr_item_sk#56, cr_order_number#57]
Condition : isnull(cr_order_number#57)

(57) CometProject
Input [9]: [cs_bill_customer_sk#48, cs_item_sk#49, cs_order_number#50, cs_quantity#51, cs_wholesale_cost#52, cs_sales_price#53, cs_sold_date_sk#54, cr_item_sk#56, cr_order_number#57]
Arguments: [cs_bill_customer_sk#48, cs_item_sk#49, cs_quantity#51, cs_wholesale_cost#52, cs_sales_price#53, cs_sold_date_sk#54], [cs_bill_customer_sk#48, cs_item_sk#49, cs_quantity#51, cs_wholesale_cost#52, cs_sales_price#53, cs_sold_date_sk#54]

(58) ReusedExchange [Reuses operator id: 15]
Output [2]: [d_date_sk#59, d_year#60]

(59) CometBroadcastHashJoin
Left output [6]: [cs_bill_customer_sk#48, cs_item_sk#49, cs_quantity#51, cs_wholesale_cost#52, cs_sales_price#53, cs_sold_date_sk#54]
Right output [2]: [d_date_sk#59, d_year#60]
Arguments: [cs_sold_date_sk#54], [d_date_sk#59], Inner, BuildRight

(60) CometProject
Input [8]: [cs_bill_customer_sk#48, cs_item_sk#49, cs_quantity#51, cs_wholesale_cost#52, cs_sales_price#53, cs_sold_date_sk#54, d_date_sk#59, d_year#60]
Arguments: [cs_bill_customer_sk#48, cs_item_sk#49, cs_quantity#51, cs_wholesale_cost#52, cs_sales_price#53, d_year#60], [cs_bill_customer_sk#48, cs_item_sk#49, cs_quantity#51, cs_wholesale_cost#52, cs_sales_price#53, d_year#60]

(61) CometHashAggregate
Input [6]: [cs_bill_customer_sk#48, cs_item_sk#49, cs_quantity#51, cs_wholesale_cost#52, cs_sales_price#53, d_year#60]
Keys [3]: [d_year#60, cs_item_sk#49, cs_bill_customer_sk#48]
Functions [3]: [partial_sum(cs_quantity#51), partial_sum(UnscaledValue(cs_wholesale_cost#52)), partial_sum(UnscaledValue(cs_sales_price#53))]

(62) CometExchange
Input [6]: [d_year#60, cs_item_sk#49, cs_bill_customer_sk#48, sum#61, sum#62, sum#63]
Arguments: hashpartitioning(d_year#60, cs_item_sk#49, cs_bill_customer_sk#48, 5), ENSURE_REQUIREMENTS, CometNativeShuffle, [plan_id=9]

(63) CometColumnarToRow [codegen id : 4]
Input [6]: [d_year#60, cs_item_sk#49, cs_bill_customer_sk#48, sum#61, sum#62, sum#63]

(64) HashAggregate [codegen id : 4]
Input [6]: [d_year#60, cs_item_sk#49, cs_bill_customer_sk#48, sum#61, sum#62, sum#63]
Keys [3]: [d_year#60, cs_item_sk#49, cs_bill_customer_sk#48]
Functions [3]: [sum(cs_quantity#51), sum(UnscaledValue(cs_wholesale_cost#52)), sum(UnscaledValue(cs_sales_price#53))]
Aggregate Attributes [3]: [sum(cs_quantity#51)#64, sum(UnscaledValue(cs_wholesale_cost#52))#65, sum(UnscaledValue(cs_sales_price#53))#66]
Results [6]: [d_year#60 AS cs_sold_year#67, cs_item_sk#49, cs_bill_customer_sk#48 AS cs_customer_sk#68, sum(cs_quantity#51)#64 AS cs_qty#69, MakeDecimal(sum(UnscaledValue(cs_wholesale_cost#52))#65,17,2) AS cs_wc#70, MakeDecimal(sum(UnscaledValue(cs_sales_price#53))#66,17,2) AS cs_sp#71]

(65) Filter [codegen id : 4]
Input [6]: [cs_sold_year#67, cs_item_sk#49, cs_customer_sk#68, cs_qty#69, cs_wc#70, cs_sp#71]
Condition : (coalesce(cs_qty#69, 0) > 0)

(66) Sort [codegen id : 4]
Input [6]: [cs_sold_year#67, cs_item_sk#49, cs_customer_sk#68, cs_qty#69, cs_wc#70, cs_sp#71]
Arguments: [cs_sold_year#67 ASC NULLS FIRST, cs_item_sk#49 ASC NULLS FIRST, cs_customer_sk#68 ASC NULLS FIRST], false, 0

(67) SortMergeJoin [codegen id : 5]
Left keys [3]: [ss_sold_year#20, ss_item_sk#1, ss_customer_sk#2]
Right keys [3]: [cs_sold_year#67, cs_item_sk#49, cs_customer_sk#68]
Join type: Inner
Join condition: None

(68) Project [codegen id : 5]
Output [12]: [round((cast(ss_qty#21 as double) / knownfloatingpointnormalized(normalizenanandzero(cast(coalesce((ws_qty#45 + cs_qty#69), 1) as double)))), 2) AS ratio#72, ss_qty#21 AS store_qty#73, ss_wc#22 AS store_wholesale_cost#74, ss_sp#23 AS store_sales_price#75, (coalesce(ws_qty#45, 0) + coalesce(cs_qty#69, 0)) AS other_chan_qty#76, (coalesce(ws_wc#46, 0.00) + coalesce(cs_wc#70, 0.00)) AS other_chan_wholesale_cost#77, (coalesce(ws_sp#47, 0.00) + coalesce(cs_sp#71, 0.00)) AS other_chan_sales_price#78, ss_qty#21, ss_wc#22, ss_sp#23, ws_qty#45, cs_qty#69]
Input [15]: [ss_sold_year#20, ss_item_sk#1, ss_customer_sk#2, ss_qty#21, ss_wc#22, ss_sp#23, ws_qty#45, ws_wc#46, ws_sp#47, cs_sold_year#67, cs_item_sk#49, cs_customer_sk#68, cs_qty#69, cs_wc#70, cs_sp#71]

(69) TakeOrderedAndProject
Input [12]: [ratio#72, store_qty#73, store_wholesale_cost#74, store_sales_price#75, other_chan_qty#76, other_chan_wholesale_cost#77, other_chan_sales_price#78, ss_qty#21, ss_wc#22, ss_sp#23, ws_qty#45, cs_qty#69]
Arguments: 100, [ratio#72 ASC NULLS FIRST, ss_qty#21 DESC NULLS LAST, ss_wc#22 DESC NULLS LAST, ss_sp#23 DESC NULLS LAST, other_chan_qty#76 ASC NULLS FIRST, other_chan_wholesale_cost#77 ASC NULLS FIRST, other_chan_sales_price#78 ASC NULLS FIRST, round((cast(ss_qty#21 as double) / cast(coalesce((ws_qty#45 + cs_qty#69), 1) as double)), 2) ASC NULLS FIRST], [ratio#72, store_qty#73, store_wholesale_cost#74, store_sales_price#75, other_chan_qty#76, other_chan_wholesale_cost#77, other_chan_sales_price#78]

===== Subqueries =====

Subquery:1 Hosting operator id = 1 Hosting Expression = ss_sold_date_sk#7 IN dynamicpruning#8
BroadcastExchange (73)
+- * CometColumnarToRow (72)
   +- CometFilter (71)
      +- CometScan [native_iceberg_compat] parquet spark_catalog.default.date_dim (70)


(70) CometScan [native_iceberg_compat] parquet spark_catalog.default.date_dim
Output [2]: [d_date_sk#12, d_year#13]
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>

(71) CometFilter
Input [2]: [d_date_sk#12, d_year#13]
Condition : ((isnotnull(d_year#13) AND (d_year#13 = 2000)) AND isnotnull(d_date_sk#12))

(72) CometColumnarToRow [codegen id : 1]
Input [2]: [d_date_sk#12, d_year#13]

(73) BroadcastExchange
Input [2]: [d_date_sk#12, d_year#13]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=10]

Subquery:2 Hosting operator id = 23 Hosting Expression = ws_sold_date_sk#30 IN dynamicpruning#8

Subquery:3 Hosting operator id = 46 Hosting Expression = cs_sold_date_sk#54 IN dynamicpruning#8


