Skip to content

Conversation

@NicolasRicheYopp
Copy link
Contributor

@NicolasRicheYopp NicolasRicheYopp commented Nov 21, 2025

In the SourceDB -> Spanner flow, add support for Float type primary key for Mysql source.

  • UniformSplitter: Add a boundary extractor and splitter (split the range of value in 2) for Float value

    • splitFloat Implementation

    Because Float is an approximate values, we need additional changes:

    • Add support for approximate value (Float, Double) in isSplittable function. Equals when diff < configurable delta Uphttps://github.com/GoogleCloudPlatform/DataflowTemplates/blob/a73e0f07a719c668396e09de5195e7a9a0b756ce/v2/sourcedb-to-spanner/src/main/java/com/google/cloud/teleport/v2/source/reader/io/jdbc/uniformsplitter/range/Boundary.java#L147
    • The delta mentioned above will be used by default. But if the Mysql column has a specific precision - FLOAT(size, d) - d being the number of decimals. This granularity should carry over as delta to use. We need to add a 'delta' value in PartitionColumn
    • Tests
  • Source IndexType: Add a new IndexType.Float which map internally to Java Float.class

    • Implementation
    • Tests
  • MysqlDialectAdapter: Map Mysql source FLOAT column type to the newly created IndexType above

    • Implementation
    • Tests
  • Add Integration tests in v2/sourcedb-to-spanner/src/test/resources/DataTypesIT

@google-cla
Copy link

google-cla bot commented Nov 21, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.36%. Comparing base (ef38a80) to head (ad36de1).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3016      +/-   ##
============================================
+ Coverage     50.25%   55.36%   +5.10%     
+ Complexity     5021     1623    -3398     
============================================
  Files           967      465     -502     
  Lines         59261    26060   -33201     
  Branches       6458     2734    -3724     
============================================
- Hits          29783    14427   -15356     
+ Misses        27374    10760   -16614     
+ Partials       2104      873    -1231     
Components Coverage Δ
spanner-templates 71.35% <100.00%> (+0.90%) ⬆️
spanner-import-export ∅ <ø> (∅)
spanner-live-forward-migration 79.69% <ø> (ø)
spanner-live-reverse-replication 77.04% <ø> (-0.04%) ⬇️
spanner-bulk-migration 88.36% <100.00%> (+0.03%) ⬆️
Files with missing lines Coverage Δ
...jdbc/dialectadapter/mysql/MysqlDialectAdapter.java 99.61% <100.00%> (+<0.01%) ⬆️
...niformsplitter/range/BoundaryExtractorFactory.java 100.00% <100.00%> (ø)
...uniformsplitter/range/BoundarySplitterFactory.java 100.00% <100.00%> (ø)
...source/reader/io/schema/SourceColumnIndexInfo.java 68.00% <100.00%> (+1.33%) ⬆️

... 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 and others added 6 commits December 4, 2025 09:57
… passed to PartitionColumn. This is to allow the Boundary splitter to know what decimal precision is used by the source column.

- Update Boundary.isSplittable to support FLOAT by doing delta based compare between 2 values. Either use a small default delta step size or the one provided the source db column.

- Update MysqlDialectAdapter to pass the Numeric-scale schema value of Float column as DecimalStepSize to SourceColumnIndexInfo
@NicolasRicheYopp NicolasRicheYopp marked this pull request as ready for review December 9, 2025 20:52
…ks with approximate delta based comparisons)
@NicolasRicheYopp
Copy link
Contributor Author

@VardhanThigle I made the changes we discussed during the meeting:

  • Move default decimalStep from Boundary to MysqlDialectAdapter
  • Add tests of Boundary.isMergable with float values (check that it works with the provided granularity of DecimalStepSize parameter)

I think the PR is now ready but of course let me know if you see anything missing.

Thank you

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.

3 participants