Having don't work with HyperUnique aggregations?

Hi guys,

We got an exception when run groupBy query with HyperUnique aggregation and havingSpecs, stack trace and query content is pasted below. After looking into the GreaterThanHavingSpec.java and MapBasedRow.java, seems HLL-greater-than is not supported?

stacktrace:
com.metamx.common.parsers.ParseException: Unknown type[class io.druid.query.aggregation.hyperloglog.HLLCV1]
at io.druid.data.input.MapBasedRow.getFloatMetric(MapBasedRow.java:112)
at io.druid.query.groupby.having.GreaterThanHavingSpec.eval(GreaterThanHavingSpec.java:67)
at io.druid.query.groupby.having.OrHavingSpec.eval(OrHavingSpec.java:55)
at io.druid.query.groupby.GroupByQuery$1$1.apply(GroupByQuery.java:123)
at io.druid.query.groupby.GroupByQuery$1$1.apply(GroupByQuery.java:119)
at com.metamx.common.guava.FilteringYieldingAccumulator.accumulate(FilteringYieldingAccumulator.java:65)
at com.metamx.common.guava.DelegatingYieldingAccumulator.accumulate(DelegatingYieldingAccumulator.java:53)
at com.metamx.common.guava.LimitedSequence$LimitedYieldingAccumulator.accumulate(LimitedSequence.java:111)
at com.metamx.common.guava.MappingYieldingAccumulator.accumulate(MappingYieldingAccumulator.java:57)
at com.metamx.common.guava.BaseSequence.makeYielder(BaseSequence.java:104)
at com.metamx.common.guava.BaseSequence.toYielder(BaseSequence.java:81)
at com.metamx.common.guava.MappedSequence.toYielder(MappedSequence.java:46)
at com.metamx.common.guava.LimitedSequence.toYielder(LimitedSequence.java:34)
at com.metamx.common.guava.FilteredSequence.toYielder(FilteredSequence.java:52)

query content:
{“queryType”:“groupBy”,“dataSource”:“myDataSource”,“granularity”:{“type”:“period”,“timeZone”:“Asia/Shanghai”,“period”:“PT1H”},“intervals”:[“2015-05-07T00:00:00.000+08:00/2015-05-08T00:00:00.000+08:00”],“dimensions”:[“myDimenssion”],“aggregations”:[{“type”:“hyperUnique”,“fieldName”:“uv”,“name”:“uv”}],“limitSpec”:{“type”:“default”,“limit”:1000},“having”:{“type”:“or”,“havingSpecs”:[{“type”:“greaterThan”,“aggregation”:“uv”,“value”:100}]}}

Can you try to add a “hyperUniqueCardinality” post aggregator on top of “hyperUnique” aggregator and use your having clause on the field from post aggregator instead?

doc for hyperUniqueCardinality -
http://druid.io/docs/latest/Post-aggregations.html#hyperunique-cardinality-post-aggregator

– Himanshu

I followed Ethan’s way(https://groups.google.com/forum/#!searchin/druid-development/hyperUniqueCardinality/druid-development/z6_WddGpIFY/JPPM-rgr6SUJ), it’s a bit bother but it works, thanks for your reply!