DerivativeReducer now copies histogram options from old histogram instance

This commit is contained in:
Colin Goodheart-Smithe 2015-02-17 10:08:25 +00:00
parent 269d4bc30e
commit 19cdfe256e
1 changed files with 1 additions and 3 deletions

View File

@ -97,7 +97,6 @@ public class DerivativeReducer extends Reducer {
List newBuckets = new ArrayList<>(); List newBuckets = new ArrayList<>();
Double lastBucketValue = null; Double lastBucketValue = null;
// NOCOMMIT this needs to be improved so that the aggs are cloned correctly to ensure aggs are fully immutable.
for (InternalHistogram.Bucket bucket : buckets) { for (InternalHistogram.Bucket bucket : buckets) {
Double thisBucketValue = resolveBucketValue(histo, bucket); Double thisBucketValue = resolveBucketValue(histo, bucket);
if (lastBucketValue != null) { if (lastBucketValue != null) {
@ -116,8 +115,7 @@ public class DerivativeReducer extends Reducer {
} }
lastBucketValue = thisBucketValue; lastBucketValue = thisBucketValue;
} }
return factory.create(histo.getName(), newBuckets, histo.getOrder(), 1, null, null, false, new ArrayList<Reducer>(), return factory.create(histo.getName(), newBuckets, histo);
histo.getMetaData()); // NOCOMMIT get order, minDocCount, emptyBucketInfo etc. from histo
} }
private Double resolveBucketValue(InternalHistogram<? extends InternalHistogram.Bucket> histo, InternalHistogram.Bucket bucket) { private Double resolveBucketValue(InternalHistogram<? extends InternalHistogram.Bucket> histo, InternalHistogram.Bucket bucket) {