Skip to content

[Bug]: binary string bitwise operations use numeric evaluation instead of MySQL binary-string evaluation #25246

Closed

Description

@Ariznawlll

Bug Report

MatrixOne Version

Latest origin/main verified locally at 33e96877604ad4b847ea7d5c55eb09429de1a5b6.

Reproduce Steps

select hex(_binary X'FF' & _binary X'0F'),
       hex(_binary X'F0' | _binary X'0F'),
       hex(_binary X'FF' ^ _binary X'0F');

Expected Behavior

MySQL performs binary-string evaluation when bitwise operands are binary strings of compatible length, preserving byte width:

0F    FF    F0

Actual Behavior

MatrixOne appears to use numeric evaluation for the first expression and loses the leading zero:

F    FF    F0

Notes

This was found while comparing bitwise operator behavior with MySQL/TiDB docs. The mismatching binary-string rows were not added to passing BVT.

Activity

  1. added
    kind/bug
    severity/s1
    on Jun 30, 2026
  2. added theissue type on Jun 30, 2026
  3. modified the milestones: MO-2507, MO-202607 on Jun 30, 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 hex(_binary X'FF' & _binary X'0F') as bit_and,
           hex(_binary X'F0' | _binary X'0F') as bit_or,
           hex(_binary X'FF' ^ _binary X'0F') as bit_xor;

    实际结果:

    bit_and  bit_or  bit_xor
    0F       FF      F0
    

    结果符合 MySQL 二进制字符串位运算预期,不再出现之前 hex(_binary X'FF' & _binary X'0F') 返回 F 的问题。

    已补充 motr 回归用例:

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

    回归验证通过:

    [ISSUE_25246_BINARY_STRING_BITWISE] ... | 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