apache / doris

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

[Bug] "count" sql has an error result #16534

Open mmx1960 opened 1 year ago

mmx1960 commented 1 year ago

Search before asking

Version

1.1.3 and 1.2.1

What's Wrong?

when i wrapper "count" sql on an normal select sql ,the "count" number is not correct. the repeatable operation sql is below

create database tt; CREATE TABLE tt.test1 ( enum_type varchar(256) comment 'rr', enum_key varchar(256) comment 'rr', enum_value STRING comment 'rr', enum_status STRING comment 'rr' )UNIQUE KEY(enum_type,enum_key) comment 'test' DISTRIBUTED BY HASH(enum_type) BUCKETS 10 PROPERTIES("replication_num" = "1");

select count(1) from(

select 'sada' ,count(1) FROM tt.test1

)t

What You Expected?

the correct result is 1 and the real result is 0

How to Reproduce?

No response

Anything Else?

No response

Are you willing to submit PR?

Code of Conduct

nextdreamblue commented 1 year ago

pr:#16556,just fix some bug about count(),if select like this:

select  max(user_id) from(  select max(user_id), 100 as user_id FROM A  )t;

will get wrong resout.