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

"path" option is added again to input paths during infer()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.4.6, 3.0.0, 3.0.1, 3.1.0
    • 3.0.1, 3.1.0
    • SQL
    • None

    Description

      When "path" option is used when creating a DataFrame, it can cause issues during infer.

      class TestFileFilter extends PathFilter {
        override def accept(path: Path): Boolean = path.getParent.getName != "p=2"
      }
      
      val path = "/tmp"
      val df = spark.range(2)
      df.write.json(path + "/p=1")
      df.write.json(path + "/p=2")
      
      val extraOptions = Map(
        "mapred.input.pathFilter.class" -> classOf[TestFileFilter].getName,
        "mapreduce.input.pathFilter.class" -> classOf[TestFileFilter].getName
      )
      
      // This works fine.
      assert(spark.read.options(extraOptions).json(path).count == 2)
      
      // The following with "path" option fails with the following:
      // assertion failed: Conflicting directory structures detected. Suspicious paths
      //	file:/tmp
      //	file:/tmp/p=1
      assert(spark.read.options(extraOptions).format("json").option("path", path).load.count() === 2)
      

      Attachments

        Activity

          People

            imback82 Terry Kim
            imback82 Terry Kim
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: