Hisoka-X commented on code in PR #42018:
URL: https://github.com/apache/spark/pull/42018#discussion_r1285208116


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonParser.scala:
##########
@@ -231,8 +231,8 @@ class JacksonParser(
               Float.PositiveInfinity
             case "-INF" | "-Infinity" if options.allowNonNumericNumbers =>
               Float.NegativeInfinity
-            case _ => throw 
QueryExecutionErrors.cannotParseStringAsDataTypeError(
-              parser, VALUE_STRING, FloatType)
+            case _ => throw StringAsDataTypeException(parser.getCurrentName, 
parser.getText,

Review Comment:
   Throw `StringAsDataTypeException`  then recatch it in `FailureSafeParser` to 
make sure can throw  `CANNOT_PARSE_STRING_AS_DATATYPE` normally. Just like we 
do in https://github.com/apache/spark/pull/40632. Before this PR, the 
`CANNOT_PARSE_STRING_AS_DATATYPE` can't be throwed.
   
   Before this PR, it will throw
   ```scala
   Caused by: org.apache.spark.SparkException: 
[MALFORMED_RECORD_IN_PARSING.WITHOUT_SUGGESTION] Malformed records are detected 
in record parsing: [null].
   Parse Mode: FAILFAST. To process malformed records as null result, try 
setting the option 'mode' as 'PERMISSIVE'. 
   ```
   



-- 
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]

Reply via email to