Skip to content

feat(sourcedb-to-spanner): Add uniform splitting support for extended…#4028

Open
jsuhani-2026 wants to merge 2 commits into
mainfrom
jsuhani-pg-indexType
Open

feat(sourcedb-to-spanner): Add uniform splitting support for extended…#4028
jsuhani-2026 wants to merge 2 commits into
mainfrom
jsuhani-pg-indexType

Conversation

@jsuhani-2026

Copy link
Copy Markdown
Contributor

Expands Uniform Splitting for PostgreSQL migrations by adding support for several new primary key data types: time, timetz, float, double, decimal, bit, and uuid.
Updated PostgreSQLDataTypesIT and PostgreSQLDataTypesPGDialectIT , to cover all supported primary key types (integers, strings, dates, timestamps, numerics, floats, etc.), addressing a previous gap in our test coverage.

@jsuhani-2026 jsuhani-2026 added the addition New feature or request label Jul 15, 2026
@jsuhani-2026
jsuhani-2026 force-pushed the jsuhani-pg-indexType branch from 210dc2c to 2b231d2 Compare July 15, 2026 07:50
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.75635% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.60%. Comparing base (0caed64) to head (3b390f5).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
...niformsplitter/range/BoundaryExtractorFactory.java 75.71% 13 Missing and 4 partials ⚠️
...rmsplitter/range/RangePreparedStatementSetter.java 76.66% 6 Missing and 1 partial ⚠️
...uniformsplitter/range/BoundarySplitterFactory.java 88.37% 2 Missing and 3 partials ⚠️
...ctadapter/postgresql/PostgreSQLDialectAdapter.java 90.90% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4028      +/-   ##
============================================
+ Coverage     55.68%   63.60%   +7.92%     
+ Complexity     7236     2548    -4688     
============================================
  Files          1124      535     -589     
  Lines         68447    30900   -37547     
  Branches       7721     3450    -4271     
============================================
- Hits          38117    19655   -18462     
+ Misses        27856    10223   -17633     
+ Partials       2474     1022    -1452     
Components Coverage Δ
spanner-templates 88.02% <83.75%> (+0.35%) ⬆️
spanner-import-export ∅ <ø> (∅)
spanner-live-forward-migration 89.21% <ø> (-0.08%) ⬇️
spanner-live-reverse-replication 83.40% <ø> (-0.07%) ⬇️
spanner-bulk-migration 92.28% <83.75%> (-0.20%) ⬇️
gcs-spanner-dv 89.98% <ø> (+1.43%) ⬆️
Files with missing lines Coverage Δ
...eleport/v2/reader/io/jdbc/JdbcCommonConstants.java 0.00% <ø> (ø)
...ort/v2/reader/io/jdbc/iowrapper/JdbcIoWrapper.java 98.10% <ø> (ø)
...io/jdbc/uniformsplitter/range/PartitionColumn.java 96.87% <100.00%> (+0.10%) ⬆️
...ort/v2/reader/io/schema/SourceColumnIndexInfo.java 82.60% <100.00%> (+10.19%) ⬆️
...ctadapter/postgresql/PostgreSQLDialectAdapter.java 93.70% <90.90%> (+0.17%) ⬆️
...uniformsplitter/range/BoundarySplitterFactory.java 96.84% <88.37%> (-2.04%) ⬇️
...rmsplitter/range/RangePreparedStatementSetter.java 89.61% <76.66%> (-8.35%) ⬇️
...niformsplitter/range/BoundaryExtractorFactory.java 91.47% <75.71%> (-7.23%) ⬇️

... and 613 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.

@jsuhani-2026
jsuhani-2026 marked this pull request as ready for review July 15, 2026 09:12
@jsuhani-2026
jsuhani-2026 requested a review from a team as a code owner July 15, 2026 09:12
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the summary. You can try again by commenting /gemini summary.

@shreyakhajanchi

Copy link
Copy Markdown
Contributor

/gemini summary

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

This pull request enhances the uniform splitting functionality for PostgreSQL migrations by extending support to a wider range of primary key data types. It introduces necessary logic for parsing and splitting these types, updates the dialect adapter to handle optimized boundary queries for non-standard types, and significantly improves test coverage to ensure reliability across various data types.

Highlights

  • Expanded Data Type Support: Added support for uniform splitting in PostgreSQL migrations for additional primary key data types, including time, timetz, float, double, decimal, bit, and uuid.
  • Enhanced Test Coverage: Updated PostgreSQLDataTypesIT and PostgreSQLDataTypesPGDialectIT to include comprehensive test coverage for all supported primary key types.
  • Optimized Boundary Queries: Implemented optimized subqueries for boundary extraction on specific types like BIT and UUID, bypassing standard MIN/MAX aggregate functions.
Activity
  • Codecov reported a patch coverage of 83.67%.
  • Gemini encountered an error generating the initial summary.
  • User shreyakhajanchi requested a new summary via /gemini summary.

@shreyakhajanchi

shreyakhajanchi commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

/gemini review

1 similar comment
@shreyakhajanchi

Copy link
Copy Markdown
Contributor

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for partitioning and splitting tables by LOCAL_TIME, OFFSET_TIME, and BIT column types in the sourcedb-to-spanner template. It implements boundary extraction, splitting logic, and prepared statement parameter mapping for these types, along with comprehensive integration tests. The review feedback suggests optimizing the parsing of PostgreSQL time and offset time bytes by checking for binary formats first, which avoids unnecessary UTF-8 string decoding and regex matching on binary payloads.

Comment thread v2/sourcedb-to-spanner/src/test/resources/DataTypesIT/postgresql-data-types.sql Outdated
Comment on lines +164 to +167
// "t_time_pk",
// "t_time_without_time_zone_pk",
// "t_timetz_pk",
// "t_time_with_time_zone_pk",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are these commented out?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, reading time and timetz types from the source isn't supported, so their values get extracted as null. Since these are primary key columns, the null values cause those rows to be routed straight to the DLQ instead of migrating. I've commented them out so the assertion for the tables in this unsupported list doesn't fail.

System.setProperty("numWorkers", "20");
Map<String, String> jobParameters = new HashMap<>();
jobParameters.put("numPartitions", "100");
jobParameters.put("numPartitions", "10");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did we debug why higher partitions are causing issue ? Can we run a test using cloudsql instances with 100 partitions locally to see that this is an issue due to small mysql container?

@jsuhani-2026
jsuhani-2026 force-pushed the jsuhani-pg-indexType branch 3 times, most recently from 1b70125 to c681d4a Compare July 20, 2026 12:41
- Added 24:00:00 and non-zero timezone test cases for time/timetz types.
- Centralized the 'bit' type literal into JdbcCommonConstants.BIT_TYPE.
- Optimized time/timetz parsing by checking for binary payload format first.
@jsuhani-2026
jsuhani-2026 force-pushed the jsuhani-pg-indexType branch from c681d4a to 3b390f5 Compare July 20, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

addition New feature or request size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants