Skip to content

test(index): cover residual computation and ResidualTransform schema paths - #8752

Merged
Xuanwo merged 2 commits into
lance-format:mainfrom
jackylee-ch:test/residual-transform-coverage
Sep 2, 2026
Merged

test(index): cover residual computation and ResidualTransform schema paths#8752
Xuanwo merged 2 commits into
lance-format:mainfrom
jackylee-ch:test/residual-transform-coverage

Conversation

@jackylee-ch

Copy link
Copy Markdown
Contributor

vector/residual.rs had no tests, unlike its siblings sq/transform.rs,
flat/transform.rs and vector/transform.rs. It runs on the IVF_PQ build path
and computes what PQ actually encodes: each vector minus the centroid of its
own partition.

Two behaviours had no coverage. compute_residual dispatches on the
centroid/vector type pair, and the (Float32, Int8) arm widens the vectors, so
the residual comes back wider than the input. ResidualTransform then has to
rewrite the field type for that case, or the schema would claim Int8 while the
data is Float32.

Adds 13 tests: exact subtraction across interleaved partitions, all four
dispatch arms, both mismatch errors, and the three transform error paths.

Verified non-vacuous: pinning part_id to 0, dropping the dimension guard, and
forcing the in-place column replacement each fail the matching test (5 of 13).

…paths

`vector/residual.rs` had no tests, unlike its siblings `sq/transform.rs`,
`flat/transform.rs` and `vector/transform.rs`. It runs on the IVF_PQ build path
and computes what PQ actually encodes: each vector minus the centroid of its
own partition.

Two behaviours had no coverage. `compute_residual` dispatches on the
centroid/vector type pair, and the `(Float32, Int8)` arm widens the vectors, so
the residual comes back wider than the input. `ResidualTransform` then has to
rewrite the field type for that case, or the schema would claim Int8 while the
data is Float32.

Adds 13 tests: exact subtraction across interleaved partitions, all four
dispatch arms, both mismatch errors, and the three transform error paths.

Verified non-vacuous: pinning `part_id` to 0, dropping the dimension guard, and
forcing the in-place column replacement each fail the matching test (5 of 13).
@github-actions github-actions Bot added A-index Vector index, linalg, tokenizer chore labels Aug 25, 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 Aug 25, 2026
@lance-gatekeeper lance-gatekeeper Bot removed the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 2, 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 merge from main leaves the residual-test patch unchanged, and the focused coverage still exercises partition-specific subtraction, type dispatch, transform failures, and Int8-to-Float32 schema rewriting on the updated base.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 2, 2026
@Xuanwo
Xuanwo merged commit 5b6a633 into lance-format:main Sep 2, 2026
38 checks passed
@jackylee-ch

Copy link
Copy Markdown
Contributor Author

Thanks!

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 chore K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants