Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/11756#discussion_r56298666
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala ---
@@ -288,6 +288,9 @@ class DataFrameReader private[sql](sqlContext:
SQLContext) extends Logging {
* </li>
* <li>`allowNumericLeadingZeros` (default `false`): allows leading
zeros in numbers
* (e.g. 00012)</li>
+ * <li>`mode` (default `PERMISSIVE`): allows a mode for dealing with
corrupt records
+ * during parsing. When fails to parse, `PERMISSIVE` mode sets `null`,
`DROPMALFORMED` drops the
+ * record and `FAILFAST` throws an exception.<li>
--- End diff --
I think we need to say more about these 3 modes. From the tests, it looks
to me that:
* `PERMISSIVE` mode will set other fields to null when meet a corrupted
record, and put the malformed string into a new field configured by
`spark.sql.columnNameOfCorruptRecord`.
* `DROPMALFORMED` mode will ignore corrupted records and append a new field
which is always null to the output.
* `FAILFAST` mode will throw an exception.
It will be better if you can expand this doc and add some examples.
---
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]