Skip to content

[Bug]: binary string numeric casts use byte value instead of MySQL string parsing #25264

Closed

Description

@Ariznawlll

Bug Report

MatrixOne Version

Latest origin/main verified locally at 33e96877604ad4b847ea7d5c55eb09429de1a5b6.

Reproduce Steps

select cast(_binary X'3132' as unsigned),
       cast(_binary X'3132' as decimal(6,0));

Expected Behavior

MySQL treats _binary X'3132' as the binary string containing ASCII text 12 when casting to numeric types:

12    12

Actual Behavior

MatrixOne interprets the bytes as the integer value 0x3132:

12594    12594

Notes

Found during Batch A of MySQL compatibility type-conversion exploration. Binary literal casts to CHAR and fixed BINARY(N) match MySQL and were added to BVT; the numeric-cast rows were excluded.

Activity

  1. added
    kind/bug
    severity/s1
    on Jun 30, 2026
  2. added this to the MO-202607 milestone on Jul 1, 2026
  3. added theissue type on Jul 1, 2026
  4. added
    ai-medium
    on Jul 1, 2026
  5. daviszhen commented on Jul 9, 2026

    @daviszhen
    Contributor

    fixed

  6. Ariznawlll commented on Jul 9, 2026

    @Ariznawlll
    CollaboratorAuthor

    在最新 main 分支验证通过,问题已修复。

    验证版本:

    • commit: 23ce67cfc1fddd36e6428cb11db28613dee031ac
    • commit 信息:fix(compile): LOAD DATA with compressed file hangs due to empty dispatch source address (#25556)

    验证 SQL:

    select cast(_binary X'3132' as unsigned) as cast_unsigned,
           cast(_binary X'3132' as decimal(6,0)) as cast_decimal;

    实际结果:

    cast_unsigned  cast_decimal
    12             12
    

    结果符合 MySQL 预期,不再出现之前返回 12594 / 12594 的问题。

    已补充 motr 回归用例:

    • suites/14_issue_regression/t/issue_25264_binary_string_numeric_cast.test
    • suites/14_issue_regression/r/issue_25264_binary_string_numeric_cast.result

    回归验证通过:

    [ISSUE_25264_BINARY_STRING_NUMERIC_CAST] ... | success | stmts=1 ok=1 fail=0
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ai-mediumkind/bugseverity/s1

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions