fix: normalize incremental cursor values in drivers before persisting state#907
Open
vishalm0509 wants to merge 10 commits intostagingfrom
Open
fix: normalize incremental cursor values in drivers before persisting state#907vishalm0509 wants to merge 10 commits intostagingfrom
vishalm0509 wants to merge 10 commits intostagingfrom
Conversation
vikaxsh
reviewed
Apr 14, 2026
|
|
||
| var maxPrimaryCursorValue, maxSecondaryCursorValue any | ||
|
|
||
| bytesConverter := func(value any) any { |
Collaborator
There was a problem hiding this comment.
For now, instead of removing this entirely, let’s add an MSSQL-specific check; otherwise, we’d need to test all other drivers.
Collaborator
Author
There was a problem hiding this comment.
It will not break anything. As there is no change in the code flow. I am doing the same thing now but in a different place
Collaborator
Author
There was a problem hiding this comment.
I have also verified with 3 models
Collaborator
There was a problem hiding this comment.
IMO, for now we should implement for mssql only
| return utils.ConvertToString(value) | ||
| } | ||
|
|
||
| func normalizeMSSQLValueForState(value any, columnType string) any { |
Collaborator
There was a problem hiding this comment.
Suggested change
| func normalizeMSSQLValueForState(value any, columnType string) any { | |
| func normalizeMSSQLValue(value any, columnType string) any { |
| } | ||
|
|
||
| func (m *MSSQL) normalizeCursorValue(ctx context.Context, stream types.StreamInterface, cursorField string, value any) (any, error) { | ||
| if cursorField == "" || value == nil { |
Collaborator
There was a problem hiding this comment.
do we need this check as cursorField is never going to be empty
Collaborator
Author
There was a problem hiding this comment.
No need to check cursorField
…ix/mssql_incremental
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.
Description
The shared JDBC helper no longer converts scanned cursor values (e.g. []byte → string). It returns raw values; each source normalizes before writing state.
Postgres, MySQL, DB2: normalize by turning []byte cursors into strings.
MSSQL: normalize using column type (existing normalizeMSSQLValueForState) so incremental state matches what the backfill path uses.
Why
Central conversion was wrong or insufficient for some drivers/types; normalization must be driver- and type-aware (especially MSSQL).
Fixes # (issue)
Type of change
How Has This Been Tested?
Screenshots or Recordings
Documentation
Related PR's (If Any):