You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "MaxGekk (via GitHub)" <gi...@apache.org> on 2023/05/03 16:09:01 UTC

[GitHub] [spark] MaxGekk commented on a diff in pull request #40632: [SPARK-42298][SQL] Assign name to _LEGACY_ERROR_TEMP_2132

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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org