Files
greptimedb/tests/compatibility/cases/stddev_pop_state/verify.result
Lei, HUANG c6b10bfbb9 feat(function): add mergeable stddev_pop state functions (#8972)
* feat(function): add Welford stddev functions

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* test(function): cover merged Welford time windows

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* refactor(function): use stddev_pop SQL names

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* fix(function): make Welford arithmetic partition-stable

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* fix(function): reject invalid singleton Welford states

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* test(function): pin Welford state compatibility

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* refactor(function): remove unreachable variance clamp

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* fix(function): reject DISTINCT Welford aggregates

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

* test(compat): bound Welford downgrade targets

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>

---------

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>
2026-08-31 14:15:33 +00:00

22 lines
508 B
Plaintext

-- Direct calculation from each state persisted by the old binary.
SELECT grp, stddev_pop_calc(state) AS stddev
FROM stddev_states
ORDER BY grp;
+-----+--------+
| grp | stddev |
+-----+--------+
| 0 | 0.5 |
| 1 | 0.5 |
+-----+--------+
-- Merge all persisted states with the new binary before calculating.
SELECT stddev_pop_calc(stddev_pop_merge(state)) AS stddev
FROM stddev_states;
+-------------------+
| stddev |
+-------------------+
| 1.118033988749895 |
+-------------------+