== Physical Plan ==
TakeOrderedAndProject (95)
+- Union (94)
   :- * HashAggregate (70)
   :  +- Exchange (69)
   :     +- * HashAggregate (68)
   :        +- * Project (67)
   :           +- * BroadcastHashJoin Inner BuildRight (66)
   :              :- * Project (60)
   :              :  +- * BroadcastHashJoin Inner BuildRight (59)
   :              :     :- * SortMergeJoin LeftSemi (46)
   :              :     :  :- * Sort (29)
   :              :     :  :  +- Exchange (28)
   :              :     :  :     +- * Project (27)
   :              :     :  :        +- * BroadcastHashJoin LeftSemi BuildRight (26)
   :              :     :  :           :- * Filter (3)
   :              :     :  :           :  +- * ColumnarToRow (2)
   :              :     :  :           :     +- Scan parquet spark_catalog.default.catalog_sales (1)
   :              :     :  :           +- BroadcastExchange (25)
   :              :     :  :              +- * Project (24)
   :              :     :  :                 +- * Filter (23)
   :              :     :  :                    +- * HashAggregate (22)
   :              :     :  :                       +- Exchange (21)
   :              :     :  :                          +- * HashAggregate (20)
   :              :     :  :                             +- * Project (19)
   :              :     :  :                                +- * BroadcastHashJoin Inner BuildRight (18)
   :              :     :  :                                   :- * Project (13)
   :              :     :  :                                   :  +- * BroadcastHashJoin Inner BuildRight (12)
   :              :     :  :                                   :     :- * Filter (6)
   :              :     :  :                                   :     :  +- * ColumnarToRow (5)
   :              :     :  :                                   :     :     +- Scan parquet spark_catalog.default.store_sales (4)
   :              :     :  :                                   :     +- BroadcastExchange (11)
   :              :     :  :                                   :        +- * Project (10)
   :              :     :  :                                   :           +- * Filter (9)
   :              :     :  :                                   :              +- * ColumnarToRow (8)
   :              :     :  :                                   :                 +- Scan parquet spark_catalog.default.date_dim (7)
   :              :     :  :                                   +- BroadcastExchange (17)
   :              :     :  :                                      +- * Filter (16)
   :              :     :  :                                         +- * ColumnarToRow (15)
   :              :     :  :                                            +- Scan parquet spark_catalog.default.item (14)
   :              :     :  +- * Sort (45)
   :              :     :     +- * Project (44)
   :              :     :        +- * Filter (43)
   :              :     :           +- * HashAggregate (42)
   :              :     :              +- Exchange (41)
   :              :     :                 +- * HashAggregate (40)
   :              :     :                    +- * Project (39)
   :              :     :                       +- * BroadcastHashJoin Inner BuildRight (38)
   :              :     :                          :- * Project (33)
   :              :     :                          :  +- * Filter (32)
   :              :     :                          :     +- * ColumnarToRow (31)
   :              :     :                          :        +- Scan parquet spark_catalog.default.store_sales (30)
   :              :     :                          +- BroadcastExchange (37)
   :              :     :                             +- * Filter (36)
   :              :     :                                +- * ColumnarToRow (35)
   :              :     :                                   +- Scan parquet spark_catalog.default.customer (34)
   :              :     +- BroadcastExchange (58)
   :              :        +- * SortMergeJoin LeftSemi (57)
   :              :           :- * Sort (51)
   :              :           :  +- Exchange (50)
   :              :           :     +- * Filter (49)
   :              :           :        +- * ColumnarToRow (48)
   :              :           :           +- Scan parquet spark_catalog.default.customer (47)
   :              :           +- * Sort (56)
   :              :              +- * Project (55)
   :              :                 +- * Filter (54)
   :              :                    +- * HashAggregate (53)
   :              :                       +- ReusedExchange (52)
   :              +- BroadcastExchange (65)
   :                 +- * Project (64)
   :                    +- * Filter (63)
   :                       +- * ColumnarToRow (62)
   :                          +- Scan parquet spark_catalog.default.date_dim (61)
   +- * HashAggregate (93)
      +- Exchange (92)
         +- * HashAggregate (91)
            +- * Project (90)
               +- * BroadcastHashJoin Inner BuildRight (89)
                  :- * Project (87)
                  :  +- * BroadcastHashJoin Inner BuildRight (86)
                  :     :- * SortMergeJoin LeftSemi (84)
                  :     :  :- * Sort (78)
                  :     :  :  +- Exchange (77)
                  :     :  :     +- * Project (76)
                  :     :  :        +- * BroadcastHashJoin LeftSemi BuildRight (75)
                  :     :  :           :- * Filter (73)
                  :     :  :           :  +- * ColumnarToRow (72)
                  :     :  :           :     +- Scan parquet spark_catalog.default.web_sales (71)
                  :     :  :           +- ReusedExchange (74)
                  :     :  +- * Sort (83)
                  :     :     +- * Project (82)
                  :     :        +- * Filter (81)
                  :     :           +- * HashAggregate (80)
                  :     :              +- ReusedExchange (79)
                  :     +- ReusedExchange (85)
                  +- ReusedExchange (88)


(1) Scan parquet spark_catalog.default.catalog_sales
Output [5]: [cs_bill_customer_sk#1, cs_item_sk#2, cs_quantity#3, cs_list_price#4, cs_sold_date_sk#5]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(cs_sold_date_sk#5)]
PushedFilters: [IsNotNull(cs_bill_customer_sk)]
ReadSchema: struct<cs_bill_customer_sk:int,cs_item_sk:int,cs_quantity:int,cs_list_price:decimal(7,2)>

(2) ColumnarToRow [codegen id : 5]
Input [5]: [cs_bill_customer_sk#1, cs_item_sk#2, cs_quantity#3, cs_list_price#4, cs_sold_date_sk#5]

(3) Filter [codegen id : 5]
Input [5]: [cs_bill_customer_sk#1, cs_item_sk#2, cs_quantity#3, cs_list_price#4, cs_sold_date_sk#5]
Condition : isnotnull(cs_bill_customer_sk#1)

(4) Scan parquet spark_catalog.default.store_sales
Output [2]: [ss_item_sk#6, ss_sold_date_sk#7]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#7)]
PushedFilters: [IsNotNull(ss_item_sk)]
ReadSchema: struct<ss_item_sk:int>

(5) ColumnarToRow [codegen id : 3]
Input [2]: [ss_item_sk#6, ss_sold_date_sk#7]

(6) Filter [codegen id : 3]
Input [2]: [ss_item_sk#6, ss_sold_date_sk#7]
Condition : isnotnull(ss_item_sk#6)

(7) Scan parquet spark_catalog.default.date_dim
Output [3]: [d_date_sk#8, d_date#9, d_year#10]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [In(d_year, [2000,2001,2002,2003]), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_date:date,d_year:int>

(8) ColumnarToRow [codegen id : 1]
Input [3]: [d_date_sk#8, d_date#9, d_year#10]

(9) Filter [codegen id : 1]
Input [3]: [d_date_sk#8, d_date#9, d_year#10]
Condition : (d_year#10 IN (2000,2001,2002,2003) AND isnotnull(d_date_sk#8))

(10) Project [codegen id : 1]
Output [2]: [d_date_sk#8, d_date#9]
Input [3]: [d_date_sk#8, d_date#9, d_year#10]

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

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

(13) Project [codegen id : 3]
Output [2]: [ss_item_sk#6, d_date#9]
Input [4]: [ss_item_sk#6, ss_sold_date_sk#7, d_date_sk#8, d_date#9]

(14) Scan parquet spark_catalog.default.item
Output [2]: [i_item_sk#11, i_item_desc#12]
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>

(15) ColumnarToRow [codegen id : 2]
Input [2]: [i_item_sk#11, i_item_desc#12]

(16) Filter [codegen id : 2]
Input [2]: [i_item_sk#11, i_item_desc#12]
Condition : isnotnull(i_item_sk#11)

(17) BroadcastExchange
Input [2]: [i_item_sk#11, i_item_desc#12]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=2]

(18) BroadcastHashJoin [codegen id : 3]
Left keys [1]: [ss_item_sk#6]
Right keys [1]: [i_item_sk#11]
Join type: Inner
Join condition: None

(19) Project [codegen id : 3]
Output [3]: [d_date#9, i_item_sk#11, substr(i_item_desc#12, 1, 30) AS _groupingexpression#13]
Input [4]: [ss_item_sk#6, d_date#9, i_item_sk#11, i_item_desc#12]

(20) HashAggregate [codegen id : 3]
Input [3]: [d_date#9, i_item_sk#11, _groupingexpression#13]
Keys [3]: [_groupingexpression#13, i_item_sk#11, d_date#9]
Functions [1]: [partial_count(1)]
Aggregate Attributes [1]: [count#14]
Results [4]: [_groupingexpression#13, i_item_sk#11, d_date#9, count#15]

(21) Exchange
Input [4]: [_groupingexpression#13, i_item_sk#11, d_date#9, count#15]
Arguments: hashpartitioning(_groupingexpression#13, i_item_sk#11, d_date#9, 5), ENSURE_REQUIREMENTS, [plan_id=3]

(22) HashAggregate [codegen id : 4]
Input [4]: [_groupingexpression#13, i_item_sk#11, d_date#9, count#15]
Keys [3]: [_groupingexpression#13, i_item_sk#11, d_date#9]
Functions [1]: [count(1)]
Aggregate Attributes [1]: [count(1)#16]
Results [2]: [i_item_sk#11 AS item_sk#17, count(1)#16 AS cnt#18]

(23) Filter [codegen id : 4]
Input [2]: [item_sk#17, cnt#18]
Condition : (cnt#18 > 4)

(24) Project [codegen id : 4]
Output [1]: [item_sk#17]
Input [2]: [item_sk#17, cnt#18]

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

(26) BroadcastHashJoin [codegen id : 5]
Left keys [1]: [cs_item_sk#2]
Right keys [1]: [item_sk#17]
Join type: LeftSemi
Join condition: None

(27) Project [codegen id : 5]
Output [4]: [cs_bill_customer_sk#1, cs_quantity#3, cs_list_price#4, cs_sold_date_sk#5]
Input [5]: [cs_bill_customer_sk#1, cs_item_sk#2, cs_quantity#3, cs_list_price#4, cs_sold_date_sk#5]

(28) Exchange
Input [4]: [cs_bill_customer_sk#1, cs_quantity#3, cs_list_price#4, cs_sold_date_sk#5]
Arguments: hashpartitioning(cs_bill_customer_sk#1, 5), ENSURE_REQUIREMENTS, [plan_id=5]

(29) Sort [codegen id : 6]
Input [4]: [cs_bill_customer_sk#1, cs_quantity#3, cs_list_price#4, cs_sold_date_sk#5]
Arguments: [cs_bill_customer_sk#1 ASC NULLS FIRST], false, 0

(30) Scan parquet spark_catalog.default.store_sales
Output [4]: [ss_customer_sk#19, ss_quantity#20, ss_sales_price#21, ss_sold_date_sk#22]
Batched: true
Location [not included in comparison]/{warehouse_dir}/store_sales]
PushedFilters: [IsNotNull(ss_customer_sk)]
ReadSchema: struct<ss_customer_sk:int,ss_quantity:int,ss_sales_price:decimal(7,2)>

(31) ColumnarToRow [codegen id : 8]
Input [4]: [ss_customer_sk#19, ss_quantity#20, ss_sales_price#21, ss_sold_date_sk#22]

(32) Filter [codegen id : 8]
Input [4]: [ss_customer_sk#19, ss_quantity#20, ss_sales_price#21, ss_sold_date_sk#22]
Condition : isnotnull(ss_customer_sk#19)

(33) Project [codegen id : 8]
Output [3]: [ss_customer_sk#19, ss_quantity#20, ss_sales_price#21]
Input [4]: [ss_customer_sk#19, ss_quantity#20, ss_sales_price#21, ss_sold_date_sk#22]

(34) Scan parquet spark_catalog.default.customer
Output [1]: [c_customer_sk#23]
Batched: true
Location [not included in comparison]/{warehouse_dir}/customer]
PushedFilters: [IsNotNull(c_customer_sk)]
ReadSchema: struct<c_customer_sk:int>

(35) ColumnarToRow [codegen id : 7]
Input [1]: [c_customer_sk#23]

(36) Filter [codegen id : 7]
Input [1]: [c_customer_sk#23]
Condition : isnotnull(c_customer_sk#23)

(37) BroadcastExchange
Input [1]: [c_customer_sk#23]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=6]

(38) BroadcastHashJoin [codegen id : 8]
Left keys [1]: [ss_customer_sk#19]
Right keys [1]: [c_customer_sk#23]
Join type: Inner
Join condition: None

(39) Project [codegen id : 8]
Output [3]: [ss_quantity#20, ss_sales_price#21, c_customer_sk#23]
Input [4]: [ss_customer_sk#19, ss_quantity#20, ss_sales_price#21, c_customer_sk#23]

(40) HashAggregate [codegen id : 8]
Input [3]: [ss_quantity#20, ss_sales_price#21, c_customer_sk#23]
Keys [1]: [c_customer_sk#23]
Functions [1]: [partial_sum((cast(ss_quantity#20 as decimal(10,0)) * ss_sales_price#21))]
Aggregate Attributes [2]: [sum#24, isEmpty#25]
Results [3]: [c_customer_sk#23, sum#26, isEmpty#27]

(41) Exchange
Input [3]: [c_customer_sk#23, sum#26, isEmpty#27]
Arguments: hashpartitioning(c_customer_sk#23, 5), ENSURE_REQUIREMENTS, [plan_id=7]

(42) HashAggregate [codegen id : 9]
Input [3]: [c_customer_sk#23, sum#26, isEmpty#27]
Keys [1]: [c_customer_sk#23]
Functions [1]: [sum((cast(ss_quantity#20 as decimal(10,0)) * ss_sales_price#21))]
Aggregate Attributes [1]: [sum((cast(ss_quantity#20 as decimal(10,0)) * ss_sales_price#21))#28]
Results [2]: [c_customer_sk#23, sum((cast(ss_quantity#20 as decimal(10,0)) * ss_sales_price#21))#28 AS ssales#29]

(43) Filter [codegen id : 9]
Input [2]: [c_customer_sk#23, ssales#29]
Condition : (isnotnull(ssales#29) AND (cast(ssales#29 as decimal(38,8)) > (0.500000 * Subquery scalar-subquery#30, [id=#31])))

(44) Project [codegen id : 9]
Output [1]: [c_customer_sk#23]
Input [2]: [c_customer_sk#23, ssales#29]

(45) Sort [codegen id : 9]
Input [1]: [c_customer_sk#23]
Arguments: [c_customer_sk#23 ASC NULLS FIRST], false, 0

(46) SortMergeJoin [codegen id : 17]
Left keys [1]: [cs_bill_customer_sk#1]
Right keys [1]: [c_customer_sk#23]
Join type: LeftSemi
Join condition: None

(47) Scan parquet spark_catalog.default.customer
Output [3]: [c_customer_sk#32, c_first_name#33, c_last_name#34]
Batched: true
Location [not included in comparison]/{warehouse_dir}/customer]
PushedFilters: [IsNotNull(c_customer_sk)]
ReadSchema: struct<c_customer_sk:int,c_first_name:string,c_last_name:string>

(48) ColumnarToRow [codegen id : 10]
Input [3]: [c_customer_sk#32, c_first_name#33, c_last_name#34]

(49) Filter [codegen id : 10]
Input [3]: [c_customer_sk#32, c_first_name#33, c_last_name#34]
Condition : isnotnull(c_customer_sk#32)

(50) Exchange
Input [3]: [c_customer_sk#32, c_first_name#33, c_last_name#34]
Arguments: hashpartitioning(c_customer_sk#32, 5), ENSURE_REQUIREMENTS, [plan_id=8]

(51) Sort [codegen id : 11]
Input [3]: [c_customer_sk#32, c_first_name#33, c_last_name#34]
Arguments: [c_customer_sk#32 ASC NULLS FIRST], false, 0

(52) ReusedExchange [Reuses operator id: 41]
Output [3]: [c_customer_sk#23, sum#26, isEmpty#27]

(53) HashAggregate [codegen id : 14]
Input [3]: [c_customer_sk#23, sum#26, isEmpty#27]
Keys [1]: [c_customer_sk#23]
Functions [1]: [sum((cast(ss_quantity#20 as decimal(10,0)) * ss_sales_price#21))]
Aggregate Attributes [1]: [sum((cast(ss_quantity#20 as decimal(10,0)) * ss_sales_price#21))#28]
Results [2]: [c_customer_sk#23, sum((cast(ss_quantity#20 as decimal(10,0)) * ss_sales_price#21))#28 AS ssales#29]

(54) Filter [codegen id : 14]
Input [2]: [c_customer_sk#23, ssales#29]
Condition : (isnotnull(ssales#29) AND (cast(ssales#29 as decimal(38,8)) > (0.500000 * ReusedSubquery Subquery scalar-subquery#30, [id=#31])))

(55) Project [codegen id : 14]
Output [1]: [c_customer_sk#23]
Input [2]: [c_customer_sk#23, ssales#29]

(56) Sort [codegen id : 14]
Input [1]: [c_customer_sk#23]
Arguments: [c_customer_sk#23 ASC NULLS FIRST], false, 0

(57) SortMergeJoin [codegen id : 15]
Left keys [1]: [c_customer_sk#32]
Right keys [1]: [c_customer_sk#23]
Join type: LeftSemi
Join condition: None

(58) BroadcastExchange
Input [3]: [c_customer_sk#32, c_first_name#33, c_last_name#34]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=9]

(59) BroadcastHashJoin [codegen id : 17]
Left keys [1]: [cs_bill_customer_sk#1]
Right keys [1]: [c_customer_sk#32]
Join type: Inner
Join condition: None

(60) Project [codegen id : 17]
Output [5]: [cs_quantity#3, cs_list_price#4, cs_sold_date_sk#5, c_first_name#33, c_last_name#34]
Input [7]: [cs_bill_customer_sk#1, cs_quantity#3, cs_list_price#4, cs_sold_date_sk#5, c_customer_sk#32, c_first_name#33, c_last_name#34]

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

(62) ColumnarToRow [codegen id : 16]
Input [3]: [d_date_sk#35, d_year#36, d_moy#37]

(63) Filter [codegen id : 16]
Input [3]: [d_date_sk#35, d_year#36, d_moy#37]
Condition : ((((isnotnull(d_year#36) AND isnotnull(d_moy#37)) AND (d_year#36 = 2000)) AND (d_moy#37 = 2)) AND isnotnull(d_date_sk#35))

(64) Project [codegen id : 16]
Output [1]: [d_date_sk#35]
Input [3]: [d_date_sk#35, d_year#36, d_moy#37]

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

(66) BroadcastHashJoin [codegen id : 17]
Left keys [1]: [cs_sold_date_sk#5]
Right keys [1]: [d_date_sk#35]
Join type: Inner
Join condition: None

(67) Project [codegen id : 17]
Output [4]: [cs_quantity#3, cs_list_price#4, c_first_name#33, c_last_name#34]
Input [6]: [cs_quantity#3, cs_list_price#4, cs_sold_date_sk#5, c_first_name#33, c_last_name#34, d_date_sk#35]

(68) HashAggregate [codegen id : 17]
Input [4]: [cs_quantity#3, cs_list_price#4, c_first_name#33, c_last_name#34]
Keys [2]: [c_last_name#34, c_first_name#33]
Functions [1]: [partial_sum((cast(cs_quantity#3 as decimal(10,0)) * cs_list_price#4))]
Aggregate Attributes [2]: [sum#38, isEmpty#39]
Results [4]: [c_last_name#34, c_first_name#33, sum#40, isEmpty#41]

(69) Exchange
Input [4]: [c_last_name#34, c_first_name#33, sum#40, isEmpty#41]
Arguments: hashpartitioning(c_last_name#34, c_first_name#33, 5), ENSURE_REQUIREMENTS, [plan_id=11]

(70) HashAggregate [codegen id : 18]
Input [4]: [c_last_name#34, c_first_name#33, sum#40, isEmpty#41]
Keys [2]: [c_last_name#34, c_first_name#33]
Functions [1]: [sum((cast(cs_quantity#3 as decimal(10,0)) * cs_list_price#4))]
Aggregate Attributes [1]: [sum((cast(cs_quantity#3 as decimal(10,0)) * cs_list_price#4))#42]
Results [3]: [c_last_name#34, c_first_name#33, sum((cast(cs_quantity#3 as decimal(10,0)) * cs_list_price#4))#42 AS sales#43]

(71) Scan parquet spark_catalog.default.web_sales
Output [5]: [ws_item_sk#44, ws_bill_customer_sk#45, ws_quantity#46, ws_list_price#47, ws_sold_date_sk#48]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ws_sold_date_sk#48)]
PushedFilters: [IsNotNull(ws_bill_customer_sk)]
ReadSchema: struct<ws_item_sk:int,ws_bill_customer_sk:int,ws_quantity:int,ws_list_price:decimal(7,2)>

(72) ColumnarToRow [codegen id : 23]
Input [5]: [ws_item_sk#44, ws_bill_customer_sk#45, ws_quantity#46, ws_list_price#47, ws_sold_date_sk#48]

(73) Filter [codegen id : 23]
Input [5]: [ws_item_sk#44, ws_bill_customer_sk#45, ws_quantity#46, ws_list_price#47, ws_sold_date_sk#48]
Condition : isnotnull(ws_bill_customer_sk#45)

(74) ReusedExchange [Reuses operator id: 25]
Output [1]: [item_sk#17]

(75) BroadcastHashJoin [codegen id : 23]
Left keys [1]: [ws_item_sk#44]
Right keys [1]: [item_sk#17]
Join type: LeftSemi
Join condition: None

(76) Project [codegen id : 23]
Output [4]: [ws_bill_customer_sk#45, ws_quantity#46, ws_list_price#47, ws_sold_date_sk#48]
Input [5]: [ws_item_sk#44, ws_bill_customer_sk#45, ws_quantity#46, ws_list_price#47, ws_sold_date_sk#48]

(77) Exchange
Input [4]: [ws_bill_customer_sk#45, ws_quantity#46, ws_list_price#47, ws_sold_date_sk#48]
Arguments: hashpartitioning(ws_bill_customer_sk#45, 5), ENSURE_REQUIREMENTS, [plan_id=12]

(78) Sort [codegen id : 24]
Input [4]: [ws_bill_customer_sk#45, ws_quantity#46, ws_list_price#47, ws_sold_date_sk#48]
Arguments: [ws_bill_customer_sk#45 ASC NULLS FIRST], false, 0

(79) ReusedExchange [Reuses operator id: 41]
Output [3]: [c_customer_sk#23, sum#26, isEmpty#27]

(80) HashAggregate [codegen id : 27]
Input [3]: [c_customer_sk#23, sum#26, isEmpty#27]
Keys [1]: [c_customer_sk#23]
Functions [1]: [sum((cast(ss_quantity#20 as decimal(10,0)) * ss_sales_price#21))]
Aggregate Attributes [1]: [sum((cast(ss_quantity#20 as decimal(10,0)) * ss_sales_price#21))#28]
Results [2]: [c_customer_sk#23, sum((cast(ss_quantity#20 as decimal(10,0)) * ss_sales_price#21))#28 AS ssales#29]

(81) Filter [codegen id : 27]
Input [2]: [c_customer_sk#23, ssales#29]
Condition : (isnotnull(ssales#29) AND (cast(ssales#29 as decimal(38,8)) > (0.500000 * ReusedSubquery Subquery scalar-subquery#30, [id=#31])))

(82) Project [codegen id : 27]
Output [1]: [c_customer_sk#23]
Input [2]: [c_customer_sk#23, ssales#29]

(83) Sort [codegen id : 27]
Input [1]: [c_customer_sk#23]
Arguments: [c_customer_sk#23 ASC NULLS FIRST], false, 0

(84) SortMergeJoin [codegen id : 35]
Left keys [1]: [ws_bill_customer_sk#45]
Right keys [1]: [c_customer_sk#23]
Join type: LeftSemi
Join condition: None

(85) ReusedExchange [Reuses operator id: 58]
Output [3]: [c_customer_sk#49, c_first_name#50, c_last_name#51]

(86) BroadcastHashJoin [codegen id : 35]
Left keys [1]: [ws_bill_customer_sk#45]
Right keys [1]: [c_customer_sk#49]
Join type: Inner
Join condition: None

(87) Project [codegen id : 35]
Output [5]: [ws_quantity#46, ws_list_price#47, ws_sold_date_sk#48, c_first_name#50, c_last_name#51]
Input [7]: [ws_bill_customer_sk#45, ws_quantity#46, ws_list_price#47, ws_sold_date_sk#48, c_customer_sk#49, c_first_name#50, c_last_name#51]

(88) ReusedExchange [Reuses operator id: 65]
Output [1]: [d_date_sk#52]

(89) BroadcastHashJoin [codegen id : 35]
Left keys [1]: [ws_sold_date_sk#48]
Right keys [1]: [d_date_sk#52]
Join type: Inner
Join condition: None

(90) Project [codegen id : 35]
Output [4]: [ws_quantity#46, ws_list_price#47, c_first_name#50, c_last_name#51]
Input [6]: [ws_quantity#46, ws_list_price#47, ws_sold_date_sk#48, c_first_name#50, c_last_name#51, d_date_sk#52]

(91) HashAggregate [codegen id : 35]
Input [4]: [ws_quantity#46, ws_list_price#47, c_first_name#50, c_last_name#51]
Keys [2]: [c_last_name#51, c_first_name#50]
Functions [1]: [partial_sum((cast(ws_quantity#46 as decimal(10,0)) * ws_list_price#47))]
Aggregate Attributes [2]: [sum#53, isEmpty#54]
Results [4]: [c_last_name#51, c_first_name#50, sum#55, isEmpty#56]

(92) Exchange
Input [4]: [c_last_name#51, c_first_name#50, sum#55, isEmpty#56]
Arguments: hashpartitioning(c_last_name#51, c_first_name#50, 5), ENSURE_REQUIREMENTS, [plan_id=13]

(93) HashAggregate [codegen id : 36]
Input [4]: [c_last_name#51, c_first_name#50, sum#55, isEmpty#56]
Keys [2]: [c_last_name#51, c_first_name#50]
Functions [1]: [sum((cast(ws_quantity#46 as decimal(10,0)) * ws_list_price#47))]
Aggregate Attributes [1]: [sum((cast(ws_quantity#46 as decimal(10,0)) * ws_list_price#47))#57]
Results [3]: [c_last_name#51, c_first_name#50, sum((cast(ws_quantity#46 as decimal(10,0)) * ws_list_price#47))#57 AS sales#58]

(94) Union

(95) TakeOrderedAndProject
Input [3]: [c_last_name#34, c_first_name#33, sales#43]
Arguments: 100, [c_last_name#34 ASC NULLS FIRST, c_first_name#33 ASC NULLS FIRST, sales#43 ASC NULLS FIRST], [c_last_name#34, c_first_name#33, sales#43]

===== Subqueries =====

Subquery:1 Hosting operator id = 43 Hosting Expression = Subquery scalar-subquery#30, [id=#31]
* HashAggregate (114)
+- Exchange (113)
   +- * HashAggregate (112)
      +- * HashAggregate (111)
         +- Exchange (110)
            +- * HashAggregate (109)
               +- * Project (108)
                  +- * BroadcastHashJoin Inner BuildRight (107)
                     :- * Project (101)
                     :  +- * BroadcastHashJoin Inner BuildRight (100)
                     :     :- * Filter (98)
                     :     :  +- * ColumnarToRow (97)
                     :     :     +- Scan parquet spark_catalog.default.store_sales (96)
                     :     +- ReusedExchange (99)
                     +- BroadcastExchange (106)
                        +- * Project (105)
                           +- * Filter (104)
                              +- * ColumnarToRow (103)
                                 +- Scan parquet spark_catalog.default.date_dim (102)


(96) Scan parquet spark_catalog.default.store_sales
Output [4]: [ss_customer_sk#59, ss_quantity#60, ss_sales_price#61, ss_sold_date_sk#62]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#62)]
PushedFilters: [IsNotNull(ss_customer_sk)]
ReadSchema: struct<ss_customer_sk:int,ss_quantity:int,ss_sales_price:decimal(7,2)>

(97) ColumnarToRow [codegen id : 3]
Input [4]: [ss_customer_sk#59, ss_quantity#60, ss_sales_price#61, ss_sold_date_sk#62]

(98) Filter [codegen id : 3]
Input [4]: [ss_customer_sk#59, ss_quantity#60, ss_sales_price#61, ss_sold_date_sk#62]
Condition : isnotnull(ss_customer_sk#59)

(99) ReusedExchange [Reuses operator id: 37]
Output [1]: [c_customer_sk#63]

(100) BroadcastHashJoin [codegen id : 3]
Left keys [1]: [ss_customer_sk#59]
Right keys [1]: [c_customer_sk#63]
Join type: Inner
Join condition: None

(101) Project [codegen id : 3]
Output [4]: [ss_quantity#60, ss_sales_price#61, ss_sold_date_sk#62, c_customer_sk#63]
Input [5]: [ss_customer_sk#59, ss_quantity#60, ss_sales_price#61, ss_sold_date_sk#62, c_customer_sk#63]

(102) Scan parquet spark_catalog.default.date_dim
Output [2]: [d_date_sk#64, d_year#65]
Batched: true
Location [not included in comparison]/{warehouse_dir}/date_dim]
PushedFilters: [In(d_year, [2000,2001,2002,2003]), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_year:int>

(103) ColumnarToRow [codegen id : 2]
Input [2]: [d_date_sk#64, d_year#65]

(104) Filter [codegen id : 2]
Input [2]: [d_date_sk#64, d_year#65]
Condition : (d_year#65 IN (2000,2001,2002,2003) AND isnotnull(d_date_sk#64))

(105) Project [codegen id : 2]
Output [1]: [d_date_sk#64]
Input [2]: [d_date_sk#64, d_year#65]

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

(107) BroadcastHashJoin [codegen id : 3]
Left keys [1]: [ss_sold_date_sk#62]
Right keys [1]: [d_date_sk#64]
Join type: Inner
Join condition: None

(108) Project [codegen id : 3]
Output [3]: [ss_quantity#60, ss_sales_price#61, c_customer_sk#63]
Input [5]: [ss_quantity#60, ss_sales_price#61, ss_sold_date_sk#62, c_customer_sk#63, d_date_sk#64]

(109) HashAggregate [codegen id : 3]
Input [3]: [ss_quantity#60, ss_sales_price#61, c_customer_sk#63]
Keys [1]: [c_customer_sk#63]
Functions [1]: [partial_sum((cast(ss_quantity#60 as decimal(10,0)) * ss_sales_price#61))]
Aggregate Attributes [2]: [sum#66, isEmpty#67]
Results [3]: [c_customer_sk#63, sum#68, isEmpty#69]

(110) Exchange
Input [3]: [c_customer_sk#63, sum#68, isEmpty#69]
Arguments: hashpartitioning(c_customer_sk#63, 5), ENSURE_REQUIREMENTS, [plan_id=15]

(111) HashAggregate [codegen id : 4]
Input [3]: [c_customer_sk#63, sum#68, isEmpty#69]
Keys [1]: [c_customer_sk#63]
Functions [1]: [sum((cast(ss_quantity#60 as decimal(10,0)) * ss_sales_price#61))]
Aggregate Attributes [1]: [sum((cast(ss_quantity#60 as decimal(10,0)) * ss_sales_price#61))#70]
Results [1]: [sum((cast(ss_quantity#60 as decimal(10,0)) * ss_sales_price#61))#70 AS csales#71]

(112) HashAggregate [codegen id : 4]
Input [1]: [csales#71]
Keys: []
Functions [1]: [partial_max(csales#71)]
Aggregate Attributes [1]: [max#72]
Results [1]: [max#73]

(113) Exchange
Input [1]: [max#73]
Arguments: SinglePartition, ENSURE_REQUIREMENTS, [plan_id=16]

(114) HashAggregate [codegen id : 5]
Input [1]: [max#73]
Keys: []
Functions [1]: [max(csales#71)]
Aggregate Attributes [1]: [max(csales#71)#74]
Results [1]: [max(csales#71)#74 AS tpcds_cmax#75]

Subquery:2 Hosting operator id = 54 Hosting Expression = ReusedSubquery Subquery scalar-subquery#30, [id=#31]

Subquery:3 Hosting operator id = 81 Hosting Expression = ReusedSubquery Subquery scalar-subquery#30, [id=#31]


