[BugFix] Fix Iceberg equality-delete under-application when a string date partition column is compared with a temporal value (backport #76280)#76293
Merged
Conversation
23 tasks
Stub nativeTbl.spec() so the mocked Iceberg table behaves like a real one; getDeleteFiles now dereferences spec() via identityStringPartitionColumns. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: trueeyu <lxhhust350@qq.com>
trueeyu
approved these changes
Jul 13, 2026
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.
Why I'm doing
Fourth (and last) in the series fixing one root cause across its consumers. When a STRING date
partition column is compared with a temporal value, e.g.
binary-predicate coercion produces
CAST(c2 AS DATETIME) = '2020-06-14 00:00:00'. Iceberg's nativepushdown unwraps the cast and compares in the STRING domain, which never equals a
'yyyy-MM-dd'partition value.
getDeleteFiles).getDeleteFilespushed the whole predicate through the string-domain converter to filter theequality-delete-file scan. A
CAST(string_partition_col AS DATETIME) = <ts>conjunct thereforepruned every equality-delete file whose
'yyyy-MM-dd'partition value did not equal the rendered'...00:00:00'string.IcebergEqualityDeleteRewriteRulethen derived no delete schemas, theequality-delete anti-join was not applied, and already-deleted rows leaked back into the result.
Unlike the other paths, this is a silent correctness bug on reads (stale rows returned).
What I'm doing
Reuse
PartitionCastPredicatePruner:non-cast (
pushable) conjuncts are converted and pushed.partitionMayMatch(drops a delete file only when its partition value provably cannot satisfy theresidual). Keeping a possibly-matching delete file is safe (a superset only over-applies equality
deletes, which match by key and never remove non-matching rows); dropping a needed one is not, so
the direction matches [BugFix] Fix Iceberg partition pruning when a string date partition column is compared with a temporal value #76068's scan-side pruning.
deleteFilePartitionValues(DeleteFile, table), which decodes a delete file's partition valuesusing the file's own partition spec (a delete file may predate the current spec) and returns an
empty map on any decoding uncertainty (partition-transform evolution, dropped source column, etc.),
so
partitionMayMatchconservatively keeps the file.Reproduce
Equality-delete files can only be written by Flink (StarRocks/Spark write position deletes), so the
fixture is created with a Flink upsert:
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check:
This is an automatic backport of pull request #76280 done by [Mergify](https://mergify.com).