Class ArrayQuantileExprMacro

  • All Implemented Interfaces:
    ExprMacroTable.ExprMacro, NamedFunction

    public class ArrayQuantileExprMacro
    extends Object
    implements ExprMacroTable.ExprMacro
    Computes a particular quantile from a numeric array. Usage: array_quantile(array, rank). The requested quantile is given by "rank", which must be from 0 to 1, inclusive: 0 is the minimum, 1 is the maximum. Null values in the input array are ignored. Returns Double.NaN if the requested quantile is below 0 or above 1. Returns Double.NaN if the input array is numeric, yet contains no nonnull elements. Returns null if the input is not a numeric array at all. If the requested quantile falls between two elements of the input array, the result is a linear interpolation of the two closest values. According to Wikipedia (https://en.wikipedia.org/wiki/Quantile), the interpolation algorithm we're using is the default method in R, NumPy, and Julia, and matches Excel's PERCENTILE.INC function.