Commit bc2d137
authored
fix: train IVF indexes on fragment subsets (#7768)
## Summary
- Resolve explicit vector fragment filters by fragment id in O(k), so
fragment-scoped IVF training no longer scans the whole manifest to find
selected fragments.
- Treat an explicit vector fragment filter that covers every current
dataset fragment as an unfiltered full build in `CreateIndexBuilder`.
- Add a filtered vector build path for genuine subset fragment builds
without precomputed IVF, covering standalone segmented index creation.
- Preserve distributed builds with shared precomputed IVF/PQ/RQ state,
and reject unsafe merge/optimize of independently trained vector
segments that do not share the same model.
- Harden distributed vector auxiliary merge validation for IVF centroids
and quantizer metadata, including codebook/rotation payload checks.
- Add regression coverage for all-fragment filters, subset training,
empty precomputed-IVF segments, unsafe merge/optimize rejection, legacy
filtered IVF_PQ rejection, and precomputed centroid partition
mismatches.
The important semantic distinction is that subset training/build is
valid and now uses fragment-scoped work, but independently trained
subset IVF segments are not merge-compatible unless they share the same
precomputed vector model.
Validated locally with `cargo fmt --all`, `cargo clippy --all --tests
--benches -- -D warnings`, targeted `lance` vector index tests, and
`cargo test -p lance-index index_merger`.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Added support for building vector indexes over a selected subset of
dataset fragments, including correct behavior for empty subsets and
precomputed-IVF centroids.
- Improved index-build routing to better respect fragment selection when
training.
- **Bug Fixes**
- Strengthened cross-shard merge/optimize validation for shared vector
models (metrics, centroids, quantizers, rotation details) with NaN-aware
comparisons.
- Rejected unsupported or incompatible metadata during merges (including
legacy IVF_PQ filtered builds, transposed/packed PQ/RQ cases).
- **Tests**
- Expanded and added coverage for fragment-selection behavior and
shared-model comparison and rejection scenarios.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent 2887837 commit bc2d137
7 files changed
Lines changed: 1017 additions & 268 deletions
File tree
- rust
- lance-index/src/vector/distributed
- lance/src
- index
- vector
Lines changed: 298 additions & 75 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
1716 | 1716 | | |
1717 | 1717 | | |
1718 | 1718 | | |
1719 | | - | |
1720 | | - | |
1721 | | - | |
1722 | | - | |
1723 | | - | |
1724 | | - | |
1725 | | - | |
1726 | | - | |
1727 | | - | |
1728 | | - | |
1729 | | - | |
1730 | | - | |
1731 | | - | |
1732 | | - | |
1733 | | - | |
1734 | | - | |
1735 | | - | |
1736 | | - | |
1737 | | - | |
1738 | | - | |
| 1719 | + | |
1739 | 1720 | | |
1740 | 1721 | | |
1741 | 1722 | | |
| |||
2545 | 2526 | | |
2546 | 2527 | | |
2547 | 2528 | | |
2548 | | - | |
2549 | | - | |
2550 | | - | |
2551 | | - | |
2552 | | - | |
2553 | | - | |
2554 | | - | |
2555 | | - | |
2556 | | - | |
2557 | | - | |
2558 | | - | |
2559 | | - | |
2560 | | - | |
2561 | | - | |
2562 | | - | |
2563 | | - | |
2564 | | - | |
2565 | | - | |
2566 | | - | |
2567 | | - | |
| 2529 | + | |
| 2530 | + | |
| 2531 | + | |
| 2532 | + | |
| 2533 | + | |
| 2534 | + | |
2568 | 2535 | | |
2569 | | - | |
2570 | | - | |
2571 | | - | |
2572 | | - | |
2573 | | - | |
2574 | | - | |
2575 | | - | |
2576 | | - | |
| 2536 | + | |
| 2537 | + | |
| 2538 | + | |
| 2539 | + | |
| 2540 | + | |
| 2541 | + | |
| 2542 | + | |
| 2543 | + | |
| 2544 | + | |
| 2545 | + | |
| 2546 | + | |
2577 | 2547 | | |
2578 | | - | |
| 2548 | + | |
| 2549 | + | |
| 2550 | + | |
| 2551 | + | |
| 2552 | + | |
| 2553 | + | |
| 2554 | + | |
| 2555 | + | |
| 2556 | + | |
| 2557 | + | |
| 2558 | + | |
| 2559 | + | |
| 2560 | + | |
| 2561 | + | |
| 2562 | + | |
| 2563 | + | |
| 2564 | + | |
| 2565 | + | |
| 2566 | + | |
| 2567 | + | |
| 2568 | + | |
| 2569 | + | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
| 2586 | + | |
| 2587 | + | |
| 2588 | + | |
| 2589 | + | |
| 2590 | + | |
| 2591 | + | |
| 2592 | + | |
| 2593 | + | |
| 2594 | + | |
| 2595 | + | |
| 2596 | + | |
| 2597 | + | |
| 2598 | + | |
| 2599 | + | |
| 2600 | + | |
| 2601 | + | |
| 2602 | + | |
| 2603 | + | |
| 2604 | + | |
| 2605 | + | |
| 2606 | + | |
| 2607 | + | |
| 2608 | + | |
| 2609 | + | |
| 2610 | + | |
| 2611 | + | |
| 2612 | + | |
| 2613 | + | |
| 2614 | + | |
| 2615 | + | |
| 2616 | + | |
| 2617 | + | |
| 2618 | + | |
| 2619 | + | |
| 2620 | + | |
| 2621 | + | |
| 2622 | + | |
| 2623 | + | |
| 2624 | + | |
| 2625 | + | |
| 2626 | + | |
| 2627 | + | |
| 2628 | + | |
| 2629 | + | |
| 2630 | + | |
2579 | 2631 | | |
2580 | 2632 | | |
2581 | 2633 | | |
| |||
0 commit comments