Skip to content

Commit

Permalink
Add 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 ef51420 commit 2a5e5fe
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;

/**
* Handles MySQL temporal data types (DATE, TIME, DATETIME, YEAR) conversion between binlog and S3 export formats.
*
* MySQL binlog represents temporal types as follows:
* - DATE: long value representing days since epoch (1970-01-01)
* - TIME: long value representing milliseconds since epoch (1970-01-01 00:00:00)
* - DATETIME: long value representing microseconds since epoch (1970-01-01 00:00:00)
* - YEAR: 4-digit year value (Example: 2024)
*
* S3 export formats:
* - DATE: "yyyy-MM-dd" (Example: "2024-01-15")
* - TIME: "HH:mm:ss" (Example: "14:30:00")
* - DATETIME: "yyyy-MM-dd HH:mm:ss[.SSSSSS]" (Example: "2024-01-15 14:30:00.123456")
* Note: Fractional seconds are optional for DATETIME
* - YEAR: "yyyy" (Example: "2024")
*/
public class TemporalTypeHandler implements DataTypeHandler {
private static final String MYSQL_DATE_FORMAT = "yyyy-MM-dd";
private static final String MYSQL_TIME_FORMAT = "HH:mm:ss";
Expand Down

0 comments on commit 2a5e5fe

Please sign in to comment.