[AMORO-4274] Remove Roaring64Bitmap.isEmpty() check in CombinedDelete…#4275
Open
byungnam wants to merge 1 commit into
Open
[AMORO-4274] Remove Roaring64Bitmap.isEmpty() check in CombinedDelete…#4275byungnam wants to merge 1 commit into
byungnam wants to merge 1 commit into
Conversation
…Filter positionMap is populated only via computeIfAbsent(...).add(...) while reading position-delete files, so any stored value is a non-empty Roaring64Bitmap. positionMap.get(...) therefore returns null or a non-empty bitmap, never an empty one, making the isEmpty() branch unreachable. Roaring64Bitmap.isEmpty() is backed by getLongCardinality(), which traverses all containers, so calling it once per scanned record wastes CPU on the hot path. Drop the check and keep only the null guard; behavior is unchanged. Close apache#4274
zhoujinsong
approved these changes
Jul 20, 2026
zhoujinsong
left a comment
Contributor
There was a problem hiding this comment.
LGTM.
Thanks a lot for the work!
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 are the changes needed?
CombinedDeleteFilterbuilds a per-file position-delete predicate that runs once per scanned record. For each record it looks up the file path inpositionMapand checksposSet.isEmpty()beforeposSet.contains(...):The
isEmpty()check is unnecessary and wastes CPU on the hot path:positionMapis populated only viacomputeIfAbsent(...).add(...)while reading position-delete files, so every value stored in the map is a non-emptyRoaring64Bitmap.positionMap.get(...)therefore returns eithernull(key absent) or a non-empty bitmap — never an empty one, so theisEmpty()branch is unreachable.Roaring64Bitmap.isEmpty()is backed bygetLongCardinality(), which traverses all high-to-low containers. It is not an O(1) check, so paying it once per record is measurable overhead on tables with large position-delete sets.Close #4274
Brief change log
amoro-format-iceberg—CombinedDeleteFilter: in the position-delete predicate, drop the unreachableposSet.isEmpty()branch, keeping only theposSet == nullguard.How was this patch tested?
amoro-format-iceberg; behavior is unchanged because the removed branch was unreachable.Documentation