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

Revert [SPARK-23094] Fix invalid character handling in JsonDataSource

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Invalid
    • 2.3.0
    • None
    • SQL
    • None

    Description

        test("invalid json with leading nulls - from dataset") {
          import testImplicits._
          withTempDir { tempDir =>
            val path = tempDir.getAbsolutePath
            Seq("""{"firstName":"Chris", "lastName":"Baird"}""",
              """{"firstName":"Doug", "lastName":"Rood"}""").toDS().write.mode("overwrite").text(path)
            val schema = new StructType().add("a", IntegerType).add("_corrupt_record", StringType)
            val jsonDF = spark.read.schema(schema).option("mode", "DROPMALFORMED").json(path)
            checkAnswer(jsonDF, Seq(
              Row("Chris", "Baird"), Row("Doug", "Rood")
            ))
          }
        }
      
      

      After this PR it returns a wrong answer.

      [null,null]
      [null,null]
      

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            smilegator Xiao Li
            smilegator Xiao Li
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment