manuzhang commented on a change in pull request #26434: [SPARK-29544] [SQL]
optimize skewed partition based on data size
URL: https://github.com/apache/spark/pull/26434#discussion_r355826902
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/ReduceNumShufflePartitions.scala
##########
@@ -145,39 +159,59 @@ case class ReduceNumShufflePartitions(conf: SQLConf)
extends Rule[SparkPlan] {
distinctNumPreShufflePartitions.length == 1,
"There should be only one distinct value of the number pre-shuffle
partitions " +
"among registered Exchange operator.")
- val numPreShufflePartitions = distinctNumPreShufflePartitions.head
val partitionStartIndices = ArrayBuffer[Int]()
- // The first element of partitionStartIndices is always 0.
- partitionStartIndices += 0
+ val partitionEndIndices = ArrayBuffer[Int]()
- var postShuffleInputSize = 0L
+ def nextStartIndex(i: Int): Int = {
+ if (i == validPartitions.length - 1) i else i + 1
Review comment:
I've seen this pattern several times. Worth to make a util function ?
----------------------------------------------------------------
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]