add test + small fix for other test

This commit is contained in:
nishantmonu51 2014-04-22 23:03:48 +05:30
parent 65c71a40bb
commit 4721ba3f1e
2 changed files with 24 additions and 11 deletions

View File

@ -210,7 +210,7 @@ public class TopNQueryQueryToolChest extends QueryToolChest<Result<TopNResultVal
final Map<String, Object> values = Maps.newHashMap();
// put non finalized aggregators for calculating dependent post Aggregators
for (AggregatorFactory agg : query.getAggregatorSpecs()) {
values.put(agg.getName(), fn.manipulate(agg, input.getMetric(agg.getName())));
values.put(agg.getName(), input.getMetric(agg.getName()));
}
for (PostAggregator postAgg : query.getPostAggregatorSpecs()) {

View File

@ -294,17 +294,20 @@ public class TopNBinaryFnTest
ImmutableMap.<String, Object>of(
"rows", 1L,
"index", 2L,
"testdim", "1"
"testdim", "1",
"addrowsindexconstant", 3.0
),
ImmutableMap.<String, Object>of(
"rows", 2L,
"index", 4L,
"testdim", "2"
"testdim", "2",
"addrowsindexconstant", 7.0
),
ImmutableMap.<String, Object>of(
"rows", 0L,
"index", 2L,
"testdim", "3"
"testdim", "3",
"addrowsindexconstant", 3.0
)
)
)
@ -316,17 +319,20 @@ public class TopNBinaryFnTest
ImmutableMap.<String, Object>of(
"rows", 2L,
"index", 3L,
"testdim", "1"
"testdim", "1",
"addrowsindexconstant", 6.0
),
ImmutableMap.<String, Object>of(
"rows", 2L,
"index", 0L,
"testdim", "2"
"testdim", "2",
"addrowsindexconstant", 3.0
),
ImmutableMap.<String, Object>of(
"rows", 0L,
"index", 1L,
"testdim", "3"
"rows", 4L,
"index", 5L,
"testdim", "other",
"addrowsindexconstant", 10.0
)
)
)
@ -336,6 +342,12 @@ public class TopNBinaryFnTest
currTime,
new TopNResultValue(
ImmutableList.<Map<String, Object>>of(
ImmutableMap.<String, Object>of(
"testdim", "other",
"rows", 4L,
"index", 5L,
"addrowsindexconstant", 10.0
),
ImmutableMap.<String, Object>of(
"testdim", "1",
"rows", 3L,
@ -357,7 +369,7 @@ public class TopNBinaryFnTest
QueryGranularity.ALL,
new DefaultDimensionSpec("testdim", null),
new NumericTopNMetricSpec("addrowsindexconstant"),
2,
3,
aggregatorFactories,
postAggregators
).apply(
@ -428,7 +440,8 @@ public class TopNBinaryFnTest
ImmutableMap.<String, Object>of(
"testdim", "2",
"rows", 4L,
"index", 4L )
"index", 4L
)
)
)
);