wangzhigang1999 opened a new pull request, #11379:
URL: https://github.com/apache/paimon/pull/11379

   ### Purpose
   
   Move the scalar and NumPy scoring routines into `vector_scoring.py` and let 
the reader own query preparation. The scoring blocks can then take a prepared 
query directly. This gives the single-query and batch readers a common place to 
get the query array and cosine norm.
   
   Each local read prepares a query once per metric and can reuse it during 
both candidate reranking and the raw scan. Each Ray scoring task prepares its 
own queries. The next read starts with an empty cache. This PR also removes 
four obsolete helpers and moves their tests to the active read paths.
   
   ### Tests
   
   The conversion test in `vector_scoring_test.py` puts tied hits on opposite 
sides of a 1,024-row block boundary. It checks the returned row IDs and scores 
and counts query-array conversions. On the base revision the single-query case 
converts twice and the two-query case converts eight times. With this change 
the counts are one and two. A separate batch-scorer test checks that an 
unsupported metric on a later query raises the usual metric error.
   
   I ran the vector search and reader regression tests on macOS arm64 with 
Python 3.11, including local and Ray execution. The main run passed 685 tests. 
Both native lookup tests skipped by the default configuration passed with 
native planning and reading enabled. Another 18 multimodal search tests passed.
   
   I also compared the patch with `3a8e01f35d` on the same machine. All 30 
cases returned the same Top-10 row IDs and bit-identical scores for L2, cosine 
and inner product. Each timing below is the median of five runs after warm-up. 
The table shows eight cosine queries.
   
   | Input | Base | With this change |
   | --- | ---: | ---: |
   | In-memory Arrow, 2,048 × 384, 8 rows per batch | 68.08 ms | 31.63 ms |
   | In-memory Arrow, 8,192 × 128, 2,048 rows per batch | 35.74 ms | 35.13 ms |
   | Local Parquet search, 4,096 × 256 | 39.69 ms | 39.21 ms |
   
   The smallest batches showed the largest benefit. In that case I counted 
4,096 query-array conversions on the base revision and eight with the patch.
   
   Closes #11378.
   


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