Support Float as primary key for Mysql source
In the SourceDB -> Spanner flow, add support for Float type primary key for Mysql source.
-
[x] UniformSplitter: Add a boundary extractor and splitter (split the range of value in 2) for Float value
- [x] splitFloat Implementation
Because Float is an approximate values, we need additional changes:
- [x] 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
- [x] 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 https://github.com/GoogleCloudPlatform/DataflowTemplates/blob/a73e0f07a719c668396e09de5195e7a9a0b756ce/v2/sourcedb-to-spanner/src/main/java/com/google/cloud/teleport/v2/source/reader/io/jdbc/uniformsplitter/range/PartitionColumn.java#L26
- [x] Tests
-
[x] Source IndexType: Add a new IndexType.Float which map internally to Java Float.class
- [x] Implementation
- [x] Tests
-
[x] MysqlDialectAdapter: Map Mysql source FLOAT column type to the newly created IndexType above
- [x] Implementation
- [x] Tests
-
[x] Add Integration tests in v2/sourcedb-to-spanner/src/test/resources/DataTypesIT
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 Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 55.36%. Comparing base (ef38a80) to head (ad36de1).
:warning: 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%) |
:arrow_up: |
| spanner-import-export | ∅ <ø> (∅) |
|
| spanner-live-forward-migration | 79.69% <ø> (ø) |
|
| spanner-live-reverse-replication | 77.04% <ø> (-0.04%) |
:arrow_down: |
| spanner-bulk-migration | 88.36% <100.00%> (+0.03%) |
:arrow_up: |
| Files with missing lines | Coverage Δ | |
|---|---|---|
| ...jdbc/dialectadapter/mysql/MysqlDialectAdapter.java | 99.61% <100.00%> (+<0.01%) |
:arrow_up: |
| ...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%) |
:arrow_up: |
: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.
@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