matrixorigin / matrixorigin/matrixone

[Bug]: DISTINCTROW is not accepted as a synonym for DISTINCT

Open
#25,329 0 comments 0 reactions 1 assignee Claimed by @jiangxinmeng1 View on GitHub
kind/bug needs-triage
Dominant language
Go
Stars
1.9k
Forks
311
Avg merge
1d 3h
Merged PRs (30d)
768

Description

### Branch

main at `200bfa7e0efb`.

### Summary

MySQL treats `DISTINCTROW` as a synonym for `DISTINCT`. MatrixOne parses it as an identifier and errors with `column distinctrow does not exist`.

### Reproduction

```sql
drop database if exists mysql_compat_module9_distinctrow;
create database mysql_compat_module9_distinctrow;
use mysql_compat_module9_distinctrow;

create table t(id int, grp int, label varchar(10));
insert into t values
(1,1,'b'),
(2,1,'a'),
(3,2,'c'),
(4,2,'a'),
(5,3,'b'),
(6,3,'d'),
(7,3,'d');

select distinctrow grp, label from t order by label, grp;
```

### MySQL result

```text
+------+-------+
| grp | label |
+------+-------+
| 1 | a |
| 2 | a |
| 1 | b |
| 3 | b |
| 2 | c |
| 3 | d |
+------+-------+
```

### MatrixOne result

```text
ERROR 20301 (HY000): invalid input: column distinctrow does not exist
```

### Expected behavior

`DISTINCTROW` should be accepted as a synonym for `DISTINCT`, matching MySQL.

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.