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]: hex-like ordinary strings cast to numeric as hex values instead of MySQL zero #25265
select cast('0x10'as unsigned) as hex_unsigned,
cast('0x10'as signed) as hex_signed,
cast('0x10'asdecimal(6,0)) as hex_decimal;
-- result-- hex_unsigned | hex_signed | hex_decimal-- 16 | 16 | 16select cast('0b1010'as unsigned) as bin_unsigned,
cast('0o17'as signed) as oct_signed,
cast('0123'as signed) as leading_zero_decimal;
-- result-- bin_unsigned | oct_signed | leading_zero_decimal-- 10 | 15 | 123select cast('+0b1010'asdecimal(6,2)) as plus_bin_decimal,
cast('+0o17'asdecimal(6,2)) as plus_oct_decimal,
cast('+0x123'asdecimal(6,2)) as plus_hex_decimal;
-- result-- plus_bin_decimal | plus_oct_decimal | plus_hex_decimal-- 10.00 | 15.00 | 291.00
Conclusion:
Latest main keeps/extends MO's radix-string behavior: 0x, 0o, and 0b prefixed strings are parsed as hexadecimal/octal/binary numeric strings.
This matches the behavior implemented by fix cast digital string #25449, but it is intentionally different from MySQL's ordinary-string conversion behavior where '0x10' returns 0 with warnings.
Added motr regression coverage in matrixorigin/motr#39:
Regression on current main nightly — the fix no longer holds
Re-verified on the latest nightly build b14d67a (docker registry.cn-shanghai.aliyuncs.com/matrixorigin/matrixone:nightly-b14d67a2-arm64, built 2026-10-26; standalone, single CN). The three cases from this issue's description, which the fix PR #25449 resolved at merge time (my verification comment above, on ec01c62e4), all return hex-parsed values again:
statement
at fix verification (ec01c62e4)
now, nightly b14d67a
MySQL 8.0 (official image, verified today)
SELECT CAST('0x10' AS UNSIGNED)
0
16
0
SELECT CAST('0x10' AS SIGNED)
0
16
0
SELECT CAST('0x10' AS DECIMAL(6,0))
0
16
0
And the same hex-parsing leaks through every implicit path beyond the original CAST scope:
statement
MO nightly b14d67a
MySQL 8.0 (verified)
SELECT '0x10' + 0
16
0.0
SELECT '0xff' + 0
255
0.0
SELECT '0deadbeef' + 0 → '0xdeadbeef'
3735928559
0.0
SELECT '0b101' + 0 (binary prefix too)
5
0.0
SELECT '0x10' = 16
1
0
SELECT '0x10' > 15
1
0
Most dangerous real-world shape — a row-filter accept that MySQL would reject:
-- varchar column containing mixed codesSELECTCOUNT(*) FROM (SELECT'0x10' x UNION ALLSELECT'20') t WHERE x >15;
-- MO b14d67a: 2 ('0x10' parsed as 16 > 15, row admitted)-- MySQL 8.0: 1 ('0x10' coerces to 0, row rejected)
For comparison, a genuinely invalid hex string errors instead of coercing — so the current behavior is neither MySQL-compatible nor internally consistent:
SELECT'0xzz'+0; -- ERROR 20203 (cast to int, bad value) on MO; MySQL: 0.0
Suggest re-opening: the regression window is somewhere between ec01c62e4 (fix verified) and b14d67a (current nightly). A BVT row for '0x10'-style strings in numeric contexts (CAST, arithmetic, comparison, and column-filter) with a MySQL-8 control would pin all four paths and prevent the next regression.
Related same-day findings in the string→numeric coercion family: '1e2'+0, ' 12abc'+0, ' +3.5'+0, '1,234.5'+0, ''+5 all error with 20203 on b14d67a where MySQL coerces leniently (prefix-parse or 0) — tracked in #30730's comment thread.
Activity
daviszhen commentedon Jul 3, 2026
初步建议[保持 mo目前的行为. "0x1234"作为16进制字符串看待.
postgresql 与mo的行为类似
fix cast digital string (#25449)
daviszhen commentedon Jul 7, 2026
修改了行为
Ariznawlll commentedon Jul 8, 2026
Verified on latest
main.Build tested:
mainec01c62e4Validation SQL and result:
Conclusion:
mainkeeps/extends MO's radix-string behavior:0x,0o, and0bprefixed strings are parsed as hexadecimal/octal/binary numeric strings.'0x10'returns0with warnings.Added motr regression coverage in matrixorigin/motr#39:
suites/14_issue_regression/t/issue_25265_cast_radix_strings.testsuites/14_issue_regression/r/issue_25265_cast_radix_strings.resultmotr validation:
1 remaining item
fix cast digital string (matrixorigin#25449)
add mysql compatibility type conversion and comparison bvt cases (mat…
fix cast digital string (matrixorigin#25449)
add mysql compatibility type conversion and comparison bvt cases (mat…
fix cast digital string (matrixorigin#25449)
add mysql compatibility type conversion and comparison bvt cases (mat…
Ariznawlll commentedon Oct 28, 2026
Regression on current main nightly — the fix no longer holds
Re-verified on the latest nightly build
b14d67a(dockerregistry.cn-shanghai.aliyuncs.com/matrixorigin/matrixone:nightly-b14d67a2-arm64, built 2026-10-26; standalone, single CN). The three cases from this issue's description, which the fix PR #25449 resolved at merge time (my verification comment above, onec01c62e4), all return hex-parsed values again:ec01c62e4)b14d67aSELECT CAST('0x10' AS UNSIGNED)0160SELECT CAST('0x10' AS SIGNED)0160SELECT CAST('0x10' AS DECIMAL(6,0))0160And the same hex-parsing leaks through every implicit path beyond the original CAST scope:
b14d67aSELECT '0x10' + 00.0SELECT '0xff' + 00.0SELECT '0deadbeef' + 0 → '0xdeadbeef'0.0SELECT '0b101' + 0(binary prefix too)0.0SELECT '0x10' = 160SELECT '0x10' > 150Most dangerous real-world shape — a row-filter accept that MySQL would reject:
For comparison, a genuinely invalid hex string errors instead of coercing — so the current behavior is neither MySQL-compatible nor internally consistent:
Suggest re-opening: the regression window is somewhere between
ec01c62e4(fix verified) andb14d67a(current nightly). A BVT row for'0x10'-style strings in numeric contexts (CAST, arithmetic, comparison, and column-filter) with a MySQL-8 control would pin all four paths and prevent the next regression.Related same-day findings in the string→numeric coercion family:
'1e2'+0,' 12abc'+0,' +3.5'+0,'1,234.5'+0,''+5all error with 20203 onb14d67awhere MySQL coerces leniently (prefix-parse or 0) — tracked in #30730's comment thread.Ariznawlll commentedon Nov 4, 2026
结论
测试不通过。按 Issue 所要求的 MySQL 普通字符串转数值语义,最新 main 仍将带进制前缀的字符串按进制解析,并会在过滤条件中产生不同结果。
关键证据
main@0f6c07639604c40d7ca880cb63d1d282239def08,本地独立 1 Log / 1 TN / 2 CN;对照为独立 MySQL 8.0.45。以下每组在两个 CN 和 MySQL 各重复 3 次,结果一致。SELECT CAST('0x10' AS UNSIGNED), CAST('0x10' AS SIGNED), CAST('0x10' AS DECIMAL(6,0)):MO 为(16,16,16),MySQL 为(0,0,0)。普通十进制123和-7转换在两端一致。'0x10'+0、'0xff'+0、'0b101'+0在 MO 为16/255/5,MySQL 均为 0;'0x10'=16在 MO 为 1、MySQL 为 0。混合'0x10'和'20'的行过滤x>15在 MO 计数 2、MySQL 计数 1;'0xzz'+0在 MO 报 20203、MySQL 返回 0。待解决点
XuPeng-SH commentedon Nov 30, 2026
Consolidated duplicate #31353 here as the same quoted-string radix coercion defect.
Additional acceptance coverage retained:
'0xff' + 0,'0x10' + 0, and'0b101' + 0must use MySQL's ordinary-string numeric-prefix semantics rather than hexadecimal/binary interpretation.'0x10' = 16and'0b101' = 5must agree with MySQL.0xff,0x41,X'41', andB'..'literal forms remain independent controls; their valid literal behavior must not be broken.+0, comparison, and row-filter cases already recorded here.Administrative consolidation only; the quoted-string coercion defect remains open and is not fixed or QA-verified.