Repository navigation
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
This pull request is merged. |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: a6c8cda3eb5e3af4d90702d663c3626799a7c0ea
Assessment: request_changes
The change reuses the existing exact-membership and result-merging paths and removes the wide-vector predicate from the scan. However, allowing NULL entries into distance evaluation exposes incompatible VECF64 scoring paths across batches, which can select the wrong exact PRE result.
Model: gpt-6.1-terra / max
Session: 01a23504-137d-7f93-9b91-fd29f7f60fa2 · slot 1 · generation 42
- P2
pkg/vectorindex/ivfflat/search.go:637: Run an exact PRE search on VECF64 data with a required non-integer key domain spanning multiple chunks, where a NULL vector shares an execution batch with a valid vector in one chunk but another chunk has no NULLs.
Impact: Chunk scores can have different precision and be ordered incorrectly. For a zero query, a null-free batch containing a nearer value of 1.9e19 can produce +Inf after its squared distance is converted to float32, while a NULL-containing batch computes the farther value 2e19 in float64 and produces a finite score. The global merge can therefore return the farther row for LIMIT 1.
Evidence: The new SQL no longer filters NULL entries before distance evaluation. pkg/sql/plan/function/func_binary.go:8555 disables the pairwise path for a batch containing NULL; its L2 fallback retains float64 precision, while pkg/vectorindex/metric/pairwise.go:64 uses float32 output for a null-free batch. search.go:671 merges those scores directly. The baseline filtered NULLs before evaluation. The retained Go arithmetic model confirms the numerical inversion; it is not a MatrixOne SQL reproduction. Keep scoring precision consistent across batches and add a public VECF64 regression covering NULLs and multiple chunks.
Validation:
-
Isolation preflight and git diff --check passed for the assigned checkout.
-
Built the native prerequisites in the diagnostic directory and verified 28 inputs against the frozen source.
-
A Go arithmetic model confirmed the float conversion used in the finding; a SQLite model checked NULL ordering. Neither model executes MatrixOne SQL.
-
The author reports public SQL, exhaustive-result and paired performance checks for the affected path. Their raw logs were not supplied in this job.
Limitations:
- The focused ivfflat Go tests did not reach compilation: dependency downloads timed out despite retries using the assigned cache. No product Go or SQL test was executed in this review.
|
Confirmed the VECF64 finding with MatrixOne SQL. A real index with 8,300 VARCHAR primary keys and one physical NULL returned 1.000000059604643 for both the one-key and 8,300-key queries on 4.2-dev. On a6c8cda the wide-domain result changed to 1.00000005. be76aac retains the original pre-distance NULL predicate for VECF64 and restricts deferred vector reads to CPU float32 L2 searches. Both VECF64 queries return 1.000000059604643 on the updated head. The reproduction is now part of the distributed SQL suite, which passed 86/86. The ivfflat package tests and vet passed. A fresh alternating float32 benchmark on that head retained the improvement, with median QPS of 7.59 → 19.08 for the broad domain and 19.24 → 37.90 for the selective domain. All 23,040 returned scores matched the exhaustive oracle. |
LeftHandCold
left a comment
There was a problem hiding this comment.
复审 be76aac3d4:代码层面建议通过。旧 review 的 VECF64 精度问题已关闭:延后读取只对 CPU + VECF32 输入/索引项 + L2/L2² 的 exact-PK 搜索生效,其他类型、度量和 GPU build 均先排除 NULL。核对了 CPU 批量/逐行的 float32 计算与舍入、分块 TopK/offset、NULL 与 INCLUDE 对齐,以及普通 IVF 仍按距离排序。作者给出的同 head 86 条 SQL 和对照性能数据与实现相符;本次没有重跑压测或全量 CI。全尺寸 nightly 的吞吐恢复程度和 #33643 的 Wiki AP CN OOM 不属于这次代码通过的结论。此为作者账号下的代码评审备注,旧正式 review 仍需独立 reviewer 处理。
LeftHandCold
left a comment
There was a problem hiding this comment.
Integration update on unchanged be76aac: the prior code verdict on this head stands, but it cannot be merged as-is into 4.2-dev@bcad244e60. A local merge-tree check confirms a content conflict in pkg/vectorindex/ivfflat/search.go. #33590 moved the non-NULL condition into the shared entries SQL builder and added readerParam range predicates before ORDER BY/LIMIT. Simply keeping the new unconditional IS NOT NULL leaves the wide read in the exact CPU/F32 path; simply taking the old PR builder drops the target branch's range correctness. When rebasing, retain range filtering before LIMIT and the existing NULL guard for non-target paths, defer the NULL check only for the eligible exact search, and validate both SQL shapes plus the wide-column read cost. On this SHA both multi-CN BVT checks and SCA passed; the red UT shows a lockservice TestHandleBindChangedConcurrently deadline. No evidence in that failure implicates these IVF changes.
be76aac to
dd93c9c
Compare
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: dd93c9c979f31e9b5aa86adc9bd34e75e9e7e6d8
Assessment: approve
The current implementation addresses the earlier VECF64 precision concern and preserves range qualification before each chunk limit. It reuses the existing exact-membership and result-merging paths, with no new persistent state. The reported measurements support the scoped optimization.
Model: gpt-6.1-terra / max
Session: 01a23504-137d-7f93-9b91-fd29f7f60fa2 · slot 1 · generation 42
Validation:
-
Reviewed the complete diff, affected SQL construction and result paths, tests, linked issues, and discussion.
-
Isolation preflight and git diff --check passed; matching receipts and logs are retained in the diagnostic directory.
-
The author reports 134 passing public SQL statements, seven additional range and pagination cases, the complete ivfflat Go package, and paired performance checks with exhaustive-result comparisons on the rebased head.
Limitations:
-
No Go or public SQL tests were run locally. The assigned Go cache lacked dependencies, and online dependency resolution timed out before compilation. Raw logs for the author's reported checks were not supplied.
-
The separate Wiki 10M AP CN availability incident remains outside this PR's claimed validation.
What type of PR is this?
Which issue does this address?
Refs #33645. The Wiki threshold/PRE AP CN OOM has a separate tracker at #33643.
What changes?
The exact primary-key path used by scalar ANLI PRE could read 1,024-dimensional vectors before discarding ineligible PKs. On CPU VECF32 L2/L2² exact searches, filter the keys first. When a distance bound is present, compute the index score only for entries satisfying the original distance function, comparison operators and bounds. All other entries receive a NULL score and sort last. The result reader drops NULLs, including on short pages, before merging chunk results. Ordinary IVF rounds retain their existing WHERE qualification. VECF64, other metrics and GPU builds retain early NULL filtering to preserve score precision.
Verification after rebasing onto 4.2-dev
Head
dd93c9c979includes basebcad244e60and its INCLUDE/range fix #33590. A direct conflict resolution passed all 134 public SQL checks but left the distance comparison in the scan filter and still processed 198.75 MiB per inspected entries scan. Moving that qualification into the score for eligible exact searches restored the ANLI improvement.The input numbers are EXPLAIN ANALYZE operator sizes on a frozen 49,152-row VECF32(1024) index. The inspected queries had 30,729 and 322 eligible PKs. The QPS ranges are two runs per revision in release/PR/PR/release order, with four clients, eight warmups and 16 timed queries per case per process. Each timed Top-30 was checked against exhaustive results.
Public SQL passed 134/134 (86 exact-PK and 48 upstream INCLUDE statements). Seven additional range/pagination cases covered strict and inclusive endpoints, NULLs, short and empty pages, and OFFSET across PK chunks. The complete ivfflat Go package and incremental lint passed.
Measurements before the rebase
At be76aac we compared the exact head against the release on the same frozen 49,152-row VECF32(1024) index, three assigned CPUs, ten clients and 96 fixed queries per condition. We used the release/candidate/candidate/release order with a fresh process per run.
All 768 measured Top-30 results (23,040 scores) matched exhaustive search, including valid ties and ordering. These are local results; #33645 retains the full-size nightly comparison. Real SQL also covered physically NULL entries, an underfilled page, OFFSET, NULL INCLUDE payload, empty input and the 8,192-key chunk boundary.
The distributed SQL case vector_ivf_pre_exact_domain passed all 86 statements on be76aac. Its VECF64 check uses 8,300 keys across chunks with one physical NULL. With identical vectors the release small and large PK domains both returned 1.000000059604643. The first patch produced 1.00000005 in the large domain. The revised patch reproduces the release score in both cases. The complete ivfflat Go package and go vet passed.