Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/18200#discussion_r120555082
--- 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 --
I did not read the code yet, but it looks like the result is wrong? We
should output the `a` in the corrupted column.
In addition, this scenario works if we pass the csv files that contain less
column values than the schema, right?
---
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]