apache / doris

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

[Bug] The ORTHOGONAL_BITMAP_EXPR_CALCULATE_COUNT function result is incorrect #36799

Open Jianing-Xu opened 3 months ago

Jianing-Xu commented 3 months ago

Search before asking

Version

doris-2.0.5-rc02

What's Wrong?

The function orthogonal_bitmap_expr_calculate_count calculates the intersection and union of bitmap data incorrectly, and the return value is not fixed

image image image image

What You Expected?

The function returns the correct result

How to Reproduce?

CREATE TABLE bitmap_test ( id int(11) NOT NULL, tag int(11) not null , bitmap bitmap BITMAP_UNION NOT NULL, ) ENGINE = OLAP AGGREGATE KEY(id, tag) COMMENT 'OLAP' DISTRIBUTED BY HASH(id) BUCKETS AUTO PROPERTIES ( "replication_allocation" = "tag.location.default: 3" );

insert into bitmap_test values (1, 1000, bitmap_from_array([1,3,5,7,9])); insert into bitmap_test values (2, 1000, bitmap_from_array([2,4,6,8,10])); insert into bitmap_test values (3, 1000, bitmap_from_array([3, 7]));

select id, tag, bitmap_to_array(bitmap) from bitmap_test order by id;

You need to execute the function orthogonal_bitmap_expr_calculate_count several more times to reproduce it

select orthogonal_bitmap_expr_calculate_count(bitmap, tag, '1000|1000') from bitmap_test; select orthogonal_bitmap_expr_calculate_count(bitmap, tag, '1000&1000') from bitmap_test;

Anything Else?

No response

Are you willing to submit PR?

Code of Conduct

ixzc commented 3 months ago

this issues have fixed in version 2.0.11, you can upgrade your doris to version 2.0.11

image
Jianing-Xu commented 3 months ago

[1,3,5,7,9],[2,4,6,8,10],[3, 7] If you're using my sample data, the expected intersection result should be 0 and the expected union result is 10. The screenshot still do not seem correct.