srowen commented on a change in pull request #26862: [SPARK-30232] [SQL]fix the 
ArthmeticException by zero when enable AQE
URL: https://github.com/apache/spark/pull/26862#discussion_r357146326
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/OptimizeLocalShuffleReader.scala
 ##########
 @@ -88,7 +88,7 @@ case class OptimizeLocalShuffleReader(conf: SQLConf) extends 
Rule[SparkPlan] {
     }
     val numReducers = shuffleDep.partitioner.numPartitions
     val expectedParallelism = advisoryParallelism.getOrElse(numReducers)
-    val numMappers = shuffleDep.rdd.getNumPartitions
+    val numMappers = math.max(1, shuffleDep.rdd.getNumPartitions)
 
 Review comment:
   Hm, but if numMappers = 0, Array.fill never evaluates anything; you get an 
empty array. Are you sure this is the cause?

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

Reply via email to