[SPARK-59208][SDP] SCD2 Ignore-null support; Introduce ignore-null selection in ChangeArgs - #58505
Draft
AnishMahto wants to merge 12 commits into
Draft
[SPARK-59208][SDP] SCD2 Ignore-null support; Introduce ignore-null selection in ChangeArgs#58505AnishMahto wants to merge 12 commits into
ChangeArgs#58505AnishMahto wants to merge 12 commits into
Conversation
diffSchemas previously compared top-level fields only. When a struct column gained or lost nested fields, the entire column type was emitted as an UpdateColumnType -- a change many DSv2 connectors reject because the semantics of replacing a whole struct type are ambiguous. This patch makes diffSchemas recurse into StructType columns: nested field additions become addColumn with multi-part field paths, deletions become deleteColumn, and type/nullability changes become the corresponding nested updateColumnType/updateColumnNullability. This is the DSv2-idiomatic way to evolve struct columns and is supported by Delta, Iceberg, and other connectors that handle nested schemas.
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.
AnishMahto
force-pushed
the
SPARK-59208-introduce-ignore-null-change-arg
branch
from
September 4, 2026 06:15
0957bfd to
773c8aa
Compare
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-59165-scd2-version-map-schema...SPARK-59208-introduce-ignore-null-change-arg
What changes were proposed in this pull request?
ChangeArgsholds all of the user-specified configurations (arguments) that should apply to their AutoCDC flow by execution time.Ignore-null is a new AutoCDC argument that allows users to specify a set of columns that AutoCDC should treat as unauthored by an event when they receive a null-value in that event.
We need to represent this selection in
ChangeArgsso that AutoCDC batch processors can later reference it, and validate that the columns selected indeed exist and are eligible for selection. Ex. a key column or reserved AutoCDC column may never be specified as ignore-null.Why are the changes needed?
To support the ignore-null feature for AutoCDC SCD2 (as per the approved SPIP), we need to represent the user-specified ignore null column selection during pipeline analysis and execution.
Does this PR introduce any user-facing change?
No. We introduce internal plumbing and representation for ignore-null selection, but no user-facing API exists yet to specify the ignore-null selection.
How was this patch tested?
Unit tests.
Was this patch authored or co-authored using generative AI tooling?
Co-authored with Claude Opus 4.6