Repository navigation
fix(sql): cast mixed ENUM and SMALLINT UNSIGNED operands - #32358
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? |
|
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: d1023d77f14c649433aa42036068cc1c3a07ce8a
Assessment: approve
The mixed ENUM/uint16 case now uses the existing ordinal cast in either operand order while preserving neighboring coercion and label semantics. Regression coverage reuses existing planner, executor and shared SQL fixtures. No actionable findings remain.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
Reviewed the complete four-file delta, linked issue, coercion consumers, value/NULL oracles and fixture cleanup; both discussion entries are accounted for.
-
Local source/format/evidence audit passed: checks/1794099300916809868-3.json and source-audit.log.
-
Reused frozen-head successful UT, SCA, coverage and PROXY/PESSIMISTIC multi-CN BVT metadata; author-reported focused RED/GREEN and native SQL results remain attributed.
Limitations:
- No local Go/native or public SQL rerun. Raw CI and author execution logs were not supplied.
🚫 Left the queue · pull request dequeued58 min in the queue, with no time running CI. So far
Reason Pull request #32358 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
To get back in the queue
Merge conditions not met when it left the queue
Tick the box to put this pull request back in the merge queue (same as
2 merge conditions met
Times in UTC · dashboard · how the merge queue works |
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #31901
What this PR does / why we need it:
An ENUM column compared with a SMALLINT UNSIGNED column could bind mismatched physical vectors for equality (and panic), while ordered comparisons and arithmetic could fail to bind. After ENUM normalization both operands look like uint16, so the diagonal incorrectly reported that no cast was needed.
Retain the original ENUM identity and force the existing ordinal-to-uint16 cast only for a mixed ENUM/uint16 pair, in either operand order. ENUM/ENUM and ENUM/varchar label comparisons, display metadata, ordinary uint16 pairs and other numeric widening routes keep their existing behavior.
Regression coverage follows bound column expressions into the real vector executor, including WHERE roots, both operand orders and NULLs. A public native SQL fixture additionally checks five operators, ordered WHERE id sets, labels, real prepared execution with repeated/NULL parameters, strict-mode typed rejection (1265/01000), rejected-row absence, and reuse of the same connection and prepared statement after rejection. The fixture releases its shared cluster, cursors, statements, connection, session mode and owned database.
Validation on upstream main
e8765aa231ee96df74119caba74c558ab650e067, with this worktree's native artifacts and CGO enabled:TestEnumSmallintUnsignedPlanCoercion(eight subtests) andTestEnumSmallintUnsignedBoundExpressionExecution. An earlier planner run failed because the test assumed one filter node; the final test walks every retained predicate consumer.Exact expanded 336-package SCA command:
Public fixture package SCA command:
make --no-print-directory static-check-selected STATIC_CHECK_PACKAGES="./pkg/tests/issues"(the emitted analyzer commands select only that package)../pkg/tests/issueswith-conce; the resulting binary ran-test.v -test.timeout=15m -test.run='^TestIssue31901EnumSmallintUnsignedNumericCoercion$'once. Parent and scene passed (5.78s / 0.12s); original child wait, foreground owner and CLI/OS exits were all 0. No retry or zero-selection claim. The actual held 1000-port lease, all TCP/UDP snapshots, private HAKeeper target and exact binary/process identity were verified; the post-stop snapshots contain no owned sockets.64384bbd4d2f0b648e1abbb5a080c32a3dbd7cfec69f0413cc64e410d0cd0e69(Go 1.27.1, CGO=1). Raw evidence is retained locally under/home/mo/.local/share/matrixone-matrix-meow-intake/batches/meow-31901/out/invalidation5-current-main-focused-CGO-and-SCA-intake68,return7-Kimi-missing-filter-plan-and-SCA-patrol144,return10-public-fixture-SCA-CGO-binary-and-binding-intake69andreturn12-one-real-native-consumer-intake69.Public CI and multi-CN topology remain to be evaluated on the published HEAD; no full-package/race pass is claimed by these focused results.