[SPARK-59358][SDP] SCD2 Ignore-null support; Coalesce ignored-null values - #58947
Open
AnishMahto wants to merge 21 commits into
Open
AnishMahto wants to merge 21 commits into
AnishMahto wants to merge 21 commits into
Conversation
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-59640-scd2-version-map-authorship-operations...SPARK-59358-coalesce-ignored-null-columns.
See previous PR in stack here: #58914
What changes were proposed in this pull request?
Once the version map is constructed per incoming row in the microbatch, we need to start actually reconciling columns in the incoming microbatch that have been deduced as unauthored - they should instead inherit the last known authored value.
While reconciling the affected existing rows from the aux/target table, it's also possible out of order received events in the current microbatch affect what authored value existing ignored-null columns inherit; these need to be updated too.
The core algorithm iterates over the full set of affected rows by the incoming microbatch in window order, coalescing unauthored columns values with the last known authored value within the window.
It's worth noting that only columns explicitly in the ignore-null selection in the current reconciliation are coalesced, even if existing rows have initialized version maps from a different ignore-null selection in a previous reconciliation. Version maps themselves are immutable, and the chosen semantic is:
Why are the changes needed?
Core algorithm for coalescing/reconciling ignore-null columns for rows in or affected by the incoming microbatch.
Does this PR introduce any user-facing change?
No. Ignore null reconciliation is strictly only invoked if an ignore-null selection is specified. The ignore-null API is not yet released, so all existing AutoCDC workloads necessarily do not specify an ignore-null selection.
How was this patch tested?
Scd2CoalesceIgnoredNullSuite.Was this patch authored or co-authored using generative AI tooling?
GPT Sol 5.6.