cloud-fan commented on a change in pull request #32872:
URL: https://github.com/apache/spark/pull/32872#discussion_r669277698



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/CustomShuffleReaderExec.scala
##########
@@ -87,8 +87,15 @@ case class CustomShuffleReaderExec private(
     Iterator(desc)
   }
 
-  def hasCoalescedPartition: Boolean =
-    partitionSpecs.exists(_.isInstanceOf[CoalescedPartitionSpec])
+  /**
+   * Returns true iff some non-empty partitions were combined
+   */
+  def hasCoalescedPartition: Boolean = {
+    partitionSpecs.exists {
+      case s: CoalescedPartitionSpec => s.endReducerIndex - 
s.startReducerIndex > 1

Review comment:
       ```
   // If all input RDDs have 0 partition, we create an empty partition for 
every shuffle reader.
   if (validMetrics.isEmpty) {
     return Seq.fill(numShuffles)(Seq(CoalescedPartitionSpec(0, 0, 0)))
   }
   ```
   
   Shall we use `CoalescedPartitionSpec(0, numReducers, 0)`?




-- 
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.

To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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

Reply via email to