We need to support ExpressionFromAccumulator for these accumulators in SBE.
Importantly, to stay consistent with SBE and with Classic, we must re-use the same underlying functions that we use for corresponding accumulators.
For example, for $sum we must do something like this
auto [accTag, accVal] = genericInitializeDoubleDoubleSumState();
value::ValueGuard accGuard{accTag, accVal};
auto* accumulator = value::getArrayView(accVal);
value::arrayForEach(arr.tag, arr.value, [&](value::TypeTags elemTag, value::Value elemVal) {
if (value::isNumber(elemTag)) {
aggDoubleDoubleSumImpl(accumulator, elemTag, elemVal);
}
});
return aggDoubleDoubleSumFinalizeImpl(accumulator).releaseToRaw();
- related to
-
SERVER-51583 Support expressions $min, $max, $avg, $sum, $stdDevPop, $stdDevSamp in SBE
-
- Closed
-