I'm playing with Snowflake and when using the KURTOSIS function I'm getting a divide by zero error :-(
Function works perfect if there's more than 1 distinct value (and more than 4 values):
select
kurtosis(bob)
from
(select seq4() bob from table(generator(rowcount => 10)));
But fails when all values are identical .. in this case 1:
select
kurtosis(bob)
from
(select 1 bob from table(generator(rowcount => 10)));
Aside from doing a count distinct or HLL test prior to each evaluation can anyone suggest a solution?
I did see this article talking about Pandas "Rolling skewness and kurtosis fail on a sample of all equal values" but this was almost 10 years old way before Snowflake was even a pipe dream.
And the SKEW function has the identical problem.
My temporary yucky solution is:
select
DECODE(HLL(bob),1,0,SKEW(bob::FLOAT)) yucky_solution
from
(select 1 bob from table(generator(rowcount => 10)));





