KURT,KURT_POP,KURTOSIS
Descriptionβ
Returns the kurtosis of the expr expression.
The forumula used for this function is 4-th centrol moment / ((variance)^2) - 3
, when variance is zero, kurtosis
will return NULL
.
Syntaxβ
kurtosis(expr)
Argumentsβ
TinyInt/SmallInt/Integer/BigInt/Float/Double, Decimal will be casted to a float number.
Return valueβ
Double
Exampleβ
create table statistic_test(tag int, val1 double not null, val2 double null) distributed by hash(tag) properties("replication_num"="1")
insert into statistic_test values (1, -10, -10),(2, -20, NULL),(3, 100, NULL),(4, 100, NULL),(5, 1000,1000);
// NULL is ignored
select kurt(val1), kurt(val2) from statistic_test
--------------
+-------------------+--------------------+
| kurt(val1) | kurt(val2) |
+-------------------+--------------------+
| 0.162124583734851 | -1.3330994719286338 |
+-------------------+--------------------+
1 row in set (0.02 sec)
// Each group just has one row, result is NULL
select kurt(val1), kurt(val2) from statistic_test group by tag
--------------
+------------+------------+
| kurt(val1) | kurt(val2) |
+------------+------------+
| NULL | NULL |
| NULL | NULL |
| NULL | NULL |
| NULL | NULL |
| NULL | NULL |
+------------+------------+
5 rows in set (0.02 sec)