using chunkPeriod yields different results

I ran a topN query spanning several days of data once without the chunkPeriod setting and once with a chunkPeriod set to P1D and I get entirely different results back, both for normal measures and unique counts.

Both the segment-granularity and the query granularity are HOUR.
Am I doing something wrong?

Here’s my query

{
“queryType”:“topN”,
“dataSource”:“test-datasource-auction”,
“intervals”:“2016-05-01/2016-05-10”,
“granularity”:“all”,
“context”:{
“timeout”:90000,
“useCache”:false,
“populateCache”:false
},
“dimension”:{
“type”:“default”,
“dimension”:“adSpaceId”,
“outputName”:“SEGMENT”
},
“aggregations”:[
{
“name”:“count”,
“type”:“doubleSum”,
“fieldName”:“count”
}
],
“metric”:“count”,
“threshold”:50
}

results:
without chunking
{
“count”: 6449711032,
“SEGMENT”: “130019751”
},

with chunking
{
“count”: 715800923,
“SEGMENT”: “130019751”
},

If I use a timeseries query instead with a granularity of DAY, the outcome is even more strange because with chunking, I don’t get results back for each day but some days are missing or I just get one result for the last day of the query period whereas without chunking, I get one result back for each day.

thanks
Sascha

Can you run this query again with the cached disabled?

Set useCache and populateCache to false in the context.

http://druid.io/docs/0.9.0/querying/query-context.html

ChunkPeriod failed to produce correct results in some cases due to a bug that was fixed in https://github.com/druid-io/druid/pull/2601 . Unfortunately, it appears, it did get backported to 0.9.0 release. Please use that patch and that should fix the issue. It will be released in 0.9.1 .

– Himanshu

Awesome! Thank you so much both of you for your support and your quick replies. Much appreciated.