lance-format / lance-format/lance
bug: build_ivf_model panics when num_partitions is unset
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7.1k
- Forks
- 852
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 272
Description
Description
build_ivf_model in rust/lance/src/index/vector/ivf.rs starts with
let num_partitions = params.num_partitions.unwrap();
IvfBuildParams::num_partitions is an Option (it is deprecated in favour of target_partition_size, and IvfBuildParams::default() leaves both unset), and build_ivf_model is public, so a caller that sets neither gets a panic out of a library call. The two sibling trainers in the same file already handle it: build_ivf_model_and_pq uses ivf_params.num_partitions.unwrap_or(32) with the comment "we use 32 as the default to avoid panicking, 32 is the default value before we make num_partitions optional", and do_train_ivf_model does the same.
The in-tree index build paths fill num_partitions in before calling this, so this is about the public function's own contract.
Expected behavior
Fall back to the same default the sibling trainers use rather than unwrapping None.
Lance version
13.0.0-beta.4 (main)
Language binding
Rust
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in rust/lance/src/index/vector/ivf.rs at the public build_ivf_model entry point, then compare its parameter handling with build_ivf_model_and_pq and do_train_ivf_model. Verify that calling build_ivf_model with IvfBuildParams::default() no longer panics and uses the same fallback behavior as the sibling trainers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 85/100