Repository navigation
Conversation
The MySQL handler now formats quoted TIMESTAMP values as UTC datetime literals with up to six fractional digits. Local timestamps, unparseable values, other column types, and PostgreSQL behavior remain unchanged. Fixes GoogleCloudPlatform#2942
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an issue where Datastream rows containing timestamp values failed to write to MySQL due to incompatible ISO timestamp literal formats. The changes introduce a dedicated formatting utility within the MySQL DML handler to sanitize these values into a format accepted by MySQL, ensuring reliable data migration while maintaining backward compatibility for other data types and PostgreSQL behavior. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces timestamp formatting logic in DatastreamToMySQLDML to parse ISO-8601 timestamp literals and format them to UTC for MySQL TIMESTAMP columns, along with comprehensive unit tests. The review feedback suggests adding a defensive null check for tableSchema to prevent potential NullPointerExceptions, extending this formatting logic to support DATETIME columns as well, and updating the unit tests to cover both column types.
3141e32 to
fd89a9c
Compare
Background
Rows containing timestamp values fail to write to MySQL because it rejects ISO timestamp literals with a trailing Z or offset.
The MySQL DML handler passed offset timestamp literals through without converting them to MySQL's datetime format.
Summary of the fix
The MySQL handler now formats quoted TIMESTAMP values as UTC datetime literals with up to six fractional digits. Local timestamps, unparseable values, other column types, and PostgreSQL behavior remain unchanged.
Verification
The command
mvn -B -ntp -pl v2/datastream-to-sql -am test -Dtest=DatastreamToDMLTest -Dsurefire.failIfNoSpecifiedTests=falsepassed all 71 tests. The tests inv2/datastream-to-sql/src/test/java/com/google/cloud/teleport/v2/utils/DatastreamToDMLTest.javafail without the fix in the DataflowTemplates DatastreamToMySQLDML change (checked by reverting the source changes).Fixes #2942