Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
Signed-off-by: Dinu John <[email protected]>
  • Loading branch information
dinujoh committed Nov 14, 2024
1 parent 26497b0 commit 3e082b0
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public Long handle(final MySQLDataType columnType, final String columnName, fina
private Long handleTime(final String timeStr) {
try {
// Try parsing as Unix timestamp first
final Long timeEpoch = parseDateTimeStrAsEpoch(timeStr);
final Long timeEpoch = parseDateTimeStrAsEpochMillis(timeStr);
if (timeEpoch != null) return timeEpoch;

final LocalTime time = LocalTime.parse(timeStr, TIME_FORMATTER);
Expand All @@ -88,7 +88,7 @@ private Long handleTime(final String timeStr) {
private Long handleDate(final String dateStr) {
try {
// Try parsing as Unix timestamp first
final Long dateEpoch = parseDateTimeStrAsEpoch(dateStr);
final Long dateEpoch = parseDateTimeStrAsEpochMillis(dateStr);
if (dateEpoch != null) return dateEpoch;

LocalDate date = LocalDate.parse(dateStr, DATE_FORMATTER);
Expand All @@ -102,7 +102,7 @@ private Long handleDate(final String dateStr) {

private Long handleDateTime(final String dateTimeStr) {
try {
final Long dateTimeEpoch = parseDateTimeStrAsEpoch(dateTimeStr);
final Long dateTimeEpoch = parseDateTimeStrAsEpochMillis(dateTimeStr);
if (dateTimeEpoch != null) return dateTimeEpoch;

// Parse using standard MySQL datetime format
Expand All @@ -114,7 +114,9 @@ private Long handleDateTime(final String dateTimeStr) {
}
}

private Long parseDateTimeStrAsEpoch(final String dateTimeStr) {
// Binlog reader converts temporal fields to epoch millis
// The Binlog reader is set with EventDeserializer.CompatibilityMode.DATE_AND_TIME_AS_LONG
private Long parseDateTimeStrAsEpochMillis(final String dateTimeStr) {
// Try parsing as Unix timestamp first
try {
return Long.parseLong(dateTimeStr);
Expand Down

0 comments on commit 3e082b0

Please sign in to comment.