Top Description Fields Constructors Methods
org.h2.expression.aggregate

pack-priv final Class Percentile

extends Object
Class Inheritance
Imports
java.math.BigDecimal, .BigInteger, java.util.ArrayList, .Arrays, org.h2.api.IntervalQualifier, org.h2.command.query.QueryOrderBy, org.h2.engine.Database, .SessionLocal, org.h2.expression.Expression, .ExpressionColumn, org.h2.index.Cursor, .Index, org.h2.mode.DefaultNullOrdering, org.h2.result.SearchRow, .SortOrder, org.h2.table.Column, .Table, .TableFilter, org.h2.util.DateTimeUtils, .IntervalUtils, org.h2.value.CompareMode, .Value, .ValueDate, .ValueInterval, .ValueNull, .ValueNumeric, .ValueTime, .ValueTimeTimeZone, .ValueTimestamp, .ValueTimestampTimeZone

PERCENTILE_CONT, PERCENTILE_DISC, and MEDIAN inverse distribution functions.

Field Summary

Modifier and TypeField and Description
pack-priv static final BigDecimal
HALF

BigDecimal value of 0.5.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static Index

Returns:

the index, or null
getColumnIndex
(Database
the database
database
,
Expression
the expression (usually a column expression)
on
)

Get the index (if any) for the column specified in the inverse distribution function.

pack-priv static Value

Returns:

the result
getFromIndex
(SessionLocal
the session
session
,
Expression
the expression
expression
,
int
the data type
dataType
,
ArrayList<QueryOrderBy>
ORDER BY list
orderByList
,
BigDecimal
argument of percentile function, or 0.5d for median
percentile
,
boolean
whether value should be interpolated
interpolate
)

Get the result from the index.

pack-priv static Value

Returns:

the result
getValue
(SessionLocal
the session
session
,
Value[]
array with values
array
,
int
the data type
dataType
,
ArrayList<QueryOrderBy>
ORDER BY list
orderByList
,
BigDecimal
argument of percentile function, or 0.5d for median
percentile
,
boolean
whether value should be interpolated
interpolate
)

Get the result from the array of values.

private static Value
interpolate(Value v0, Value v1, BigDecimal factor, int dataType, SessionLocal session, CompareMode compareMode)

private static BigDecimal
private static boolean
isNullsLast(DefaultNullOrdering defaultNullOrdering, Index index)

private static BigDecimal
timestampToDecimal(long dateValue, long timeNanos)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

HALFback to summary
pack-priv static final BigDecimal HALF

BigDecimal value of 0.5.

Constructor Detail

Percentileback to summary
private Percentile()

Method Detail

getColumnIndexback to summary
pack-priv static Index getColumnIndex(Database database, Expression on)

Get the index (if any) for the column specified in the inverse distribution function.

Parameters
database:Database

the database

on:Expression

the expression (usually a column expression)

Returns:Index

the index, or null

getFromIndexback to summary
pack-priv static Value getFromIndex(SessionLocal session, Expression expression, int dataType, ArrayList<QueryOrderBy> orderByList, BigDecimal percentile, boolean interpolate)

Get the result from the index.

Parameters
session:SessionLocal

the session

expression:Expression

the expression

dataType:int

the data type

orderByList:ArrayList<QueryOrderBy>

ORDER BY list

percentile:BigDecimal

argument of percentile function, or 0.5d for median

interpolate:boolean

whether value should be interpolated

Returns:Value

the result

getValueback to summary
pack-priv static Value getValue(SessionLocal session, Value[] array, int dataType, ArrayList<QueryOrderBy> orderByList, BigDecimal percentile, boolean interpolate)

Get the result from the array of values.

Parameters
session:SessionLocal

the session

array:Value[]

array with values

dataType:int

the data type

orderByList:ArrayList<QueryOrderBy>

ORDER BY list

percentile:BigDecimal

argument of percentile function, or 0.5d for median

interpolate:boolean

whether value should be interpolated

Returns:Value

the result

interpolateback to summary
private static Value interpolate(Value v0, Value v1, BigDecimal factor, int dataType, SessionLocal session, CompareMode compareMode)
interpolateDecimalback to summary
private static BigDecimal interpolateDecimal(BigDecimal d0, BigDecimal d1, BigDecimal factor)
isNullsLastback to summary
private static boolean isNullsLast(DefaultNullOrdering defaultNullOrdering, Index index)
timestampToDecimalback to summary
private static BigDecimal timestampToDecimal(long dateValue, long timeNanos)