Repository navigation
Conversation
|
Important Format specification voteThis PR modifies the Lance format specification, so it requires 3 binding +1 votes from PMC members (excluding the proposer), at least one of them on the latest commit, and a minimum 72-hour voting period, weekends excluded, before it can merge. Vote by approving this PR (+1) or requesting changes (−1, a veto). See the voting process. Approvals carry over across pushes, so a rebase or a typo fix does not send everyone back to re-vote. Whoever approves the latest commit is vouching that nothing substantive has changed since the earlier approvals; if something has, ask for fresh votes. Status: ❌ Blocked — 0 of 3 required approvals
Updated automatically by the format-spec vote gate, which re-checks every 15 minutes — just voted? Re-check now (press Run workflow; leave the input blank to re-check every open format PR). A PMC member may apply the |
| } | ||
| let mean = sums; | ||
|
|
||
| let statistics = if sample_count >= input_dimension { |
There was a problem hiding this comment.
Please use streaming scatter/covariance unconditionally here, matching the removal of Gram in #9967. This removes the centered sample buffer, PcaStatistics branching and train_from_centered call. N < D should still be supported when the sample's effective rank is sufficient for the requested output dimension.
| /// | ||
| /// Candidates are unique, invalid vectors are replaced from the same RNG | ||
| /// stream, and the returned offsets are sorted into the training order. | ||
| pub async fn sample_valid_vector_offsets_seeded( |
There was a problem hiding this comment.
Please share candidate-row reading and the NULL/NaN/Inf predicate with the existing IVF sampler instead of maintaining a separate sampler and is_valid_pca_vector. Keep PCA's seeded RNG, returned row offsets and replenishment to a valid-sample target, so both streaming passes read the same sample without collecting the whole vector array. IVF currently filters finite values after sampling, so preserve that semantic difference when sharing the machinery.
Train the model from the dataset and store it in index.idx under lance:pca, then project indexed and query vectors before IVF and quantization. PCA indexes record metadata version 4. Training parameters stay out of the manifest.
56262db to
5f7fb12
Compare
There was a problem hiding this comment.
❌ Gate recommendation: request changes.
The specification split is satisfied by merged #9968. Several independent implementation issues remain. Keep the PCA approach, restore the core build, and align the version-4 writer and reader with the merged row-address contract before merging.
Please mark this PR with the breaking-change label: lance::index::vector::VectorIndexParams::pre_transform adds a required field to public struct literals, so Rust callers constructing VectorIndexParams directly must initialize it.
| quantizer, | ||
| quantizer.into(), | ||
| None, | ||
| self.ivf_pre_transformer(), |
There was a problem hiding this comment.
PartitionAdjuster has no ivf_pre_transformer method, so this change prevents the core lance crate from compiling, including builds that do not use PCA. The helper exists only on IvfIndexBuilder; this adjuster has no PCA model. Preserve its existing no-pre-transform path unless model support is explicitly wired through.
Reproduced on this head with the pinned Rust 1.98.1 toolchain: cargo check -p lance --tests reports E0599 here: “no method named ivf_pre_transformer found for reference &PartitionAdjuster<'_>”.
There was a problem hiding this comment.
Fixed in 94a23f3: PartitionAdjuster again uses new_ivf_transformer_with_quantizer, preserving its existing no-pre-transform path and removing the unavailable builder-only helper call.
| let piece = if take_n == finite.len() { | ||
| finite | ||
| } else { | ||
| finite.slice(0, take_n).as_fixed_size_list().clone() |
There was a problem hiding this comment.
This expression prevents the core crate from compiling: finite is a concrete FixedSizeListArray, and its inherent slice already returns a FixedSizeListArray, which has no as_fixed_size_list method. Return finite.slice(0, take_n) directly; no downcast or clone is needed.
Reproduced on this head with the pinned Rust 1.98.1 toolchain: cargo check -p lance --tests reports E0599 at this line: “no method named as_fixed_size_list found for struct FixedSizeListArray”. This is an unconditional compile failure, rather than a failure limited to invoking the sampler.
There was a problem hiding this comment.
Fixed in 94a23f3: the sampler returns the concrete FixedSizeListArray slice directly, removing the invalid downcast call and redundant clone.
| query = normalize_query_for_index(raw_index.as_ref(), query)?; | ||
| let policy = AutoProbePolicy::from_env(&query, raw_index.as_ref())?; | ||
| policy.apply(&mut query, q_c_dists.values(), raw_index.metric_type()); | ||
| let (search_index, query) = raw_index |
There was a problem hiding this comment.
The new tuple binding shadows the mutable query with an immutable one, but policy.apply(&mut query, ...) below still needs mutable access. This prevents the core lance crate from compiling for ordinary ANN queries as well as PCA queries. Bind the returned query as mut query so the existing probe policy can update it.
Reproduced on this head with the pinned Rust 1.98.1 toolchain: cargo check -p lance --tests reports E0596 at line 2680: “cannot borrow query as mutable, as it is not declared as mutable”, and points to this binding.
There was a problem hiding this comment.
Fixed in 029d292: the prepared query is now bound as mut query, allowing AutoProbePolicy::apply to borrow it mutably. This addresses the mutable-borrow error on the ANN query path.
| /// of its [`IndexType`], including IVF_RQ without PCA. | ||
| pub fn compatibility_version(&self) -> u32 { | ||
| match (self.pre_transform.is_some(), self.index_type()) { | ||
| (true, IndexType::IvfRq) => VECTOR_PCA_INDEX_VERSION, |
There was a problem hiding this comment.
This advertises version 4 without implementing its row-address domain. The merged PCA specification explicitly says version 4 retains physical row addresses from version 3, but IvfIndexBuilder::shuffle_dataset still uses .with_row_id() and merge_partitions writes ROW_ID_FIELD to auxiliary.idx. Neither path converts those logical IDs to physical addresses. This matters on stable-row-ID datasets, where the two values differ; an interoperable version-4 reader cannot interpret that identifier stream according to the advertised format.
Implement the version-4 identifier domain end to end before selecting this version, including its read/filter behavior and a multi-fragment stable-row-ID fixture that checks the persisted addresses. Merely renaming the column does not convert the values. The merged row-domain proposal #10299 is documentation-only and does not supply that implementation.
This finding is a mismatch between the selected version and the writer's source path. A runtime file round trip could not be run because cargo check -p lance --tests fails on the compile errors in this revision; incorrect runtime query results have not been reproduced.
AutoProbePolicy::apply updates nprobes on the query returned by prepare_partition_query. The shadowed binding was immutable, so the lance crate failed to compile.
PartitionAdjuster has no PCA model, so it keeps the quantizer-only IVF transform. FixedSizeListArray::slice already returns that type, so the sampler no longer downcasts it.
The trainer and index.idx helpers sit in modules that are not public, so pub(crate) is redundant under the workspace Clippy deny.
Clippy denies an assertion whose condition is a comparison of two consts.
There was a problem hiding this comment.
❌ Gate recommendation: request changes.
The version-4 storage-contract finding remains: the writer and reader must honor the physical-row-address domain specified by merged #9968. Keep the PCA approach and satisfy that persisted-format contract before emitting version 4. The earlier compilation findings remain fixed.
Please mark this PR with the breaking-change label: lance::index::vector::VectorIndexParams::pre_transform adds a required field to public struct literals, so Rust callers constructing VectorIndexParams directly must initialize it.
Base: main
Discussion Link: #9122