presto-main/src/main/java/io/prestosql/operator/aggregation/CentralMomentsAggregation.java/CentralMomentsAggregation/kurtosis
class CentralMomentsAggregation:    @AggregationFunction("kurtosis")
    @Description("Returns the (excess) kurtosis of the argument")
    @OutputFunction(StandardTypes.DOUBLE)
    public static void kurtosis(@AggregationState CentralMomentsState state, BlockBuilder out)
    {
        double n = state.getCount();

        if (n < 4) {
            out.appendNull();
        }
        else {
            double m2 = state.getM2();
            double m4 = state.getM4();
            double result = ((n - 1) * n * (n + 1)) / ((n - 2) * (n - 3)) * m4 / (m2 * m2) - 3 * ((n - 1) * (n - 1)) / ((n - 2) * (n - 3));
            DOUBLE.writeDouble(out, result);
        }
    }