Revert "[SPARK-36429][SQL] JacksonParser should throw exception when data type unsupported"

### What changes were proposed in this pull request?

This PR reverts the change in SPARK-36429 (#33654).
See [conversation](https://github.com/apache/spark/pull/33654#issuecomment-894160037).

### Why are the changes needed?

To recover CIs.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

N/A

Closes #33670 from sarutak/revert-SPARK-36429.

Authored-by: Kousuke Saruta <sarutak@oss.nttdata.com>
Signed-off-by: Kousuke Saruta <sarutak@oss.nttdata.com>
This commit is contained in:
Kousuke Saruta 2021-08-06 20:56:24 +09:00
parent 888f8f03c8
commit e17612d0bf
3 changed files with 10 additions and 8 deletions

View file

@ -330,8 +330,12 @@ class JacksonParser(
case udt: UserDefinedType[_] => case udt: UserDefinedType[_] =>
makeConverter(udt.sqlType) makeConverter(udt.sqlType)
// We don't actually hit this exception though, we keep it for understandability case _ =>
case _ => throw QueryExecutionErrors.unsupportedTypeError(dataType) (parser: JsonParser) =>
// Here, we pass empty `PartialFunction` so that this case can be
// handled as a failed conversion. It will throw an exception as
// long as the value is not null.
parseJsonToken[AnyRef](parser, dataType)(PartialFunction.empty[JsonToken, AnyRef])
} }
/** /**

View file

@ -661,10 +661,9 @@ You may get a different result due to the upgrading of Spark 3.0: Fail to recogn
-- !query -- !query
select from_json('{"t":"26/October/2015"}', 't Timestamp', map('timestampFormat', 'dd/MMMMM/yyyy')) select from_json('{"t":"26/October/2015"}', 't Timestamp', map('timestampFormat', 'dd/MMMMM/yyyy'))
-- !query schema -- !query schema
struct<> struct<from_json({"t":"26/October/2015"}):struct<t:timestamp_ntz>>
-- !query output -- !query output
java.lang.Exception {"t":null}
Unsupported type: timestamp_ntz
-- !query -- !query

View file

@ -642,10 +642,9 @@ You may get a different result due to the upgrading of Spark 3.0: Fail to recogn
-- !query -- !query
select from_json('{"t":"26/October/2015"}', 't Timestamp', map('timestampFormat', 'dd/MMMMM/yyyy')) select from_json('{"t":"26/October/2015"}', 't Timestamp', map('timestampFormat', 'dd/MMMMM/yyyy'))
-- !query schema -- !query schema
struct<> struct<from_json({"t":"26/October/2015"}):struct<t:timestamp_ntz>>
-- !query output -- !query output
java.lang.Exception {"t":null}
Unsupported type: timestamp_ntz
-- !query -- !query