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


(1) Scan parquet default.catalog_sales
Output [5]: [cs_sold_date_sk#1, cs_bill_customer_sk#2, cs_item_sk#3, cs_quantity#4, cs_list_price#5]
Batched: true
Location [not included in comparison]/{warehouse_dir}/catalog_sales]
PushedFilters: [IsNotNull(cs_sold_date_sk)]
ReadSchema: struct<cs_sold_date_sk:int,cs_bill_customer_sk:int,cs_item_sk:int,cs_quantity:int,cs_list_price:decimal(7,2)>

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

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

(4) Exchange
Input [5]: [cs_sold_date_sk#1, cs_bill_customer_sk#2, cs_item_sk#3, cs_quantity#4, cs_list_price#5]
Arguments: hashpartitioning(cs_item_sk#3, 5), true, [id=#6]

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

(6) Scan parquet default.store_sales
Output [2]: [ss_sold_date_sk#7, ss_item_sk#8]
Batched: true
Location [not included in comparison]/{warehouse_dir}/store_sales]
PushedFilters: [IsNotNull(ss_sold_date_sk), IsNotNull(ss_item_sk)]
ReadSchema: struct<ss_sold_date_sk:int,ss_item_sk:int>

(7) ColumnarToRow [codegen id : 4]
Input [2]: [ss_sold_date_sk#7, ss_item_sk#8]

(8) Filter [codegen id : 4]
Input [2]: [ss_sold_date_sk#7, ss_item_sk#8]
Condition : (isnotnull(ss_sold_date_sk#7) AND isnotnull(ss_item_sk#8))

(9) Scan parquet default.date_dim
Output [3]: [d_date_sk#9, d_date#10, d_year#11]
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>

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

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

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

(13) BroadcastExchange
Input [2]: [d_date_sk#9, d_date#10]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [id=#12]

(14) BroadcastHashJoin [codegen id : 4]
Left keys [1]: [ss_sold_date_sk#7]
Right keys [1]: [d_date_sk#9]
Join condition: None

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

(16) Exchange
Input [2]: [ss_item_sk#8, d_date#10]
Arguments: hashpartitioning(ss_item_sk#8, 5), true, [id=#13]

(17) Sort [codegen id : 5]
Input [2]: [ss_item_sk#8, d_date#10]
Arguments: [ss_item_sk#8 ASC NULLS FIRST], false, 0

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

(19) ColumnarToRow [codegen id : 6]
Input [2]: [i_item_sk#14, i_item_desc#15]

(20) Filter [codegen id : 6]
Input [2]: [i_item_sk#14, i_item_desc#15]
Condition : isnotnull(i_item_sk#14)

(21) Exchange
Input [2]: [i_item_sk#14, i_item_desc#15]
Arguments: hashpartitioning(i_item_sk#14, 5), true, [id=#16]

(22) Sort [codegen id : 7]
Input [2]: [i_item_sk#14, i_item_desc#15]
Arguments: [i_item_sk#14 ASC NULLS FIRST], false, 0

(23) SortMergeJoin [codegen id : 8]
Left keys [1]: [ss_item_sk#8]
Right keys [1]: [i_item_sk#14]
Join condition: None

(24) Project [codegen id : 8]
Output [3]: [d_date#10, i_item_sk#14, i_item_desc#15]
Input [4]: [ss_item_sk#8, d_date#10, i_item_sk#14, i_item_desc#15]

(25) HashAggregate [codegen id : 8]
Input [3]: [d_date#10, i_item_sk#14, i_item_desc#15]
Keys [3]: [substr(i_item_desc#15, 1, 30) AS substr(i_item_desc#15, 1, 30)#17, i_item_sk#14, d_date#10]
Functions [1]: [partial_count(1)]
Aggregate Attributes [1]: [count#18]
Results [4]: [substr(i_item_desc#15, 1, 30)#17, i_item_sk#14, d_date#10, count#19]

(26) HashAggregate [codegen id : 8]
Input [4]: [substr(i_item_desc#15, 1, 30)#17, i_item_sk#14, d_date#10, count#19]
Keys [3]: [substr(i_item_desc#15, 1, 30)#17, i_item_sk#14, d_date#10]
Functions [1]: [count(1)]
Aggregate Attributes [1]: [count(1)#20]
Results [2]: [i_item_sk#14 AS item_sk#21, count(1)#20 AS count(1)#22]

(27) Filter [codegen id : 8]
Input [2]: [item_sk#21, count(1)#22]
Condition : (count(1)#22 > 4)

(28) Project [codegen id : 8]
Output [1]: [item_sk#21]
Input [2]: [item_sk#21, count(1)#22]

(29) Sort [codegen id : 8]
Input [1]: [item_sk#21]
Arguments: [item_sk#21 ASC NULLS FIRST], false, 0

(30) SortMergeJoin
Left keys [1]: [cs_item_sk#3]
Right keys [1]: [item_sk#21]
Join condition: None

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

(32) Exchange
Input [4]: [cs_sold_date_sk#1, cs_bill_customer_sk#2, cs_quantity#4, cs_list_price#5]
Arguments: hashpartitioning(cs_bill_customer_sk#2, 5), true, [id=#23]

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

(34) Scan parquet default.store_sales
Output [3]: [ss_customer_sk#24, ss_quantity#25, ss_sales_price#26]
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)>

(35) ColumnarToRow [codegen id : 11]
Input [3]: [ss_customer_sk#24, ss_quantity#25, ss_sales_price#26]

(36) Filter [codegen id : 11]
Input [3]: [ss_customer_sk#24, ss_quantity#25, ss_sales_price#26]
Condition : isnotnull(ss_customer_sk#24)

(37) Exchange
Input [3]: [ss_customer_sk#24, ss_quantity#25, ss_sales_price#26]
Arguments: hashpartitioning(ss_customer_sk#24, 5), true, [id=#27]

(38) Sort [codegen id : 12]
Input [3]: [ss_customer_sk#24, ss_quantity#25, ss_sales_price#26]
Arguments: [ss_customer_sk#24 ASC NULLS FIRST], false, 0

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

(40) ColumnarToRow [codegen id : 13]
Input [1]: [c_customer_sk#28]

(41) Filter [codegen id : 13]
Input [1]: [c_customer_sk#28]
Condition : isnotnull(c_customer_sk#28)

(42) Exchange
Input [1]: [c_customer_sk#28]
Arguments: hashpartitioning(c_customer_sk#28, 5), true, [id=#29]

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

(44) SortMergeJoin [codegen id : 15]
Left keys [1]: [ss_customer_sk#24]
Right keys [1]: [c_customer_sk#28]
Join condition: None

(45) Project [codegen id : 15]
Output [3]: [ss_quantity#25, ss_sales_price#26, c_customer_sk#28]
Input [4]: [ss_customer_sk#24, ss_quantity#25, ss_sales_price#26, c_customer_sk#28]

(46) HashAggregate [codegen id : 15]
Input [3]: [ss_quantity#25, ss_sales_price#26, c_customer_sk#28]
Keys [1]: [c_customer_sk#28]
Functions [1]: [partial_sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))]
Aggregate Attributes [2]: [sum#30, isEmpty#31]
Results [3]: [c_customer_sk#28, sum#32, isEmpty#33]

(47) HashAggregate [codegen id : 15]
Input [3]: [c_customer_sk#28, sum#32, isEmpty#33]
Keys [1]: [c_customer_sk#28]
Functions [1]: [sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))]
Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))#34]
Results [2]: [c_customer_sk#28, sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))#34 AS sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))#35]

(48) Filter [codegen id : 15]
Input [2]: [c_customer_sk#28, sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))#35]
Condition : (isnotnull(sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))#35) AND (cast(sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))#35 as decimal(38,8)) > CheckOverflow((0.500000 * promote_precision(cast(Subquery scalar-subquery#36, [id=#37] as decimal(32,6)))), DecimalType(38,8), true)))

(49) Project [codegen id : 15]
Output [1]: [c_customer_sk#28]
Input [2]: [c_customer_sk#28, sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))#35]

(50) Sort [codegen id : 15]
Input [1]: [c_customer_sk#28]
Arguments: [c_customer_sk#28 ASC NULLS FIRST], false, 0

(51) SortMergeJoin
Left keys [1]: [cs_bill_customer_sk#2]
Right keys [1]: [c_customer_sk#28]
Join condition: None

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

(53) Scan parquet default.date_dim
Output [3]: [d_date_sk#9, d_year#11, d_moy#38]
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>

(54) ColumnarToRow [codegen id : 16]
Input [3]: [d_date_sk#9, d_year#11, d_moy#38]

(55) Filter [codegen id : 16]
Input [3]: [d_date_sk#9, d_year#11, d_moy#38]
Condition : ((((isnotnull(d_year#11) AND isnotnull(d_moy#38)) AND (d_year#11 = 2000)) AND (d_moy#38 = 2)) AND isnotnull(d_date_sk#9))

(56) Project [codegen id : 16]
Output [1]: [d_date_sk#9]
Input [3]: [d_date_sk#9, d_year#11, d_moy#38]

(57) BroadcastExchange
Input [1]: [d_date_sk#9]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [id=#39]

(58) BroadcastHashJoin [codegen id : 17]
Left keys [1]: [cs_sold_date_sk#1]
Right keys [1]: [d_date_sk#9]
Join condition: None

(59) Project [codegen id : 17]
Output [1]: [CheckOverflow((promote_precision(cast(cast(cs_quantity#4 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(cs_list_price#5 as decimal(12,2)))), DecimalType(18,2), true) AS sales#40]
Input [4]: [cs_sold_date_sk#1, cs_quantity#4, cs_list_price#5, d_date_sk#9]

(60) Scan parquet default.web_sales
Output [5]: [ws_sold_date_sk#41, ws_item_sk#42, ws_bill_customer_sk#43, ws_quantity#44, ws_list_price#45]
Batched: true
Location [not included in comparison]/{warehouse_dir}/web_sales]
PushedFilters: [IsNotNull(ws_sold_date_sk)]
ReadSchema: struct<ws_sold_date_sk:int,ws_item_sk:int,ws_bill_customer_sk:int,ws_quantity:int,ws_list_price:decimal(7,2)>

(61) ColumnarToRow [codegen id : 18]
Input [5]: [ws_sold_date_sk#41, ws_item_sk#42, ws_bill_customer_sk#43, ws_quantity#44, ws_list_price#45]

(62) Filter [codegen id : 18]
Input [5]: [ws_sold_date_sk#41, ws_item_sk#42, ws_bill_customer_sk#43, ws_quantity#44, ws_list_price#45]
Condition : isnotnull(ws_sold_date_sk#41)

(63) Exchange
Input [5]: [ws_sold_date_sk#41, ws_item_sk#42, ws_bill_customer_sk#43, ws_quantity#44, ws_list_price#45]
Arguments: hashpartitioning(ws_item_sk#42, 5), true, [id=#46]

(64) Sort [codegen id : 19]
Input [5]: [ws_sold_date_sk#41, ws_item_sk#42, ws_bill_customer_sk#43, ws_quantity#44, ws_list_price#45]
Arguments: [ws_item_sk#42 ASC NULLS FIRST], false, 0

(65) ReusedExchange [Reuses operator id: 16]
Output [2]: [ss_item_sk#8, d_date#10]

(66) Sort [codegen id : 22]
Input [2]: [ss_item_sk#8, d_date#10]
Arguments: [ss_item_sk#8 ASC NULLS FIRST], false, 0

(67) ReusedExchange [Reuses operator id: 21]
Output [2]: [i_item_sk#14, i_item_desc#15]

(68) Sort [codegen id : 24]
Input [2]: [i_item_sk#14, i_item_desc#15]
Arguments: [i_item_sk#14 ASC NULLS FIRST], false, 0

(69) SortMergeJoin [codegen id : 25]
Left keys [1]: [ss_item_sk#8]
Right keys [1]: [i_item_sk#14]
Join condition: None

(70) Project [codegen id : 25]
Output [3]: [d_date#10, i_item_sk#14, i_item_desc#15]
Input [4]: [ss_item_sk#8, d_date#10, i_item_sk#14, i_item_desc#15]

(71) HashAggregate [codegen id : 25]
Input [3]: [d_date#10, i_item_sk#14, i_item_desc#15]
Keys [3]: [substr(i_item_desc#15, 1, 30) AS substr(i_item_desc#15, 1, 30)#47, i_item_sk#14, d_date#10]
Functions [1]: [partial_count(1)]
Aggregate Attributes [1]: [count#48]
Results [4]: [substr(i_item_desc#15, 1, 30)#47, i_item_sk#14, d_date#10, count#49]

(72) HashAggregate [codegen id : 25]
Input [4]: [substr(i_item_desc#15, 1, 30)#47, i_item_sk#14, d_date#10, count#49]
Keys [3]: [substr(i_item_desc#15, 1, 30)#47, i_item_sk#14, d_date#10]
Functions [1]: [count(1)]
Aggregate Attributes [1]: [count(1)#50]
Results [2]: [i_item_sk#14 AS item_sk#21, count(1)#50 AS count(1)#51]

(73) Filter [codegen id : 25]
Input [2]: [item_sk#21, count(1)#51]
Condition : (count(1)#51 > 4)

(74) Project [codegen id : 25]
Output [1]: [item_sk#21]
Input [2]: [item_sk#21, count(1)#51]

(75) Sort [codegen id : 25]
Input [1]: [item_sk#21]
Arguments: [item_sk#21 ASC NULLS FIRST], false, 0

(76) SortMergeJoin
Left keys [1]: [ws_item_sk#42]
Right keys [1]: [item_sk#21]
Join condition: None

(77) Project [codegen id : 26]
Output [4]: [ws_sold_date_sk#41, ws_bill_customer_sk#43, ws_quantity#44, ws_list_price#45]
Input [5]: [ws_sold_date_sk#41, ws_item_sk#42, ws_bill_customer_sk#43, ws_quantity#44, ws_list_price#45]

(78) Exchange
Input [4]: [ws_sold_date_sk#41, ws_bill_customer_sk#43, ws_quantity#44, ws_list_price#45]
Arguments: hashpartitioning(ws_bill_customer_sk#43, 5), true, [id=#52]

(79) Sort [codegen id : 27]
Input [4]: [ws_sold_date_sk#41, ws_bill_customer_sk#43, ws_quantity#44, ws_list_price#45]
Arguments: [ws_bill_customer_sk#43 ASC NULLS FIRST], false, 0

(80) ReusedExchange [Reuses operator id: 37]
Output [3]: [ss_customer_sk#24, ss_quantity#25, ss_sales_price#26]

(81) Sort [codegen id : 29]
Input [3]: [ss_customer_sk#24, ss_quantity#25, ss_sales_price#26]
Arguments: [ss_customer_sk#24 ASC NULLS FIRST], false, 0

(82) ReusedExchange [Reuses operator id: 42]
Output [1]: [c_customer_sk#28]

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

(84) SortMergeJoin [codegen id : 32]
Left keys [1]: [ss_customer_sk#24]
Right keys [1]: [c_customer_sk#28]
Join condition: None

(85) Project [codegen id : 32]
Output [3]: [ss_quantity#25, ss_sales_price#26, c_customer_sk#28]
Input [4]: [ss_customer_sk#24, ss_quantity#25, ss_sales_price#26, c_customer_sk#28]

(86) HashAggregate [codegen id : 32]
Input [3]: [ss_quantity#25, ss_sales_price#26, c_customer_sk#28]
Keys [1]: [c_customer_sk#28]
Functions [1]: [partial_sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))]
Aggregate Attributes [2]: [sum#53, isEmpty#54]
Results [3]: [c_customer_sk#28, sum#55, isEmpty#56]

(87) HashAggregate [codegen id : 32]
Input [3]: [c_customer_sk#28, sum#55, isEmpty#56]
Keys [1]: [c_customer_sk#28]
Functions [1]: [sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))]
Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))#57]
Results [2]: [c_customer_sk#28, sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))#57 AS sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))#58]

(88) Filter [codegen id : 32]
Input [2]: [c_customer_sk#28, sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))#58]
Condition : (isnotnull(sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))#58) AND (cast(sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))#58 as decimal(38,8)) > CheckOverflow((0.500000 * promote_precision(cast(ReusedSubquery Subquery scalar-subquery#36, [id=#37] as decimal(32,6)))), DecimalType(38,8), true)))

(89) Project [codegen id : 32]
Output [1]: [c_customer_sk#28]
Input [2]: [c_customer_sk#28, sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))#58]

(90) Sort [codegen id : 32]
Input [1]: [c_customer_sk#28]
Arguments: [c_customer_sk#28 ASC NULLS FIRST], false, 0

(91) SortMergeJoin
Left keys [1]: [ws_bill_customer_sk#43]
Right keys [1]: [c_customer_sk#28]
Join condition: None

(92) Project [codegen id : 34]
Output [3]: [ws_sold_date_sk#41, ws_quantity#44, ws_list_price#45]
Input [4]: [ws_sold_date_sk#41, ws_bill_customer_sk#43, ws_quantity#44, ws_list_price#45]

(93) ReusedExchange [Reuses operator id: 57]
Output [1]: [d_date_sk#9]

(94) BroadcastHashJoin [codegen id : 34]
Left keys [1]: [ws_sold_date_sk#41]
Right keys [1]: [d_date_sk#9]
Join condition: None

(95) Project [codegen id : 34]
Output [1]: [CheckOverflow((promote_precision(cast(cast(ws_quantity#44 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ws_list_price#45 as decimal(12,2)))), DecimalType(18,2), true) AS sales#59]
Input [4]: [ws_sold_date_sk#41, ws_quantity#44, ws_list_price#45, d_date_sk#9]

(96) Union

(97) HashAggregate [codegen id : 35]
Input [1]: [sales#40]
Keys: []
Functions [1]: [partial_sum(sales#40)]
Aggregate Attributes [2]: [sum#60, isEmpty#61]
Results [2]: [sum#62, isEmpty#63]

(98) Exchange
Input [2]: [sum#62, isEmpty#63]
Arguments: SinglePartition, true, [id=#64]

(99) HashAggregate [codegen id : 36]
Input [2]: [sum#62, isEmpty#63]
Keys: []
Functions [1]: [sum(sales#40)]
Aggregate Attributes [1]: [sum(sales#40)#65]
Results [1]: [sum(sales#40)#65 AS sum(sales)#66]

===== Subqueries =====

Subquery:1 Hosting operator id = 48 Hosting Expression = Subquery scalar-subquery#36, [id=#37]
* HashAggregate (123)
+- Exchange (122)
   +- * HashAggregate (121)
      +- * HashAggregate (120)
         +- * HashAggregate (119)
            +- * Project (118)
               +- * SortMergeJoin Inner (117)
                  :- * Sort (111)
                  :  +- Exchange (110)
                  :     +- * Project (109)
                  :        +- * BroadcastHashJoin Inner BuildRight (108)
                  :           :- * Filter (102)
                  :           :  +- * ColumnarToRow (101)
                  :           :     +- Scan parquet default.store_sales (100)
                  :           +- BroadcastExchange (107)
                  :              +- * Project (106)
                  :                 +- * Filter (105)
                  :                    +- * ColumnarToRow (104)
                  :                       +- Scan parquet default.date_dim (103)
                  +- * Sort (116)
                     +- Exchange (115)
                        +- * Filter (114)
                           +- * ColumnarToRow (113)
                              +- Scan parquet default.customer (112)


(100) Scan parquet default.store_sales
Output [4]: [ss_sold_date_sk#7, ss_customer_sk#24, ss_quantity#25, ss_sales_price#26]
Batched: true
Location [not included in comparison]/{warehouse_dir}/store_sales]
PushedFilters: [IsNotNull(ss_customer_sk), IsNotNull(ss_sold_date_sk)]
ReadSchema: struct<ss_sold_date_sk:int,ss_customer_sk:int,ss_quantity:int,ss_sales_price:decimal(7,2)>

(101) ColumnarToRow [codegen id : 2]
Input [4]: [ss_sold_date_sk#7, ss_customer_sk#24, ss_quantity#25, ss_sales_price#26]

(102) Filter [codegen id : 2]
Input [4]: [ss_sold_date_sk#7, ss_customer_sk#24, ss_quantity#25, ss_sales_price#26]
Condition : (isnotnull(ss_customer_sk#24) AND isnotnull(ss_sold_date_sk#7))

(103) Scan parquet default.date_dim
Output [2]: [d_date_sk#9, d_year#11]
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>

(104) ColumnarToRow [codegen id : 1]
Input [2]: [d_date_sk#9, d_year#11]

(105) Filter [codegen id : 1]
Input [2]: [d_date_sk#9, d_year#11]
Condition : (d_year#11 IN (2000,2001,2002,2003) AND isnotnull(d_date_sk#9))

(106) Project [codegen id : 1]
Output [1]: [d_date_sk#9]
Input [2]: [d_date_sk#9, d_year#11]

(107) BroadcastExchange
Input [1]: [d_date_sk#9]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, true] as bigint)),false), [id=#67]

(108) BroadcastHashJoin [codegen id : 2]
Left keys [1]: [ss_sold_date_sk#7]
Right keys [1]: [d_date_sk#9]
Join condition: None

(109) Project [codegen id : 2]
Output [3]: [ss_customer_sk#24, ss_quantity#25, ss_sales_price#26]
Input [5]: [ss_sold_date_sk#7, ss_customer_sk#24, ss_quantity#25, ss_sales_price#26, d_date_sk#9]

(110) Exchange
Input [3]: [ss_customer_sk#24, ss_quantity#25, ss_sales_price#26]
Arguments: hashpartitioning(ss_customer_sk#24, 5), true, [id=#68]

(111) Sort [codegen id : 3]
Input [3]: [ss_customer_sk#24, ss_quantity#25, ss_sales_price#26]
Arguments: [ss_customer_sk#24 ASC NULLS FIRST], false, 0

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

(113) ColumnarToRow [codegen id : 4]
Input [1]: [c_customer_sk#28]

(114) Filter [codegen id : 4]
Input [1]: [c_customer_sk#28]
Condition : isnotnull(c_customer_sk#28)

(115) Exchange
Input [1]: [c_customer_sk#28]
Arguments: hashpartitioning(c_customer_sk#28, 5), true, [id=#69]

(116) Sort [codegen id : 5]
Input [1]: [c_customer_sk#28]
Arguments: [c_customer_sk#28 ASC NULLS FIRST], false, 0

(117) SortMergeJoin [codegen id : 6]
Left keys [1]: [ss_customer_sk#24]
Right keys [1]: [c_customer_sk#28]
Join condition: None

(118) Project [codegen id : 6]
Output [3]: [ss_quantity#25, ss_sales_price#26, c_customer_sk#28]
Input [4]: [ss_customer_sk#24, ss_quantity#25, ss_sales_price#26, c_customer_sk#28]

(119) HashAggregate [codegen id : 6]
Input [3]: [ss_quantity#25, ss_sales_price#26, c_customer_sk#28]
Keys [1]: [c_customer_sk#28]
Functions [1]: [partial_sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))]
Aggregate Attributes [2]: [sum#70, isEmpty#71]
Results [3]: [c_customer_sk#28, sum#72, isEmpty#73]

(120) HashAggregate [codegen id : 6]
Input [3]: [c_customer_sk#28, sum#72, isEmpty#73]
Keys [1]: [c_customer_sk#28]
Functions [1]: [sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))]
Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))#74]
Results [1]: [sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#25 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#26 as decimal(12,2)))), DecimalType(18,2), true))#74 AS csales#75]

(121) HashAggregate [codegen id : 6]
Input [1]: [csales#75]
Keys: []
Functions [1]: [partial_max(csales#75)]
Aggregate Attributes [1]: [max#76]
Results [1]: [max#77]

(122) Exchange
Input [1]: [max#77]
Arguments: SinglePartition, true, [id=#78]

(123) HashAggregate [codegen id : 7]
Input [1]: [max#77]
Keys: []
Functions [1]: [max(csales#75)]
Aggregate Attributes [1]: [max(csales#75)#79]
Results [1]: [max(csales#75)#79 AS tpcds_cmax#80]

Subquery:2 Hosting operator id = 88 Hosting Expression = ReusedSubquery Subquery scalar-subquery#36, [id=#37]


