Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] SELECT DISTINCT returns wrong value for UNIQUE model #36343

Open
2 of 3 tasks
malwaregarry opened this issue Jun 15, 2024 · 0 comments
Open
2 of 3 tasks

[Bug] SELECT DISTINCT returns wrong value for UNIQUE model #36343

malwaregarry opened this issue Jun 15, 2024 · 0 comments

Comments

@malwaregarry
Copy link

Search before asking

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

Version

2.1.4

What's Wrong?

Could be related to #36072

CREATE TABLE t0(c0 INT) UNIQUE KEY(c0) DISTRIBUTED BY HASH (c0) PROPERTIES ("replication_num" = "1");
CREATE TABLE t1(c0 INT NOT NULL) DISTRIBUTED BY HASH (c0) PROPERTIES ("replication_num" = "1");
INSERT INTO t0 (c0) VALUES (1);

This returns value 0, but there is no value 0 in t1.c0:
SELECT DISTINCT t1.c0 FROM t0 LEFT JOIN t1 ON (true) WHERE ((t1.c0) IS NULL);

What You Expected?

This returns null:
SELECT DISTINCT t1.c0 FROM t0 LEFT JOIN t1 ON (true) WHERE ((t1.c0) IS NULL);

How to Reproduce?

DROP DATABASE IF EXISTS doris2;
CREATE DATABASE doris2;
USE doris2;
CREATE TABLE t0(c0 INT) UNIQUE KEY(c0) DISTRIBUTED BY HASH (c0) PROPERTIES ("replication_num" = "1");
CREATE TABLE t1(c0 INT NOT NULL) DISTRIBUTED BY HASH (c0) PROPERTIES ("replication_num" = "1");
INSERT INTO t0 (c0) VALUES (1);
SELECT DISTINCT t1.c0 FROM  t0 LEFT JOIN t1 ON (true); 
SELECT DISTINCT t1.c0 FROM  t0 LEFT JOIN t1 ON (true) WHERE ((t1.c0) IS NULL);

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant