Repository navigation
fix: classify invalid vector Base64 input as user error - #29363
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? |
7c6e749 to
d6bdf0f
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed current head d6bdf0f. No blocking findings. Malformed Base64 and decoded byte lengths that cannot form whole elements are now classified as invalid user input across all six vector element types; valid one-byte uint8 decoding remains the control. The unit tests check both error code and alignment message, and the distributed SQL fixture verifies the public error result and that a later valid call succeeds. Current-head CI is green. This self-authored COMMENT is not an approval.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review of d6bdf0f290527a439b03a9eb25497a69ae0e9905 against base/merge-base 44e5226a21d7905a1d1e528d257321d2696c807b: PASS — no blocking findings; technically ready to merge.
Reviewed all four changed files for root-cause coverage, unhappy paths, test quality, duplication, and unnecessary complexity.
- Fix completeness: all six public vector Base64 decoders resolve to
VecFromBase64[T]. Both malformed Base64 and decoded-width mismatch now produceErrInvalidInput. The unsupported generic-type guard remains an internal error. Valid decoding, NULL handling, and the IVF-Flat producer's correctly aligned payloads retain their behavior. - Public compatibility: the MatrixOne error class and displayed prefix change as intended. Both classes map to the existing MySQL
ER_UNKNOWN_ERROR/default SQLSTATE; this does not introduce a new wire error number. - Engineering quality: two error-constructor replacements fix the shared cause. No new production abstraction, fallback, configuration, or dependency is needed. The focused table covers six malformed-input variants and the four applicable width mismatches; one-byte integer elements correctly have no alignment-error case. Existing round-trip tests provide the positive controls. Calling
DebugRunis justified here because the ordinary test helper only checks whether any error occurred. - BVT quality: the dedicated 11-statement case asserts the SQL-visible rejection contract and successful UINT8 decoding after errors. It creates no database, table, transaction, or global setting. Its coverage complements the exact error-code UT without adding an expensive fixture.
Unhappy-path audit of the changed rejection paths and test fixture:
| Check | Conclusion |
|---|---|
| Q1: ownership/cleanup | Decode scratch is local Go memory. Failed evaluation keeps result ownership with the expression executor for reset/free; the new UT defers input/result vector cleanup before executing the decoder. No new ownership transfer or double cleanup. |
| Q2: termination | Both changed branches return synchronously; no retry, lock, channel, RPC, or background worker was introduced. |
| Q3: retained growth | No new persistent buffer or collection. Scratch lifetime and result reuse/free boundaries are unchanged; test data and fixture count are small and fixed. |
Evidence reused from the current head, CI run 36036487031: UT (including the function package in the race group), coverage, SCA, shared build, and both active Compose BVT jobs passed. The merged coverage artifact shows execution of both changed return branches. The PROXY BVT log explicitly reports vector_base64_invalid_input.sql: 11 total, 11 successful, 0 failed/ignored/abnormal, 0.058 s. The PR also records focused normal-mode tests and two standalone comparison runs. No duplicate local suite was needed; git diff --check passed.
This is an ordinary local error-classification fix (R2 public error contract), so a new design document or distributed/GPU validation requirement would be disproportionate. No blocking correctness, cleanup, test-quality, or overengineering issue found.
Submitted as a COMMENT review because the authenticated account is also the PR author; GitHub does not allow self-approval.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #29327.
What this PR does / why we need it:
All six public
VEC*_FROM_BASE64functions shareVecFromBase64[T]. Malformed Base64 and decoded byte lengths that do not fit the selected element width were incorrectly reported as MatrixOne internal errors. Those two user-input rejection paths now returnErrInvalidInput. Valid decoding and the internal guard for unsupported generic element types are unchanged.Validation
271c3f159957eab683cf4eb8474b7a353cfea622, the new focused test failed for all six malformed-input variants withinternal error.TestVecFromBase64*and the full./pkg/sql/plan/functionpackage passed throughmo-cgo-testwith matching native artifacts,-count=1.go vet -mod=readonly ./pkg/sql/plan/functionpassed. Incrementalgolangci-lint2.5.0, built with Go 1.26.4, passed with 0 issues.vector_base64_invalid_input.sqlpassed normal mo-tester comparison twice against the task-owned standalone service: 11/11 statements per run, zero failed/ignored/abnormal. It checks all six malformed inputs, four applicable width mismatches, and a successful one-byte UINT8 control after errors.gofmtandgit diff --checkpassed. Independent GPT-6 medium design and whole-diff review found no blockers.Risk and rollback
The public error classification and displayed prefix change from
internal errortoinvalid input. This repository maps both to MySQLER_UNKNOWN_ERROR; the MatrixOne error class is the intended contract. The CPU IVF-Flat caller produces well-formed, aligned Base64 and does not enter the changed branches. No GPU algorithm, native, protocol, or data-success path changes. Revert this commit to restore the previous classification.Rebase and CI interpretation
Rebased onto
maincontaining #29370, which fixes the unauthorized Quay MinIO image pulls used by Compose BVT. On the previous head, ordinary Ubuntu UT, SCA, and shared build passed; Compose BVT failed at image startup before executing the Base64 SQL. Coverage UT had a separateTestAutoIDCacheRestartAndDisabledNodecontext deadline failure inpkg/tests/issues/isolated. It must not be attributed to MinIO or to the changed Base64 error branches without a matching baseline. On the rebased head, focusedTestVecFromBase64*and the full function package passed locally. CI for the rebased head should be read from its checks.No distributed topology or GPU execution was run locally; the changed error branches do not depend on either.