Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/22723#discussion_r229721018
  
    --- Diff: 
core/src/main/scala/org/apache/spark/input/WholeTextFileInputFormat.scala ---
    @@ -48,11 +50,11 @@ private[spark] class WholeTextFileInputFormat
        * Allow minPartitions set by end-user in order to keep compatibility 
with old Hadoop API,
        * which is set through setMaxSplitSize
        */
    -  def setMinPartitions(context: JobContext, minPartitions: Int) {
    +  def setMinPartitions(sc: SparkContext, context: JobContext, 
minPartitions: Int) {
         val files = listStatus(context).asScala
         val totalLen = files.map(file => if (file.isDirectory) 0L else 
file.getLen).sum
    -    val maxSplitSize = Math.ceil(totalLen * 1.0 /
    -      (if (minPartitions == 0) 1 else minPartitions)).toLong
    +    val minPartNum = Math.max(sc.defaultParallelism, minPartitions)
    +    val maxSplitSize = Math.ceil(totalLen * 1.0 / minPartNum).toLong
    --- End diff --
    
    Yes, this no longer matches the title or JIRA. I am also not clear on the 
argument why this is better?


---

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

Reply via email to