Package org.h2.expression.aggregate
Class Percentile
- java.lang.Object
-
- org.h2.expression.aggregate.Percentile
-
final class Percentile extends java.lang.ObjectPERCENTILE_CONT, PERCENTILE_DISC, and MEDIAN inverse distribution functions.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.math.BigDecimalHALFBigDecimal value of 0.5.
-
Constructor Summary
Constructors Modifier Constructor Description privatePercentile()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static IndexgetColumnIndex(Database database, Expression on)Get the index (if any) for the column specified in the inverse distribution function.(package private) static ValuegetFromIndex(SessionLocal session, Expression expression, int dataType, java.util.ArrayList<QueryOrderBy> orderByList, java.math.BigDecimal percentile, boolean interpolate)Get the result from the index.(package private) static ValuegetValue(SessionLocal session, Value[] array, int dataType, java.util.ArrayList<QueryOrderBy> orderByList, java.math.BigDecimal percentile, boolean interpolate)Get the result from the array of values.private static Valueinterpolate(Value v0, Value v1, java.math.BigDecimal factor, int dataType, SessionLocal session, CompareMode compareMode)private static java.math.BigDecimalinterpolateDecimal(java.math.BigDecimal d0, java.math.BigDecimal d1, java.math.BigDecimal factor)private static booleanisNullsLast(DefaultNullOrdering defaultNullOrdering, Index index)private static java.math.BigDecimaltimestampToDecimal(long dateValue, long timeNanos)
-
-
-
Method Detail
-
isNullsLast
private static boolean isNullsLast(DefaultNullOrdering defaultNullOrdering, Index index)
-
getColumnIndex
static Index getColumnIndex(Database database, Expression on)
Get the index (if any) for the column specified in the inverse distribution function.- Parameters:
database- the databaseon- the expression (usually a column expression)- Returns:
- the index, or null
-
getValue
static Value getValue(SessionLocal session, Value[] array, int dataType, java.util.ArrayList<QueryOrderBy> orderByList, java.math.BigDecimal percentile, boolean interpolate)
Get the result from the array of values.- Parameters:
session- the sessionarray- array with valuesdataType- the data typeorderByList- ORDER BY listpercentile- argument of percentile function, or 0.5d for medianinterpolate- whether value should be interpolated- Returns:
- the result
-
getFromIndex
static Value getFromIndex(SessionLocal session, Expression expression, int dataType, java.util.ArrayList<QueryOrderBy> orderByList, java.math.BigDecimal percentile, boolean interpolate)
Get the result from the index.- Parameters:
session- the sessionexpression- the expressiondataType- the data typeorderByList- ORDER BY listpercentile- argument of percentile function, or 0.5d for medianinterpolate- whether value should be interpolated- Returns:
- the result
-
interpolate
private static Value interpolate(Value v0, Value v1, java.math.BigDecimal factor, int dataType, SessionLocal session, CompareMode compareMode)
-
timestampToDecimal
private static java.math.BigDecimal timestampToDecimal(long dateValue, long timeNanos)
-
interpolateDecimal
private static java.math.BigDecimal interpolateDecimal(java.math.BigDecimal d0, java.math.BigDecimal d1, java.math.BigDecimal factor)
-
-