[fix](iceberg) Fix NPE in COUNT(*) pushdown when snapshot summary omits total-* counters#64648
Open
raghav-reglobe wants to merge 1 commit into
Open
[fix](iceberg) Fix NPE in COUNT(*) pushdown when snapshot summary omits total-* counters#64648raghav-reglobe wants to merge 1 commit into
raghav-reglobe wants to merge 1 commit into
Conversation
…ts total-* counters
IcebergScanNode.getCountFromSnapshot() read total-equality-deletes /
total-position-deletes / total-records from the snapshot summary and called
.equals() / Long.parseLong() directly on the Map.get() results. An Iceberg
snapshot summary is not guaranteed to carry these counters (snapshots written
by compaction/replace, or some writers, may omit them), so `SELECT COUNT(*)`
threw a NullPointerException ("Cannot invoke String.equals because
Map.get(...) is null") on such tables while `SELECT *` worked fine.
Extract the summary parsing into a pure static getCountFromSummary() that
null-checks the counters and falls back to a normal scan (returns -1) when any
is absent. Add a unit test covering the missing-counter, no-delete,
equality-delete and position-delete cases.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
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.
Proposed changes
IcebergScanNode.getCountFromSnapshot()readstotal-equality-deletes,total-position-deletesandtotal-recordsfrom the Iceberg snapshot summaryand calls
.equals()/Long.parseLong()directly on theMap.get()results.An Iceberg snapshot summary is not guaranteed to carry these
total-*counters — snapshots written by compaction/replace (and some writers) may omit
them. When a counter is absent,
SELECT COUNT(*)throws:SELECT *on the same table works (it scans); onlyCOUNT(*)fails (it takesthe metadata-count shortcut). Reproducible on current master.
Fix
Extract the summary parsing into a pure static
getCountFromSummary(Map<String, String> summary, boolean ignoreDanglingDelete)that null-checks the counters and falls back to a normal scan (
return -1,the method's existing "cannot push down count" signal) when any required
counter is absent. Behaviour is otherwise unchanged.
Release note
Fix a NullPointerException on
SELECT COUNT(*)over an Iceberg table whoselatest snapshot summary omits the
total-*counters (e.g. snapshots producedby compaction/replace).
Check List
(
IcebergCountPushDownTest: missing-counter, no-delete, equality-delete andposition-delete cases)
fall-back to scan