MaxGekk commented on code in PR #40632:
URL: https://github.com/apache/spark/pull/40632#discussion_r1183905218
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonParser.scala:
##########
@@ -134,54 +137,60 @@ class JacksonParser(
// List([str_a_1,null])
// List([str_a_2,null], [null,str_b_3])
//
- case START_ARRAY if allowArrayAsStructs =>
- val array = convertArray(parser, elementConverter, isRoot = true)
- // Here, as we support reading top level JSON arrays and take every
element
- // in such an array as a row, this case is possible.
- if (array.numElements() == 0) {
- Array.empty[InternalRow]
- } else {
- array.toArray[InternalRow](schema)
- }
- case START_ARRAY =>
- throw QueryExecutionErrors.cannotParseJsonArraysAsStructsError()
- }
+ case START_ARRAY if allowArrayAsStructs =>
+ val array = convertArray(parser, elementConverter, isRoot = true)
+ // Here, as we support reading top level JSON arrays and take every
element
+ // in such an array as a row, this case is possible.
+ if (array.numElements() == 0) {
+ Array.empty[InternalRow]
+ } else {
+ array.toArray[InternalRow](schema)
+ }
+ case START_ARRAY =>
+ throw
QueryExecutionErrors.cannotParseJsonArraysAsStructsError(record().toString)
Review Comment:
Could you leave it as is, and fill in the record later?
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/FailureSafeParser.scala:
##########
@@ -65,6 +65,9 @@ class FailureSafeParser[IN](
case DropMalformedMode =>
Iterator.empty
case FailFastMode =>
+ if
(e.getCause.getMessage.startsWith("[MALFORMED_RECORD_IN_PARSING")) {
Review Comment:
`BadRecordException` should be `SparkThrowable`. Just fill in needed fields
and re-throw it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]