fix NPE in aggregatrFirstTopnAlgo

This commit is contained in:
nishantmonu51 2014-04-16 09:12:34 +05:30
parent 6893282a65
commit 6da2272076
5 changed files with 6 additions and 6 deletions

View File

@ -65,7 +65,7 @@ public class AggregateTopNMetricFirstAlgorithm implements TopNAlgorithm<int[], T
}
@Override
public TopNResultBuilder makeResultBuilder(TopNParams params)
public TopNResultBuilder makeResultBuilder(TopNParams params, TopNQuery query)
{
return query.getTopNMetricSpec().getResultBuilder(
params.getCursor().getTime(),
@ -82,7 +82,6 @@ public class AggregateTopNMetricFirstAlgorithm implements TopNAlgorithm<int[], T
TopNParams params, TopNResultBuilder resultBuilder, int[] ints
)
{
final TopNResultBuilder singleMetricResultBuilder = makeResultBuilder(params);
final String metric;
// ugly
TopNMetricSpec spec = query.getTopNMetricSpec();
@ -128,6 +127,7 @@ public class AggregateTopNMetricFirstAlgorithm implements TopNAlgorithm<int[], T
.aggregators(condensedAggs)
.postAggregators(condensedPostAggs)
.build();
final TopNResultBuilder singleMetricResultBuilder = makeResultBuilder(params, singleMetricQuery);
PooledTopNAlgorithm singleMetricAlgo = new PooledTopNAlgorithm(capabilities, singleMetricQuery, bufferPool);
PooledTopNAlgorithm.PooledTopNParams singleMetricParam = null;

View File

@ -57,7 +57,7 @@ public class DimExtractionTopNAlgorithm extends BaseTopNAlgorithm<Aggregator[][]
}
@Override
public TopNResultBuilder makeResultBuilder(TopNParams params)
public TopNResultBuilder makeResultBuilder(TopNParams params, TopNQuery query)
{
return query.getTopNMetricSpec().getResultBuilder(
params.getCursor().getTime(),

View File

@ -115,7 +115,7 @@ public class PooledTopNAlgorithm
}
@Override
public TopNResultBuilder makeResultBuilder(PooledTopNParams params)
public TopNResultBuilder makeResultBuilder(PooledTopNParams params, TopNQuery query)
{
return query.getTopNMetricSpec().getResultBuilder(
params.getCursor().getTime(),

View File

@ -33,7 +33,7 @@ public interface TopNAlgorithm<DimValSelector, Parameters extends TopNParams>
public TopNParams makeInitParams(DimensionSelector dimSelector, Cursor cursor);
public TopNResultBuilder makeResultBuilder(Parameters params);
public TopNResultBuilder makeResultBuilder(Parameters params, TopNQuery query);
public void run(
Parameters params,

View File

@ -52,7 +52,7 @@ public class TopNMapFn implements Function<Cursor, Result<TopNResultValue>>
try {
params = topNAlgorithm.makeInitParams(dimSelector, cursor);
TopNResultBuilder resultBuilder = topNAlgorithm.makeResultBuilder(params);
TopNResultBuilder resultBuilder = topNAlgorithm.makeResultBuilder(params, query);
topNAlgorithm.run(params, resultBuilder, null);