Skip to content

[IcebergIO] Keep CDC DELETEs on bucket, month and year partitions - #41980

Open
claudevdm wants to merge 1 commit into
apache:masterfrom
claudevdm:iceberg-fix-cdc-partition-match
Open

claudevdm wants to merge 1 commit into
apache:masterfrom
claudevdm:iceberg-fix-cdc-partition-match

Conversation

@claudevdm

Copy link
Copy Markdown
Collaborator

On tables partitioned by bucket, month or year, a CDC read left out the DELETE made by an equality or position delete, so the change stream said the row still existed. A DELETE in a null partition went missing when the same snapshot also deleted in another partition, and a NaN partition value failed the read with "Cannot create expression literal from NaN".

To find the data files that a snapshot's deletes touch, the changelog scan pruned manifests with a filter that compared each affected partition value with the source column. A bucket, month or year is not a value of its source column, so the right manifests were dropped; null values were left out of the filter, and NaN cannot be a literal. Match each affected partition on the partition fields of its own spec instead, with IS NULL and IS NAN for null and NaN values.

@claudevdm
claudevdm requested a review from ahmedabu98 December 4, 2026 23:24
On tables partitioned by bucket, month or year, a CDC read left out the
DELETE made by an equality delete, a position delete or a deletion
vector, so the change stream said the row still existed. A DELETE in a
null partition went missing whenever the planned snapshot also touched a
non-null partition, by a delete or only by an append. A NaN partition
value failed the read with "Cannot create expression literal from NaN".

To find the data files that a snapshot's deletes touch, the changelog
scan pruned data manifests with a filter that compared each affected
partition value with the source column. A bucket, month or year is not a
value of its source column, so the right manifests were dropped; null
values were left out of the filter, and NaN cannot be a literal.

Match each affected partition on the partition fields of its own spec
instead, with IS NULL and IS NAN for null and NaN values and a
nanosecond literal for timestamp_ns values. The partitions of a spec are
combined into a balanced OR, so many affected partitions cannot overflow
the stack, and bound once per spec, case-sensitively since the names
come from the spec itself. Manifests of a spec with no affected
partition are skipped, unpartitioned ones included: a delete applies
only to data files of its own spec, and a global delete still keeps
every manifest. When matching fails, the manifests are kept and a
warning is logged.

DELETEs that a CDC read already dropped stay dropped: to get them,
re-read from a snapshot before the first affected delete.
@claudevdm
claudevdm force-pushed the iceberg-fix-cdc-partition-match branch from 054d16a to f303d7b Compare December 5, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant