matrixorigin / matrixorigin/matrixone
[Bug]: CHAR_LENGTH over binary string counts characters instead of bytes
- Dominant language
- Go
- Stars
- 1.9k
- Forks
- 311
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 768
Description
### Environment
- Branch: latest `main`
- Commit tested locally: `200bfa7e0efb` (`fix: improve skills SKILL.md compatibility format (#25271)`)
- MySQL oracle: local MySQL 8.x via `mysql -u root -p...`
- MO: `8.0.30-MatrixOne-v1.3.0`
### Steps to Reproduce
```sql
select length(_binary '你好') as byte_len,
char_length(_binary '你好') as char_len;
```
### MySQL Result
```text
byte_len char_len
6 6
```
For a binary string, MySQL counts bytes for `CHAR_LENGTH()`.
### MatrixOne Result
```text
byte_len char_len
6 2
```
MatrixOne appears to count Unicode characters even though the literal is explicitly `_binary`.
### Expected Behavior
For binary strings, `CHAR_LENGTH()` / `CHARACTER_LENGTH()` should match MySQL and count bytes, not decoded characters.
### Notes
Found during active MySQL compatibility exploration, Module 4: String / Charset / Collation. I searched existing issues for `CHAR_LENGTH binary` and did not find a duplicate.
Contributor guide
Assessment
This issue has not been assessed yet.