TopN query not returning results in a sorted order

Hi,

I am firing the below query on Druid but I am not getting the results in the sorted order as expected. Please let me know if there’s any problem with this query.

{

“queryType”: “topN”,

“dataSource”: “test1”,

“dimension”: “dim1”,

“threshold”: 10,

“metric”: “uniqueUsers”,

“granularity”: “none”,

“aggregations”: [

{

“fieldName”: “uniqueUsers”,

“type”: “hyperUnique”,

“name”: “uniqueUsers”

}

],

“intervals”: [

“2016-05-30/2016-06-01”

]

}

Result :

[ {

“timestamp” : “2016-05-30T00:00:00.000Z”,

“result” : [ {

“uniqueUsers” : 393289.83118044457,

“dim1” : “NULL”

}, {

“uniqueUsers” : 94280.7040673439,

“dim1” : “39577”

}, {

“uniqueUsers” : 87117.32116155689,

“dim1” : “30788”

}, {

“uniqueUsers” : 76271.86826461602,

“dim1” : “39619”

}, {

“uniqueUsers” : 69039.7719226331,

“dim1” : “931605”

}, {

“uniqueUsers” : 88414.05511727017,

“dim1” : “931166”

}, {

“uniqueUsers” : 67329.76441261184,

“dim1” : “918827”

}, {

“uniqueUsers” : 59642.92801810539,

“dim1” : “936262”

}, {

“uniqueUsers” : 54170.02519923738,

“dim1” : “39606”

}, {

“uniqueUsers” : 53922.838623882395,

“dim1” : “30793”

} ]

} ]

Thanks,

Varsha

Hi Varsha, what version of Druid are you using? I believe this is a bug that was already fixed.

Hi Xavier,

I am using druid 0.8.3. Was the bug fixed in 0.9.0?

Thanks,

Varsha

Hi Varsha,

TopN with HyperUnique metric work for me in 0.9.0 and now in 0.9.1 !

I think it was fixed in previous versions.

I’ll investigate on it but you should try druid latest version.

(I mean 0.9.0, seems like 0.9.1 and 0.9.1.1 has some things to fix)

Ben

Fixed in 0.9.0 : https://github.com/druid-io/druid/pull/2453

Thanks for the help.