Skip to content

feat(index): support distributed optimize for BloomFilter - #10977

Merged
Xuanwo merged 5 commits into
lance-format:mainfrom
wombatu-kun:issue/10847-bloomfilter-distributed-optimize
Nov 16, 2026
Merged

Xuanwo merged 5 commits into
lance-format:mainfrom
wombatu-kun:issue/10847-bloomfilter-distributed-optimize

Conversation

@wombatu-kun

@wombatu-kun wombatu-kun commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Part of #10847.

A bounded optimize_indices (max_rows_per_task / max_rows_per_segment) now splits a BloomFilter index into tasks and merges its segments by their zones; before, the whole index stayed in one task, and the single-process merge(N >= 2) rebuilt the segments by rescanning the column. The new merge_bloomfilter_indices_with_new_data, next to the unchanged merge_bloomfilter_indices, keeps each segment's zones and null rows over its live fragments and trains zones for the new rows with the trainer update uses. merge_scalar_indices takes this path for two or more segments, and the planner adds BloomFilter to segment_has_merge_primitive.

Segments merge by zones only when each records its null rows and shares the build parameters (read from the file metadata without loading zones), when none holds zones of a fragment that an in-place column rewrite took out of its coverage (read from the zones' fragment ids, including fragments a deferred compaction has since moved), and when the table has no tagged fragment reuse history, no compaction remap pending on them and no segment in a shallow clone's base; otherwise the index stays one task, as before.

Out of scope, since main has them too: #10986 (the default optimize keeps a rewritten fragment's old null rows through update) and #10987 (a segment outside the merge keeps answering for a rewritten fragment once another segment indexes it). This PR is independent of #10884 (MinHashLSH): both touch segment_has_merge_primitive and the module docs, so whichever lands second rebases mechanically.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions github-actions Bot added A-index Vector index, linalg, tokenizer A-java Java bindings + JNI enhancement New feature or request labels Nov 12, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added K-changes Latest Gatekeeper recommendation requests changes. and removed K-changes Latest Gatekeeper recommendation requests changes. labels Nov 12, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 12, 2026
@wombatu-kun
wombatu-kun force-pushed the issue/10847-bloomfilter-distributed-optimize branch from a222928 to 5105afd Compare November 15, 2026 01:46
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 15, 2026
lance-gatekeeper[bot]

This comment was marked as outdated.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 15, 2026
…d update

The test only planned the bounded optimize and then ran the default one.
Execute and commit the bounded plan, and assert the coverage it leaves, the
updated value, the deleted copy it filters out, and the IS NULL answers.
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 16, 2026

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Gate recommendation: approve.

The earlier stale-null finding remains fixed. The bounded path also preserves updated values and exact null answers after a stable-row-ID update. No remaining blockers found.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Nov 16, 2026
Xuanwo added a commit that referenced this pull request Nov 16, 2026
The `test_create_ivf_hnsw_pq` fixture is stochastic: its live index
build samples four IVF training rows and initializes the IVF and PQ
k-means models from OS entropy. Recall is therefore a random variable,
and the existing `recall >= 0.5` assertion occasionally sees `0.45`. The
same test failed with that signature on ARM in #10977 and on x86 in
#10716; the test, training and lockfile inputs are identical at those
heads, their bases and current `main`.

This is a test-only change. The test now trains the IVF model from four
fixed rows of the same fixture with `train_ivf_model_from_sample`,
trains the PQ codebook on the corresponding residuals with
`PQBuildParams::build`, and passes both models to `create_index`. The
live build therefore no longer consumes training entropy, while the
index parameters (`nlist=2`, `sample_rate=2`, `max_iters=2`, PQ 4x8,
HNSW 3/8/32), the query (`k=20`, `nprobes=2`, `ef=64`), the `recall >=
0.5` threshold, ground truth, HNSW construction, PQ encoding and scan
path are unchanged.

Training coverage is retained: both production trainers execute in this
test, and their independent exact-output tests remain
(`vector::kmeans::tests::test_flat_kmeans_seed_is_reproducible`,
`vector::pq::builder::tests`, and the `train_ivf_from_sample_*` cases).

Validation:
- Before: 15 independent-process runs passed with instrumented recall
0.60-0.85; the `0.45` CI tail was not reproduced locally, matching the
prior 200-run measurement.
- After: 10 independent-process runs of the fixed-model fixture produced
identical results with recall 0.80; the final test code passed 15/15
unmodified runs (5 before and 10 after the temporary recall print was
removed).
- Neighbor tests: IVF/HNSW/PQ lifecycle cases,
`test_create_index_nulls`, PQ builder and seeded-kmeans tests passed.
- `cargo fmt --all -- --check`
- `cargo clippy --all --tests --benches --profile ci --locked --features
"$ALL_FEATURES" -- -D warnings`

Limits: the failing CI run did not log its sampled rows or initial
centroids, so the exact draw cannot be replayed. ARM was not run
locally; the hosted Rust ARM job on this PR is the platform check.

Refs #8764
@Xuanwo
Xuanwo merged commit a49b513 into lance-format:main Nov 16, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-index Vector index, linalg, tokenizer A-java Java bindings + JNI enhancement New feature or request K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants