Skip to content

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

@apatrida

Description

@apatrida

Search before asking

  • I had searched in the issues 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 {<EOF>, ';'}(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 {<EOF>, ';'}(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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions