matrixorigin / matrixorigin/matrixone

[Bug]: Mixed IN list casts decimal string to INT and rejects valid MySQL comparison

Open
#25,222 8 comments 0 reactions 1 assignee Claimed by @daviszhen View on GitHub
ai-light kind/bug severity/s1
Dominant language
Go
Stars
1.9k
Forks
311
Avg merge
1d 3h
Merged PRs (30d)
768

Description

## Bug Report

### MatrixOne version

Verified on latest `origin/main` at `24d9d1ede` (`fix(function,plan): GREATEST/LEAST numeric promotion (#25145) and ambiguous-column typo (#25146) (#25168)`).

### Reproduce

Scalar repro:

```sql
select '9.50' in (7, '8', 9.5) as r;
```

Table repro:

```sql
drop database if exists mo_cmp_bug;
create database mo_cmp_bug;
use mo_cmp_bug;
create table t(s varchar(20));
insert into t values('9.50');
select s from t where s in (7, '8', 9.5);
drop database mo_cmp_bug;
```

### Expected behavior

MySQL 8.0.45 returns `1` for the scalar query and returns the row `9.50` for the table query.

```text
r
1

s
9.50
```

### Actual behavior

MatrixOne main returns:

```text
ERROR 20203 (HY000): invalid argument cast to int, bad value 9.50
```

### Notes

`select '9.50' in (9.5)` works on MatrixOne, so the issue appears when the `IN` list mixes integer, string, and decimal operands and chooses an incompatible integer cast path.

References:
- https://dev.mysql.com/doc/refman/8.4/en/type-conversion.html
- https://dev.mysql.com/doc/refman/8.4/en/comparison-operators.html
- https://docs.pingcap.com/tidb/stable/type-conversion-in-expression-evaluation/

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.