Github user Cazen commented on the pull request:
https://github.com/apache/spark/pull/10496#issuecomment-167571045
For example, if JSON file that includes not listed by JSON backslash
quoting specification, it returns corrupt_record
JSON File
{"name": "Cazen Lee", "price": "$10"}
{"name": "John Doe", "price": "\$20"}
{"name": "Tracy", "price": "$10"}
corrupt_record(returns null)
scala> df.show
+--------------------+---------+-----+
| _corrupt_record| name|price|
+--------------------+---------+-----+
| null|Cazen Lee| $10|
|{"name": "John Do...| null| null|
| null| Tracy| $10|
+--------------------+---------+-----+
And after apply this patch, we can enable
allowBackslashEscapingAnyCharacter option like below
scala> val df =
sqlContext.read.option("allowBackslashEscapingAnyCharacter",
"true").json("/user/Cazen/test/test2.txt")
df: org.apache.spark.sql.DataFrame = [name: string, price: string]
scala> df.show
+---------+-----+
| name|price|
+---------+-----+
|Cazen Lee| $10|
| John Doe| $20|
| Tracy| $10|
+---------+-----+
This issue similar to HIVE-11825, HIVE-12717.
---
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]