Repository navigation
test: anchor cosine boundary regressions to scale invariance - #29175
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
PASS — completed full deep review of f42330b..8baeefd.
The six golden corrections match the independent cosine oracle 1−4/√18. The new tests cover float32/float64 scale invariance, negative/zero controls, and actual SQL batch/scalar paths with DOUBLE result assertions. Existing BVT statements and comparison rules remain intact.
Verified exact-head Ubuntu UT success and PROXY BVT execution of vector_hnsw_cosine_boundary.sql: 22/22 passed, zero ignored or failed. Reviewed reusable focused/package and cleanup/rerun evidence. No blockers found; coverage was not used as a gate.
## What type of PR is this? - [x] BUG - [x] Test and CI ## Which issue(s) this PR fixes: Fixes #28852 ## What this PR does / why we need it: Decimal variance and standard-deviation executors accumulate in `float64`. Their previous final conversion exposed the binary ULP tail as decimal digits, so the issue's DATETIME/TIMESTAMP `VAR_POP` result became `680202686800.666624` instead of MySQL-compatible `680202686800.666600`. This change converts finite aggregate results through their shortest round-trip decimal representation before scaling to Decimal128. It is deliberately limited to the Decimal variance/stddev finalizer: planner coercion, recurrence, distributed state/wire format, global casts, and float-returning aggregates are unchanged. Validation includes: - exact conversion boundaries, signs, non-finite values, exponent notation, precision overflow, and adjacent-float cases; - exact executor results for Decimal64/Decimal128, VAR/STDDEV population/sample, resident/DISTINCT paths; - serialized-state restore and merge; - the original temporal SQL regression and all twelve existing DECIMAL variance overflow assertions, preserving exact target precision/scale while allowing approximate numeric payload variation; - full owning-package tests, `go vet`, scoped golangci-lint, and build; - current rebased code: native/server build and full aggexec package tests passed; - normal BVT comparison twice on one fresh instance: 419/419 each (VAR_POP/VARIANCE 242, VAR_SAMP 141, temporal regression 14, cosine boundary 22), with no test schemas left after either run. The branch includes main through `b2f178defd` (#29175 cosine regression correction). Current remote SCA/full CI is pending; the earlier revision passed scoped static checks. The follow-up changes only BVT error expectations and retains all executable SQL and successful-result oracles. GPT-6 Astra medium completed both design review and final overall review; final verdict: PASS with no material findings.
What type of PR is this?
Which issue(s) this PR fixes:
Related to #29083 and #29082. Repairs the deterministic base BVT failure exposed by #29174 after #29143; does not claim to close every vector-index issue.
What this PR does / why we need it:
The cosine boundary golden captured float32 subnormal squared-norm error. After #29143 switched SQL scalar and batch paths to scaled float64 reductions, six assertions still expected
0.05718844756484032rather than the correct1 - 4/sqrt(18) = 0.05719095841793653. The same six failures occur in the CI of #29143 and #29174; this is not a timing flake.No production code, runtime allocations, algorithm dispatch, retries, skips, or comparison tolerances changed. Reuses existing small fixtures.
Validation
pkg/vectorindex/metricandpkg/sql/plan/functionpackages PASS.Local BVT is standalone; historical failure evidence is Linux multi-CN PROXY CI. No topology/runtime change warrants another full multi-CN run locally. New PR CI remains pending; it has not been claimed green.