-
Notifications
You must be signed in to change notification settings - Fork 214
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
Add support for MySQL Date/Time/TimeStamp/DateTime date type transformation #5190
Conversation
…mation to OpenSearch Signed-off-by: Dinu John <[email protected]>
Signed-off-by: Dinu John <[email protected]>
Signed-off-by: Dinu John <[email protected]>
Signed-off-by: Dinu John <[email protected]>
Signed-off-by: Dinu John <[email protected]>
final Long dateEpoch = parseDateTimeStrAsEpoch(dateStr); | ||
if (dateEpoch != null) return dateEpoch; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the return value here epoch in millis or in days, since "Date from binlog is long value representing days since epoch"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's Unix time (number of seconds that have elapsed since 00:00:00 (UTC), Thursday, 1 January 1970, not counting leap seconds)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, we need to convert it to epoch millis to be consistent with the conversion below for export data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated documentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Thanks for clarifying!
final Long dateTimeEpoch = parseDateTimeStrAsEpoch(dateTimeStr); | ||
if (dateTimeEpoch != null) return dateTimeEpoch; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly here, is the return value epoch in millis or epoch in micros?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's epoch seconds
|
||
private static Stream<Arguments> provideDateTestCases() throws ParseException { | ||
return Stream.of( | ||
Arguments.of("2023-12-25", getEpochMillisFromDateStr("2023-12-25")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to add a test case with a string of long value as input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
} | ||
|
||
private static Stream<Arguments> provideTimeTestCases() { | ||
return Stream.of( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, we may want to add a test case with a string of long value as input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
Signed-off-by: Dinu John <[email protected]>
Signed-off-by: Dinu John <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
…mation (opensearch-project#5190) * Add support for MySQL Date/Time/TimeStamp/DateTime date type transformation to OpenSearch Signed-off-by: Dinu John <[email protected]> * Configure BinlogClient to deserialize data and time as long Signed-off-by: Dinu John <[email protected]> * Add documentation Signed-off-by: Dinu John <[email protected]> * Update documentation Signed-off-by: Dinu John <[email protected]> * Update documentation Signed-off-by: Dinu John <[email protected]> * Update unit test and documentation Signed-off-by: Dinu John <[email protected]> * Update documentation Signed-off-by: Dinu John <[email protected]> --------- Signed-off-by: Dinu John <[email protected]> Signed-off-by: Kondaka <[email protected]>
Description
Add support for MySQL Date/Time/TimeStamp/DateTime date type transformation between binlog and S3 export formats to OpenSearch.
MySQL binlog represents temporal types as follows:
S3 export formats:
Note: Fractional seconds are optional for DATETIME
Issues Resolved
Contributes to #4561
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.