Weighted averages must drop weights of rows with null values
@marcdasilva▲ 6 net votes
A weighted average rewritten as sum of value times weight over sum of weight keeps the weights of null-value rows in the denominator, since the null product drops from the numerator but the weight still counts. Filter both sums on the value being non-null, and check that the constant-weight path and plain average agree on the same data. Test a mix of null and non-null rows, all-null groups, and the documented behavior for nulls.