Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-22225

wholeTextFilesIterators

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • 2.2.0
    • None
    • Spark Core
    • None

    Description

      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:

      def wholeTextFilesIterators(
          path: String,
          minPartitions: Int = defaultMinPartitions,
          delimiter: String = "\n"): RDD[(String, Iterator[String])]
      

      Where each `Iterator[String]` is a lazy file iterator where each string is delimited by the `delimiter` field.

      Attachments

        Activity

          People

            Unassigned Unassigned
            sams sam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: