Fix query by segment

* Changed topN queries to use joda Interval instead of string values
* topN by segment now implements `BySegmentResultValue<Result<TopNResultValue>>` instead of `BySegmentResultValue<TopNResultValue>`
* Added a unit test which failed under the prior implementation.
* Fixes #845 
The bug is actually in the broker side. running master broker with this branch's historical returns topN queries just fine. But the topN by segment fails (due to the bug this patch fixes)