Skip to content

[Bug] unstable results of intersect_count with order by statement #8917

@spaces-X

Description

@spaces-X

Search before asking

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

Version

version: 0.13 and 0.14

I searched the key words intersect_count in our pr list but i did not find a fix pr.
So i am not sure whether it can be reproduced in version 0.15 or current master branch.

What's Wrong?

I got an unstable results of intersect_count with order by statement.
Details are shown in the following(How to Reproduce) sql 1 and sql 2.

For sql 1, the first row is not stable

image

image

For sql 2, the results are more random
For name A the result of its rank, pay_uv and pay_1d_uv are random:
case 1:
image
case 2:
image
case 3:

image

What You Expected?

The results of this kind of sql are in order and stable.

How to Reproduce?

sql 1: simply sql (reproduction with low frequancy):

select '2022-03-21' as partition_date,
       name,
       intersect_count(user_id, partition_date, '2022-03-21') as pay_uv,
from  t
where partition_date in ('2022-03-21','2022-03-22','2022-03-23','2022-03-24')
group by name
order by partition_date,pay_uv desc

sql 2:complicated sql (reproduction with high frequancy):

select '2022-03-21' as partition_date,
       name,
       intersect_count(user_id, partition_date, '2022-03-21') as pay_uv,
       intersect_count(user_id, partition_date, '2022-03-21', '2022-03-22') as repay_1d_uv
from
  (select partition_date,
          name,
          bitmap_union(user_id) as user_id
   from t
   where partition_date in ('2022-03-21','2022-03-22','2022-03-23','2022-03-24')
   group by partition_date,
           name) t
group by name
order by partition_date,
         pay_uv desc

Anything Else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions