Hi all ,good morning

I’ve opened PR #19531 to fix a table-model bug in sliding variance and
standard deviation. For the readings 10, NULL, NULL, NULL, 20, 24, a
four-row window returns NaN for the last two VAR_POP results. The expected
results are 0 for the window containing only 20 and 4 for the window
containing 20 and 24.

The window removes 10 before adding 20. At that point the non-null count
briefly reaches zero, and the accumulator divides by zero. The fix resets
the accumulator when its last value leaves so the next reading starts a
fresh calculation.

I added a regression test covering VAR_POP, VAR_SAMP, STDDEV_POP, and
STDDEV_SAMP, and verified the results before and after the fix on IoTDB
Edge 2.0.13-SNAPSHOT.

I’d appreciate a review. PR #19531
<https://github.com/apache/iotdb/pull/19531> · Issue #19530
<https://github.com/apache/iotdb/issues/19530>

Thanks,
DaZuiZui

Reply via email to