You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: comparing an ENUM column with a SMALLINT UNSIGNED column panics (type mismatch casting SMALLINT UNSIGNED vector to []types.Enum) #31901
ENUM 列和 SMALLINT UNSIGNED 列比较时,MO 在执行阶段 panic(被捕获后返回 20101 internal error: panic type mismatch: casting SMALLINT UNSIGNED vector to []types.Enum)。WHERE e = s、WHERE s = e、SELECT e = s 都会触发。<、+、* 则在绑定阶段报 bad value [ENUM SMALLINT UNSIGNED]。
createtablet (e enum('a','b','c'), s smallint unsigned, u int unsigned, ti tinyint unsigned);
insert into t values ('b', 2, 2, 2);
select e = u, e = ti, e + u from t; -- 正常:1 1 4select e = s from t;
select*from t where e = s;
select*from t where s = e;
select e < s from t;
select e + s from t;
select s * e from t;
实际结果(MO)
select e = s -> ERROR 20101 (HY000): internal error: panic type mismatch: casting SMALLINT UNSIGNED vector to []types.Enum:
github.com/matrixorigin/matrixone/pkg/container/vector.checkType[...] vector.go:227
... vector.ToFixedCol ... function.opBinaryFixedFixedToFixed ... function.equalFn (func_compare.go:1248)
select * where e = s -> 同上
select * where s = e -> ERROR 20101 (HY000): internal error: panic type mismatch: casting ENUM vector to []uint16: ...
select e < s -> ERROR 20203 (HY000): invalid argument operator <, bad value [ENUM SMALLINT UNSIGNED]
select e + s -> ERROR 20203 (HY000): invalid argument operator +, bad value [ENUM SMALLINT UNSIGNED]
select s * e -> ERROR 20203 (HY000): invalid argument operator *, bad value [SMALLINT UNSIGNED ENUM]
服务端日志里是 panic in pipeline: internal error: panic type mismatch ...。
期望结果(MySQL 8.4.9)
ENUM 在数值上下文里取成员序号('b' → 2):
e = s -> 1;WHERE e = s / WHERE s = e 都返回那一行;e < s -> 0;e + s -> 4;s * e -> 4
批准评审 对应较早 head d1023d77f14c649433aa42036068cc1c3a07ce8a,复用了该 head 的 UT/SCA/coverage/多 CN BVT 成功元数据,不能直接当作最终 b86c8d8 或 merge SHA 的验证。最新队列记录 显示因 fork 编辑权限退出队列、无队列 CI 运行,且当时 CI Required 条件未满足;没有把此记录写成 CI 通过。合入 main 的事实由 PR 元数据独立确认。
Regression and extended verification for #31901 (2026-11-10)
Verification Environment
Frozen latest origin/main at test start, 11d2e1ef7e1b3ed3a20e6d7f29f912e55118db5b, fix(python): reconnect ORM export shortcuts to current exporters (#32447).
Freshly built CPU binary, matching native-library provenance, and runtime git_version()=11d2e1ef7e at every endpoint. macOS 26.6, arm64, Go 1.27.1.
Complete co-hosted topology of 2 CN / 1 TN / 1 Log service / Proxy, launched in one service process. Proxy 6001, CN1 16001 and CN2 16002 were reachable. Original and extended SQL actually ran through each endpoint.
PyMySQL 1.1.2 using MySQL text protocol (COM_QUERY). Additional Go database/sql + go-sql-driver/mysql tests used interpolateParams=false and actual COM_STMT_PREPARE / COM_STMT_EXECUTE on one checked-out connection per endpoint.
What Was Covered
OK — Replayed the original e=s, s=e, both WHERE orders, ordering comparison, addition and multiplication through every endpoint. The ordinal 2 compares equal to 2, and arithmetic returns 4 without a vector type panic.
OK — Both operand orders for =, <=>, <>, <, <=, >, >=, +, * and %, including all NULL permutations and matching/nonmatching rows.
OK — Unsigned boundaries 0 / 65535, bounded subtraction, and existing checked 1690 overflow/underflow diagnostics. Arithmetic boundary errors retain their existing contract.
OK — ENUM/ENUM, label comparisons, displayed member strings, ENUM metadata, ordinary uint16 pairs, and the original wider/narrower unsigned controls.
OK — Native prepared execution reuses the same statement for normal and NULL filters. A strict invalid ENUM insert returns 1265 / 01000, stores no invalid row, and the same prepared insert handle subsequently succeeds.
Not covered — Exhaustive ENUM cardinality and every numeric-width combination. Existing focused neighboring-coercion tests passed.
Findings
Associated fix fbcca458c3f8543236594841f22914cec78c0e3f, fix(sql): cast mixed ENUM and SMALLINT UNSIGNED operands. The merge is an ancestor of the frozen main commit. PR #32358
Mixed ENUM/uint16 operations use the ENUM ordinal conversion while preserving label and same-family controls. No panic occurred in the verified comparison, arithmetic, prepared or checked-error paths.
MOTR / BVT Coverage
Added suites/14_issue_regression/t/issue_31901_enum_uint16.test and the matching .result. Recording passed, followed by 2 successful replays through each of the 3 endpoints.
Independent branch test/issue-31901-enum-uint16, source commit cd022508b5a88401a8e3a3e88d44ca0cd6bfd6ae, pushed and remote/upstream verified. Weekly cherry-pick 304bf4ca559c332caa2adb0c2e5523406533ee09 is included in the existing weekly summary. MOTR PR #321
Combined weekly tests passed with -j 5 --repeat 2, 7 isolated cases, 14/14 executions per endpoint and 42/42 total. Databases and connections are independent, with session-local settings.
Focused product tests recorded 142 test/subtest passes. Complete external, function and value_scan packages recorded 18,182 passes with 1 unrelated Arrow/MinIO integration skip. These counts include subtests.
Final Conclusion
Fixed for the issue contract on the verified main build and topology.
Large-data regression — Not required. The failure depends on operand types and physical vector identity. Small rows and focused vector tests cover the relevant boundary.
Activity
fix(sql): cast mixed ENUM and SMALLINT UNSIGNED operands (#32358)
XuPeng-SH commentedon Nov 8, 2026
QA 交接:#32358 已于 2026-11-08 01:55:18 UTC 合入 main,merge SHA
fbcca458c3f8543236594841f22914cec78c0e3f,最终 PR headb86c8d8045463ddd315986b16e5614d2659dd0f2(base7a73a7395506a04e2555422fee7dd5c766416f0f)。修复范围:保留操作数原始 ENUM 身份,仅在恰好一侧为 ENUM、另一侧为 SMALLINT UNSIGNED 的 uint16 同型分支中强制使用现有序号转换,覆盖两种操作数顺序。这样避免等值比较把 ENUM 与 uint16 物理向量混用,也让排序比较和算术运算得到可执行的共同类型。ENUM/ENUM、ENUM/varchar 的标签比较、ENUM 展示及成员元数据、普通 uint16 对和其他数值拓宽路线保持原有语义。这是 SQL 产品缺陷,不按 CI flaky 关闭。
已核实的证据与限制:
c32e75a2;目前未见适用于该新修复的已验证反例或未完成的开发 follow-up。e8765aa...基线上做 production-only overlay,未修复实现的定向 function/planner 回归语义失败,修复后定向测试通过;早期 planner 测试对单一过滤节点的错误假设已改为遍历全部保留的谓词消费者。作者另报告 336 个相关包的增量 SCA 通过,新增公共 SQL fixture 所属包随后单独复查通过,不是全仓重新检查。TestIssue31901EnumSmallintUnsignedNumericCoercion一次运行通过,覆盖五类运算、WHERE 行集合、NULL、标签对照、真实 prepared 执行及严格模式错误后的连接/语句复用。该运行及二进制证据属于作者报告,本轮没有复跑。d1023d77f14c649433aa42036068cc1c3a07ce8a,复用了该 head 的 UT/SCA/coverage/多 CN BVT 成功元数据,不能直接当作最终b86c8d8或 merge SHA 的验证。最新队列记录 显示因 fork 编辑权限退出队列、无队列 CI 运行,且当时 CI Required 条件未满足;没有把此记录写成 CI 通过。合入 main 的事实由 PR 元数据独立确认。建议 QA 在包含上述 merge SHA 的 main 上优先验证:
转交 @Ariznawlll 进行 QA;issue 保持开放。
slyunnn commentedon Nov 10, 2026
Regression and extended verification for #31901 (2026-11-10)
Verification Environment
origin/mainat test start,11d2e1ef7e1b3ed3a20e6d7f29f912e55118db5b,fix(python): reconnect ORM export shortcuts to current exporters (#32447).git_version()=11d2e1ef7eat every endpoint. macOS26.6,arm64, Go1.27.1.2 CN / 1 TN / 1 Log service / Proxy, launched in one service process. Proxy6001, CN116001and CN216002were reachable. Original and extended SQL actually ran through each endpoint.1.1.2using MySQL text protocol (COM_QUERY). Additional Godatabase/sql+go-sql-driver/mysqltests usedinterpolateParams=falseand actualCOM_STMT_PREPARE/COM_STMT_EXECUTEon one checked-out connection per endpoint.What Was Covered
e=s,s=e, bothWHEREorders, ordering comparison, addition and multiplication through every endpoint. The ordinal2compares equal to2, and arithmetic returns4without a vector type panic.=,<=>,<>,<,<=,>,>=,+,*and%, including allNULLpermutations and matching/nonmatching rows.0/65535, bounded subtraction, and existing checked1690overflow/underflow diagnostics. Arithmetic boundary errors retain their existing contract.ENUM/ENUM, label comparisons, displayed member strings,ENUMmetadata, ordinary uint16 pairs, and the original wider/narrower unsigned controls.NULLfilters. A strict invalidENUMinsert returns1265/01000, stores no invalid row, and the same prepared insert handle subsequently succeeds.ENUMcardinality and every numeric-width combination. Existing focused neighboring-coercion tests passed.Findings
fbcca458c3f8543236594841f22914cec78c0e3f,fix(sql): cast mixed ENUM and SMALLINT UNSIGNED operands. The merge is an ancestor of the frozen main commit. PR #32358ENUM/uint16 operations use theENUMordinal conversion while preserving label and same-family controls. No panic occurred in the verified comparison, arithmetic, prepared or checked-error paths.MOTR / BVT Coverage
suites/14_issue_regression/t/issue_31901_enum_uint16.testand the matching.result. Recording passed, followed by2successful replays through each of the3endpoints.test/issue-31901-enum-uint16, source commitcd022508b5a88401a8e3a3e88d44ca0cd6bfd6ae, pushed and remote/upstream verified. Weekly cherry-pick304bf4ca559c332caa2adb0c2e5523406533ee09is included in the existing weekly summary. MOTR PR #321-j 5 --repeat 2,7isolated cases,14/14executions per endpoint and42/42total. Databases and connections are independent, with session-local settings.142test/subtest passes. Complete external, function and value_scan packages recorded18,182passes with1unrelated Arrow/MinIO integration skip. These counts include subtests.Final Conclusion
Fixed for the issue contract on the verified main build and topology.
Large-data regression — Not required. The failure depends on operand types and physical vector identity. Small rows and focused vector tests cover the relevant boundary.