Skip to content

test(index): cover KeepFiniteVectors row filtering - #8229

Open
jackylee-ch wants to merge 1 commit into
lance-format:mainfrom
jackylee-ch:test/keep-finite-vectors
Open

test(index): cover KeepFiniteVectors row filtering#8229
jackylee-ch wants to merge 1 commit into
lance-format:mainfrom
jackylee-ch:test/keep-finite-vectors

Conversation

@jackylee-ch

Copy link
Copy Markdown
Contributor

KeepFiniteVectors runs on every IVF build path — five construction sites in vector/ivf.rs — and has three behaviours: drop rows whose vector is null, drop rows containing NaN or an infinity, and error on a column that is not a fixed size list. None of them was tested. The existing tests in this module exercise the is_all_finite free function and the l2 overflow bounds, never the transformer itself; grep KeepFiniteVectors::new returns only the five production sites.

Adds coverage for all three behaviours, plus the all-null and empty-batch cases AGENTS.md asks for in index tests, and the missing-column pass-through. The non-list case also pins the error message, which already names the column and the offending type.

Testing

  • cargo test -p lance-index --lib vector::transform — 12 pass
  • Confirmed test_keep_finite_vectors_drops_null_and_non_finite_rows fails when the validity check in transform is bypassed, so it is a real regression test
  • cargo fmt --all -- --check, cargo clippy -p lance-index --tests -- -D warnings

@github-actions github-actions Bot added chore A-index Vector index, linalg, tokenizer and removed chore labels Aug 4, 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 transformer-level tests directly pin null and non-finite row filtering, empty and all-null inputs, missing-column pass-through, and contextual type errors. This is the right boundary for protecting the shared filtering behavior used by the IVF construction paths.

@jackylee-ch

Copy link
Copy Markdown
Contributor Author

The red checks here are not from this change — main at 018386c (#8024) does not compile. rust/lance/src/index/vector/ivf/v2.rs:660 calls ReaderProjection::from_column_names, which no longer exists, and rust/lance-file/src/reader.rs references LanceFileVersion without importing it.

Same run on main itself: https://github.com/lance-format/lance/actions/runs/30903838621clippy, rustdoc, MSRV, cargo-deny, linux-arm, mac-build, windows-build, build-no-lock, query-integration-tests, linux-coverage-build all fail there too, the same 10 jobs that fail here.

cargo-deny is separately red on main for RUSTSEC-2026-0233/0234/0235 (rkyv 0.8.16, fixed in 0.8.17).

This PR only appends to #[cfg(test)] mod tests in rust/lance-index/src/vector/transform.rs and touches nothing else; cargo test -p lance-index --lib vector::transform passes locally against 51da66d. Happy to rebase once main is green.

`KeepFiniteVectors` runs on every IVF build path (five construction
sites in `vector/ivf.rs`) and has three behaviours: drop rows whose
vector is null, drop rows containing NaN or an infinity, and error on a
column that is not a fixed size list. None of them was tested — the
existing tests in this module exercise `is_all_finite` and the `l2`
overflow bounds, never the transformer itself.

Adds coverage for all three, plus the all-null and empty-batch cases
that `AGENTS.md` asks for in index tests, and the missing-column
pass-through. The non-list case also pins the error message, which
already names the column and the offending type.

Verified the row-filtering test fails if the validity check is bypassed.

Co-Authored-By: Claude <noreply@anthropic.com>
@jackylee-ch
jackylee-ch force-pushed the test/keep-finite-vectors branch from a59b529 to de71287 Compare August 5, 2026 03:17
@jackylee-ch

Copy link
Copy Markdown
Contributor Author

Rebased onto d95cb36 to pick up #8261, which fixed the main breakage.

Correcting my earlier comment: the first bad commit was a2d3047 (#8227), not #8024 — a duplicate LanceFileVersion import in the lance-file reader tests, as #8261 describes. My diagnosis that the failures were pre-existing on main was right, the attribution was not.

rust/lance-index/src/vector/transform.rs was untouched by the 16 intervening commits, so the rebase was clean. Re-verified at the new base: cargo test -p lance-index --lib vector::transform 12 pass, cargo fmt --all -- --check, cargo clippy -p lance-index --tests -- -D warnings.

@github-actions github-actions Bot added the chore label Aug 5, 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 rebase preserves the previously reviewed transformer-level coverage unchanged, and the focused tests pass on the new base. The direct unit boundary continues to protect the shared filtering behavior across the IVF construction paths.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant