DataflowTemplates icon indicating copy to clipboard operation
DataflowTemplates copied to clipboard

support for date as primary key

Open gpalanisamyYopp opened this issue 11 months ago • 4 comments

gpalanisamyYopp avatar Dec 08 '25 21:12 gpalanisamyYopp

Summary of Changes

Hello @gpalanisamyYopp, I'm Gemini Code Assist[^1]! 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 enhances the sourcedb-to-spanner tool by introducing explicit support for the MySQL DATE data type. It ensures that DATE columns are correctly recognized and mapped as TIME_STAMP during schema discovery and data migration, with comprehensive unit and integration tests to validate this new functionality.

Highlights

  • MySQL DATE Type Mapping: The MySQL DATE data type is now explicitly mapped to IndexType.TIME_STAMP within the MysqlDialectAdapter, ensuring consistent handling during schema discovery.
  • Unit Test Updates: The MysqlDialectAdapterTest has been updated to include DATE in its column type discovery tests, verifying that the new mapping is correctly processed.
  • Integration Test Expansion: New integration tests have been added for the DATE data type, including a date_pk_table in mysql-data-types.sql and its corresponding Spanner schema in mysql-spanner-schema.sql, along with expected data in MySQLDataTypesIT.java.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize 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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

[^1]: Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

gemini-code-assist avatar Dec 08 '25 21:12 gemini-code-assist

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 55.64%. Comparing base (301cd41) to head (848cea7). :warning: Report is 5 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3082      +/-   ##
============================================
+ Coverage     50.41%   55.64%   +5.23%     
+ Complexity     5022     1613    -3409     
============================================
  Files           970      468     -502     
  Lines         59606    26362   -33244     
  Branches       6506     2771    -3735     
============================================
- Hits          30051    14670   -15381     
+ Misses        27434    10800   -16634     
+ Partials       2121      892    -1229     
Components Coverage Δ
spanner-templates 71.60% <100.00%> (+0.95%) :arrow_up:
spanner-import-export ∅ <ø> (∅)
spanner-live-forward-migration 80.03% <ø> (ø)
spanner-live-reverse-replication 77.42% <ø> (-0.05%) :arrow_down:
spanner-bulk-migration 88.25% <100.00%> (+<0.01%) :arrow_up:
Files with missing lines Coverage Δ
...jdbc/dialectadapter/mysql/MysqlDialectAdapter.java 99.62% <100.00%> (+<0.01%) :arrow_up:

... and 522 files with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Dec 09 '25 06:12 codecov[bot]

Conflicts + Title need to be updated to mention this is for Primary key support. Other than that looks good to me.

NicolasRicheYopp avatar Dec 09 '25 14:12 NicolasRicheYopp

Please fix spotless.

VardhanThigle avatar Dec 10 '25 09:12 VardhanThigle

Please fix the build, UT all lines of code touched, fix spotless before pushing the changes so as to avoid back and forth..

VardhanThigle avatar Dec 11 '25 09:12 VardhanThigle

Is there an import missing? The build is not yet fixed.

VardhanThigle avatar Dec 12 '25 03:12 VardhanThigle

Build is still borken

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project sourcedb-to-spanner: Compilation failure
/home/runner/actions-runner/_work/DataflowTemplates/DataflowTemplates/v2/sourcedb-to-spanner/src/main/java/com/google/cloud/teleport/v2/source/reader/io/jdbc/uniformsplitter/range/BoundarySplitterFactory.java:[208,55] cannot find symbol
  symbol:   variable DateTimeFormatter
  location: class com.google.cloud.teleport.v2.source.reader.io.jdbc.uniformsplitter.range.BoundarySplitterFactory

VardhanThigle avatar Dec 15 '25 06:12 VardhanThigle