mirror of https://github.com/apache/druid.git
optimise pruning of aggs
optimise pruning of aggregators for topN
This commit is contained in:
parent
00806ba836
commit
6023d602e6
|
@ -156,6 +156,7 @@ public class TopNQueryQueryToolChest extends QueryToolChest<Result<TopNResultVal
|
||||||
return new Function<Result<TopNResultValue>, Result<TopNResultValue>>()
|
return new Function<Result<TopNResultValue>, Result<TopNResultValue>>()
|
||||||
{
|
{
|
||||||
private String dimension = query.getDimensionSpec().getOutputName();
|
private String dimension = query.getDimensionSpec().getOutputName();
|
||||||
|
final List<PostAggregator> prunedAggs = prunePostAggregators(query);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<TopNResultValue> apply(Result<TopNResultValue> result)
|
public Result<TopNResultValue> apply(Result<TopNResultValue> result)
|
||||||
|
@ -172,7 +173,7 @@ public class TopNQueryQueryToolChest extends QueryToolChest<Result<TopNResultVal
|
||||||
for (AggregatorFactory agg : query.getAggregatorSpecs()) {
|
for (AggregatorFactory agg : query.getAggregatorSpecs()) {
|
||||||
values.put(agg.getName(), fn.manipulate(agg, input.getMetric(agg.getName())));
|
values.put(agg.getName(), fn.manipulate(agg, input.getMetric(agg.getName())));
|
||||||
}
|
}
|
||||||
for (PostAggregator postAgg : prunePostAggregators(query)) {
|
for (PostAggregator postAgg : prunedAggs) {
|
||||||
Object calculatedPostAgg = input.getMetric(postAgg.getName());
|
Object calculatedPostAgg = input.getMetric(postAgg.getName());
|
||||||
if (calculatedPostAgg != null) {
|
if (calculatedPostAgg != null) {
|
||||||
values.put(postAgg.getName(), calculatedPostAgg);
|
values.put(postAgg.getName(), calculatedPostAgg);
|
||||||
|
|
Loading…
Reference in New Issue