Github user maropu commented on a diff in the pull request:
https://github.com/apache/spark/pull/18200#discussion_r120594941
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVSuite.scala
---
@@ -1174,4 +1174,12 @@ class CSVSuite extends QueryTest with
SharedSQLContext with SQLTestUtils {
}
}
}
+
+ test("SPARK-20978: Set null for malformed column when the number of
tokens is less than schema") {
+ val df = spark.read
+ .schema("a string, b string, unparsed string")
+ .option("columnNameOfCorruptRecord", "unparsed")
+ .csv(Seq("a").toDS())
+ checkAnswer(df, Row("a", null, null))
--- End diff --
Sorry for cutting in, but how to handle these longer/shorter cases is some
arguable as @HyukjinKwon said in
https://github.com/apache/spark/pull/16928#discussion_r120023340. IMHO
currently we just regard shorter cases as not-corrupted so as to keep existing
behaviour (the previous Spark releases have regarded these case as
not-corrupted, so other developers said that this behaviour change was not
acceptable in earlier prs).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]