From c12427d047b7cf9fd1ac9acc611bc2985ad12c40 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Thu, 2 Jan 2014 17:03:24 +0100 Subject: [PATCH] remove double check for null in value source --- .../aggregations/metrics/min/MinAggregator.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/elasticsearch/search/aggregations/metrics/min/MinAggregator.java b/src/main/java/org/elasticsearch/search/aggregations/metrics/min/MinAggregator.java index b690d1b45eb..80e8ab83f19 100644 --- a/src/main/java/org/elasticsearch/search/aggregations/metrics/min/MinAggregator.java +++ b/src/main/java/org/elasticsearch/search/aggregations/metrics/min/MinAggregator.java @@ -23,12 +23,12 @@ import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.common.util.DoubleArray; import org.elasticsearch.index.fielddata.DoubleValues; import org.elasticsearch.search.aggregations.Aggregator; +import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.support.AggregationContext; +import org.elasticsearch.search.aggregations.support.ValueSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.numeric.NumericValuesSource; -import org.elasticsearch.search.aggregations.AggregatorFactories; -import org.elasticsearch.search.aggregations.support.ValueSourceAggregatorFactory; import java.io.IOException; @@ -45,11 +45,9 @@ public class MinAggregator extends Aggregator { super(name, BucketAggregationMode.MULTI_BUCKETS, AggregatorFactories.EMPTY, estimatedBucketsCount, context, parent); this.valuesSource = valuesSource; if (valuesSource != null) { - if (valuesSource != null) { - final long initialSize = estimatedBucketsCount < 2 ? 1 : estimatedBucketsCount; - mins = BigArrays.newDoubleArray(initialSize); - mins.fill(0, mins.size(), Double.POSITIVE_INFINITY); - } + final long initialSize = estimatedBucketsCount < 2 ? 1 : estimatedBucketsCount; + mins = BigArrays.newDoubleArray(initialSize); + mins.fill(0, mins.size(), Double.POSITIVE_INFINITY); } }