mirror of https://github.com/apache/druid.git
account for null values in the stddev post aggregator (#15660)
This commit is contained in:
parent
6b951b94c0
commit
8ba06cf723
|
@ -79,7 +79,11 @@ public class StandardDeviationPostAggregator implements PostAggregator
|
|||
@Nullable
|
||||
public Double compute(Map<String, Object> combinedAggregators)
|
||||
{
|
||||
Double variance = ((VarianceAggregatorCollector) combinedAggregators.get(fieldName)).getVariance(isVariancePop);
|
||||
Object varianceAggregatorCollector = combinedAggregators.get(fieldName);
|
||||
if (!(varianceAggregatorCollector instanceof VarianceAggregatorCollector)) {
|
||||
return NullHandling.defaultDoubleValue();
|
||||
}
|
||||
Double variance = ((VarianceAggregatorCollector) varianceAggregatorCollector).getVariance(isVariancePop);
|
||||
return variance == null ? NullHandling.defaultDoubleValue() : (Double) Math.sqrt(variance);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue