Github user mateiz commented on a diff in the pull request:
https://github.com/apache/spark/pull/376#discussion_r11469906
--- 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 --
Also can this code apply to other FileInputFormats too, or just the
CombinedFileInputFormat? It's a bit weird that minSplits is passed to HadoopRDD
but then it only applies it if the RDD is using this InputFormat.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---