-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-2559] Millisecond granularity for instant timestamps #3824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8c37d51
Update the instance format to include milliseconds
davehagman 42f0681
Abstract instant serde into active timeline methods
davehagman 4371002
Add test to verify parsing and instant date math works as expected
davehagman 719f111
Update returned test value to be ms granularity
davehagman 7d16138
Add method to timeline to correctly parse incoming date-times for ins…
davehagman f717a61
Merge branch 'master' into ms_granularity_instants
davehagman 7bb77d2
Merge branch 'master' into ms_granularity_instants
davehagman 50cc95c
Use default millis
davehagman 1209fe7
Make var naming more consistent. Better comments
davehagman d4a8853
Fixed test to line up with new default millis on instants
davehagman 52b7ea1
Update test value (which is actually correct). Add ability to overrid…
davehagman 150a746
Revert "Update test value (which is actually correct). Add ability to…
davehagman 08536c3
Update test to use correct value
davehagman 06ed6bd
Merge branch 'master' into ms_granularity_instants
davehagman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Empty file.
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,7 +48,6 @@ import java.text.SimpleDateFormat | |
| import scala.collection.immutable.Map | ||
|
|
||
| object HoodieSqlUtils extends SparkAdapterSupport { | ||
| private val defaultDateTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") | ||
| private val defaultDateFormat = new SimpleDateFormat("yyyy-MM-dd") | ||
|
|
||
| def isHoodieTable(table: CatalogTable): Boolean = { | ||
|
|
@@ -292,13 +291,14 @@ object HoodieSqlUtils extends SparkAdapterSupport { | |
| * 3、yyyyMMddHHmmss | ||
| */ | ||
| def formatQueryInstant(queryInstant: String): String = { | ||
| if (queryInstant.length == 19) { // for yyyy-MM-dd HH:mm:ss | ||
| HoodieActiveTimeline.COMMIT_FORMATTER.format(defaultDateTimeFormat.parse(queryInstant)) | ||
| } else if (queryInstant.length == 14) { // for yyyyMMddHHmmss | ||
| HoodieActiveTimeline.COMMIT_FORMATTER.parse(queryInstant) // validate the format | ||
| val instantLength = queryInstant.length | ||
| if (instantLength == 19 || instantLength == 23) { // for yyyy-MM-dd HH:mm:ss[:SSS] | ||
| HoodieActiveTimeline.getInstantForDateString(queryInstant) | ||
| } else if (instantLength == 14 || instantLength == 17) { // for yyyyMMddHHmmss[SSS] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: should we use the |
||
| HoodieActiveTimeline.parseDateFromInstantTime(queryInstant) // validate the format | ||
| queryInstant | ||
| } else if (queryInstant.length == 10) { // for yyyy-MM-dd | ||
| HoodieActiveTimeline.COMMIT_FORMATTER.format(defaultDateFormat.parse(queryInstant)) | ||
| HoodieActiveTimeline.getInstantForDate(defaultDateFormat.parse(queryInstant)) | ||
| } else { | ||
| throw new IllegalArgumentException(s"Unsupported query instant time format: $queryInstant," | ||
| + s"Supported time format are: 'yyyy-MM-dd: HH:mm:ss' or 'yyyy-MM-dd' or 'yyyyMMddHHmmss'") | ||
|
|
||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.