Class ArrayQuantileExprMacro
java.lang.Object
org.apache.druid.query.expression.ArrayQuantileExprMacro
- All Implemented Interfaces:
ExprMacroTable.ExprMacro,NamedFunction
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.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.druid.math.expr.NamedFunction
processingFailed, processingFailed, validationFailed, validationFailed, validationHelperCheckAnyOfArgumentCount, validationHelperCheckArgIsLiteral, validationHelperCheckArgumentCount, validationHelperCheckArgumentCount, validationHelperCheckArgumentRange, validationHelperCheckLambaArgumentCount, validationHelperCheckMinArgumentCount, validationHelperCheckMinArgumentCount
-
Field Details
-
FN_NAME
- See Also:
-
-
Constructor Details
-
ArrayQuantileExprMacro
public ArrayQuantileExprMacro()
-
-
Method Details
-
name
Description copied from interface:NamedFunctionName of the function- Specified by:
namein interfaceNamedFunction
-
apply
- Specified by:
applyin interfaceExprMacroTable.ExprMacro
-