[SPARK-59183][SDP] SCD2 Ignore-null support; Populate version map per event row at ingest - #58645
Draft
AnishMahto wants to merge 16 commits into
Draft
[SPARK-59183][SDP] SCD2 Ignore-null support; Populate version map per event row at ingest#58645AnishMahto wants to merge 16 commits into
AnishMahto wants to merge 16 commits into
Conversation
Add a nullable __VERSION_MAP field (Map<String, Boolean>) to the SCD2 _cdc_metadata struct. This field will track per-column authorship for ignore-null semantics in a future change; for now it is always null. Source changes: - Introduce Scd2VersionMap with mapType and authorship contract docs. - Add versionMapFieldName, versionMapOf to Scd2BatchProcessor companion. - Extend cdcMetadataColSchema and constructCdcMetadataCol with the new field. All four call sites pass versionMap explicitly (no default). - Decomposition tails and tombstones always receive a null version map (synthetic rows carry no authorship claim). Test changes: - Update all Row(...) constructions for CDC metadata structs across Scd2BatchProcessorSuite, Scd2BatchProcessorMergeSuite, Scd2ForeachBatchHandlerSuite, and 7 graph execution test suites. - Fix schema-preservation tests to use the production two-field cdcMetadataInnerSchema. - Update scd2MetadataDdl in AutoCdcGraphExecutionTestMixin.
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.
This is a stacked PR. See incremental diff here: AnishMahto/spark@SPARK-59208-introduce-ignore-null-change-arg...SPARK-59183-populate-verison-map-at-ingest
See previous PR in stack here: #58505
What changes were proposed in this pull request?
When processing an incoming microbatch, if ignore-null is enabled for the AutoCDC flow, a non-null version map needs to be populated for every row in the microbatch.
As per the version map contract (see
Scd2VersionMap's scaladoc), the version map is populated with null-authorship information for every event, respecting the currently active ignore-null selection.This ticket is not concerned with reconciling the microbatch's version maps with existing rows in the aux/target table.
Why are the changes needed?
Core part of the algorithm for supporting ignore-null API in SCD2.
Does this PR introduce any user-facing change?
No. The user facing interfaces for ignore-null are not exposed yet, this logic cannot be hit yet.
How was this patch tested?
Unit tests.
Was this patch authored or co-authored using generative AI tooling?
Co-authored with GPT-5.6 Sol.