Skip to content

Use funciton (count and HLL_UNION_AGG) in one column cause doris return wrong value #794

@qdore

Description

@qdore

Describe the bug

The following sql cause doris return wrong value:

SELECT DATE(event_day) AS __timestamp,
       if (true, HLL_UNION_AGG(uv),count(distinc(cuid)))
    FROM visd_novel_searchbox_operate_hll
    WHERE event_day >= STR_TO_DATE('2019-03-15 00:00:00', '%Y-%m-%d %H:%i:%s') AND 
          event_day <= STR_TO_DATE('2019-03-22 00:00:00', '%Y-%m-%d %H:%i:%s') AND 
          ((bdcloud_module_app_name = 'tcbox'     and bdcloud_cateid = 1      and evtType = 'show'     and evtName = 'novel-detail'))
 GROUP BY DATE(event_day)
 LIMIT 100;

To Reproduce
Steps to reproduce the behavior:

  1. Use COUNT and HLL_UNION_AGG in a column with function like IF or COALESCE. For example:
IF (true, HLL_UNION_AGG(uv),count(distinct cuid))
IF(HLL_UNION_AGG(uv)!=count(distinct cuid), HLL_UNION_AGG(uv),count(distinct cuid))
COALESCE(IF(count(distinct cuid)>1, count(distinct cuid), null), HLL_UNION_AGG(uv))

  1. The function always return 1.

Expected behavior
return correct value

Screenshots
MacHi 2019-03-22 17-47-57

Metadata

Metadata

Labels

kind/fixCategorizes issue or PR as related to a bug.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions