Class ArrayQuantileExprMacro
- java.lang.Object
-
- org.apache.druid.query.expression.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. ReturnsDouble.NaN
if the requested quantile is below 0 or above 1. ReturnsDouble.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.
-
-
Constructor Summary
Constructors Constructor Description ArrayQuantileExprMacro()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Expr
apply(List<Expr> args)
String
name()
Name of the function-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.druid.math.expr.NamedFunction
processingFailed, validationFailed, validationFailed, validationHelperCheckAnyOfArgumentCount, validationHelperCheckArgIsLiteral, validationHelperCheckArgumentCount, validationHelperCheckArgumentCount, validationHelperCheckArgumentRange, validationHelperCheckLambaArgumentCount, validationHelperCheckMinArgumentCount, validationHelperCheckMinArgumentCount
-
-
-
-
Field Detail
-
FN_NAME
public static final String FN_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
name
public String name()
Description copied from interface:NamedFunction
Name of the function- Specified by:
name
in interfaceNamedFunction
-
apply
public Expr apply(List<Expr> args)
- Specified by:
apply
in interfaceExprMacroTable.ExprMacro
-
-