apache / apache/doris

[Bug] REGRESSION in 4.1 for CLUSTER BY now errors on SQL parsing for UNIQUE KEY tables

Open
#62,727 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
15.9k
Forks
3.9k
Avg merge
2d 23h
Merged PRs (30d)
520

Description

### Search before asking

- [x] I had searched in the [issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no similar issues.

### Version

4.1

### What's Wrong?

You can no longer use `CLUSTER BY` in a unique key table create statement.

```
CREATE TABLE foo
( ... )
UNIQUE KEY (myKey)
CLUSTER BY (something)
...

[HY000][1105] errCode = 2, detailMessage =
mismatched input 'CLUSTER' expecting {, ';'}(line 10, pos 0)

Does not matter where you place it, it fails.

### What You Expected?

```
CREATE TABLE test_cluster_by
(
user_id LARGEINT NOT NULL,
username VARCHAR(50) NOT NULL,
city VARCHAR(20),
age SMALLINT,
sex TINYINT
)
UNIQUE KEY(user_id, username)
CLUSTER BY (city, age)
DISTRIBUTED BY HASH(user_id) BUCKETS 10
PROPERTIES (
"replication_num" = "1",
"enable_unique_key_merge_on_write" = "true"
);
```

returns

> [HY000][1105] errCode = 2, detailMessage = mismatched input 'CLUSTER' expecting {, ';'}(line 10, pos 0

export it not to fail

### How to Reproduce?

```
CREATE TABLE test_cluster_by
(
user_id LARGEINT NOT NULL,
username VARCHAR(50) NOT NULL,
city VARCHAR(20),
age SMALLINT,
sex TINYINT
)
UNIQUE KEY(user_id, username)
CLUSTER BY (city, age)
DISTRIBUTED BY HASH(user_id) BUCKETS 10
PROPERTIES (
"replication_num" = "1",
"enable_unique_key_merge_on_write" = "true"
);
```

### Anything Else?

_No response_

### Are you willing to submit PR?

- [ ] Yes I am willing to submit a PR!

### Code of Conduct

- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)

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.