Repository navigation
[SpannerToSourceDb] Unify DMLGeneratorUtils column walker and fix null custom NPE - #4668
Closed
aasthabharill wants to merge 4 commits into
Closed
aasthabharill wants to merge 4 commits into
aasthabharill wants to merge 4 commits into
Conversation
This was referenced Dec 1, 2026
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4668 +/- ##
============================================
+ Coverage 59.72% 66.46% +6.74%
+ Complexity 8218 3352 -4866
============================================
Files 1122 552 -570
Lines 72762 32713 -40049
Branches 8855 3791 -5064
============================================
- Hits 43454 21742 -21712
+ Misses 26405 9887 -16518
+ Partials 2903 1084 -1819
🚀 New features to boost your workflow:
|
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part 4 of 7 for migrating
v2/spanner-to-sourcedbJDBC reverse-replication writers toPreparedStatementexecution (follows #4667; split out of combined prototype #4655).This PR is self-contained and safe to merge on its own: it refactors
DMLGeneratorUtils.getColumnValuesandgetPkColumnValuesonto a shared private generic column walker (resolveNonPkColumns/resolvePkColumns) in preparation forgetColumnBindings, and fixes aNullPointerExceptionwhen custom transformations returnnullacross MySQL, Oracle, and SQL Server.Implementation & Why
DMLGeneratorUtils(dbutils/dml/DMLGeneratorUtils.java):resolveNonPkColumns,resolvePkColumns,resolveSpannerColumn, andselectValuesJsonparameterized on value type<V>.ColumnBindingAPIs are layered on top in [SpannerToSourceDb] Add ColumnBinding and DMLGeneratorUtils binding APIs #4663.customTransformationResponse.get(colName),newValuesJson,keyValuesJson, andsourceTable.primaryKeyColumns().TODOto evaluate returningnullwhen a non-generated composite PK column has no Spanner mapping (pre-existing behavior preserved for compatibility with existing tests).DMLGeneratorUtilsTest.java):testLegacyGetColumnAndPkValues_HandleNullCustomTransformationWithoutNpeverifying both non-PK and PK paths handlenullcustom transformation outputs cleanly.Verification
mvn -pl v2/spanner-common,v2/spanner-custom-shard,v2/spanner-to-sourcedb test spotless:check(Checkstyle, Spotless, and unit tests passed).Series Context
JdbcDaoleak/rollback fix), [SpannerToSourceDb] Add PreparedStatementValue and JdbcDao typed binding #4666 (PreparedStatementValue), [SpannerToSourceDb] Add bytesToHex and Spanner value helpers to DMLGeneratorUtils #4667 (DMLGeneratorUtilsvalue helpers).DMLGeneratorUtils+ null custom-transformation NPE fix.ColumnBindingand exposesDMLGeneratorUtils.getColumnBindings/getPkColumnBindingsbacked by this generic walker.PostgreSQLDMLGeneratorontoPreparedStatementbinding + unit tests + docs.SpannerToPostgreSQLDataTypesITacross 11 non-bigint PK types, enums, non-finite floats, and generated-PK CRUD.