fix(core): compute bitmap build gap on its own index type, not btree#480
Merged
JingsongLi merged 1 commit intoJul 8, 2026
Merged
Conversation
The incremental gap computation and overlap guard in the sorted global-index builder's execute() hard-coded the btree index type. Since apache#478 the same builder also builds bitmap indexes (via normalize_sorted_global_index_type), so a bitmap build was computing its gap over BTREE coverage: if a btree index already covered the same field, the bitmap build would treat those rows as already indexed and skip them, producing an incomplete or empty bitmap index. Pass the builder's resolved index_type instead, so bitmap builds are incremental over bitmap coverage. Adds bitmap no-op / incremental / btree-coexistence tests (the coexistence test fails if the type is hard-coded).
45cf628 to
e44a751
Compare
leaves12138
approved these changes
Jul 8, 2026
leaves12138
left a comment
There was a problem hiding this comment.
Looks good to me. The fix correctly uses the resolved sorted global index type for both incremental coverage computation and overlap validation, so bitmap builds are no longer keyed against btree coverage.
I also checked the added regression coverage for bitmap no-op rebuilds, bitmap-after-btree coexistence on the same field, and incremental bitmap builds. Verified locally with cargo test -p paimon --lib bitmap_; CI is green.
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.
Purpose
Follow-up to #481. #481 fixed the compile break on
main(the undefinedBTREE_INDEX_TYPEfrom the #478/#479 merge) by renaming the four references toBTREE_GLOBAL_INDEX_TYPE. This PR fixes a second, subtler bug on the same two call sites that the rename alone left latent.Since #478,
BTreeGlobalIndexBuildBuilderbuilds btree or bitmap indexes (resolved vianormalize_sorted_global_index_type(self.index_type)). But the incremental gap computation (indexed_row_ranges) and the overlap guard (validate_existing_index_overlap) inexecute()pass the hard-coded btree constant instead of the builder's resolved type. So a bitmap build computes its gap over btree coverage: if a btree index already covers the same field, the bitmap build treats those rows as already indexed and skips them, producing an incomplete or empty bitmap index. No test caught it because the only bitmap test covered a first full build.Brief change log
execute()call sites (indexed_row_rangesgap at ~line 116 andvalidate_existing_index_overlapguard at ~139) at the builder's resolvedindex_typevariable, so btree builds compute over btree coverage and bitmap builds over bitmap coverage. This makes bitmap builds correctly incremental through the shared builder — matching Java, where btree and bitmap share the sorted incremental path.Tests
cargo test -p paimon --lib(3 new bitmap tests) passes;cargo build -p paimonclean.bitmap_build_after_btree_on_same_field_still_indexesfail, confirming the test catches the bug.cargo fmt --all --checkandcargo clippy -p paimon --all-targets -- -D warningsclean.API and Format
No API or format change.
IndexFileMeta.index_typeon written index files was already dynamic (#478) and is unaffected; this only corrects which coverage the incremental gap/guard reads.Documentation
None.