Uh oh!
There was an error while loading. Please reload this page.
[SPARK-31874][SQL] Use FastDateFormat as the legacy fractional formatter - #28678
Closed
MaxGekk wants to merge 1 commit into
Closed
[SPARK-31874][SQL] Use FastDateFormat as the legacy fractional formatter#28678MaxGekk wants to merge 1 commit into
FastDateFormat as the legacy fractional formatter#28678MaxGekk wants to merge 1 commit into
Conversation
SparkQA
commented
May 30, 2020
Test build #123317 has finished for PR 28678 at commit
|
FastDateFormat as the legacy fractional formatterFastDateFormat as the legacy fractional formatterMaxGekk
commented
May 30, 2020
MemberAuthor
@cloud-fan@HyukjinKwon@juliuszsompolski Please, review this PR. |
FastDateFormat as the legacy fractional formatterFastDateFormat as the legacy fractional formatterFastDateFormat as the legacy fractional formatterFastDateFormat as the legacy fractional formatter| TimestampFormatter.defaultPattern, | ||
| zoneId, | ||
| TimestampFormatter.defaultLocale, | ||
| LegacyDateFormats.FAST_DATE_FORMAT, |
Contributor
There was a problem hiding this comment.
is it the same with Spark 2.4?
MemberAuthor
There was a problem hiding this comment.
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.
cloud-fan
commented
May 31, 2020
Contributor
thanks, merging to master/3.0! |
cloud-fan pushed a commit
that referenced
this pull request
May 31, 2020
…atter ### What changes were proposed in this pull request? 1. Replace `SimpleDateFormat` by `FastDateFormat` as the legacy formatter of `FractionTimestampFormatter`. 2. Optimise `LegacyFastTimestampFormatter` for `java.sql.Timestamp` w/o fractional part. ### Why are the changes needed? 1. By default `HiveResult`.`hiveResultString` retrieves timestamps values as instances of `java.sql.Timestamp`, and uses the legacy parser `SimpleDateFormat` to convert the timestamps to strings. After the fix#28024, the fractional formatter and its companion - legacy formatter `SimpleDateFormat` are created per every value. By switching from `LegacySimpleTimestampFormatter` to `LegacyFastTimestampFormatter`, we can utilize the internal cache of `FastDateFormat`, and avoid parsing the default pattern `yyyy-MM-dd HH:mm:ss`. 2. The second change in the method `def format(ts: Timestamp): String` of `LegacyFastTimestampFormatter` is needed to optimize the formatter for patterns without the fractional part and avoid conversions to microseconds. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? By existing tests in `TimestampFormatter`. Closes#28678 from MaxGekk/fastdateformat-as-legacy-frac-formatter. Authored-by: Max Gekk <max.gekk@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> (cherry picked from commit 47dc332) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
HyukjinKwon
commented
Jun 1, 2020
Member
+1 |
1 similar comment
juliuszsompolski
commented
Jun 2, 2020
Contributor
+1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
SimpleDateFormatbyFastDateFormatas the legacy formatter ofFractionTimestampFormatter.LegacyFastTimestampFormatterforjava.sql.Timestampw/o fractional part.Why are the changes needed?
HiveResult.hiveResultStringretrieves timestamps values as instances ofjava.sql.Timestamp, and uses the legacy parserSimpleDateFormatto convert the timestamps to strings. After the fix[SPARK-31254][SQL] Use the current session time zone inHiveResult.toHiveString#28024, the fractional formatter and its companion - legacy formatterSimpleDateFormatare created per every value. By switching fromLegacySimpleTimestampFormattertoLegacyFastTimestampFormatter, we can utilize the internal cache ofFastDateFormat, and avoid parsing the default patternyyyy-MM-dd HH:mm:ss.def format(ts: Timestamp): StringofLegacyFastTimestampFormatteris needed to optimize the formatter for patterns without the fractional part and avoid conversions to microseconds.Does this PR introduce any user-facing change?
No
How was this patch tested?
By existing tests in
TimestampFormatter.