spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sean Owen (JIRA)" <>
Subject [jira] [Commented] (SPARK-22225) wholeTextFilesIterators
Date Tue, 10 Oct 2017 07:13:00 GMT


Sean Owen commented on SPARK-22225:

I tend to agree that this is already available from binaryFiles as it gives you a stream on
the input file. That's not a textual representation but of course you just apply a Reader
to it. The given use case was XML files earlier, and those libraries are happy to operate
on a stream. It's not crazy to have a convenience method that applies a BufferedReader to
an InputStream but it hides virtually no complexity.

> wholeTextFilesIterators
> -----------------------
>                 Key: SPARK-22225
>                 URL:
>             Project: Spark
>          Issue Type: New Feature
>          Components: Spark Core
>    Affects Versions: 2.2.0
>            Reporter: sam
> It is a very common use case to want to preserve a path -> file mapping in an RDD,
or read an entire file in one go.  Especially for unstructured data and ETL.
> Currently wholeTextFiles is the goto method for this, but it read the entire file into
memory, which is sometimes an issue (see SPARK-18965).  It also precludes the option to lazily
process files.
> It would be nice to have a method with the following signature:
> {code}
> def wholeTextFilesIterators(
>     path: String,
>     minPartitions: Int = defaultMinPartitions,
>     delimiter: String = "\n"): RDD[(String, Iterator[String])]
> {code}
> Where each `Iterator[String]` is a lazy file iterator where each string is delimited
by the `delimiter` field.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message