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

    https://github.com/apache/spark/pull/376#discussion_r11469892
  
    --- Diff: 
core/src/main/scala/org/apache/spark/input/WholeTextFileInputFormat.scala ---
    @@ -44,4 +47,15 @@ private[spark] class WholeTextFileInputFormat extends 
CombineFileInputFormat[Str
           context,
           classOf[WholeTextFileRecordReader])
       }
    +
    +  /**
    +   * Allow minSplits set by end-user in order to keep compatibility with 
old Hadoop API.
    +   */
    +  def setMaxSplitSize(context: JobContext, minSplits: Int) {
    +    val files = listStatus(context)
    +    val totalLen = files.map { file =>
    +      if (file.isDir) 0L else file.getLen
    +    }.sum
    +    super.setMaxSplitSize(totalLen / (if (minSplits == 0) 1 else 
minSplits))
    --- End diff --
    
    Are you sure this won't create an extra split sometimes due to rounding 
down? E.g. if the file is 11 bytes and you set minSplits to 2, it will set 
maxSplitSize to 5, and it will create three splits (5 + 5 + 1 bytes).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to