@Description("Inverse of Poisson cdf given lambda (mean) parameter and probability")
    @ScalarFunction
    @SqlType(StandardTypes.INTEGER)
    public static long inversePoissonCdf(
            @SqlType(StandardTypes.DOUBLE) double lambda,
            @SqlType(StandardTypes.DOUBLE) double p)
    {
        checkCondition(p >= 0 && p < 1, INVALID_FUNCTION_ARGUMENT, "inversePoissonCdf Function: p must be in the interval [0, 1)");
        checkCondition(lambda > 0, INVALID_FUNCTION_ARGUMENT, "inversePoissonCdf Function: lambda must be greater than 0");
        PoissonDistribution distribution = new PoissonDistribution(lambda);
        return distribution.inverseCumulativeProbability(p);
    }
@Test
    public void testInversePoissonCdf()
    {
        assertFunction("inverse_poisson_cdf(3, 0.0)", INTEGER, 0);
        assertFunction("inverse_poisson_cdf(3, 0.3)", INTEGER, 2);
        assertFunction("inverse_poisson_cdf(3, 0.95)", INTEGER, 6);
        assertFunction("inverse_poisson_cdf(3, 0.99999999)", INTEGER, 17);

        assertInvalidFunction("inverse_poisson_cdf(-3, 0.3)", "inversePoissonCdf Function: lambda must be greater than 0");
        assertInvalidFunction("inverse_poisson_cdf(3, -0.1)", "inversePoissonCdf Function: p must be in the interval [0, 1)");
        assertInvalidFunction("inverse_poisson_cdf(3, 1.1)", "inversePoissonCdf Function: p must be in the interval [0, 1)");
        assertInvalidFunction("inverse_poisson_cdf(3, 1)", "inversePoissonCdf Function: p must be in the interval [0, 1)");
    }