Skip to content

[Compatibility]: CAST numeric-prefix text AS SIGNED reports DOUBLE instead of INTEGER in warning #31443

Description

@slyunnn

Description

An explicit CAST of numeric-prefix text to SIGNED returns the correct value and warning code, but MatrixOne describes the conversion as DOUBLE in the warning. MySQL 8.0.46 describes it as INTEGER.

The observed difference is diagnostic text; it is not a wrong numeric result.

Environment

  • MatrixOne: main at 802376360c574f44aea23db5eef3cfcebf0527fd; the freshly built runtime reported git_version() = 8023763.
  • Deployment: isolated local 2 CN / 1 TN / 1 LogService / Proxy.
  • Client: MySQL CLI over the MySQL TCP protocol; the reproducer was executed through Proxy.
  • Comparison: an isolated MySQL 8.0.46 instance.
  • Verification date: 2026-10-27.

Steps to reproduce

Run both statements in the same session on each server. Inspect SHOW WARNINGS immediately after the SELECT.

SELECT CAST('42tail' AS SIGNED);
SHOW WARNINGS;

Actual behavior

MatrixOne returns 42 and emits:

Level:   Warning
Code:    1292
Message: Truncated incorrect DOUBLE value: '42tail'

The query succeeds; the mismatch is the type name in the warning.

Expected behavior

MySQL 8.0.46 returns 42 and emits:

Level:   Warning
Code:    1292
Message: Truncated incorrect INTEGER value: '42tail'

If exact warning text is part of MatrixOne's MySQL compatibility contract, a truncated SIGNED cast should preserve the current result and warning code while naming INTEGER. Please confirm the intended diagnostic contract.

Stability and controls

  • Numeric-prefix reproducer: executed once on each server in the stated environment; both returned 42 and warning 1292, with the message difference above. Repeated-run stability has not been established.
  • Invalid-text control: SELECT CAST('x' AS SIGNED); SHOW WARNINGS; returned 0 and an INTEGER warning with code 1292 on both servers.
  • Valid-value control: CAST('42' AS SIGNED) returned 42; CAST(NULL AS SIGNED) returned NULL.
  • Only the literal SIGNED prefix case was compared here. UNSIGNED numeric-prefix values, column values, and prepared/binary-protocol execution remain untested.

Evidence

MatrixOne: 42; Warning 1292: Truncated incorrect DOUBLE value: '42tail'
MySQL:     42; Warning 1292: Truncated incorrect INTEGER value: '42tail'

The full verification and environment record is in #30417's regression comment.

Code analysis

At the tested commit, the signed string-cast path in func_cast.go can call appendNumericCoercionWarning, which formats a DOUBLE diagnostic. The explicit integer-warning helper in the same file formats INTEGER.

This is a candidate explanation based on static inspection; the specific runtime branch for this query has not been traced.

Regression coverage

If diagnostic text is confirmed as in scope:

  1. Assert the value, warning code, and warning message for a SIGNED numeric-prefix literal.
  2. Retain valid, NULL, and wholly invalid-text controls.
  3. Check UNSIGNED, column-driven values, and prepared/text versus binary protocol independently before claiming those paths are covered.

Related

Activity

  1. added
    kind/compatibility
    on Oct 27, 2026
  2. added this to the MO-202610 milestone on Oct 27, 2026
  3. added theissue type on Oct 27, 2026
  4. added
    kind/bug
    and removed
    kind/compatibility
    on Oct 27, 2026
  5. added a commit that references this issue on Oct 30, 2026
    d48cfce
  6. Ariznawlll commented on Nov 29, 2026

    @Ariznawlll
    Collaborator

    结论

    测试通过。CAST 数字前缀文本 AS SIGNED 的警告已正确使用 INTEGER,同时保持结果与 1292 错误码;列输入、UNSIGNED 和真实二进制预编译也已覆盖。

    关键证据

    版本与环境

    • 此项按 main 验收。本地隔离双 CN 实测 922815d74fe664dc9f4ea7bfc4c4e8ac3b279cd0;本次 Linux CI 从官方 main 检出的实际版本为 231b68c2d6421e9d212538866e0f825afd6c13e8,两处分别核对完整 git_version()。CI 比本地多了 Release merge spill buffers on panic #32160,核对差异仅为 spill sinker 及其两个测试文件。以下 CI 的正式 SQL、SDK 和源码测试确实在 CI 版本上重新执行;不把 MOTR commit 当作 MO 版本,也不将 main 结果外推为 4.2-dev 通过。
    • 原生源码测试使用该版本;[Bug]: PREPARE'd LOAD DATA re-bind drops its column list and SET/NULLIF — rows load into the wrong columns #31315 的测试 overlay 只增加测试与适配 BuildPlan 调用签名,没有修改产品实现。SQL 与协议测试连接实际启动的服务。

    步骤、断言与实际结果

    SELECT CAST('42tail' AS SIGNED) -> 42
    SHOW WARNINGS -> Warning | 1292 | Truncated incorrect INTEGER value: '42tail'
    SELECT CAST('x' AS SIGNED) -> 0
    SHOW WARNINGS -> Warning | 1292 | Truncated incorrect INTEGER value: 'x'
    SELECT CAST('42' AS SIGNED) -> 42; SHOW WARNINGS -> empty
    SELECT CAST(NULL AS SIGNED) -> NULL
    
    • 本地三轮对照独立 MySQL 8.0.45;原报告参考为 8.0.46,明确区分实际使用版本。
    • 覆盖 SIGNED/UNSIGNED、负前缀、存储 VARCHAR 列及 SQL PREPARE;检查值、警告 level/code/text 和成功执行后警告清除。负数转 UNSIGNED 的补码及额外诊断单独断言。
    • 另用 Go MySQL driver 的实际 binary PREPARE/EXECUTE 三轮共24次,未启用插值代替二进制协议;覆盖同一 prepared statement 从错误到正常参数的 warning 生命周期。
    • TestExplicitCastTextToIntegerWarnsInteger 原生三轮通过。
    • 旧 CI 最终二进制探针因测试账户环境未传入而返回1045;修正仅限 fixture 默认值,本地重新24次执行通过。后续通过证据以本评论链接的修正后 CI 为准,不把旧失败 run 说成全绿。

    回归与 CI

    • 回归追加现有 MOTR main PR #374,未向 MatrixOne 主库提测试 PR。
    • 本项固定回归文件,本地三轮通过,Linux 正式 MOTR 本项 3/3。
    • Linux CI 46298275529 SUCCESS;已回读 qa-acceptance-main 中版本、正式结果、原生测试和 SDK 日志。本轮整体正式 MOTR 63/63(21 个用例各三轮)、0 失败;63 次不全属于本 Issue。
    • 同轮原生日志有 398 个顶层 PASS,没有顶层 FAIL/SKIP 或 DATA RACE;其中 saved-result projection 为普通20次、race3次。真实 SDK Arrow 48项通过,真实二进制 prepared 探针三轮、共24次执行通过。每项证据归属以上具体步骤,不将组合 CI 的总数重复算作本 Issue 的独立测试数量。
    • 汇总 PR 尚待合入;合入默认分支后相关每日调度才会生效,不声称尚未合入的 schedule 已在每天执行。

    待解决点

    本 Issue 上述原始问题与相关边界没有未通过项。该结论不扩展为其他 Issue、大数据性能或未执行的生产拓扑验收。MOTR 回归已经提交,按用户允许先验收关闭、随后合入 PR 的流程处理。

    最终结论:测试通过。原始复现、上述扩展、对应 MOTR 回归及 Linux CI 均已完成;本 Issue 验收范围内未通过项:无。按授权关闭 #31443。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugneeds-triage

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions