JunRuiLee opened a new pull request, #801:
URL: https://github.com/apache/paimon-rust/pull/801

   ### Purpose
   
   Split out of #771 at the reviewer's request: an independent hardening fix 
that was riding along in that PR.
   
   Three single-query terminals in `vector_search_builder.rs` call a batch 
entry point with one query and then take `results.remove(0)` behind a 
`debug_assert_eq!(results.len(), 1)`.
   
   The assert is compiled out of release builds, which leaves two silent 
failure modes there:
   
   - an **empty** vector panics on an index out of bounds, with nothing 
indicating what went wrong;
   - a **longer** vector returns the FIRST result — pairing the caller's single 
query with another query's answer, which no caller can detect.
   
   A wrong length means the batch ran the wrong number of searches. That is a 
programming error in this crate rather than bad input, so the error kind stays 
the same in spirit; only its enforcement moves from debug-only to always.
   
   ### Brief change log
   
   - Add `take_only_result`, which reports both a missing and an extra result 
as `UnexpectedError`, naming the operation.
   - Use it at the three pre-existing sites: `VectorSearchBuilder::execute`, 
`plan_and_search_pk_candidates`, and the test-only `evaluate_vector_search`.
   
   ### Tests
   
   - `take_only_result_rejects_bad_batch_arity` — the one-element, empty, and 
two-element cases.
   - `cargo test -p paimon --lib`: 2622 passed, 2 ignored.
   - `cargo clippy -p paimon --all-targets -- -D warnings` and `cargo fmt --all 
-- --check` clean.
   
   ### API and Format
   
   No public API or storage-format change. `take_only_result` is private to the 
module.
   
   ### Documentation
   
   None needed.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to