Skip to content

Commit 8358a95

Browse files
committed
[SPARK-57456][SQL][FOLLOWUP] Document that JSON nanos timestamp types accept only string input
The numeric-epoch shorthand (a JSON integer parsed as epoch seconds) is legacy TimestampType behavior and is intentionally not carried over to the nanosecond timestamp types, which accept only string input. Co-authored-by: Isaac
1 parent b52fce8 commit 8358a95

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonParser.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,9 @@ class JacksonParser(
382382

383383
case t: TimestampLTZNanosType =>
384384
(parser: JsonParser) => parseJsonToken[TimestampNanosVal](parser, dataType) {
385+
// Unlike the microsecond TimestampType, the nanosecond types accept only string input.
386+
// The numeric-epoch shorthand (a JSON integer read as epoch seconds) is legacy
387+
// TimestampType behavior and is intentionally not carried over to the nanos types.
385388
case VALUE_STRING if parser.getTextLength >= 1 =>
386389
timestampFormatter.parseNanos(parser.getText, t.precision)
387390
}

0 commit comments

Comments
 (0)