Skip to content

Commit

Permalink
add test + small fix for other test
Browse files Browse the repository at this point in the history
  • Loading branch information
nishantmonu51 committed Apr 22, 2014
1 parent 65c71a4 commit 4721ba3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public Map<String, Object> apply(DimensionAndMetricValueExtractor input)
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()) {
Expand Down
33 changes: 23 additions & 10 deletions processing/src/test/java/io/druid/query/topn/TopNBinaryFnTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,20 @@ public void testMergeByPostAgg()
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
)
)
)
Expand All @@ -316,17 +319,20 @@ public void testMergeByPostAgg()
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
)
)
)
Expand All @@ -336,6 +342,12 @@ public void testMergeByPostAgg()
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,
Expand All @@ -357,7 +369,7 @@ public void testMergeByPostAgg()
QueryGranularity.ALL,
new DefaultDimensionSpec("testdim", null),
new NumericTopNMetricSpec("addrowsindexconstant"),
2,
3,
aggregatorFactories,
postAggregators
).apply(
Expand Down Expand Up @@ -428,7 +440,8 @@ public void testMergeShiftedTimestamp()
ImmutableMap.<String, Object>of(
"testdim", "2",
"rows", 4L,
"index", 4L )
"index", 4L
)
)
)
);
Expand Down

0 comments on commit 4721ba3

Please sign in to comment.