apache / doris

Apache Doris is an easy-to-use, high performance and unified analytics database.
https://doris.apache.org
Apache License 2.0
12.3k stars 3.21k forks source link

[Bug] NOT IN didn't get expected result #22597

Open TingYu404 opened 1 year ago

TingYu404 commented 1 year ago

Search before asking

Version

Doris 1.2.6

What's Wrong?

Expected results wasn't provided by Doris 1.2.6, which I used 'NOT IN' to filter A table‘s data and B table's(auxiliary table) data contains NULL. U guys can use the table structure and data below to reproduce the scenario.

CREATE TABLE temp.temp_sss ( tracking_number varchar(200) NULL ) ENGINE=OLAP UNIQUE KEY(tracking_number) COMMENT 'OLAP' DISTRIBUTED BY HASH(tracking_number) BUCKETS 1 PROPERTIES ( "replication_allocation" = "tag.location.olap: 1, tag.location.default: 3", "in_memory" = "false", "storage_format" = "V2", "function_column.sequence_type"="largeint", "disable_auto_compaction" = "false" );

insert into temp.temp_sss values('344444'); insert into temp.temp_sss values(''); insert into temp.temp_sss values(null);

CREATE TABLE temp_sss11 ( tracking_number varchar(200) NULL ) ENGINE=OLAP UNIQUE KEY(tracking_number) COMMENT 'OLAP' DISTRIBUTED BY HASH(tracking_number) BUCKETS 1 PROPERTIES ( "replication_allocation" = "tag.location.olap: 1, tag.location.default: 3", "in_memory" = "false", "storage_format" = "V2", "function_column.sequence_type"="largeint", "disable_auto_compaction" = "false" );

insert into temp.temp_sss11 values('344444'); insert into temp.temp_sss11 values('aaaabbbs'); insert into temp.temp_sss11 values(null);

SELECT * FROM temp.temp_sss11 WHERE tracking_number NOT IN (SELECT tracking_number FROM temp.temp_sss);

image

What You Expected?

The result should contains A table's data not exists in B table

How to Reproduce?

No response

Anything Else?

No response

Are you willing to submit PR?

Code of Conduct

ixzc commented 1 year ago

If you remove the null, the result is what you expect. Your result is empty because the result data has null.