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]: DECIMAL arithmetic/comparison with a BOOL operand fails with 'bad value [DECIMAL64 BOOL]' #31181
Arithmetic and comparison between a DECIMAL value and a BOOL value fail at plan time in both operand orders:
ERROR 20203 (HY000): invalid argument operator +, bad value [DECIMAL64 BOOL]
ERROR 20203 (HY000): invalid argument operator =, bad value [DECIMAL64 BOOL]
This affects + - * / % DIV and = <> > < >= <=, for DECIMAL64 and DECIMAL128 (including decimal literals like 1.5 + TRUE). MySQL treats TRUE/FALSE as 1/0 here: CAST(1.5 AS DECIMAL(10,2)) + TRUE is 2.50. MatrixOne already does this for integers (2 + TRUE = 3), because the fixed binary cast tables have BOOL×INT* rows, but they have no BOOL×DECIMAL* rows. BOOL → DECIMAL is also missing from the cast table, so CAST(TRUE AS DECIMAL(10,2)) fails with [BOOL DECIMAL64].
Reported by QA as a follow-up on #30922 (comment 1, comment). #30922 / PR #30923 cover DECIMAL in a boolean context (DECIMAL → BOOL), which is the opposite direction.
How to reproduce
createtabletd(id intprimary key, d decimal(10,2), d2 decimal(30,4));
insert into td values (1,1.50,1.50),(2,0,0),(3,null,null);
select id, d + true, true + d, d - true, d * true, d / true, d % true from td order by id;
select id, d = true, d > true, d < true, d <= true, d >= true, d <> true from td order by id;
select id, d2 + true, d2 > false from td order by id;
select cast(1.5asdecimal(10,2)) + true, 1.5+ true, cast(true asdecimal(10,2));
Activity
fix(function): GREATEST/LEAST accept BOOL mixed with numeric or strin…
gouhongshen commentedon Oct 30, 2026
PR #31937 is trying to fix this issue.
fix(function): support DECIMAL arithmetic and comparison with BOOL op…
gouhongshen commentedon Oct 31, 2026
PR #31937 has merged and is awaiting manual validation. The issue remains open.
XuPeng-SH commentedon Oct 31, 2026
转 QA 验证(不代表验收通过):#31937 已合入 main,merge SHA
fe3b5591edac949af74ced9e0f3d61433826c582。已核对 issue 全部评论及 PR 修复范围,未见适用于本次合入版本的已验证反例或未完成开发 follow-up。证据来源:PR 作者报告 DECIMAL/BOOL 绑定与转换 UT 先红后绿、function 包通过;decimal_bool_arithmetic BVT 90/90,两个 EXISTS 相关 BVT 分别 235/0/14 skipped、340/0/20 skipped。远端评审记录 CI 成功及静态审计,但并非本轮本地复测,本轮未运行 Go、SQL 或完整 BVT。
请 @Ariznawlll 在上述 main 版本验证原始 DECIMAL64/128 双操作数顺序、TRUE/FALSE/NULL、除零、非字面 BOOL、显式转换和各写入路径的精度拒绝/原子性;补测 DECIMAL256 与协议精度边界。BOOL 贡献一位精度,与 INT64 字面量协议 Length 可不同;BOOL / DECIMAL256 反向除法仍与现有 INT64 / DECIMAL256 一样不支持,SUM/AVG BOOL 模式及反向 DECIMAL→BOOL 不属于本次新增覆盖。保留 issue open,交接后由 QA 验证。
Ariznawlll commentedon Oct 31, 2026
结论
测试通过。DECIMAL 与 BOOL 的原始运算、比较、转换及精度拒绝在本轮验证范围内符合研发定义。
关键证据
main@ae40f12a647880a63466de32a9f507c2c72dca0b;本地隔离双 CN / 单 TN / LogService,服务二进制对应该 SHA 且vcs.modified=false。修复 fix(function): support DECIMAL arithmetic and comparison with BOOL operands #31937 的合并提交fe3b5591edac949af74ced9e0f3d61433826c582在祖先链。TestDecimalBool*、TestBoolToDecimal*及关联函数定向测试重复 3 次成功。待解决点