Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class FractionTimestampFormatter(zoneId: ZoneId)
TimestampFormatter.defaultPattern,
zoneId,
TimestampFormatter.defaultLocale,
LegacyDateFormats.FAST_DATE_FORMAT,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it the same with Spark 2.4?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spark 2.4 uses SimpleDateFormat but output of FastDateFormat and SimpleDateFormat for the concrete pattern yyyy-MM-dd HH:mm:ss is the same. At least, all our tests show no difference.

needVarLengthSecondFraction = false) {

@transient
Expand Down Expand Up @@ -224,7 +225,11 @@ class LegacyFastTimestampFormatter(
}

override def format(ts: Timestamp): String = {
format(fromJavaTimestamp(ts))
if (ts.getNanos == 0) {
fastDateFormat.format(ts)
} else {
format(fromJavaTimestamp(ts))
}
}

override def format(instant: Instant): String = {
Expand Down