ulysses-you edited a comment on issue #26946: [SPARK-30036][SQL] Fix: REPARTITION hint does not work with order by URL: https://github.com/apache/spark/pull/26946#issuecomment-570535969 Wait, another point. First this scence also exists in `join` or `window` operator, as @viirya say, exists other Distribution. For e.g. join ``` val df = spark.range(1, 10, 2) df.join(df.repartition(10), Seq("id"), "left").explain(true) // physical plan like this = Physical Plan == *(5) Project [id#0L] +- SortMergeJoin [id#0L], [id#83L], LeftOuter :- *(2) Sort [id#0L ASC NULLS FIRST], false, 0 : +- Exchange hashpartitioning(id#0L, 200), true, [id=#378] : +- *(1) Range (1, 10, step=1, splits=40) +- *(4) Sort [id#83L ASC NULLS FIRST], false, 0 +- Exchange hashpartitioning(id#83L, 200), true, [id=#384] +- Exchange RoundRobinPartitioning(10), false, [id=#383] +- *(3) Range (1, 10, step=1, splits=40) ``` And then there is a little difference between `2 -> 10 -> 200` and `2 -> 10` because of different operator complexity. Repartition may be is a light operator compare with sort or join or else algorithm. So it's not sure `2 -> 10` is always run faster than `2 -> 10 -> 200`. The last, if end user really want result partition is 10, should use `df.sort("id").repartition(10)` instead, not the `df.repartition(10).sort("id")`. Pruning shuffle may mislead user. cc @HyukjinKwon @cloud-fan @maropu
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
