Skip to content

Commit 1dac0ef

Browse files
committed
Format Java date-time types in Row.jsonValue directly
1 parent 721cba5 commit 1dac0ef

File tree

1 file changed

+4
-8
lines changed
  • sql/catalyst/src/main/scala/org/apache/spark/sql

1 file changed

+4
-8
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/Row.scala

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -571,14 +571,10 @@ trait Row extends Serializable {
571571
case (s: String, _) => JString(s)
572572
case (b: Array[Byte], BinaryType) =>
573573
JString(Base64.getEncoder.encodeToString(b))
574-
case (d: LocalDate, _) =>
575-
JString(dateFormatter.format(DateTimeUtils.localDateToDays(d)))
576-
case (d: Date, _) =>
577-
JString(dateFormatter.format(DateTimeUtils.fromJavaDate(d)))
578-
case (i: Instant, _) =>
579-
JString(timestampFormatter.format(DateTimeUtils.instantToMicros(i)))
580-
case (t: Timestamp, _) =>
581-
JString(timestampFormatter.format(DateTimeUtils.fromJavaTimestamp(t)))
574+
case (d: LocalDate, _) => JString(dateFormatter.format(d))
575+
case (d: Date, _) => JString(dateFormatter.format(d))
576+
case (i: Instant, _) => JString(timestampFormatter.format(i))
577+
case (t: Timestamp, _) => JString(timestampFormatter.format(t))
582578
case (i: CalendarInterval, _) => JString(i.toString)
583579
case (a: Array[_], ArrayType(elementType, _)) =>
584580
iteratorToJsonArray(a.iterator, elementType)

0 commit comments

Comments
 (0)