The spec says to throw an error when a set function is called on an empty
set (unless explicitly mentioned otherwise like COUNT).
However, aggregate error handling says to not bind the result in case of an
error. So to simplify logic in the caller, we return undefined by default.
Parameters
expr: AggregateExpression
the aggregate expression
throwError: boolean = false
whether this function should respect the spec and throw an error if no empty value is defined
The spec says to throw an error when a set function is called on an empty set (unless explicitly mentioned otherwise like COUNT). However, aggregate error handling says to not bind the result in case of an error. So to simplify logic in the caller, we return undefined by default.