Skip to content

Commit

Permalink
account for null values in the stddev post aggregator (#15660)
Browse files Browse the repository at this point in the history
  • Loading branch information
LakshSingla authored Jan 16, 2024
1 parent 6b951b9 commit 8ba06cf
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ public Comparator<Double> getComparator()
@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);
}

Expand Down

0 comments on commit 8ba06cf

Please sign in to comment.