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


(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), 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 : 1]
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 : 1]
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) Exchange
Input [5]: [cs_bill_customer_sk#1, cs_item_sk#2, cs_quantity#3, cs_list_price#4, cs_sold_date_sk#5]
Arguments: hashpartitioning(cs_item_sk#2, 5), ENSURE_REQUIREMENTS, [plan_id=1]

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

(6) Scan parquet spark_catalog.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>

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

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

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

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

(11) Project [codegen id : 4]
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]

(12) Exchange
Input [2]: [ss_item_sk#7, d_date#11]
Arguments: hashpartitioning(ss_item_sk#7, 5), ENSURE_REQUIREMENTS, [plan_id=2]

(13) Sort [codegen id : 5]
Input [2]: [ss_item_sk#7, d_date#11]
Arguments: [ss_item_sk#7 ASC NULLS FIRST], false, 0

(14) Scan parquet spark_catalog.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>

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

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

(17) Exchange
Input [2]: [i_item_sk#12, i_item_desc#13]
Arguments: hashpartitioning(i_item_sk#12, 5), ENSURE_REQUIREMENTS, [plan_id=3]

(18) Sort [codegen id : 7]
Input [2]: [i_item_sk#12, i_item_desc#13]
Arguments: [i_item_sk#12 ASC NULLS FIRST], false, 0

(19) SortMergeJoin [codegen id : 8]
Left keys [1]: [ss_item_sk#7]
Right keys [1]: [i_item_sk#12]
Join type: Inner
Join condition: None

(20) Project [codegen id : 8]
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]

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

(22) Filter [codegen id : 8]
Input [2]: [item_sk#16, cnt#17]
Condition : (cnt#17 > 4)

(23) Project [codegen id : 8]
Output [1]: [item_sk#16]
Input [2]: [item_sk#16, cnt#17]

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

(25) SortMergeJoin [codegen id : 9]
Left keys [1]: [cs_item_sk#2]
Right keys [1]: [item_sk#16]
Join type: LeftSemi
Join condition: None

(26) Project [codegen id : 9]
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]

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

(28) Sort [codegen id : 10]
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

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

(30) ColumnarToRow [codegen id : 11]
Input [4]: [ss_customer_sk#18, ss_quantity#19, ss_sales_price#20, ss_sold_date_sk#21]

(31) Filter [codegen id : 11]
Input [4]: [ss_customer_sk#18, ss_quantity#19, ss_sales_price#20, ss_sold_date_sk#21]
Condition : isnotnull(ss_customer_sk#18)

(32) Project [codegen id : 11]
Output [3]: [ss_customer_sk#18, ss_quantity#19, ss_sales_price#20]
Input [4]: [ss_customer_sk#18, ss_quantity#19, ss_sales_price#20, ss_sold_date_sk#21]

(33) Exchange
Input [3]: [ss_customer_sk#18, ss_quantity#19, ss_sales_price#20]
Arguments: hashpartitioning(ss_customer_sk#18, 5), ENSURE_REQUIREMENTS, [plan_id=5]

(34) Sort [codegen id : 12]
Input [3]: [ss_customer_sk#18, ss_quantity#19, ss_sales_price#20]
Arguments: [ss_customer_sk#18 ASC NULLS FIRST], false, 0

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

(36) ColumnarToRow [codegen id : 13]
Input [1]: [c_customer_sk#22]

(37) Filter [codegen id : 13]
Input [1]: [c_customer_sk#22]
Condition : isnotnull(c_customer_sk#22)

(38) Exchange
Input [1]: [c_customer_sk#22]
Arguments: hashpartitioning(c_customer_sk#22, 5), ENSURE_REQUIREMENTS, [plan_id=6]

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

(40) SortMergeJoin [codegen id : 15]
Left keys [1]: [ss_customer_sk#18]
Right keys [1]: [c_customer_sk#22]
Join type: Inner
Join condition: None

(41) Project [codegen id : 15]
Output [3]: [ss_quantity#19, ss_sales_price#20, c_customer_sk#22]
Input [4]: [ss_customer_sk#18, ss_quantity#19, ss_sales_price#20, c_customer_sk#22]

(42) SortAggregate [codegen id : 15]
Input [3]: [ss_quantity#19, ss_sales_price#20, c_customer_sk#22]
Keys [1]: [c_customer_sk#22]
Functions [1]: [sum((cast(ss_quantity#19 as decimal(10,0)) * ss_sales_price#20))]
Aggregate Attributes [1]: [sum((cast(ss_quantity#19 as decimal(10,0)) * ss_sales_price#20))#23]
Results [2]: [c_customer_sk#22, sum((cast(ss_quantity#19 as decimal(10,0)) * ss_sales_price#20))#23 AS ssales#24]

(43) Filter [codegen id : 15]
Input [2]: [c_customer_sk#22, ssales#24]
Condition : (isnotnull(ssales#24) AND (cast(ssales#24 as decimal(38,8)) > (0.500000 * Subquery scalar-subquery#25, [id=#7])))

(44) Project [codegen id : 15]
Output [1]: [c_customer_sk#22]
Input [2]: [c_customer_sk#22, ssales#24]

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

(46) ReusedExchange [Reuses operator id: 124]
Output [1]: [d_date_sk#26]

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

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

(49) Scan parquet spark_catalog.default.customer
Output [3]: [c_customer_sk#27, c_first_name#28, c_last_name#29]
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>

(50) ColumnarToRow [codegen id : 18]
Input [3]: [c_customer_sk#27, c_first_name#28, c_last_name#29]

(51) Filter [codegen id : 18]
Input [3]: [c_customer_sk#27, c_first_name#28, c_last_name#29]
Condition : isnotnull(c_customer_sk#27)

(52) Exchange
Input [3]: [c_customer_sk#27, c_first_name#28, c_last_name#29]
Arguments: hashpartitioning(c_customer_sk#27, 5), ENSURE_REQUIREMENTS, [plan_id=8]

(53) Sort [codegen id : 19]
Input [3]: [c_customer_sk#27, c_first_name#28, c_last_name#29]
Arguments: [c_customer_sk#27 ASC NULLS FIRST], false, 0

(54) ReusedExchange [Reuses operator id: 33]
Output [3]: [ss_customer_sk#18, ss_quantity#19, ss_sales_price#20]

(55) Sort [codegen id : 21]
Input [3]: [ss_customer_sk#18, ss_quantity#19, ss_sales_price#20]
Arguments: [ss_customer_sk#18 ASC NULLS FIRST], false, 0

(56) ReusedExchange [Reuses operator id: 38]
Output [1]: [c_customer_sk#22]

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

(58) SortMergeJoin [codegen id : 24]
Left keys [1]: [ss_customer_sk#18]
Right keys [1]: [c_customer_sk#22]
Join type: Inner
Join condition: None

(59) Project [codegen id : 24]
Output [3]: [ss_quantity#19, ss_sales_price#20, c_customer_sk#22]
Input [4]: [ss_customer_sk#18, ss_quantity#19, ss_sales_price#20, c_customer_sk#22]

(60) SortAggregate [codegen id : 24]
Input [3]: [ss_quantity#19, ss_sales_price#20, c_customer_sk#22]
Keys [1]: [c_customer_sk#22]
Functions [1]: [sum((cast(ss_quantity#19 as decimal(10,0)) * ss_sales_price#20))]
Aggregate Attributes [1]: [sum((cast(ss_quantity#19 as decimal(10,0)) * ss_sales_price#20))#23]
Results [2]: [c_customer_sk#22, sum((cast(ss_quantity#19 as decimal(10,0)) * ss_sales_price#20))#23 AS ssales#24]

(61) Filter [codegen id : 24]
Input [2]: [c_customer_sk#22, ssales#24]
Condition : (isnotnull(ssales#24) AND (cast(ssales#24 as decimal(38,8)) > (0.500000 * ReusedSubquery Subquery scalar-subquery#25, [id=#7])))

(62) Project [codegen id : 24]
Output [1]: [c_customer_sk#22]
Input [2]: [c_customer_sk#22, ssales#24]

(63) SortMergeJoin [codegen id : 25]
Left keys [1]: [c_customer_sk#27]
Right keys [1]: [c_customer_sk#22]
Join type: LeftSemi
Join condition: None

(64) SortMergeJoin [codegen id : 26]
Left keys [1]: [cs_bill_customer_sk#1]
Right keys [1]: [c_customer_sk#27]
Join type: Inner
Join condition: None

(65) Project [codegen id : 26]
Output [4]: [cs_quantity#3, cs_list_price#4, c_first_name#28, c_last_name#29]
Input [6]: [cs_bill_customer_sk#1, cs_quantity#3, cs_list_price#4, c_customer_sk#27, c_first_name#28, c_last_name#29]

(66) HashAggregate [codegen id : 26]
Input [4]: [cs_quantity#3, cs_list_price#4, c_first_name#28, c_last_name#29]
Keys [2]: [c_last_name#29, c_first_name#28]
Functions [1]: [partial_sum((cast(cs_quantity#3 as decimal(10,0)) * cs_list_price#4))]
Aggregate Attributes [2]: [sum#30, isEmpty#31]
Results [4]: [c_last_name#29, c_first_name#28, sum#32, isEmpty#33]

(67) Exchange
Input [4]: [c_last_name#29, c_first_name#28, sum#32, isEmpty#33]
Arguments: hashpartitioning(c_last_name#29, c_first_name#28, 5), ENSURE_REQUIREMENTS, [plan_id=9]

(68) HashAggregate [codegen id : 27]
Input [4]: [c_last_name#29, c_first_name#28, sum#32, isEmpty#33]
Keys [2]: [c_last_name#29, c_first_name#28]
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))#34]
Results [3]: [c_last_name#29, c_first_name#28, sum((cast(cs_quantity#3 as decimal(10,0)) * cs_list_price#4))#34 AS sales#35]

(69) Scan parquet spark_catalog.default.web_sales
Output [5]: [ws_item_sk#36, ws_bill_customer_sk#37, ws_quantity#38, ws_list_price#39, ws_sold_date_sk#40]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ws_sold_date_sk#40), dynamicpruningexpression(ws_sold_date_sk#40 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)>

(70) ColumnarToRow [codegen id : 28]
Input [5]: [ws_item_sk#36, ws_bill_customer_sk#37, ws_quantity#38, ws_list_price#39, ws_sold_date_sk#40]

(71) Filter [codegen id : 28]
Input [5]: [ws_item_sk#36, ws_bill_customer_sk#37, ws_quantity#38, ws_list_price#39, ws_sold_date_sk#40]
Condition : isnotnull(ws_bill_customer_sk#37)

(72) Exchange
Input [5]: [ws_item_sk#36, ws_bill_customer_sk#37, ws_quantity#38, ws_list_price#39, ws_sold_date_sk#40]
Arguments: hashpartitioning(ws_item_sk#36, 5), ENSURE_REQUIREMENTS, [plan_id=10]

(73) Sort [codegen id : 29]
Input [5]: [ws_item_sk#36, ws_bill_customer_sk#37, ws_quantity#38, ws_list_price#39, ws_sold_date_sk#40]
Arguments: [ws_item_sk#36 ASC NULLS FIRST], false, 0

(74) ReusedExchange [Reuses operator id: 12]
Output [2]: [ss_item_sk#41, d_date#42]

(75) Sort [codegen id : 32]
Input [2]: [ss_item_sk#41, d_date#42]
Arguments: [ss_item_sk#41 ASC NULLS FIRST], false, 0

(76) ReusedExchange [Reuses operator id: 17]
Output [2]: [i_item_sk#43, i_item_desc#44]

(77) Sort [codegen id : 34]
Input [2]: [i_item_sk#43, i_item_desc#44]
Arguments: [i_item_sk#43 ASC NULLS FIRST], false, 0

(78) SortMergeJoin [codegen id : 35]
Left keys [1]: [ss_item_sk#41]
Right keys [1]: [i_item_sk#43]
Join type: Inner
Join condition: None

(79) Project [codegen id : 35]
Output [3]: [d_date#42, i_item_sk#43, substr(i_item_desc#44, 1, 30) AS _groupingexpression#45]
Input [4]: [ss_item_sk#41, d_date#42, i_item_sk#43, i_item_desc#44]

(80) HashAggregate [codegen id : 35]
Input [3]: [d_date#42, i_item_sk#43, _groupingexpression#45]
Keys [3]: [_groupingexpression#45, i_item_sk#43, d_date#42]
Functions [1]: [count(1)]
Aggregate Attributes [1]: [count(1)#15]
Results [2]: [i_item_sk#43 AS item_sk#46, count(1)#15 AS cnt#47]

(81) Filter [codegen id : 35]
Input [2]: [item_sk#46, cnt#47]
Condition : (cnt#47 > 4)

(82) Project [codegen id : 35]
Output [1]: [item_sk#46]
Input [2]: [item_sk#46, cnt#47]

(83) Sort [codegen id : 35]
Input [1]: [item_sk#46]
Arguments: [item_sk#46 ASC NULLS FIRST], false, 0

(84) SortMergeJoin [codegen id : 36]
Left keys [1]: [ws_item_sk#36]
Right keys [1]: [item_sk#46]
Join type: LeftSemi
Join condition: None

(85) Project [codegen id : 36]
Output [4]: [ws_bill_customer_sk#37, ws_quantity#38, ws_list_price#39, ws_sold_date_sk#40]
Input [5]: [ws_item_sk#36, ws_bill_customer_sk#37, ws_quantity#38, ws_list_price#39, ws_sold_date_sk#40]

(86) Exchange
Input [4]: [ws_bill_customer_sk#37, ws_quantity#38, ws_list_price#39, ws_sold_date_sk#40]
Arguments: hashpartitioning(ws_bill_customer_sk#37, 5), ENSURE_REQUIREMENTS, [plan_id=11]

(87) Sort [codegen id : 37]
Input [4]: [ws_bill_customer_sk#37, ws_quantity#38, ws_list_price#39, ws_sold_date_sk#40]
Arguments: [ws_bill_customer_sk#37 ASC NULLS FIRST], false, 0

(88) ReusedExchange [Reuses operator id: 33]
Output [3]: [ss_customer_sk#48, ss_quantity#49, ss_sales_price#50]

(89) Sort [codegen id : 39]
Input [3]: [ss_customer_sk#48, ss_quantity#49, ss_sales_price#50]
Arguments: [ss_customer_sk#48 ASC NULLS FIRST], false, 0

(90) ReusedExchange [Reuses operator id: 38]
Output [1]: [c_customer_sk#51]

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

(92) SortMergeJoin [codegen id : 42]
Left keys [1]: [ss_customer_sk#48]
Right keys [1]: [c_customer_sk#51]
Join type: Inner
Join condition: None

(93) Project [codegen id : 42]
Output [3]: [ss_quantity#49, ss_sales_price#50, c_customer_sk#51]
Input [4]: [ss_customer_sk#48, ss_quantity#49, ss_sales_price#50, c_customer_sk#51]

(94) SortAggregate [codegen id : 42]
Input [3]: [ss_quantity#49, ss_sales_price#50, c_customer_sk#51]
Keys [1]: [c_customer_sk#51]
Functions [1]: [sum((cast(ss_quantity#49 as decimal(10,0)) * ss_sales_price#50))]
Aggregate Attributes [1]: [sum((cast(ss_quantity#49 as decimal(10,0)) * ss_sales_price#50))#23]
Results [2]: [c_customer_sk#51, sum((cast(ss_quantity#49 as decimal(10,0)) * ss_sales_price#50))#23 AS ssales#52]

(95) Filter [codegen id : 42]
Input [2]: [c_customer_sk#51, ssales#52]
Condition : (isnotnull(ssales#52) AND (cast(ssales#52 as decimal(38,8)) > (0.500000 * ReusedSubquery Subquery scalar-subquery#25, [id=#7])))

(96) Project [codegen id : 42]
Output [1]: [c_customer_sk#51]
Input [2]: [c_customer_sk#51, ssales#52]

(97) SortMergeJoin [codegen id : 44]
Left keys [1]: [ws_bill_customer_sk#37]
Right keys [1]: [c_customer_sk#51]
Join type: LeftSemi
Join condition: None

(98) ReusedExchange [Reuses operator id: 124]
Output [1]: [d_date_sk#53]

(99) BroadcastHashJoin [codegen id : 44]
Left keys [1]: [ws_sold_date_sk#40]
Right keys [1]: [d_date_sk#53]
Join type: Inner
Join condition: None

(100) Project [codegen id : 44]
Output [3]: [ws_bill_customer_sk#37, ws_quantity#38, ws_list_price#39]
Input [5]: [ws_bill_customer_sk#37, ws_quantity#38, ws_list_price#39, ws_sold_date_sk#40, d_date_sk#53]

(101) ReusedExchange [Reuses operator id: 52]
Output [3]: [c_customer_sk#54, c_first_name#55, c_last_name#56]

(102) Sort [codegen id : 46]
Input [3]: [c_customer_sk#54, c_first_name#55, c_last_name#56]
Arguments: [c_customer_sk#54 ASC NULLS FIRST], false, 0

(103) ReusedExchange [Reuses operator id: 33]
Output [3]: [ss_customer_sk#48, ss_quantity#49, ss_sales_price#50]

(104) Sort [codegen id : 48]
Input [3]: [ss_customer_sk#48, ss_quantity#49, ss_sales_price#50]
Arguments: [ss_customer_sk#48 ASC NULLS FIRST], false, 0

(105) ReusedExchange [Reuses operator id: 38]
Output [1]: [c_customer_sk#51]

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

(107) SortMergeJoin [codegen id : 51]
Left keys [1]: [ss_customer_sk#48]
Right keys [1]: [c_customer_sk#51]
Join type: Inner
Join condition: None

(108) Project [codegen id : 51]
Output [3]: [ss_quantity#49, ss_sales_price#50, c_customer_sk#51]
Input [4]: [ss_customer_sk#48, ss_quantity#49, ss_sales_price#50, c_customer_sk#51]

(109) SortAggregate [codegen id : 51]
Input [3]: [ss_quantity#49, ss_sales_price#50, c_customer_sk#51]
Keys [1]: [c_customer_sk#51]
Functions [1]: [sum((cast(ss_quantity#49 as decimal(10,0)) * ss_sales_price#50))]
Aggregate Attributes [1]: [sum((cast(ss_quantity#49 as decimal(10,0)) * ss_sales_price#50))#23]
Results [2]: [c_customer_sk#51, sum((cast(ss_quantity#49 as decimal(10,0)) * ss_sales_price#50))#23 AS ssales#52]

(110) Filter [codegen id : 51]
Input [2]: [c_customer_sk#51, ssales#52]
Condition : (isnotnull(ssales#52) AND (cast(ssales#52 as decimal(38,8)) > (0.500000 * ReusedSubquery Subquery scalar-subquery#25, [id=#7])))

(111) Project [codegen id : 51]
Output [1]: [c_customer_sk#51]
Input [2]: [c_customer_sk#51, ssales#52]

(112) SortMergeJoin [codegen id : 52]
Left keys [1]: [c_customer_sk#54]
Right keys [1]: [c_customer_sk#51]
Join type: LeftSemi
Join condition: None

(113) SortMergeJoin [codegen id : 53]
Left keys [1]: [ws_bill_customer_sk#37]
Right keys [1]: [c_customer_sk#54]
Join type: Inner
Join condition: None

(114) Project [codegen id : 53]
Output [4]: [ws_quantity#38, ws_list_price#39, c_first_name#55, c_last_name#56]
Input [6]: [ws_bill_customer_sk#37, ws_quantity#38, ws_list_price#39, c_customer_sk#54, c_first_name#55, c_last_name#56]

(115) HashAggregate [codegen id : 53]
Input [4]: [ws_quantity#38, ws_list_price#39, c_first_name#55, c_last_name#56]
Keys [2]: [c_last_name#56, c_first_name#55]
Functions [1]: [partial_sum((cast(ws_quantity#38 as decimal(10,0)) * ws_list_price#39))]
Aggregate Attributes [2]: [sum#57, isEmpty#58]
Results [4]: [c_last_name#56, c_first_name#55, sum#59, isEmpty#60]

(116) Exchange
Input [4]: [c_last_name#56, c_first_name#55, sum#59, isEmpty#60]
Arguments: hashpartitioning(c_last_name#56, c_first_name#55, 5), ENSURE_REQUIREMENTS, [plan_id=12]

(117) HashAggregate [codegen id : 54]
Input [4]: [c_last_name#56, c_first_name#55, sum#59, isEmpty#60]
Keys [2]: [c_last_name#56, c_first_name#55]
Functions [1]: [sum((cast(ws_quantity#38 as decimal(10,0)) * ws_list_price#39))]
Aggregate Attributes [1]: [sum((cast(ws_quantity#38 as decimal(10,0)) * ws_list_price#39))#61]
Results [3]: [c_last_name#56, c_first_name#55, sum((cast(ws_quantity#38 as decimal(10,0)) * ws_list_price#39))#61 AS sales#62]

(118) Union

(119) TakeOrderedAndProject
Input [3]: [c_last_name#29, c_first_name#28, sales#35]
Arguments: 100, [c_last_name#29 ASC NULLS FIRST, c_first_name#28 ASC NULLS FIRST, sales#35 ASC NULLS FIRST], [c_last_name#29, c_first_name#28, sales#35]

===== Subqueries =====

Subquery:1 Hosting operator id = 1 Hosting Expression = cs_sold_date_sk#5 IN dynamicpruning#6
BroadcastExchange (124)
+- * Project (123)
   +- * Filter (122)
      +- * ColumnarToRow (121)
         +- Scan parquet spark_catalog.default.date_dim (120)


(120) Scan parquet spark_catalog.default.date_dim
Output [3]: [d_date_sk#26, d_year#63, d_moy#64]
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>

(121) ColumnarToRow [codegen id : 1]
Input [3]: [d_date_sk#26, d_year#63, d_moy#64]

(122) Filter [codegen id : 1]
Input [3]: [d_date_sk#26, d_year#63, d_moy#64]
Condition : ((((isnotnull(d_year#63) AND isnotnull(d_moy#64)) AND (d_year#63 = 2000)) AND (d_moy#64 = 2)) AND isnotnull(d_date_sk#26))

(123) Project [codegen id : 1]
Output [1]: [d_date_sk#26]
Input [3]: [d_date_sk#26, d_year#63, d_moy#64]

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

Subquery:2 Hosting operator id = 6 Hosting Expression = ss_sold_date_sk#8 IN dynamicpruning#9
BroadcastExchange (129)
+- * Project (128)
   +- * Filter (127)
      +- * ColumnarToRow (126)
         +- Scan parquet spark_catalog.default.date_dim (125)


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

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

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

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

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

Subquery:3 Hosting operator id = 43 Hosting Expression = Subquery scalar-subquery#25, [id=#7]
* HashAggregate (145)
+- Exchange (144)
   +- * HashAggregate (143)
      +- * SortAggregate (142)
         +- * Project (141)
            +- * SortMergeJoin Inner (140)
               :- * Sort (137)
               :  +- Exchange (136)
               :     +- * Project (135)
               :        +- * BroadcastHashJoin Inner BuildRight (134)
               :           :- * Filter (132)
               :           :  +- * ColumnarToRow (131)
               :           :     +- Scan parquet spark_catalog.default.store_sales (130)
               :           +- ReusedExchange (133)
               +- * Sort (139)
                  +- ReusedExchange (138)


(130) Scan parquet spark_catalog.default.store_sales
Output [4]: [ss_customer_sk#66, ss_quantity#67, ss_sales_price#68, ss_sold_date_sk#69]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#69), dynamicpruningexpression(ss_sold_date_sk#69 IN dynamicpruning#70)]
PushedFilters: [IsNotNull(ss_customer_sk)]
ReadSchema: struct<ss_customer_sk:int,ss_quantity:int,ss_sales_price:decimal(7,2)>

(131) ColumnarToRow [codegen id : 2]
Input [4]: [ss_customer_sk#66, ss_quantity#67, ss_sales_price#68, ss_sold_date_sk#69]

(132) Filter [codegen id : 2]
Input [4]: [ss_customer_sk#66, ss_quantity#67, ss_sales_price#68, ss_sold_date_sk#69]
Condition : isnotnull(ss_customer_sk#66)

(133) ReusedExchange [Reuses operator id: 150]
Output [1]: [d_date_sk#71]

(134) BroadcastHashJoin [codegen id : 2]
Left keys [1]: [ss_sold_date_sk#69]
Right keys [1]: [d_date_sk#71]
Join type: Inner
Join condition: None

(135) Project [codegen id : 2]
Output [3]: [ss_customer_sk#66, ss_quantity#67, ss_sales_price#68]
Input [5]: [ss_customer_sk#66, ss_quantity#67, ss_sales_price#68, ss_sold_date_sk#69, d_date_sk#71]

(136) Exchange
Input [3]: [ss_customer_sk#66, ss_quantity#67, ss_sales_price#68]
Arguments: hashpartitioning(ss_customer_sk#66, 5), ENSURE_REQUIREMENTS, [plan_id=15]

(137) Sort [codegen id : 3]
Input [3]: [ss_customer_sk#66, ss_quantity#67, ss_sales_price#68]
Arguments: [ss_customer_sk#66 ASC NULLS FIRST], false, 0

(138) ReusedExchange [Reuses operator id: 38]
Output [1]: [c_customer_sk#72]

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

(140) SortMergeJoin [codegen id : 6]
Left keys [1]: [ss_customer_sk#66]
Right keys [1]: [c_customer_sk#72]
Join type: Inner
Join condition: None

(141) Project [codegen id : 6]
Output [3]: [ss_quantity#67, ss_sales_price#68, c_customer_sk#72]
Input [4]: [ss_customer_sk#66, ss_quantity#67, ss_sales_price#68, c_customer_sk#72]

(142) SortAggregate [codegen id : 6]
Input [3]: [ss_quantity#67, ss_sales_price#68, c_customer_sk#72]
Keys [1]: [c_customer_sk#72]
Functions [1]: [sum((cast(ss_quantity#67 as decimal(10,0)) * ss_sales_price#68))]
Aggregate Attributes [1]: [sum((cast(ss_quantity#67 as decimal(10,0)) * ss_sales_price#68))#73]
Results [1]: [sum((cast(ss_quantity#67 as decimal(10,0)) * ss_sales_price#68))#73 AS csales#74]

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

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

(145) HashAggregate [codegen id : 7]
Input [1]: [max#76]
Keys: []
Functions [1]: [max(csales#74)]
Aggregate Attributes [1]: [max(csales#74)#77]
Results [1]: [max(csales#74)#77 AS tpcds_cmax#78]

Subquery:4 Hosting operator id = 130 Hosting Expression = ss_sold_date_sk#69 IN dynamicpruning#70
BroadcastExchange (150)
+- * Project (149)
   +- * Filter (148)
      +- * ColumnarToRow (147)
         +- Scan parquet spark_catalog.default.date_dim (146)


(146) Scan parquet spark_catalog.default.date_dim
Output [2]: [d_date_sk#71, d_year#79]
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>

(147) ColumnarToRow [codegen id : 1]
Input [2]: [d_date_sk#71, d_year#79]

(148) Filter [codegen id : 1]
Input [2]: [d_date_sk#71, d_year#79]
Condition : (d_year#79 IN (2000,2001,2002,2003) AND isnotnull(d_date_sk#71))

(149) Project [codegen id : 1]
Output [1]: [d_date_sk#71]
Input [2]: [d_date_sk#71, d_year#79]

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

Subquery:5 Hosting operator id = 61 Hosting Expression = ReusedSubquery Subquery scalar-subquery#25, [id=#7]

Subquery:6 Hosting operator id = 69 Hosting Expression = ws_sold_date_sk#40 IN dynamicpruning#6

Subquery:7 Hosting operator id = 95 Hosting Expression = ReusedSubquery Subquery scalar-subquery#25, [id=#7]

Subquery:8 Hosting operator id = 110 Hosting Expression = ReusedSubquery Subquery scalar-subquery#25, [id=#7]


