Built SUM final result in each branch directly.

Keeps the empty-bucket coercion visible at the boundary instead of a
shared binding, following the reviewer's suggested shape.
This commit is contained in:
Mohammad Dashti 2026-06-15 10:48:37 -07:00 committed by PSeitz
commit 799f7b4646

View file

@ -387,12 +387,12 @@ impl IntermediateMetricResult {
.and_then(|sum| sum.none_if_no_match)
.unwrap_or(false);
let value = intermediate_sum.finalize();
let coerced = if none_if_no_match {
value
if none_if_no_match {
MetricResult::Sum(value.into())
} else {
Some(value.unwrap_or(0.0))
};
MetricResult::Sum(coerced.into())
let value = Some(value.unwrap_or(0.0));
MetricResult::Sum(value.into())
}
}
IntermediateMetricResult::Percentiles(percentiles) => MetricResult::Percentiles(
percentiles