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


(1) Scan parquet 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), dynamicpruningexpression(cs_sold_date_sk#5 IN dynamicpruning#6)]
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 default.store_sales
Output [2]: [ss_item_sk#7, ss_sold_date_sk#8]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#8), dynamicpruningexpression(ss_sold_date_sk#8 IN dynamicpruning#9)]
PushedFilters: [IsNotNull(ss_item_sk)]
ReadSchema: struct<ss_item_sk:int>

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

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

(7) ReusedExchange [Reuses operator id: 97]
Output [2]: [d_date_sk#10, d_date#11]

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

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

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

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

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

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

(14) BroadcastHashJoin [codegen id : 3]
Left keys [1]: [ss_item_sk#7]
Right keys [1]: [i_item_sk#12]
Join condition: None

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

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

(17) Exchange
Input [4]: [_groupingexpression#14, i_item_sk#12, d_date#11, count#16]
Arguments: hashpartitioning(_groupingexpression#14, i_item_sk#12, d_date#11, 5), ENSURE_REQUIREMENTS, [plan_id=2]

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

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

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

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

(22) BroadcastHashJoin [codegen id : 5]
Left keys [1]: [cs_item_sk#2]
Right keys [1]: [item_sk#18]
Join condition: None

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

(24) 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=4]

(25) 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

(26) Scan parquet default.store_sales
Output [4]: [ss_customer_sk#20, ss_quantity#21, ss_sales_price#22, ss_sold_date_sk#23]
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)>

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

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

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

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

(31) ColumnarToRow [codegen id : 7]
Input [1]: [c_customer_sk#24]

(32) Filter [codegen id : 7]
Input [1]: [c_customer_sk#24]
Condition : isnotnull(c_customer_sk#24)

(33) BroadcastExchange
Input [1]: [c_customer_sk#24]
Arguments: HashedRelationBroadcastMode(List(cast(input[0, int, false] as bigint)),false), [plan_id=5]

(34) BroadcastHashJoin [codegen id : 8]
Left keys [1]: [ss_customer_sk#20]
Right keys [1]: [c_customer_sk#24]
Join condition: None

(35) Project [codegen id : 8]
Output [3]: [ss_quantity#21, ss_sales_price#22, c_customer_sk#24]
Input [4]: [ss_customer_sk#20, ss_quantity#21, ss_sales_price#22, c_customer_sk#24]

(36) HashAggregate [codegen id : 8]
Input [3]: [ss_quantity#21, ss_sales_price#22, c_customer_sk#24]
Keys [1]: [c_customer_sk#24]
Functions [1]: [partial_sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#21 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#22 as decimal(12,2)))), DecimalType(18,2), true))]
Aggregate Attributes [2]: [sum#25, isEmpty#26]
Results [3]: [c_customer_sk#24, sum#27, isEmpty#28]

(37) Exchange
Input [3]: [c_customer_sk#24, sum#27, isEmpty#28]
Arguments: hashpartitioning(c_customer_sk#24, 5), ENSURE_REQUIREMENTS, [plan_id=6]

(38) HashAggregate [codegen id : 9]
Input [3]: [c_customer_sk#24, sum#27, isEmpty#28]
Keys [1]: [c_customer_sk#24]
Functions [1]: [sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#21 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#22 as decimal(12,2)))), DecimalType(18,2), true))]
Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#21 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#22 as decimal(12,2)))), DecimalType(18,2), true))#29]
Results [2]: [c_customer_sk#24, sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#21 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#22 as decimal(12,2)))), DecimalType(18,2), true))#29 AS ssales#30]

(39) Filter [codegen id : 9]
Input [2]: [c_customer_sk#24, ssales#30]
Condition : (isnotnull(ssales#30) AND (cast(ssales#30 as decimal(38,8)) > CheckOverflow((0.500000 * promote_precision(cast(Subquery scalar-subquery#31, [id=#32] as decimal(32,6)))), DecimalType(38,8), true)))

(40) Project [codegen id : 9]
Output [1]: [c_customer_sk#24]
Input [2]: [c_customer_sk#24, ssales#30]

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

(42) SortMergeJoin [codegen id : 17]
Left keys [1]: [cs_bill_customer_sk#1]
Right keys [1]: [c_customer_sk#24]
Join condition: None

(43) Scan parquet default.customer
Output [3]: [c_customer_sk#33, c_first_name#34, c_last_name#35]
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>

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

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

(46) Exchange
Input [3]: [c_customer_sk#33, c_first_name#34, c_last_name#35]
Arguments: hashpartitioning(c_customer_sk#33, 5), ENSURE_REQUIREMENTS, [plan_id=7]

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

(48) ReusedExchange [Reuses operator id: 37]
Output [3]: [c_customer_sk#24, sum#27, isEmpty#28]

(49) HashAggregate [codegen id : 14]
Input [3]: [c_customer_sk#24, sum#27, isEmpty#28]
Keys [1]: [c_customer_sk#24]
Functions [1]: [sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#21 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#22 as decimal(12,2)))), DecimalType(18,2), true))]
Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#21 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#22 as decimal(12,2)))), DecimalType(18,2), true))#29]
Results [2]: [c_customer_sk#24, sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#21 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#22 as decimal(12,2)))), DecimalType(18,2), true))#29 AS ssales#30]

(50) Filter [codegen id : 14]
Input [2]: [c_customer_sk#24, ssales#30]
Condition : (isnotnull(ssales#30) AND (cast(ssales#30 as decimal(38,8)) > CheckOverflow((0.500000 * promote_precision(cast(ReusedSubquery Subquery scalar-subquery#31, [id=#32] as decimal(32,6)))), DecimalType(38,8), true)))

(51) Project [codegen id : 14]
Output [1]: [c_customer_sk#24]
Input [2]: [c_customer_sk#24, ssales#30]

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

(53) SortMergeJoin [codegen id : 15]
Left keys [1]: [c_customer_sk#33]
Right keys [1]: [c_customer_sk#24]
Join condition: None

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

(55) BroadcastHashJoin [codegen id : 17]
Left keys [1]: [cs_bill_customer_sk#1]
Right keys [1]: [c_customer_sk#33]
Join condition: None

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

(57) ReusedExchange [Reuses operator id: 92]
Output [1]: [d_date_sk#36]

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

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

(60) HashAggregate [codegen id : 17]
Input [4]: [cs_quantity#3, cs_list_price#4, c_first_name#34, c_last_name#35]
Keys [2]: [c_last_name#35, c_first_name#34]
Functions [1]: [partial_sum(CheckOverflow((promote_precision(cast(cast(cs_quantity#3 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(cs_list_price#4 as decimal(12,2)))), DecimalType(18,2), true))]
Aggregate Attributes [2]: [sum#37, isEmpty#38]
Results [4]: [c_last_name#35, c_first_name#34, sum#39, isEmpty#40]

(61) Exchange
Input [4]: [c_last_name#35, c_first_name#34, sum#39, isEmpty#40]
Arguments: hashpartitioning(c_last_name#35, c_first_name#34, 5), ENSURE_REQUIREMENTS, [plan_id=9]

(62) HashAggregate [codegen id : 18]
Input [4]: [c_last_name#35, c_first_name#34, sum#39, isEmpty#40]
Keys [2]: [c_last_name#35, c_first_name#34]
Functions [1]: [sum(CheckOverflow((promote_precision(cast(cast(cs_quantity#3 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(cs_list_price#4 as decimal(12,2)))), DecimalType(18,2), true))]
Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(cast(cast(cs_quantity#3 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(cs_list_price#4 as decimal(12,2)))), DecimalType(18,2), true))#41]
Results [3]: [c_last_name#35, c_first_name#34, sum(CheckOverflow((promote_precision(cast(cast(cs_quantity#3 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(cs_list_price#4 as decimal(12,2)))), DecimalType(18,2), true))#41 AS sales#42]

(63) Scan parquet default.web_sales
Output [5]: [ws_item_sk#43, ws_bill_customer_sk#44, ws_quantity#45, ws_list_price#46, ws_sold_date_sk#47]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ws_sold_date_sk#47), dynamicpruningexpression(ws_sold_date_sk#47 IN dynamicpruning#6)]
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)>

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

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

(66) ReusedExchange [Reuses operator id: 21]
Output [1]: [item_sk#18]

(67) BroadcastHashJoin [codegen id : 23]
Left keys [1]: [ws_item_sk#43]
Right keys [1]: [item_sk#18]
Join condition: None

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

(69) Exchange
Input [4]: [ws_bill_customer_sk#44, ws_quantity#45, ws_list_price#46, ws_sold_date_sk#47]
Arguments: hashpartitioning(ws_bill_customer_sk#44, 5), ENSURE_REQUIREMENTS, [plan_id=10]

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

(71) ReusedExchange [Reuses operator id: 37]
Output [3]: [c_customer_sk#24, sum#27, isEmpty#28]

(72) HashAggregate [codegen id : 27]
Input [3]: [c_customer_sk#24, sum#27, isEmpty#28]
Keys [1]: [c_customer_sk#24]
Functions [1]: [sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#21 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#22 as decimal(12,2)))), DecimalType(18,2), true))]
Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#21 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#22 as decimal(12,2)))), DecimalType(18,2), true))#29]
Results [2]: [c_customer_sk#24, sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#21 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#22 as decimal(12,2)))), DecimalType(18,2), true))#29 AS ssales#30]

(73) Filter [codegen id : 27]
Input [2]: [c_customer_sk#24, ssales#30]
Condition : (isnotnull(ssales#30) AND (cast(ssales#30 as decimal(38,8)) > CheckOverflow((0.500000 * promote_precision(cast(ReusedSubquery Subquery scalar-subquery#31, [id=#32] as decimal(32,6)))), DecimalType(38,8), true)))

(74) Project [codegen id : 27]
Output [1]: [c_customer_sk#24]
Input [2]: [c_customer_sk#24, ssales#30]

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

(76) SortMergeJoin [codegen id : 35]
Left keys [1]: [ws_bill_customer_sk#44]
Right keys [1]: [c_customer_sk#24]
Join condition: None

(77) ReusedExchange [Reuses operator id: 54]
Output [3]: [c_customer_sk#48, c_first_name#49, c_last_name#50]

(78) BroadcastHashJoin [codegen id : 35]
Left keys [1]: [ws_bill_customer_sk#44]
Right keys [1]: [c_customer_sk#48]
Join condition: None

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

(80) ReusedExchange [Reuses operator id: 92]
Output [1]: [d_date_sk#51]

(81) BroadcastHashJoin [codegen id : 35]
Left keys [1]: [ws_sold_date_sk#47]
Right keys [1]: [d_date_sk#51]
Join condition: None

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

(83) HashAggregate [codegen id : 35]
Input [4]: [ws_quantity#45, ws_list_price#46, c_first_name#49, c_last_name#50]
Keys [2]: [c_last_name#50, c_first_name#49]
Functions [1]: [partial_sum(CheckOverflow((promote_precision(cast(cast(ws_quantity#45 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ws_list_price#46 as decimal(12,2)))), DecimalType(18,2), true))]
Aggregate Attributes [2]: [sum#52, isEmpty#53]
Results [4]: [c_last_name#50, c_first_name#49, sum#54, isEmpty#55]

(84) Exchange
Input [4]: [c_last_name#50, c_first_name#49, sum#54, isEmpty#55]
Arguments: hashpartitioning(c_last_name#50, c_first_name#49, 5), ENSURE_REQUIREMENTS, [plan_id=11]

(85) HashAggregate [codegen id : 36]
Input [4]: [c_last_name#50, c_first_name#49, sum#54, isEmpty#55]
Keys [2]: [c_last_name#50, c_first_name#49]
Functions [1]: [sum(CheckOverflow((promote_precision(cast(cast(ws_quantity#45 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ws_list_price#46 as decimal(12,2)))), DecimalType(18,2), true))]
Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(cast(cast(ws_quantity#45 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ws_list_price#46 as decimal(12,2)))), DecimalType(18,2), true))#56]
Results [3]: [c_last_name#50, c_first_name#49, sum(CheckOverflow((promote_precision(cast(cast(ws_quantity#45 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ws_list_price#46 as decimal(12,2)))), DecimalType(18,2), true))#56 AS sales#57]

(86) Union

(87) TakeOrderedAndProject
Input [3]: [c_last_name#35, c_first_name#34, sales#42]
Arguments: 100, [c_last_name#35 ASC NULLS FIRST, c_first_name#34 ASC NULLS FIRST, sales#42 ASC NULLS FIRST], [c_last_name#35, c_first_name#34, sales#42]

===== Subqueries =====

Subquery:1 Hosting operator id = 1 Hosting Expression = cs_sold_date_sk#5 IN dynamicpruning#6
BroadcastExchange (92)
+- * Project (91)
   +- * Filter (90)
      +- * ColumnarToRow (89)
         +- Scan parquet default.date_dim (88)


(88) Scan parquet default.date_dim
Output [3]: [d_date_sk#36, d_year#58, d_moy#59]
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>

(89) ColumnarToRow [codegen id : 1]
Input [3]: [d_date_sk#36, d_year#58, d_moy#59]

(90) Filter [codegen id : 1]
Input [3]: [d_date_sk#36, d_year#58, d_moy#59]
Condition : ((((isnotnull(d_year#58) AND isnotnull(d_moy#59)) AND (d_year#58 = 2000)) AND (d_moy#59 = 2)) AND isnotnull(d_date_sk#36))

(91) Project [codegen id : 1]
Output [1]: [d_date_sk#36]
Input [3]: [d_date_sk#36, d_year#58, d_moy#59]

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

Subquery:2 Hosting operator id = 4 Hosting Expression = ss_sold_date_sk#8 IN dynamicpruning#9
BroadcastExchange (97)
+- * Project (96)
   +- * Filter (95)
      +- * ColumnarToRow (94)
         +- Scan parquet default.date_dim (93)


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

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

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

(96) Project [codegen id : 1]
Output [2]: [d_date_sk#10, d_date#11]
Input [3]: [d_date_sk#10, d_date#11, d_year#60]

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

Subquery:3 Hosting operator id = 39 Hosting Expression = Subquery scalar-subquery#31, [id=#32]
* HashAggregate (112)
+- Exchange (111)
   +- * HashAggregate (110)
      +- * HashAggregate (109)
         +- Exchange (108)
            +- * HashAggregate (107)
               +- * Project (106)
                  +- * BroadcastHashJoin Inner BuildRight (105)
                     :- * Project (103)
                     :  +- * BroadcastHashJoin Inner BuildRight (102)
                     :     :- * Filter (100)
                     :     :  +- * ColumnarToRow (99)
                     :     :     +- Scan parquet default.store_sales (98)
                     :     +- ReusedExchange (101)
                     +- ReusedExchange (104)


(98) Scan parquet default.store_sales
Output [4]: [ss_customer_sk#61, ss_quantity#62, ss_sales_price#63, ss_sold_date_sk#64]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#64), dynamicpruningexpression(ss_sold_date_sk#64 IN dynamicpruning#65)]
PushedFilters: [IsNotNull(ss_customer_sk)]
ReadSchema: struct<ss_customer_sk:int,ss_quantity:int,ss_sales_price:decimal(7,2)>

(99) ColumnarToRow [codegen id : 3]
Input [4]: [ss_customer_sk#61, ss_quantity#62, ss_sales_price#63, ss_sold_date_sk#64]

(100) Filter [codegen id : 3]
Input [4]: [ss_customer_sk#61, ss_quantity#62, ss_sales_price#63, ss_sold_date_sk#64]
Condition : isnotnull(ss_customer_sk#61)

(101) ReusedExchange [Reuses operator id: 33]
Output [1]: [c_customer_sk#66]

(102) BroadcastHashJoin [codegen id : 3]
Left keys [1]: [ss_customer_sk#61]
Right keys [1]: [c_customer_sk#66]
Join condition: None

(103) Project [codegen id : 3]
Output [4]: [ss_quantity#62, ss_sales_price#63, ss_sold_date_sk#64, c_customer_sk#66]
Input [5]: [ss_customer_sk#61, ss_quantity#62, ss_sales_price#63, ss_sold_date_sk#64, c_customer_sk#66]

(104) ReusedExchange [Reuses operator id: 117]
Output [1]: [d_date_sk#67]

(105) BroadcastHashJoin [codegen id : 3]
Left keys [1]: [ss_sold_date_sk#64]
Right keys [1]: [d_date_sk#67]
Join condition: None

(106) Project [codegen id : 3]
Output [3]: [ss_quantity#62, ss_sales_price#63, c_customer_sk#66]
Input [5]: [ss_quantity#62, ss_sales_price#63, ss_sold_date_sk#64, c_customer_sk#66, d_date_sk#67]

(107) HashAggregate [codegen id : 3]
Input [3]: [ss_quantity#62, ss_sales_price#63, c_customer_sk#66]
Keys [1]: [c_customer_sk#66]
Functions [1]: [partial_sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#62 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#63 as decimal(12,2)))), DecimalType(18,2), true))]
Aggregate Attributes [2]: [sum#68, isEmpty#69]
Results [3]: [c_customer_sk#66, sum#70, isEmpty#71]

(108) Exchange
Input [3]: [c_customer_sk#66, sum#70, isEmpty#71]
Arguments: hashpartitioning(c_customer_sk#66, 5), ENSURE_REQUIREMENTS, [plan_id=14]

(109) HashAggregate [codegen id : 4]
Input [3]: [c_customer_sk#66, sum#70, isEmpty#71]
Keys [1]: [c_customer_sk#66]
Functions [1]: [sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#62 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#63 as decimal(12,2)))), DecimalType(18,2), true))]
Aggregate Attributes [1]: [sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#62 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#63 as decimal(12,2)))), DecimalType(18,2), true))#72]
Results [1]: [sum(CheckOverflow((promote_precision(cast(cast(ss_quantity#62 as decimal(10,0)) as decimal(12,2))) * promote_precision(cast(ss_sales_price#63 as decimal(12,2)))), DecimalType(18,2), true))#72 AS csales#73]

(110) HashAggregate [codegen id : 4]
Input [1]: [csales#73]
Keys: []
Functions [1]: [partial_max(csales#73)]
Aggregate Attributes [1]: [max#74]
Results [1]: [max#75]

(111) Exchange
Input [1]: [max#75]
Arguments: SinglePartition, ENSURE_REQUIREMENTS, [plan_id=15]

(112) HashAggregate [codegen id : 5]
Input [1]: [max#75]
Keys: []
Functions [1]: [max(csales#73)]
Aggregate Attributes [1]: [max(csales#73)#76]
Results [1]: [max(csales#73)#76 AS tpcds_cmax#77]

Subquery:4 Hosting operator id = 98 Hosting Expression = ss_sold_date_sk#64 IN dynamicpruning#65
BroadcastExchange (117)
+- * Project (116)
   +- * Filter (115)
      +- * ColumnarToRow (114)
         +- Scan parquet default.date_dim (113)


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

(114) ColumnarToRow [codegen id : 1]
Input [2]: [d_date_sk#67, d_year#78]

(115) Filter [codegen id : 1]
Input [2]: [d_date_sk#67, d_year#78]
Condition : (d_year#78 IN (2000,2001,2002,2003) AND isnotnull(d_date_sk#67))

(116) Project [codegen id : 1]
Output [1]: [d_date_sk#67]
Input [2]: [d_date_sk#67, d_year#78]

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

Subquery:5 Hosting operator id = 50 Hosting Expression = ReusedSubquery Subquery scalar-subquery#31, [id=#32]

Subquery:6 Hosting operator id = 63 Hosting Expression = ws_sold_date_sk#47 IN dynamicpruning#6

Subquery:7 Hosting operator id = 73 Hosting Expression = ReusedSubquery Subquery scalar-subquery#31, [id=#32]


