cloud-fan 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_r362847404
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/QueryStageExec.scala
 ##########
 @@ -160,6 +162,29 @@ case class ShuffleQueryStageExec(
       case _ =>
     }
   }
+
+  private def getPartitionIndexRanges(): Array[(Int, Int)] = {
+    val length = shuffle.shuffleDependency.partitioner.numPartitions
+    val partitionStartIndices = ArrayBuffer[Int]()
+    val partitionEndIndices = ArrayBuffer[Int]()
+    (0 until length).map { i =>
+      if (!excludedPartitions.contains(i)) {
+        partitionStartIndices += i
+        partitionEndIndices += i + 1
+      }
+    }
+    partitionStartIndices.zip(partitionEndIndices).toArray
+  }
+
+  private var cachedShuffleRDD: ShuffledRowRDD = null
+
+  override def doExecute(): RDD[InternalRow] = {
+    if (cachedShuffleRDD == null) {
+      cachedShuffleRDD = shuffle.createShuffledRDD(
 
 Review comment:
   if `excludedPartitions` is empty, shall we just call `plan.execute` here?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to