Skip to content

[Bug]: compact TIME string comparison differs from MySQL #25229

Closed

Description

@Ariznawlll

Repro on main

MO version: 8.0.30-MatrixOne-verify-greatest-main built from latest main in local verification.

select cast('03:04:05.123456' as time(6)) = '030405.123456' as time_eq_compact_string,
       cast('03:04:05.123456' as time(6)) between '030405.123455' and '030405.123457' as time_between_microsecond;

MySQL result

time_eq_compact_string  time_between_microsecond
0                       0

MatrixOne result

time_eq_compact_string  time_between_microsecond
1                       1

Notes

This is a MySQL compatibility issue for compact TIME-looking strings in temporal comparison predicates. MatrixOne currently treats these compact strings as matching the TIME value, while MySQL does not in these predicate expressions.

Activity

  1. Ariznawlll commented on Jun 29, 2026

    @Ariznawlll
    CollaboratorAuthor

    Duplicate check before filing/after filing: searched existing open and closed issues with keywords 030405.123456, compact TIME, time comparison MySQL, and temporal comparison MySQL. No duplicate issue found; the only exact hits were this issue itself.

  2. added
    kind/bug
    severity/s1
    on Jun 29, 2026
  3. added theissue type on Jun 30, 2026
  4. added this to the MO-202607 milestone on Jun 30, 2026
  5. added
    ai-light
    on Jul 10, 2026
  6. added a commit that references this issue on Jul 15, 2026
  7. added a commit that references this issue on Jul 24, 2026
  8. daviszhen commented on Jul 30, 2026

    @daviszhen
    Contributor

    fixed

  9. Ariznawlll commented on Jul 30, 2026

    @Ariznawlll
    CollaboratorAuthor

    测试版本

    • 分支:main(截至 2026-07-30 16:30,Asia/Shanghai)
    • commit:41332062a6740978f269088a92ee362a888c7bd7
    • 部署方式:从该官方 commit 源码构建;etc/launch-with-proxy/launch.toml(2 CN + 1 TN + Proxy),SQL 入口 127.0.0.1:6001
    • 测试日期:2026-07-30

    原问题验证

    TIME(6) '03:04:05.123456' 与 compact string '030405.123456' 的等值和 BETWEEN 均返回 0;完整黑盒 3/3 通过。

    Happy Path 覆盖

    1. 带冒号的标准字符串比较返回 1。
    2. 微秒精度 TIME 保持 6 位精度。

    Unhappy Path 覆盖

    1. 正 compact TIME-looking string 不再被错误当作同一 TIME。
    2. 负 compact string 与最大范围 compact string 均返回不相等,不发生错误强转。

    白盒验证

    TIME string comparison、BETWEEN、IN 和 parameter binder 定向测试通过。

    回归测试

    修复提交 5c3243d2f 已加入 mysql_compat_time_string_compare.test 及 binder/function UT。

    测试证据

    完整 3 轮 SQL 结果、测试脚本、Proxy 黑盒日志、定向 UT 与 -race 输出:https://gist.github.com/Ariznawlll/b8f1a22642a58fd5264482687534728b

    测试结论

    测试通过。

  10. Ariznawlll commented on Jul 30, 2026

    @Ariznawlll
    CollaboratorAuthor

    motr 黑盒回归已补充

    • PR:matrixorigin/motr#72
    • 用例:suites/14_issue_regression/t/issue_25229_time_compact_string_compare.test
    • 覆盖:TIME 不把紧凑数字串按合法 TIME 比较;带冒号输入作为正常对照
    • 本地验证:基于 MatrixOne main@41332062a6740978f269088a92ee362a888c7bd7,该批 14 个用例连续 3 轮为 42/42 成功(504/504 语句);完整 14_issue_regression suite 为 124 成功、0 失败。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ai-lightkind/bugseverity/s1

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions