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

SparkContext's newAPIHadoopFile does not support comma-separated list of files, but the other API hadoopFile does.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.3.1
    • 1.3.2, 1.4.0
    • Spark Core
    • None
    • Ubuntu 14.04

    Description

      SparkContext's newAPIHadoopFile() does not support comma-separated list of files. For example, the following:

      sc.newAPIHadoopFile("/root/file1.txt,/root/file2.txt", classOf[TextInputFormat], classOf[LongWritable], classOf[Text])

      will throw

      org.apache.hadoop.mapreduce.lib.input.InvalidInputException: Input path does not exist: file:/root/file1.txt,/root/file2.txt

      However, the other API hadoopFile() is able to process comma-separated list of files correctly.

      In addition, since sc.textFile() uses hadoopFile(), it is also able to process comma-separated list of files correctly.

      The problem is that newAPIHadoopFile() use addInputPath() to add the file path into NewHadoopRDD. See Ln 928-931, master branch:
      val job = new NewHadoopJob(conf)
      NewFileInputFormat.addInputPath(job, new Path(path))
      val updatedConf = job.getConfiguration
      new NewHadoopRDD(this, fClass, kClass, vClass, updatedConf).setName(path)

      Change addInputPath(job, new Path(path)) to addInputPaths(job, path) will resolve this issue.

      Attachments

        Issue Links

          Activity

            People

              yongtang Yong Tang
              yongtang Yong Tang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: