Skip to content

[Bug] SELECT DISTINCT returns duplicate column with aggregate key #36072

Description

@malwaregarry

Search before asking

  • I had searched in the issues and found no similar issues.

Version

2.1.3

What's Wrong?

Given a table with a column that is an aggregate key:
CREATE TABLE t1(c0 varchar(1) NOT NULL) AGGREGATE KEY(c0) DISTRIBUTED BY RANDOM PROPERTIES ("replication_num" = "1");

If we insert duplicate entries, and select distinct, we get duplicate rows

INSERT INTO t1 (c0) VALUES ('a');
INSERT INTO t1 (c0) VALUES ('a');
SELECT DISTINCT t1.c0 FROM t1; -- returns both rows

What You Expected?

only distinct rows returned

How to Reproduce?

DROP DATABASE IF EXISTS doris0;
CREATE DATABASE doris0;
USE doris0;
CREATE TABLE t1(c0 varchar(1) NOT NULL) AGGREGATE KEY(c0) DISTRIBUTED BY RANDOM PROPERTIES ("replication_num" = "1");
INSERT INTO t1 (c0) VALUES ('a');
INSERT INTO t1 (c0) VALUES ('a');
SELECT DISTINCT t1.c0 FROM t1;

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions