== Physical Plan ==
AdaptiveSparkPlan (150)
+- == Final Plan ==
   NativeTakeOrdered (95)
   +- NativeProject (94)
      +- NativeSortMergeJoin Inner (93)
         :- NativeSort (84)
         :  +- InputAdapter (83)
         :     +- AQEShuffleRead (82)
         :        +- ShuffleQueryStage (81), Statistics(X)
         :           +- NativeShuffleExchange (80)
         :              +- NativeProject (79)
         :                 +- NativeSortMergeJoin Inner (78)
         :                    :- NativeProject (68)
         :                    :  +- NativeSortMergeJoin Inner (67)
         :                    :     :- NativeSort (33)
         :                    :     :  +- InputAdapter (32)
         :                    :     :     +- AQEShuffleRead (31)
         :                    :     :        +- ShuffleQueryStage (30), Statistics(X)
         :                    :     :           +- NativeShuffleExchange (29)
         :                    :     :              +- NativeFilter (28)
         :                    :     :                 +- NativeProject (27)
         :                    :     :                    +- NativeHashAggregate (26)
         :                    :     :                       +- InputAdapter (25)
         :                    :     :                          +- AQEShuffleRead (24)
         :                    :     :                             +- ShuffleQueryStage (23), Statistics(X)
         :                    :     :                                +- NativeShuffleExchange (22)
         :                    :     :                                   +- NativeHashAggregate (21)
         :                    :     :                                      +- NativeProject (20)
         :                    :     :                                         +- NativeProject (19)
         :                    :     :                                            +- NativeSortMergeJoin Inner (18)
         :                    :     :                                               :- NativeSort (8)
         :                    :     :                                               :  +- InputAdapter (7)
         :                    :     :                                               :     +- AQEShuffleRead (6)
         :                    :     :                                               :        +- ShuffleQueryStage (5), Statistics(X)
         :                    :     :                                               :           +- NativeShuffleExchange (4)
         :                    :     :                                               :              +- NativeFilter (3)
         :                    :     :                                               :                 +- InputAdapter (2)
         :                    :     :                                               :                    +- NativeParquetScan  (1)
         :                    :     :                                               +- NativeSort (17)
         :                    :     :                                                  +- InputAdapter (16)
         :                    :     :                                                     +- AQEShuffleRead (15)
         :                    :     :                                                        +- ShuffleQueryStage (14), Statistics(X)
         :                    :     :                                                           +- NativeShuffleExchange (13)
         :                    :     :                                                              +- NativeProject (12)
         :                    :     :                                                                 +- NativeFilter (11)
         :                    :     :                                                                    +- InputAdapter (10)
         :                    :     :                                                                       +- NativeParquetScan  (9)
         :                    :     +- NativeSort (66)
         :                    :        +- NativeFilter (65)
         :                    :           +- NativeProject (64)
         :                    :              +- NativeHashAggregate (63)
         :                    :                 +- InputAdapter (62)
         :                    :                    +- AQEShuffleRead (61)
         :                    :                       +- ShuffleQueryStage (60), Statistics(X)
         :                    :                          +- NativeShuffleExchange (59)
         :                    :                             +- NativeHashAggregate (58)
         :                    :                                +- NativeProject (57)
         :                    :                                   +- NativeHashAggregate (56)
         :                    :                                      +- InputAdapter (55)
         :                    :                                         +- AQEShuffleRead (54)
         :                    :                                            +- ShuffleQueryStage (53), Statistics(X)
         :                    :                                               +- NativeShuffleExchange (52)
         :                    :                                                  +- NativeHashAggregate (51)
         :                    :                                                     +- NativeProject (50)
         :                    :                                                        +- NativeProject (49)
         :                    :                                                           +- NativeSortMergeJoin Inner (48)
         :                    :                                                              :- NativeSort (41)
         :                    :                                                              :  +- InputAdapter (40)
         :                    :                                                              :     +- AQEShuffleRead (39)
         :                    :                                                              :        +- ShuffleQueryStage (38), Statistics(X)
         :                    :                                                              :           +- NativeShuffleExchange (37)
         :                    :                                                              :              +- NativeFilter (36)
         :                    :                                                              :                 +- InputAdapter (35)
         :                    :                                                              :                    +- NativeParquetScan  (34)
         :                    :                                                              +- NativeSort (47)
         :                    :                                                                 +- InputAdapter (46)
         :                    :                                                                    +- InputAdapter (45)
         :                    :                                                                       +- AQEShuffleRead (44)
         :                    :                                                                          +- ShuffleQueryStage (43), Statistics(X)
         :                    :                                                                             +- ReusedExchange (42)
         :                    +- NativeSort (77)
         :                       +- InputAdapter (76)
         :                          +- AQEShuffleRead (75)
         :                             +- ShuffleQueryStage (74), Statistics(X)
         :                                +- NativeShuffleExchange (73)
         :                                   +- NativeProject (72)
         :                                      +- NativeFilter (71)
         :                                         +- InputAdapter (70)
         :                                            +- NativeParquetScan  (69)
         +- NativeSort (92)
            +- InputAdapter (91)
               +- AQEShuffleRead (90)
                  +- ShuffleQueryStage (89), Statistics(X)
                     +- NativeShuffleExchange (88)
                        +- NativeFilter (87)
                           +- InputAdapter (86)
                              +- NativeParquetScan  (85)
+- == Initial Plan ==
   TakeOrderedAndProject (149)
   +- Project (148)
      +- SortMergeJoin Inner (147)
         :- Sort (142)
         :  +- Exchange (141)
         :     +- Project (140)
         :        +- SortMergeJoin Inner (139)
         :           :- Project (133)
         :           :  +- SortMergeJoin Inner (132)
         :           :     :- Sort (112)
         :           :     :  +- Exchange (111)
         :           :     :     +- Filter (110)
         :           :     :        +- HashAggregate (109)
         :           :     :           +- Exchange (108)
         :           :     :              +- HashAggregate (107)
         :           :     :                 +- Project (106)
         :           :     :                    +- SortMergeJoin Inner (105)
         :           :     :                       :- Sort (99)
         :           :     :                       :  +- Exchange (98)
         :           :     :                       :     +- Filter (97)
         :           :     :                       :        +- Scan parquet (96)
         :           :     :                       +- Sort (104)
         :           :     :                          +- Exchange (103)
         :           :     :                             +- Project (102)
         :           :     :                                +- Filter (101)
         :           :     :                                   +- Scan parquet (100)
         :           :     +- Sort (131)
         :           :        +- Filter (130)
         :           :           +- HashAggregate (129)
         :           :              +- Exchange (128)
         :           :                 +- HashAggregate (127)
         :           :                    +- HashAggregate (126)
         :           :                       +- Exchange (125)
         :           :                          +- HashAggregate (124)
         :           :                             +- Project (123)
         :           :                                +- SortMergeJoin Inner (122)
         :           :                                   :- Sort (116)
         :           :                                   :  +- Exchange (115)
         :           :                                   :     +- Filter (114)
         :           :                                   :        +- Scan parquet (113)
         :           :                                   +- Sort (121)
         :           :                                      +- Exchange (120)
         :           :                                         +- Project (119)
         :           :                                            +- Filter (118)
         :           :                                               +- Scan parquet (117)
         :           +- Sort (138)
         :              +- Exchange (137)
         :                 +- Project (136)
         :                    +- Filter (135)
         :                       +- Scan parquet (134)
         +- Sort (146)
            +- Exchange (145)
               +- Filter (144)
                  +- Scan parquet (143)


(96) Scan parquet
Output [4]: [sr_returned_date_sk#1, sr_customer_sk#2, sr_store_sk#3, sr_return_amt#4]
Batched: true
Location: InMemoryFileIndex [file:/<warehouse_dir>]
PushedFilters: [IsNotNull(sr_returned_date_sk), IsNotNull(sr_store_sk), IsNotNull(sr_customer_sk)]
ReadSchema: struct<sr_returned_date_sk:int,sr_customer_sk:int,sr_store_sk:int,sr_return_amt:decimal(7,2)>

(2) InputAdapter
Input [4]: [sr_returned_date_sk#1, sr_customer_sk#2, sr_store_sk#3, sr_return_amt#4]
Arguments: [#1, #2, #3, #4]

(3) NativeFilter
Input [4]: [#1#1, #2#2, #3#3, #4#4]
Condition : ((isnotnull(sr_returned_date_sk#1) AND isnotnull(sr_store_sk#3)) AND isnotnull(sr_customer_sk#2))

(4) NativeShuffleExchange
Input [4]: [#1#1, #2#2, #3#3, #4#4]
Arguments: hashpartitioning(sr_returned_date_sk#1, 100), ENSURE_REQUIREMENTS, [plan_id=1]

(5) ShuffleQueryStage
Output [4]: [#1#1, #2#2, #3#3, #4#4]
Arguments: X

(6) AQEShuffleRead
Input [4]: [#1#1, #2#2, #3#3, #4#4]
Arguments: coalesced

(7) InputAdapter
Input [4]: [#1#1, #2#2, #3#3, #4#4]

(8) NativeSort
Input [4]: [#1#1, #2#2, #3#3, #4#4]
Arguments: [sr_returned_date_sk#1 ASC NULLS FIRST], false

(100) Scan parquet
Output [2]: [d_date_sk#5, d_year#6]
Batched: true
Location: InMemoryFileIndex [file:/<warehouse_dir>]
PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2000), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_year:int>

(10) InputAdapter
Input [2]: [d_date_sk#5, d_year#6]
Arguments: [#5, #6]

(11) NativeFilter
Input [2]: [#5#5, #6#6]
Condition : ((isnotnull(d_year#6) AND (d_year#6 = 2000)) AND isnotnull(d_date_sk#5))

(12) NativeProject
Output [1]: [d_date_sk#5]
Input [2]: [#5#5, #6#6]

(13) NativeShuffleExchange
Input [1]: [d_date_sk#5]
Arguments: hashpartitioning(d_date_sk#5, 100), ENSURE_REQUIREMENTS, [plan_id=2]

(14) ShuffleQueryStage
Output [1]: [d_date_sk#5]
Arguments: X

(15) AQEShuffleRead
Input [1]: [d_date_sk#5]
Arguments: coalesced

(16) InputAdapter
Input [1]: [d_date_sk#5]

(17) NativeSort
Input [1]: [d_date_sk#5]
Arguments: [d_date_sk#5 ASC NULLS FIRST], false

(18) NativeSortMergeJoin
Left keys [1]: [sr_returned_date_sk#1]
Right keys [1]: [d_date_sk#5]
Join type: Inner
Join condition: None

(19) NativeProject
Output [3]: [sr_customer_sk#2, sr_store_sk#3, sr_return_amt#4]
Input [5]: [#1#1, #2#2, #3#3, #4#4, d_date_sk#5]

(20) NativeProject
Output [3]: [sr_customer_sk#2 AS sr_customer_sk#2, sr_store_sk#3 AS sr_store_sk#3, UnscaledValue(sr_return_amt#4) AS _c2#7]
Input [3]: [sr_customer_sk#2, sr_store_sk#3, sr_return_amt#4]

(21) NativeHashAggregate
Input [3]: [sr_customer_sk#2, sr_store_sk#3, _c2#7]
Keys [2]: [sr_customer_sk#2, sr_store_sk#3]
Functions [1]: [partial_sum(_c2#7)]
Aggregate Attributes [1]: [sum#8]
Results [3]: [sr_customer_sk#2, sr_store_sk#3, #9]

(22) NativeShuffleExchange
Input [3]: [sr_customer_sk#2, sr_store_sk#3, #9]
Arguments: hashpartitioning(sr_customer_sk#2, sr_store_sk#3, 100), ENSURE_REQUIREMENTS, [plan_id=3]

(23) ShuffleQueryStage
Output [3]: [sr_customer_sk#2, sr_store_sk#3, #9]
Arguments: X

(24) AQEShuffleRead
Input [3]: [sr_customer_sk#2, sr_store_sk#3, #9]
Arguments: coalesced

(25) InputAdapter
Input [3]: [sr_customer_sk#2, sr_store_sk#3, #9]

(26) NativeHashAggregate
Input [3]: [sr_customer_sk#2, sr_store_sk#3, #9]
Keys [2]: [sr_customer_sk#2, sr_store_sk#3]
Functions [1]: [sum(UnscaledValue(sr_return_amt#4))]
Aggregate Attributes [1]: [sum(UnscaledValue(sr_return_amt#4))#10]
Results [3]: [sr_customer_sk#2, sr_store_sk#3, sum(UnscaledValue(sr_return_amt#4))#10]

(27) NativeProject
Output [3]: [sr_customer_sk#2 AS ctr_customer_sk#11, sr_store_sk#3 AS ctr_store_sk#12, MakeDecimal(sum(UnscaledValue(sr_return_amt#4))#10,17,2) AS ctr_total_return#13]
Input [3]: [sr_customer_sk#2, sr_store_sk#3, sum(UnscaledValue(sr_return_amt#4))#10]

(28) NativeFilter
Input [3]: [ctr_customer_sk#11, ctr_store_sk#12, ctr_total_return#13]
Condition : isnotnull(ctr_total_return#13)

(29) NativeShuffleExchange
Input [3]: [ctr_customer_sk#11, ctr_store_sk#12, ctr_total_return#13]
Arguments: hashpartitioning(ctr_store_sk#12, 100), ENSURE_REQUIREMENTS, [plan_id=4]

(30) ShuffleQueryStage
Output [3]: [ctr_customer_sk#11, ctr_store_sk#12, ctr_total_return#13]
Arguments: X

(31) AQEShuffleRead
Input [3]: [ctr_customer_sk#11, ctr_store_sk#12, ctr_total_return#13]
Arguments: coalesced

(32) InputAdapter
Input [3]: [ctr_customer_sk#11, ctr_store_sk#12, ctr_total_return#13]

(33) NativeSort
Input [3]: [ctr_customer_sk#11, ctr_store_sk#12, ctr_total_return#13]
Arguments: [ctr_store_sk#12 ASC NULLS FIRST], false

(113) Scan parquet
Output [4]: [sr_returned_date_sk#14, sr_customer_sk#15, sr_store_sk#16, sr_return_amt#17]
Batched: true
Location: InMemoryFileIndex [file:/<warehouse_dir>]
PushedFilters: [IsNotNull(sr_returned_date_sk), IsNotNull(sr_store_sk)]
ReadSchema: struct<sr_returned_date_sk:int,sr_customer_sk:int,sr_store_sk:int,sr_return_amt:decimal(7,2)>

(35) InputAdapter
Input [4]: [sr_returned_date_sk#14, sr_customer_sk#15, sr_store_sk#16, sr_return_amt#17]
Arguments: [#14, #15, #16, #17]

(36) NativeFilter
Input [4]: [#14#14, #15#15, #16#16, #17#17]
Condition : (isnotnull(sr_returned_date_sk#14) AND isnotnull(sr_store_sk#16))

(37) NativeShuffleExchange
Input [4]: [#14#14, #15#15, #16#16, #17#17]
Arguments: hashpartitioning(sr_returned_date_sk#14, 100), ENSURE_REQUIREMENTS, [plan_id=5]

(38) ShuffleQueryStage
Output [4]: [#14#14, #15#15, #16#16, #17#17]
Arguments: X

(39) AQEShuffleRead
Input [4]: [#14#14, #15#15, #16#16, #17#17]
Arguments: coalesced

(40) InputAdapter
Input [4]: [#14#14, #15#15, #16#16, #17#17]

(41) NativeSort
Input [4]: [#14#14, #15#15, #16#16, #17#17]
Arguments: [sr_returned_date_sk#14 ASC NULLS FIRST], false

(42) ReusedExchange [Reuses operator id: 13]
Output [1]: [d_date_sk#18]

(43) ShuffleQueryStage
Output [1]: [d_date_sk#18]
Arguments: X

(44) AQEShuffleRead
Input [1]: [d_date_sk#18]
Arguments: coalesced

(45) InputAdapter
Input [1]: [d_date_sk#18]
Arguments: [#18]

(46) InputAdapter
Input [1]: [#18#18]

(47) NativeSort
Input [1]: [#18#18]
Arguments: [d_date_sk#18 ASC NULLS FIRST], false

(48) NativeSortMergeJoin
Left keys [1]: [sr_returned_date_sk#14]
Right keys [1]: [d_date_sk#18]
Join type: Inner
Join condition: None

(49) NativeProject
Output [3]: [sr_customer_sk#15, sr_store_sk#16, sr_return_amt#17]
Input [5]: [#14#14, #15#15, #16#16, #17#17, #18#18]

(50) NativeProject
Output [3]: [sr_customer_sk#15 AS sr_customer_sk#15, sr_store_sk#16 AS sr_store_sk#16, UnscaledValue(sr_return_amt#17) AS _c2#19]
Input [3]: [sr_customer_sk#15, sr_store_sk#16, sr_return_amt#17]

(51) NativeHashAggregate
Input [3]: [sr_customer_sk#15, sr_store_sk#16, _c2#19]
Keys [2]: [sr_customer_sk#15, sr_store_sk#16]
Functions [1]: [partial_sum(_c2#19)]
Aggregate Attributes [1]: [sum#20]
Results [3]: [sr_customer_sk#15, sr_store_sk#16, #9]

(52) NativeShuffleExchange
Input [3]: [sr_customer_sk#15, sr_store_sk#16, #9]
Arguments: hashpartitioning(sr_customer_sk#15, sr_store_sk#16, 100), ENSURE_REQUIREMENTS, [plan_id=6]

(53) ShuffleQueryStage
Output [3]: [sr_customer_sk#15, sr_store_sk#16, #9]
Arguments: X

(54) AQEShuffleRead
Input [3]: [sr_customer_sk#15, sr_store_sk#16, #9]
Arguments: coalesced

(55) InputAdapter
Input [3]: [sr_customer_sk#15, sr_store_sk#16, #9]

(56) NativeHashAggregate
Input [3]: [sr_customer_sk#15, sr_store_sk#16, #9]
Keys [2]: [sr_customer_sk#15, sr_store_sk#16]
Functions [1]: [sum(UnscaledValue(sr_return_amt#17))]
Aggregate Attributes [1]: [sum(UnscaledValue(sr_return_amt#17))#10]
Results [3]: [sr_customer_sk#15, sr_store_sk#16, sum(UnscaledValue(sr_return_amt#17))#10]

(57) NativeProject
Output [2]: [sr_store_sk#16 AS ctr_store_sk#21, MakeDecimal(sum(UnscaledValue(sr_return_amt#17))#10,17,2) AS ctr_total_return#22]
Input [3]: [sr_customer_sk#15, sr_store_sk#16, sum(UnscaledValue(sr_return_amt#17))#10]

(58) NativeHashAggregate
Input [2]: [ctr_store_sk#21, ctr_total_return#22]
Keys [1]: [ctr_store_sk#21]
Functions [1]: [partial_avg(ctr_total_return#22)]
Aggregate Attributes [2]: [sum#23, count#24]
Results [3]: [ctr_store_sk#21, #25, #9]

(59) NativeShuffleExchange
Input [3]: [ctr_store_sk#21, #25, #9]
Arguments: hashpartitioning(ctr_store_sk#21, 100), ENSURE_REQUIREMENTS, [plan_id=7]

(60) ShuffleQueryStage
Output [3]: [ctr_store_sk#21, #25, #9]
Arguments: X

(61) AQEShuffleRead
Input [3]: [ctr_store_sk#21, #25, #9]
Arguments: coalesced

(62) InputAdapter
Input [3]: [ctr_store_sk#21, #25, #9]

(63) NativeHashAggregate
Input [3]: [ctr_store_sk#21, #25, #9]
Keys [1]: [ctr_store_sk#21]
Functions [1]: [avg(ctr_total_return#22)]
Aggregate Attributes [1]: [avg(ctr_total_return#22)#26]
Results [2]: [ctr_store_sk#21, avg(ctr_total_return#22)#26]

(64) NativeProject
Output [2]: [(avg(ctr_total_return#22)#26 * 1.2) AS (avg(ctr_total_return) * 1.2)#27, ctr_store_sk#21]
Input [2]: [ctr_store_sk#21, avg(ctr_total_return#22)#26]

(65) NativeFilter
Input [2]: [(avg(ctr_total_return) * 1.2)#27, ctr_store_sk#21]
Condition : isnotnull((avg(ctr_total_return) * 1.2)#27)

(66) NativeSort
Input [2]: [(avg(ctr_total_return) * 1.2)#27, ctr_store_sk#21]
Arguments: [ctr_store_sk#21 ASC NULLS FIRST], false

(67) NativeSortMergeJoin
Left keys [1]: [ctr_store_sk#12]
Right keys [1]: [ctr_store_sk#21]
Join type: Inner
Join condition: (cast(ctr_total_return#13 as decimal(24,7)) > (avg(ctr_total_return) * 1.2)#27)

(68) NativeProject
Output [2]: [ctr_customer_sk#11, ctr_store_sk#12]
Input [5]: [ctr_customer_sk#11, ctr_store_sk#12, ctr_total_return#13, (avg(ctr_total_return) * 1.2)#27, ctr_store_sk#21]

(134) Scan parquet
Output [2]: [s_store_sk#28, s_state#29]
Batched: true
Location: InMemoryFileIndex [file:/<warehouse_dir>]
PushedFilters: [IsNotNull(s_state), EqualTo(s_state,TN), IsNotNull(s_store_sk)]
ReadSchema: struct<s_store_sk:int,s_state:string>

(70) InputAdapter
Input [2]: [s_store_sk#28, s_state#29]
Arguments: [#28, #29]

(71) NativeFilter
Input [2]: [#28#28, #29#29]
Condition : ((isnotnull(s_state#29) AND (s_state#29 = TN)) AND isnotnull(s_store_sk#28))

(72) NativeProject
Output [1]: [s_store_sk#28]
Input [2]: [#28#28, #29#29]

(73) NativeShuffleExchange
Input [1]: [s_store_sk#28]
Arguments: hashpartitioning(s_store_sk#28, 100), ENSURE_REQUIREMENTS, [plan_id=8]

(74) ShuffleQueryStage
Output [1]: [s_store_sk#28]
Arguments: X

(75) AQEShuffleRead
Input [1]: [s_store_sk#28]
Arguments: coalesced

(76) InputAdapter
Input [1]: [s_store_sk#28]

(77) NativeSort
Input [1]: [s_store_sk#28]
Arguments: [s_store_sk#28 ASC NULLS FIRST], false

(78) NativeSortMergeJoin
Left keys [1]: [ctr_store_sk#12]
Right keys [1]: [s_store_sk#28]
Join type: Inner
Join condition: None

(79) NativeProject
Output [1]: [ctr_customer_sk#11]
Input [3]: [ctr_customer_sk#11, ctr_store_sk#12, s_store_sk#28]

(80) NativeShuffleExchange
Input [1]: [ctr_customer_sk#11]
Arguments: hashpartitioning(ctr_customer_sk#11, 100), ENSURE_REQUIREMENTS, [plan_id=9]

(81) ShuffleQueryStage
Output [1]: [ctr_customer_sk#11]
Arguments: X

(82) AQEShuffleRead
Input [1]: [ctr_customer_sk#11]
Arguments: coalesced

(83) InputAdapter
Input [1]: [ctr_customer_sk#11]

(84) NativeSort
Input [1]: [ctr_customer_sk#11]
Arguments: [ctr_customer_sk#11 ASC NULLS FIRST], false

(143) Scan parquet
Output [2]: [c_customer_sk#30, c_customer_id#31]
Batched: true
Location: InMemoryFileIndex [file:/<warehouse_dir>]
PushedFilters: [IsNotNull(c_customer_sk)]
ReadSchema: struct<c_customer_sk:int,c_customer_id:string>

(86) InputAdapter
Input [2]: [c_customer_sk#30, c_customer_id#31]
Arguments: [#30, #31]

(87) NativeFilter
Input [2]: [#30#30, #31#31]
Condition : isnotnull(c_customer_sk#30)

(88) NativeShuffleExchange
Input [2]: [#30#30, #31#31]
Arguments: hashpartitioning(c_customer_sk#30, 100), ENSURE_REQUIREMENTS, [plan_id=10]

(89) ShuffleQueryStage
Output [2]: [#30#30, #31#31]
Arguments: X

(90) AQEShuffleRead
Input [2]: [#30#30, #31#31]
Arguments: coalesced

(91) InputAdapter
Input [2]: [#30#30, #31#31]

(92) NativeSort
Input [2]: [#30#30, #31#31]
Arguments: [c_customer_sk#30 ASC NULLS FIRST], false

(93) NativeSortMergeJoin
Left keys [1]: [ctr_customer_sk#11]
Right keys [1]: [c_customer_sk#30]
Join type: Inner
Join condition: None

(94) NativeProject
Output [1]: [c_customer_id#31]
Input [3]: [ctr_customer_sk#11, #30#30, #31#31]

(95) NativeTakeOrdered
Input [1]: [c_customer_id#31]
Arguments: X, X, [c_customer_id#31 ASC NULLS FIRST]

(96) Scan parquet
Output [4]: [sr_returned_date_sk#1, sr_customer_sk#2, sr_store_sk#3, sr_return_amt#4]
Batched: true
Location: InMemoryFileIndex [file:/<warehouse_dir>]
PushedFilters: [IsNotNull(sr_returned_date_sk), IsNotNull(sr_store_sk), IsNotNull(sr_customer_sk)]
ReadSchema: struct<sr_returned_date_sk:int,sr_customer_sk:int,sr_store_sk:int,sr_return_amt:decimal(7,2)>

(97) Filter
Input [4]: [sr_returned_date_sk#1, sr_customer_sk#2, sr_store_sk#3, sr_return_amt#4]
Condition : ((isnotnull(sr_returned_date_sk#1) AND isnotnull(sr_store_sk#3)) AND isnotnull(sr_customer_sk#2))

(98) Exchange
Input [4]: [sr_returned_date_sk#1, sr_customer_sk#2, sr_store_sk#3, sr_return_amt#4]
Arguments: hashpartitioning(sr_returned_date_sk#1, 100), ENSURE_REQUIREMENTS, [plan_id=11]

(99) Sort
Input [4]: [sr_returned_date_sk#1, sr_customer_sk#2, sr_store_sk#3, sr_return_amt#4]
Arguments: [sr_returned_date_sk#1 ASC NULLS FIRST], false, 0

(100) Scan parquet
Output [2]: [d_date_sk#5, d_year#6]
Batched: true
Location: InMemoryFileIndex [file:/<warehouse_dir>]
PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2000), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_year:int>

(101) Filter
Input [2]: [d_date_sk#5, d_year#6]
Condition : ((isnotnull(d_year#6) AND (d_year#6 = 2000)) AND isnotnull(d_date_sk#5))

(102) Project
Output [1]: [d_date_sk#5]
Input [2]: [d_date_sk#5, d_year#6]

(103) Exchange
Input [1]: [d_date_sk#5]
Arguments: hashpartitioning(d_date_sk#5, 100), ENSURE_REQUIREMENTS, [plan_id=12]

(104) Sort
Input [1]: [d_date_sk#5]
Arguments: [d_date_sk#5 ASC NULLS FIRST], false, 0

(105) SortMergeJoin
Left keys [1]: [sr_returned_date_sk#1]
Right keys [1]: [d_date_sk#5]
Join type: Inner
Join condition: None

(106) Project
Output [3]: [sr_customer_sk#2, sr_store_sk#3, sr_return_amt#4]
Input [5]: [sr_returned_date_sk#1, sr_customer_sk#2, sr_store_sk#3, sr_return_amt#4, d_date_sk#5]

(107) HashAggregate
Input [3]: [sr_customer_sk#2, sr_store_sk#3, sr_return_amt#4]
Keys [2]: [sr_customer_sk#2, sr_store_sk#3]
Functions [1]: [partial_sum(UnscaledValue(sr_return_amt#4))]
Aggregate Attributes [1]: [sum#8]
Results [3]: [sr_customer_sk#2, sr_store_sk#3, sum#32]

(108) Exchange
Input [3]: [sr_customer_sk#2, sr_store_sk#3, sum#32]
Arguments: hashpartitioning(sr_customer_sk#2, sr_store_sk#3, 100), ENSURE_REQUIREMENTS, [plan_id=13]

(109) HashAggregate
Input [3]: [sr_customer_sk#2, sr_store_sk#3, sum#32]
Keys [2]: [sr_customer_sk#2, sr_store_sk#3]
Functions [1]: [sum(UnscaledValue(sr_return_amt#4))]
Aggregate Attributes [1]: [sum(UnscaledValue(sr_return_amt#4))#10]
Results [3]: [sr_customer_sk#2 AS ctr_customer_sk#11, sr_store_sk#3 AS ctr_store_sk#12, MakeDecimal(sum(UnscaledValue(sr_return_amt#4))#10,17,2) AS ctr_total_return#13]

(110) Filter
Input [3]: [ctr_customer_sk#11, ctr_store_sk#12, ctr_total_return#13]
Condition : isnotnull(ctr_total_return#13)

(111) Exchange
Input [3]: [ctr_customer_sk#11, ctr_store_sk#12, ctr_total_return#13]
Arguments: hashpartitioning(ctr_store_sk#12, 100), ENSURE_REQUIREMENTS, [plan_id=14]

(112) Sort
Input [3]: [ctr_customer_sk#11, ctr_store_sk#12, ctr_total_return#13]
Arguments: [ctr_store_sk#12 ASC NULLS FIRST], false, 0

(113) Scan parquet
Output [4]: [sr_returned_date_sk#14, sr_customer_sk#15, sr_store_sk#16, sr_return_amt#17]
Batched: true
Location: InMemoryFileIndex [file:/<warehouse_dir>]
PushedFilters: [IsNotNull(sr_returned_date_sk), IsNotNull(sr_store_sk)]
ReadSchema: struct<sr_returned_date_sk:int,sr_customer_sk:int,sr_store_sk:int,sr_return_amt:decimal(7,2)>

(114) Filter
Input [4]: [sr_returned_date_sk#14, sr_customer_sk#15, sr_store_sk#16, sr_return_amt#17]
Condition : (isnotnull(sr_returned_date_sk#14) AND isnotnull(sr_store_sk#16))

(115) Exchange
Input [4]: [sr_returned_date_sk#14, sr_customer_sk#15, sr_store_sk#16, sr_return_amt#17]
Arguments: hashpartitioning(sr_returned_date_sk#14, 100), ENSURE_REQUIREMENTS, [plan_id=15]

(116) Sort
Input [4]: [sr_returned_date_sk#14, sr_customer_sk#15, sr_store_sk#16, sr_return_amt#17]
Arguments: [sr_returned_date_sk#14 ASC NULLS FIRST], false, 0

(117) Scan parquet
Output [2]: [d_date_sk#18, d_year#33]
Batched: true
Location: InMemoryFileIndex [file:/<warehouse_dir>]
PushedFilters: [IsNotNull(d_year), EqualTo(d_year,2000), IsNotNull(d_date_sk)]
ReadSchema: struct<d_date_sk:int,d_year:int>

(118) Filter
Input [2]: [d_date_sk#18, d_year#33]
Condition : ((isnotnull(d_year#33) AND (d_year#33 = 2000)) AND isnotnull(d_date_sk#18))

(119) Project
Output [1]: [d_date_sk#18]
Input [2]: [d_date_sk#18, d_year#33]

(120) Exchange
Input [1]: [d_date_sk#18]
Arguments: hashpartitioning(d_date_sk#18, 100), ENSURE_REQUIREMENTS, [plan_id=16]

(121) Sort
Input [1]: [d_date_sk#18]
Arguments: [d_date_sk#18 ASC NULLS FIRST], false, 0

(122) SortMergeJoin
Left keys [1]: [sr_returned_date_sk#14]
Right keys [1]: [d_date_sk#18]
Join type: Inner
Join condition: None

(123) Project
Output [3]: [sr_customer_sk#15, sr_store_sk#16, sr_return_amt#17]
Input [5]: [sr_returned_date_sk#14, sr_customer_sk#15, sr_store_sk#16, sr_return_amt#17, d_date_sk#18]

(124) HashAggregate
Input [3]: [sr_customer_sk#15, sr_store_sk#16, sr_return_amt#17]
Keys [2]: [sr_customer_sk#15, sr_store_sk#16]
Functions [1]: [partial_sum(UnscaledValue(sr_return_amt#17))]
Aggregate Attributes [1]: [sum#20]
Results [3]: [sr_customer_sk#15, sr_store_sk#16, sum#34]

(125) Exchange
Input [3]: [sr_customer_sk#15, sr_store_sk#16, sum#34]
Arguments: hashpartitioning(sr_customer_sk#15, sr_store_sk#16, 100), ENSURE_REQUIREMENTS, [plan_id=17]

(126) HashAggregate
Input [3]: [sr_customer_sk#15, sr_store_sk#16, sum#34]
Keys [2]: [sr_customer_sk#15, sr_store_sk#16]
Functions [1]: [sum(UnscaledValue(sr_return_amt#17))]
Aggregate Attributes [1]: [sum(UnscaledValue(sr_return_amt#17))#10]
Results [2]: [sr_store_sk#16 AS ctr_store_sk#21, MakeDecimal(sum(UnscaledValue(sr_return_amt#17))#10,17,2) AS ctr_total_return#22]

(127) HashAggregate
Input [2]: [ctr_store_sk#21, ctr_total_return#22]
Keys [1]: [ctr_store_sk#21]
Functions [1]: [partial_avg(ctr_total_return#22)]
Aggregate Attributes [2]: [sum#23, count#24]
Results [3]: [ctr_store_sk#21, sum#35, count#36]

(128) Exchange
Input [3]: [ctr_store_sk#21, sum#35, count#36]
Arguments: hashpartitioning(ctr_store_sk#21, 100), ENSURE_REQUIREMENTS, [plan_id=18]

(129) HashAggregate
Input [3]: [ctr_store_sk#21, sum#35, count#36]
Keys [1]: [ctr_store_sk#21]
Functions [1]: [avg(ctr_total_return#22)]
Aggregate Attributes [1]: [avg(ctr_total_return#22)#26]
Results [2]: [(avg(ctr_total_return#22)#26 * 1.2) AS (avg(ctr_total_return) * 1.2)#27, ctr_store_sk#21]

(130) Filter
Input [2]: [(avg(ctr_total_return) * 1.2)#27, ctr_store_sk#21]
Condition : isnotnull((avg(ctr_total_return) * 1.2)#27)

(131) Sort
Input [2]: [(avg(ctr_total_return) * 1.2)#27, ctr_store_sk#21]
Arguments: [ctr_store_sk#21 ASC NULLS FIRST], false, 0

(132) SortMergeJoin
Left keys [1]: [ctr_store_sk#12]
Right keys [1]: [ctr_store_sk#21]
Join type: Inner
Join condition: (cast(ctr_total_return#13 as decimal(24,7)) > (avg(ctr_total_return) * 1.2)#27)

(133) Project
Output [2]: [ctr_customer_sk#11, ctr_store_sk#12]
Input [5]: [ctr_customer_sk#11, ctr_store_sk#12, ctr_total_return#13, (avg(ctr_total_return) * 1.2)#27, ctr_store_sk#21]

(134) Scan parquet
Output [2]: [s_store_sk#28, s_state#29]
Batched: true
Location: InMemoryFileIndex [file:/<warehouse_dir>]
PushedFilters: [IsNotNull(s_state), EqualTo(s_state,TN), IsNotNull(s_store_sk)]
ReadSchema: struct<s_store_sk:int,s_state:string>

(135) Filter
Input [2]: [s_store_sk#28, s_state#29]
Condition : ((isnotnull(s_state#29) AND (s_state#29 = TN)) AND isnotnull(s_store_sk#28))

(136) Project
Output [1]: [s_store_sk#28]
Input [2]: [s_store_sk#28, s_state#29]

(137) Exchange
Input [1]: [s_store_sk#28]
Arguments: hashpartitioning(s_store_sk#28, 100), ENSURE_REQUIREMENTS, [plan_id=19]

(138) Sort
Input [1]: [s_store_sk#28]
Arguments: [s_store_sk#28 ASC NULLS FIRST], false, 0

(139) SortMergeJoin
Left keys [1]: [ctr_store_sk#12]
Right keys [1]: [s_store_sk#28]
Join type: Inner
Join condition: None

(140) Project
Output [1]: [ctr_customer_sk#11]
Input [3]: [ctr_customer_sk#11, ctr_store_sk#12, s_store_sk#28]

(141) Exchange
Input [1]: [ctr_customer_sk#11]
Arguments: hashpartitioning(ctr_customer_sk#11, 100), ENSURE_REQUIREMENTS, [plan_id=20]

(142) Sort
Input [1]: [ctr_customer_sk#11]
Arguments: [ctr_customer_sk#11 ASC NULLS FIRST], false, 0

(143) Scan parquet
Output [2]: [c_customer_sk#30, c_customer_id#31]
Batched: true
Location: InMemoryFileIndex [file:/<warehouse_dir>]
PushedFilters: [IsNotNull(c_customer_sk)]
ReadSchema: struct<c_customer_sk:int,c_customer_id:string>

(144) Filter
Input [2]: [c_customer_sk#30, c_customer_id#31]
Condition : isnotnull(c_customer_sk#30)

(145) Exchange
Input [2]: [c_customer_sk#30, c_customer_id#31]
Arguments: hashpartitioning(c_customer_sk#30, 100), ENSURE_REQUIREMENTS, [plan_id=21]

(146) Sort
Input [2]: [c_customer_sk#30, c_customer_id#31]
Arguments: [c_customer_sk#30 ASC NULLS FIRST], false, 0

(147) SortMergeJoin
Left keys [1]: [ctr_customer_sk#11]
Right keys [1]: [c_customer_sk#30]
Join type: Inner
Join condition: None

(148) Project
Output [1]: [c_customer_id#31]
Input [3]: [ctr_customer_sk#11, c_customer_sk#30, c_customer_id#31]

(149) TakeOrderedAndProject
Input [1]: [c_customer_id#31]
Arguments: X, [c_customer_id#31 ASC NULLS FIRST], [c_customer_id#31]

(150) AdaptiveSparkPlan
Output [1]: [c_customer_id#31]
Arguments: isFinalPlan=true

