== Physical Plan ==
TakeOrderedAndProject (129)
+- Union (128)
   :- * HashAggregate (73)
   :  +- Exchange (72)
   :     +- * HashAggregate (71)
   :        +- * Project (70)
   :           +- * SortMergeJoin Inner (69)
   :              :- * Project (51)
   :              :  +- * BroadcastHashJoin Inner BuildRight (50)
   :              :     :- * SortMergeJoin LeftSemi (48)
   :              :     :  :- * Sort (29)
   :              :     :  :  +- Exchange (28)
   :              :     :  :     +- * Project (27)
   :              :     :  :        +- * SortMergeJoin LeftSemi (26)
   :              :     :  :           :- * Sort (5)
   :              :     :  :           :  +- Exchange (4)
   :              :     :  :           :     +- * Filter (3)
   :              :     :  :           :        +- * ColumnarToRow (2)
   :              :     :  :           :           +- Scan parquet spark_catalog.default.catalog_sales (1)
   :              :     :  :           +- * Sort (25)
   :              :     :  :              +- * Project (24)
   :              :     :  :                 +- * Filter (23)
   :              :     :  :                    +- * HashAggregate (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)
   :              :     :  +- * Sort (47)
   :              :     :     +- * Project (46)
   :              :     :        +- * Filter (45)
   :              :     :           +- * HashAggregate (44)
   :              :     :              +- * HashAggregate (43)
   :              :     :                 +- * Project (42)
   :              :     :                    +- * SortMergeJoin Inner (41)
   :              :     :                       :- * Sort (35)
   :              :     :                       :  +- Exchange (34)
   :              :     :                       :     +- * Project (33)
   :              :     :                       :        +- * Filter (32)
   :              :     :                       :           +- * ColumnarToRow (31)
   :              :     :                       :              +- Scan parquet spark_catalog.default.store_sales (30)
   :              :     :                       +- * Sort (40)
   :              :     :                          +- Exchange (39)
   :              :     :                             +- * Filter (38)
   :              :     :                                +- * ColumnarToRow (37)
   :              :     :                                   +- Scan parquet spark_catalog.default.customer (36)
   :              :     +- ReusedExchange (49)
   :              +- * SortMergeJoin LeftSemi (68)
   :                 :- * Sort (56)
   :                 :  +- Exchange (55)
   :                 :     +- * Filter (54)
   :                 :        +- * ColumnarToRow (53)
   :                 :           +- Scan parquet spark_catalog.default.customer (52)
   :                 +- * Sort (67)
   :                    +- * Project (66)
   :                       +- * Filter (65)
   :                          +- * HashAggregate (64)
   :                             +- * HashAggregate (63)
   :                                +- * Project (62)
   :                                   +- * SortMergeJoin Inner (61)
   :                                      :- * Sort (58)
   :                                      :  +- ReusedExchange (57)
   :                                      +- * Sort (60)
   :                                         +- ReusedExchange (59)
   +- * HashAggregate (127)
      +- Exchange (126)
         +- * HashAggregate (125)
            +- * Project (124)
               +- * SortMergeJoin Inner (123)
                  :- * Project (108)
                  :  +- * BroadcastHashJoin Inner BuildRight (107)
                  :     :- * SortMergeJoin LeftSemi (105)
                  :     :  :- * Sort (93)
                  :     :  :  +- Exchange (92)
                  :     :  :     +- * Project (91)
                  :     :  :        +- * SortMergeJoin LeftSemi (90)
                  :     :  :           :- * Sort (78)
                  :     :  :           :  +- Exchange (77)
                  :     :  :           :     +- * Filter (76)
                  :     :  :           :        +- * ColumnarToRow (75)
                  :     :  :           :           +- Scan parquet spark_catalog.default.web_sales (74)
                  :     :  :           +- * Sort (89)
                  :     :  :              +- * Project (88)
                  :     :  :                 +- * Filter (87)
                  :     :  :                    +- * HashAggregate (86)
                  :     :  :                       +- * HashAggregate (85)
                  :     :  :                          +- * Project (84)
                  :     :  :                             +- * SortMergeJoin Inner (83)
                  :     :  :                                :- * Sort (80)
                  :     :  :                                :  +- ReusedExchange (79)
                  :     :  :                                +- * Sort (82)
                  :     :  :                                   +- ReusedExchange (81)
                  :     :  +- * Sort (104)
                  :     :     +- * Project (103)
                  :     :        +- * Filter (102)
                  :     :           +- * HashAggregate (101)
                  :     :              +- * HashAggregate (100)
                  :     :                 +- * Project (99)
                  :     :                    +- * SortMergeJoin Inner (98)
                  :     :                       :- * Sort (95)
                  :     :                       :  +- ReusedExchange (94)
                  :     :                       +- * Sort (97)
                  :     :                          +- ReusedExchange (96)
                  :     +- ReusedExchange (106)
                  +- * SortMergeJoin LeftSemi (122)
                     :- * Sort (110)
                     :  +- ReusedExchange (109)
                     +- * Sort (121)
                        +- * Project (120)
                           +- * Filter (119)
                              +- * HashAggregate (118)
                                 +- * HashAggregate (117)
                                    +- * Project (116)
                                       +- * SortMergeJoin Inner (115)
                                          :- * Sort (112)
                                          :  +- ReusedExchange (111)
                                          +- * Sort (114)
                                             +- ReusedExchange (113)


(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: 139]
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]: [partial_count(1)]
Aggregate Attributes [1]: [count#15]
Results [4]: [_groupingexpression#14, i_item_sk#12, d_date#11, count#16]

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

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

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

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

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

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

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

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

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

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

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

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

(34) Exchange
Input [3]: [ss_customer_sk#20, ss_quantity#21, ss_sales_price#22]
Arguments: hashpartitioning(ss_customer_sk#20, 5), ENSURE_REQUIREMENTS, [plan_id=5]

(35) Sort [codegen id : 12]
Input [3]: [ss_customer_sk#20, ss_quantity#21, ss_sales_price#22]
Arguments: [ss_customer_sk#20 ASC NULLS FIRST], false, 0

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

(37) ColumnarToRow [codegen id : 13]
Input [1]: [c_customer_sk#24]

(38) Filter [codegen id : 13]
Input [1]: [c_customer_sk#24]
Condition : isnotnull(c_customer_sk#24)

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

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

(41) SortMergeJoin [codegen id : 15]
Left keys [1]: [ss_customer_sk#20]
Right keys [1]: [c_customer_sk#24]
Join type: Inner
Join condition: None

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

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

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

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

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

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

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

(49) ReusedExchange [Reuses operator id: 134]
Output [1]: [d_date_sk#32]

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

(51) 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#32]

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

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

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

(55) 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=8]

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

(57) ReusedExchange [Reuses operator id: 34]
Output [3]: [ss_customer_sk#20, ss_quantity#21, ss_sales_price#22]

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

(59) ReusedExchange [Reuses operator id: 39]
Output [1]: [c_customer_sk#24]

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

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

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

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

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

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

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

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

(68) SortMergeJoin [codegen id : 25]
Left keys [1]: [c_customer_sk#33]
Right keys [1]: [c_customer_sk#24]
Join type: LeftSemi
Join condition: None

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

(70) Project [codegen id : 26]
Output [4]: [cs_quantity#3, cs_list_price#4, c_first_name#34, c_last_name#35]
Input [6]: [cs_bill_customer_sk#1, cs_quantity#3, cs_list_price#4, c_customer_sk#33, c_first_name#34, c_last_name#35]

(71) HashAggregate [codegen id : 26]
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((cast(cs_quantity#3 as decimal(10,0)) * cs_list_price#4))]
Aggregate Attributes [2]: [sum#36, isEmpty#37]
Results [4]: [c_last_name#35, c_first_name#34, sum#38, isEmpty#39]

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

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

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

(75) ColumnarToRow [codegen id : 28]
Input [5]: [ws_item_sk#42, ws_bill_customer_sk#43, ws_quantity#44, ws_list_price#45, ws_sold_date_sk#46]

(76) Filter [codegen id : 28]
Input [5]: [ws_item_sk#42, ws_bill_customer_sk#43, ws_quantity#44, ws_list_price#45, ws_sold_date_sk#46]
Condition : isnotnull(ws_bill_customer_sk#43)

(77) Exchange
Input [5]: [ws_item_sk#42, ws_bill_customer_sk#43, ws_quantity#44, ws_list_price#45, ws_sold_date_sk#46]
Arguments: hashpartitioning(ws_item_sk#42, 5), ENSURE_REQUIREMENTS, [plan_id=10]

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

(79) ReusedExchange [Reuses operator id: 12]
Output [2]: [ss_item_sk#47, d_date#48]

(80) Sort [codegen id : 32]
Input [2]: [ss_item_sk#47, d_date#48]
Arguments: [ss_item_sk#47 ASC NULLS FIRST], false, 0

(81) ReusedExchange [Reuses operator id: 17]
Output [2]: [i_item_sk#49, i_item_desc#50]

(82) Sort [codegen id : 34]
Input [2]: [i_item_sk#49, i_item_desc#50]
Arguments: [i_item_sk#49 ASC NULLS FIRST], false, 0

(83) SortMergeJoin [codegen id : 35]
Left keys [1]: [ss_item_sk#47]
Right keys [1]: [i_item_sk#49]
Join type: Inner
Join condition: None

(84) Project [codegen id : 35]
Output [3]: [d_date#48, i_item_sk#49, substr(i_item_desc#50, 1, 30) AS _groupingexpression#51]
Input [4]: [ss_item_sk#47, d_date#48, i_item_sk#49, i_item_desc#50]

(85) HashAggregate [codegen id : 35]
Input [3]: [d_date#48, i_item_sk#49, _groupingexpression#51]
Keys [3]: [_groupingexpression#51, i_item_sk#49, d_date#48]
Functions [1]: [partial_count(1)]
Aggregate Attributes [1]: [count#15]
Results [4]: [_groupingexpression#51, i_item_sk#49, d_date#48, count#16]

(86) HashAggregate [codegen id : 35]
Input [4]: [_groupingexpression#51, i_item_sk#49, d_date#48, count#16]
Keys [3]: [_groupingexpression#51, i_item_sk#49, d_date#48]
Functions [1]: [count(1)]
Aggregate Attributes [1]: [count(1)#17]
Results [2]: [i_item_sk#49 AS item_sk#52, count(1)#17 AS cnt#53]

(87) Filter [codegen id : 35]
Input [2]: [item_sk#52, cnt#53]
Condition : (cnt#53 > 4)

(88) Project [codegen id : 35]
Output [1]: [item_sk#52]
Input [2]: [item_sk#52, cnt#53]

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

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

(91) Project [codegen id : 36]
Output [4]: [ws_bill_customer_sk#43, ws_quantity#44, ws_list_price#45, ws_sold_date_sk#46]
Input [5]: [ws_item_sk#42, ws_bill_customer_sk#43, ws_quantity#44, ws_list_price#45, ws_sold_date_sk#46]

(92) Exchange
Input [4]: [ws_bill_customer_sk#43, ws_quantity#44, ws_list_price#45, ws_sold_date_sk#46]
Arguments: hashpartitioning(ws_bill_customer_sk#43, 5), ENSURE_REQUIREMENTS, [plan_id=11]

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

(94) ReusedExchange [Reuses operator id: 34]
Output [3]: [ss_customer_sk#54, ss_quantity#55, ss_sales_price#56]

(95) Sort [codegen id : 39]
Input [3]: [ss_customer_sk#54, ss_quantity#55, ss_sales_price#56]
Arguments: [ss_customer_sk#54 ASC NULLS FIRST], false, 0

(96) ReusedExchange [Reuses operator id: 39]
Output [1]: [c_customer_sk#57]

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

(98) SortMergeJoin [codegen id : 42]
Left keys [1]: [ss_customer_sk#54]
Right keys [1]: [c_customer_sk#57]
Join type: Inner
Join condition: None

(99) Project [codegen id : 42]
Output [3]: [ss_quantity#55, ss_sales_price#56, c_customer_sk#57]
Input [4]: [ss_customer_sk#54, ss_quantity#55, ss_sales_price#56, c_customer_sk#57]

(100) HashAggregate [codegen id : 42]
Input [3]: [ss_quantity#55, ss_sales_price#56, c_customer_sk#57]
Keys [1]: [c_customer_sk#57]
Functions [1]: [partial_sum((cast(ss_quantity#55 as decimal(10,0)) * ss_sales_price#56))]
Aggregate Attributes [2]: [sum#58, isEmpty#59]
Results [3]: [c_customer_sk#57, sum#60, isEmpty#61]

(101) HashAggregate [codegen id : 42]
Input [3]: [c_customer_sk#57, sum#60, isEmpty#61]
Keys [1]: [c_customer_sk#57]
Functions [1]: [sum((cast(ss_quantity#55 as decimal(10,0)) * ss_sales_price#56))]
Aggregate Attributes [1]: [sum((cast(ss_quantity#55 as decimal(10,0)) * ss_sales_price#56))#29]
Results [2]: [c_customer_sk#57, sum((cast(ss_quantity#55 as decimal(10,0)) * ss_sales_price#56))#29 AS ssales#62]

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

(103) Project [codegen id : 42]
Output [1]: [c_customer_sk#57]
Input [2]: [c_customer_sk#57, ssales#62]

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

(105) SortMergeJoin [codegen id : 44]
Left keys [1]: [ws_bill_customer_sk#43]
Right keys [1]: [c_customer_sk#57]
Join type: LeftSemi
Join condition: None

(106) ReusedExchange [Reuses operator id: 134]
Output [1]: [d_date_sk#63]

(107) BroadcastHashJoin [codegen id : 44]
Left keys [1]: [ws_sold_date_sk#46]
Right keys [1]: [d_date_sk#63]
Join type: Inner
Join condition: None

(108) Project [codegen id : 44]
Output [3]: [ws_bill_customer_sk#43, ws_quantity#44, ws_list_price#45]
Input [5]: [ws_bill_customer_sk#43, ws_quantity#44, ws_list_price#45, ws_sold_date_sk#46, d_date_sk#63]

(109) ReusedExchange [Reuses operator id: 55]
Output [3]: [c_customer_sk#64, c_first_name#65, c_last_name#66]

(110) Sort [codegen id : 46]
Input [3]: [c_customer_sk#64, c_first_name#65, c_last_name#66]
Arguments: [c_customer_sk#64 ASC NULLS FIRST], false, 0

(111) ReusedExchange [Reuses operator id: 34]
Output [3]: [ss_customer_sk#54, ss_quantity#55, ss_sales_price#56]

(112) Sort [codegen id : 48]
Input [3]: [ss_customer_sk#54, ss_quantity#55, ss_sales_price#56]
Arguments: [ss_customer_sk#54 ASC NULLS FIRST], false, 0

(113) ReusedExchange [Reuses operator id: 39]
Output [1]: [c_customer_sk#57]

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

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

(116) Project [codegen id : 51]
Output [3]: [ss_quantity#55, ss_sales_price#56, c_customer_sk#57]
Input [4]: [ss_customer_sk#54, ss_quantity#55, ss_sales_price#56, c_customer_sk#57]

(117) HashAggregate [codegen id : 51]
Input [3]: [ss_quantity#55, ss_sales_price#56, c_customer_sk#57]
Keys [1]: [c_customer_sk#57]
Functions [1]: [partial_sum((cast(ss_quantity#55 as decimal(10,0)) * ss_sales_price#56))]
Aggregate Attributes [2]: [sum#58, isEmpty#59]
Results [3]: [c_customer_sk#57, sum#60, isEmpty#61]

(118) HashAggregate [codegen id : 51]
Input [3]: [c_customer_sk#57, sum#60, isEmpty#61]
Keys [1]: [c_customer_sk#57]
Functions [1]: [sum((cast(ss_quantity#55 as decimal(10,0)) * ss_sales_price#56))]
Aggregate Attributes [1]: [sum((cast(ss_quantity#55 as decimal(10,0)) * ss_sales_price#56))#29]
Results [2]: [c_customer_sk#57, sum((cast(ss_quantity#55 as decimal(10,0)) * ss_sales_price#56))#29 AS ssales#62]

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

(120) Project [codegen id : 51]
Output [1]: [c_customer_sk#57]
Input [2]: [c_customer_sk#57, ssales#62]

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

(122) SortMergeJoin [codegen id : 52]
Left keys [1]: [c_customer_sk#64]
Right keys [1]: [c_customer_sk#57]
Join type: LeftSemi
Join condition: None

(123) SortMergeJoin [codegen id : 53]
Left keys [1]: [ws_bill_customer_sk#43]
Right keys [1]: [c_customer_sk#64]
Join type: Inner
Join condition: None

(124) Project [codegen id : 53]
Output [4]: [ws_quantity#44, ws_list_price#45, c_first_name#65, c_last_name#66]
Input [6]: [ws_bill_customer_sk#43, ws_quantity#44, ws_list_price#45, c_customer_sk#64, c_first_name#65, c_last_name#66]

(125) HashAggregate [codegen id : 53]
Input [4]: [ws_quantity#44, ws_list_price#45, c_first_name#65, c_last_name#66]
Keys [2]: [c_last_name#66, c_first_name#65]
Functions [1]: [partial_sum((cast(ws_quantity#44 as decimal(10,0)) * ws_list_price#45))]
Aggregate Attributes [2]: [sum#67, isEmpty#68]
Results [4]: [c_last_name#66, c_first_name#65, sum#69, isEmpty#70]

(126) Exchange
Input [4]: [c_last_name#66, c_first_name#65, sum#69, isEmpty#70]
Arguments: hashpartitioning(c_last_name#66, c_first_name#65, 5), ENSURE_REQUIREMENTS, [plan_id=12]

(127) HashAggregate [codegen id : 54]
Input [4]: [c_last_name#66, c_first_name#65, sum#69, isEmpty#70]
Keys [2]: [c_last_name#66, c_first_name#65]
Functions [1]: [sum((cast(ws_quantity#44 as decimal(10,0)) * ws_list_price#45))]
Aggregate Attributes [1]: [sum((cast(ws_quantity#44 as decimal(10,0)) * ws_list_price#45))#71]
Results [3]: [c_last_name#66, c_first_name#65, sum((cast(ws_quantity#44 as decimal(10,0)) * ws_list_price#45))#71 AS sales#72]

(128) Union

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

===== Subqueries =====

Subquery:1 Hosting operator id = 1 Hosting Expression = cs_sold_date_sk#5 IN dynamicpruning#6
BroadcastExchange (134)
+- * Project (133)
   +- * Filter (132)
      +- * ColumnarToRow (131)
         +- Scan parquet spark_catalog.default.date_dim (130)


(130) Scan parquet spark_catalog.default.date_dim
Output [3]: [d_date_sk#32, d_year#73, d_moy#74]
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>

(131) ColumnarToRow [codegen id : 1]
Input [3]: [d_date_sk#32, d_year#73, d_moy#74]

(132) Filter [codegen id : 1]
Input [3]: [d_date_sk#32, d_year#73, d_moy#74]
Condition : ((((isnotnull(d_year#73) AND isnotnull(d_moy#74)) AND (d_year#73 = 2000)) AND (d_moy#74 = 2)) AND isnotnull(d_date_sk#32))

(133) Project [codegen id : 1]
Output [1]: [d_date_sk#32]
Input [3]: [d_date_sk#32, d_year#73, d_moy#74]

(134) BroadcastExchange
Input [1]: [d_date_sk#32]
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 (139)
+- * Project (138)
   +- * Filter (137)
      +- * ColumnarToRow (136)
         +- Scan parquet spark_catalog.default.date_dim (135)


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

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

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

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

(139) 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 = 45 Hosting Expression = Subquery scalar-subquery#31, [id=#7]
* HashAggregate (156)
+- Exchange (155)
   +- * HashAggregate (154)
      +- * HashAggregate (153)
         +- * HashAggregate (152)
            +- * Project (151)
               +- * SortMergeJoin Inner (150)
                  :- * Sort (147)
                  :  +- Exchange (146)
                  :     +- * Project (145)
                  :        +- * BroadcastHashJoin Inner BuildRight (144)
                  :           :- * Filter (142)
                  :           :  +- * ColumnarToRow (141)
                  :           :     +- Scan parquet spark_catalog.default.store_sales (140)
                  :           +- ReusedExchange (143)
                  +- * Sort (149)
                     +- ReusedExchange (148)


(140) Scan parquet spark_catalog.default.store_sales
Output [4]: [ss_customer_sk#76, ss_quantity#77, ss_sales_price#78, ss_sold_date_sk#79]
Batched: true
Location: InMemoryFileIndex []
PartitionFilters: [isnotnull(ss_sold_date_sk#79), dynamicpruningexpression(ss_sold_date_sk#79 IN dynamicpruning#80)]
PushedFilters: [IsNotNull(ss_customer_sk)]
ReadSchema: struct<ss_customer_sk:int,ss_quantity:int,ss_sales_price:decimal(7,2)>

(141) ColumnarToRow [codegen id : 2]
Input [4]: [ss_customer_sk#76, ss_quantity#77, ss_sales_price#78, ss_sold_date_sk#79]

(142) Filter [codegen id : 2]
Input [4]: [ss_customer_sk#76, ss_quantity#77, ss_sales_price#78, ss_sold_date_sk#79]
Condition : isnotnull(ss_customer_sk#76)

(143) ReusedExchange [Reuses operator id: 161]
Output [1]: [d_date_sk#81]

(144) BroadcastHashJoin [codegen id : 2]
Left keys [1]: [ss_sold_date_sk#79]
Right keys [1]: [d_date_sk#81]
Join type: Inner
Join condition: None

(145) Project [codegen id : 2]
Output [3]: [ss_customer_sk#76, ss_quantity#77, ss_sales_price#78]
Input [5]: [ss_customer_sk#76, ss_quantity#77, ss_sales_price#78, ss_sold_date_sk#79, d_date_sk#81]

(146) Exchange
Input [3]: [ss_customer_sk#76, ss_quantity#77, ss_sales_price#78]
Arguments: hashpartitioning(ss_customer_sk#76, 5), ENSURE_REQUIREMENTS, [plan_id=15]

(147) Sort [codegen id : 3]
Input [3]: [ss_customer_sk#76, ss_quantity#77, ss_sales_price#78]
Arguments: [ss_customer_sk#76 ASC NULLS FIRST], false, 0

(148) ReusedExchange [Reuses operator id: 39]
Output [1]: [c_customer_sk#82]

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

(150) SortMergeJoin [codegen id : 6]
Left keys [1]: [ss_customer_sk#76]
Right keys [1]: [c_customer_sk#82]
Join type: Inner
Join condition: None

(151) Project [codegen id : 6]
Output [3]: [ss_quantity#77, ss_sales_price#78, c_customer_sk#82]
Input [4]: [ss_customer_sk#76, ss_quantity#77, ss_sales_price#78, c_customer_sk#82]

(152) HashAggregate [codegen id : 6]
Input [3]: [ss_quantity#77, ss_sales_price#78, c_customer_sk#82]
Keys [1]: [c_customer_sk#82]
Functions [1]: [partial_sum((cast(ss_quantity#77 as decimal(10,0)) * ss_sales_price#78))]
Aggregate Attributes [2]: [sum#83, isEmpty#84]
Results [3]: [c_customer_sk#82, sum#85, isEmpty#86]

(153) HashAggregate [codegen id : 6]
Input [3]: [c_customer_sk#82, sum#85, isEmpty#86]
Keys [1]: [c_customer_sk#82]
Functions [1]: [sum((cast(ss_quantity#77 as decimal(10,0)) * ss_sales_price#78))]
Aggregate Attributes [1]: [sum((cast(ss_quantity#77 as decimal(10,0)) * ss_sales_price#78))#87]
Results [1]: [sum((cast(ss_quantity#77 as decimal(10,0)) * ss_sales_price#78))#87 AS csales#88]

(154) HashAggregate [codegen id : 6]
Input [1]: [csales#88]
Keys: []
Functions [1]: [partial_max(csales#88)]
Aggregate Attributes [1]: [max#89]
Results [1]: [max#90]

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

(156) HashAggregate [codegen id : 7]
Input [1]: [max#90]
Keys: []
Functions [1]: [max(csales#88)]
Aggregate Attributes [1]: [max(csales#88)#91]
Results [1]: [max(csales#88)#91 AS tpcds_cmax#92]

Subquery:4 Hosting operator id = 140 Hosting Expression = ss_sold_date_sk#79 IN dynamicpruning#80
BroadcastExchange (161)
+- * Project (160)
   +- * Filter (159)
      +- * ColumnarToRow (158)
         +- Scan parquet spark_catalog.default.date_dim (157)


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

(158) ColumnarToRow [codegen id : 1]
Input [2]: [d_date_sk#81, d_year#93]

(159) Filter [codegen id : 1]
Input [2]: [d_date_sk#81, d_year#93]
Condition : (d_year#93 IN (2000,2001,2002,2003) AND isnotnull(d_date_sk#81))

(160) Project [codegen id : 1]
Output [1]: [d_date_sk#81]
Input [2]: [d_date_sk#81, d_year#93]

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

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

Subquery:6 Hosting operator id = 74 Hosting Expression = ws_sold_date_sk#46 IN dynamicpruning#6

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

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


