Delta ods hardening fixes#206
Merged
Merged
Conversation
…Greek letters...) and adding use_transaction as test
MaxAlex
approved these changes
Jul 6, 2026
Contributor
Author
|
Merging for velocity test on dev |
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 PR addresses some issues with the new delta pipeline (added here: #203), and puts a new test table on the gamma instance (
EDW.USE_TRANSACTION).fix: Sparse updates no longer move rows to partition odin_year=0/odin_month=0
The merge source derives odin_year/odin_month from the CDC batch's edw_inserted_dtm. When a sparse update batch carried no edw_inserted_dtm for a key, those degraded to 0 and were written verbatim. The row would silently move into the 0/0 partition (and out of partition-pruned query results) with internally inconsistent partition vs. data values. Partition columns now update via CASE WHEN source.edw_inserted_dtm IS NOT NULL THEN source.odin_year ELSE target.odin_year END, keeping the target's partition placement when the batch has no new timestamp.
fix: Null header__change_seq CDC records now raise instead of being silently skipped
The watermark filter header__change_seq > ? never matches NULL in SQL, so null-seq CDC records were excluded before the existing null_count == 0 assertion could see them. The documented "CDC records carry a change sequence" invariant was thus unenforceable. The CDC read now includes an OR header__change_seq IS NULL arm with ORDER BY … NULLS FIRST, so any null-seq record surfaces at the head of the next batch and fails loudly.
fix: MERGE identifiers are quoted
The MERGE key predicate and update/insert expressions used unquoted column names, so a column named like a SQL reserved word would break the merge. All column references in MERGE expressions are now quoted.
fix: History reads scoped to the current snapshot partition
Schema discovery previously ran DESCRIBE over the table-wide glob with union_by_name, unioning columns across every historical snapshot. A column dropped upstream would reappear in silver as a phantom all-null column. All reads now use a snapshot=/**/*.parquet glob (DuckDB's ** matches zero or more directories, and hive partitioning still derives the snapshot column). Side benefit: the job no longer lists/reads footers for every historical snapshot's files on each run. The WHERE snapshot = ? filters remain as defense-in-depth.