Skip to content

support for date as primary key#3082

Closed
gpalanisamyYopp wants to merge 11 commits intoGoogleCloudPlatform:mainfrom
gpalanisamyYopp:source-to-spanner-mysql-date-timestamp
Closed

support for date as primary key#3082
gpalanisamyYopp wants to merge 11 commits intoGoogleCloudPlatform:mainfrom
gpalanisamyYopp:source-to-spanner-mysql-date-timestamp

Conversation

@gpalanisamyYopp
Copy link
Contributor

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @gpalanisamyYopp, 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 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 👍 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.

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.

Footnotes

  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.

@codecov
Copy link

codecov bot commented Dec 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.64%. Comparing base (301cd41) to head (848cea7).
⚠️ 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%) ⬆️
spanner-import-export ∅ <ø> (∅)
spanner-live-forward-migration 80.03% <ø> (ø)
spanner-live-reverse-replication 77.42% <ø> (-0.05%) ⬇️
spanner-bulk-migration 88.25% <100.00%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
...jdbc/dialectadapter/mysql/MysqlDialectAdapter.java 99.62% <100.00%> (+<0.01%) ⬆️

... and 522 files with indirect coverage changes

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

@NicolasRicheYopp
Copy link
Contributor

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

@gpalanisamyYopp gpalanisamyYopp changed the title add DATE mapping as TIME_STAMP support for date as primary key Dec 9, 2025
@VardhanThigle
Copy link
Contributor

Please fix spotless.

@VardhanThigle
Copy link
Contributor

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

@pull-request-size pull-request-size bot added size/L and removed size/M labels Dec 11, 2025
@VardhanThigle
Copy link
Contributor

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

@VardhanThigle
Copy link
Contributor

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

@nmemond
Copy link
Contributor

nmemond commented Dec 15, 2025

I unfortunately don't have permissions to push to the fork and the developer that owns this is out of office for the rest of the year. I've re-created the PR but up-to-date with main in #3113.

@VardhanThigle
Copy link
Contributor

Closing as this is being tracked in #3113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants