I found a bug of druid sql about having. when I add having condition of "count(distinct uid)". It will return []. if I replace it for "having count(uid)", it will return right result.for example:
{
"query": "select (count(distinct("uid")) filter (where binlog_event='i')) as __y,Floor(__time to MINUTE) as __time from "test_dataSource" where __time > TIMESTAMP '2017-10-12 00:00:00' and __time < TIMESTAMP '2017-10-12 23:59:59' group by Floor(__time to MINUTE) having (count("uid") filter (where binlog_event='i')) >0",
"context": {
"sqlTimeZone": "Asia/Shanghai",
"skipEmptyBuckets": "false"
}
}
the reasult is:
[
{
"__y": 1,
"__time": "2017-10-12T01:54:00.000+08:00"
},
{
"__y": 2,
"__time": "2017-10-12T02:23:00.000+08:00"
}
]
but when I used having (count(distinct("uid")) filter (where binlog_event='i')) >0
the result is:
[]
I found a bug of druid sql about having. when I add having condition of "count(distinct uid)". It will return []. if I replace it for "having count(uid)", it will return right result.for example:
{
"query": "select (count(distinct("uid")) filter (where binlog_event='i')) as __y,Floor(__time to MINUTE) as __time from "test_dataSource" where __time > TIMESTAMP '2017-10-12 00:00:00' and __time < TIMESTAMP '2017-10-12 23:59:59' group by Floor(__time to MINUTE) having (count("uid") filter (where binlog_event='i')) >0",
"context": {
"sqlTimeZone": "Asia/Shanghai",
"skipEmptyBuckets": "false"
}
}
the reasult is:
[
{
"__y": 1,
"__time": "2017-10-12T01:54:00.000+08:00"
},
{
"__y": 2,
"__time": "2017-10-12T02:23:00.000+08:00"
}
]
but when I used having (count(distinct("uid")) filter (where binlog_event='i')) >0
the result is:
[]