Github user mateiz commented on a diff in the pull request:
https://github.com/apache/spark/pull/1658#discussion_r17707460
--- Diff: core/src/main/scala/org/apache/spark/SparkContext.scala ---
@@ -511,6 +511,67 @@ class SparkContext(config: SparkConf) extends Logging {
}
/**
+ * Get an RDD for a Hadoop-readable dataset as byte-streams for each file
+ * (useful for binary data)
+ *
+ * @param minPartitions A suggestion value of the minimal splitting
number for input data.
+ *
+ * @note Small files are preferred, large file is also allowable, but
may cause bad performance.
+ */
+ def binaryFiles(path: String, minPartitions: Int = defaultMinPartitions):
+ RDD[(String, Array[Byte])] = {
--- End diff --
What if we just added a toArray to PortableDataStream, and had only one
method for reading these? Then you could do
`sc.binaryFiles(...).map(_.toArray)` if you want to get byte arrays. Or would
this cause a regression?
Basically my suggestion is to have binaryFiles, which will return an RDD of
PortableDataStream, and binaryRecords, which will return an RDD of byte arrays
of the same length (since I imagine there's no point streaming a record).
---
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.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]