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

   ## What changed
   
   - Batch raw-vector distance scoring with the existing SIMD/cache-blocked 
SGEMM implementation for four or more unrestricted queries.
   - Keep small query batches and sparse `include_row_ids` searches on the 
scalar path to avoid matrix setup and unnecessary scoring.
   - Replace heap-based `O(n log K)` raw Top-K maintenance with buffered 
partial selection, giving amortized `O(n)` candidate selection and sorting only 
the final K rows.
   - Bound score-matrix chunks to roughly one million elements and store 
results query-major for contiguous Top-K reads.
   - Respect sliced `FixedSizeListArray` offsets and preserve scalar L2 
semantics for non-finite values.
   
   ## Why
   
   Raw vector search previously computed every row/query distance with scalar 
loops and maintained a K-sized heap for every query. This left batch queries 
unable to reuse optimized matrix kernels and paid `log K` work for each 
candidate.
   
   ## Performance
   
   Local release microbenchmark: 8,192 rows, 128 dimensions, L2, K=10. The 
benchmark compared the previous scalar-distance + heap path with the optimized 
hybrid path.
   
   | Queries | Speedup |
   | ---: | ---: |
   | 1 | ~1.0x |
   | 2 | ~1.0x |
   | 4 | 1.81-1.84x |
   | 8 | 3.30x |
   | 16 | 4.49-4.62x |
   
   ## Validation
   
   - `cargo test -p paimon table::vector_search_builder::tests --lib` (79 
passed)
   - `cargo clippy -p paimon --lib -- -D warnings`
   - `cargo fmt --all -- --check`
   - Matrix/scalar equivalence tests for L2, cosine, and inner product
   - Deterministic partial Top-K, sparse candidate, non-finite L2, and sliced 
Arrow-array coverage
   


-- 
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