mirror of https://github.com/apache/druid.git
calculate postAggs while pulling from cache
This commit is contained in:
parent
7bafb71841
commit
3fb42251d9
|
@ -249,6 +249,11 @@ public class TopNQueryQueryToolChest extends QueryToolChest<Result<TopNResultVal
|
||||||
return new CacheStrategy<Result<TopNResultValue>, Object, TopNQuery>()
|
return new CacheStrategy<Result<TopNResultValue>, Object, TopNQuery>()
|
||||||
{
|
{
|
||||||
private final List<AggregatorFactory> aggs = query.getAggregatorSpecs();
|
private final List<AggregatorFactory> aggs = query.getAggregatorSpecs();
|
||||||
|
private final List<PostAggregator> postAggs = AggregatorUtil.pruneDependentPostAgg(
|
||||||
|
query.getPostAggregatorSpecs(),
|
||||||
|
query.getTopNMetricSpec()
|
||||||
|
.getMetricName(query.getDimensionSpec())
|
||||||
|
);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] computeCacheKey(TopNQuery query)
|
public byte[] computeCacheKey(TopNQuery query)
|
||||||
|
@ -338,6 +343,10 @@ public class TopNQueryQueryToolChest extends QueryToolChest<Result<TopNResultVal
|
||||||
vals.put(factory.getName(), factory.deserialize(resultIter.next()));
|
vals.put(factory.getName(), factory.deserialize(resultIter.next()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (PostAggregator postAgg : postAggs) {
|
||||||
|
vals.put(postAgg.getName(), postAgg.compute(vals));
|
||||||
|
}
|
||||||
|
|
||||||
retVal.add(vals);
|
retVal.add(vals);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue