| Modifier and Type | Field and Description |
|---|---|
| private final Expression[] | |
| private boolean | |
| private boolean | |
| private final WindowFunctionType |
| Access | Constructor and Description |
|---|---|
| public | WindowFunction(WindowFunctionType
the type type, Select the select statement select, Expression[] arguments, or null args)Creates new instance of a window function. |
| Modifier and Type | Method and Description |
|---|---|
| protected Object | createAggregateData()
Implements abstract org. Create aggregate data object specific to the subclass. |
| protected Value | getAggregatedValue(SessionLocal
the session session, Object the aggregate data aggregateData)Implements abstract org. Returns aggregated value. |
| public int | getCost()
Implements abstract org. Estimate the cost to process the expression. |
| private void | |
| public WindowFunctionType | |
| private void | getLeadLag(HashMap<Integer, Value> result, ArrayList<Value[]> ordered, int rowIdColumn, SessionLocal session)
|
| public static int | Returns: maximal number of argumentsthe type of a window function type)Returns maximal number of arguments for the specified type. |
| public static int | Returns: minimal number of argumentsthe type of a window function type)Returns minimal number of arguments for the specified type. |
| private void | |
| private static Value | |
| private static void | |
| protected int | getNumExpressions()
Implements abstract org. Returns the number of expressions, excluding OVER clause. |
| protected void | getOrderedResultLoop(SessionLocal
the session session, HashMap<Integer, Value> the map to append result to result, ArrayList<Value[]> ordered data ordered, int the index of row id value rowIdColumn)Implements abstract org. Returns result of this window function or window aggregate. |
| private void | |
| private static void | |
| public TypeInfo | getType()
Implements abstract org. Implements org. Returns the data type. |
| public StringBuilder | getUnenclosedSQL(StringBuilder
string builder builder, int formatting flags sqlFlags)Implements abstract org. Get the SQL statement of this expression. |
| public boolean | isAggregate()
Implements abstract org. Checks whether this expression is an aggregate function. |
| public void | mapColumnsAnalysis(ColumnResolver
the column resolver resolver, int the subquery nesting level level, int one of the Expression MAP_IN_* values innerState)Overrides org. Map the columns of the resolver to expression columns. |
| public Expression | optimize(SessionLocal
the session session)Overrides org. Try to optimize the expression. |
| protected void | rememberExpressions(SessionLocal
the session session, Value[] array to store values of expressions array)Implements abstract org. Stores current values of expressions into the specified array. |
| public void | setEvaluatable(TableFilter
the table filter tableFilter, boolean true if the table filter can return value b)Overrides org. Tell the expression columns whether the table filter can return values now. |
| public void | setFromLast(boolean
whether FROM LAST clause was specified. fromLast)Sets FROM FIRST or FROM LAST clause value. |
| public void | setIgnoreNulls(boolean
whether IGNORE NULLS clause was specified ignoreNulls)Sets RESPECT NULLS or IGNORE NULLS clause value. |
| protected void | updateAggregate(SessionLocal
the database session session, SelectGroups data for the aggregate group groupData, int row id of group groupRowId)Implements abstract org. Update a row of an aggregate. |
| protected void | updateGroupAggregates(SessionLocal
the session session, int select stage stage)Overrides org. Invoked when processing group stage of grouped window queries to update arguments of this aggregate. |
| args | back to summary |
|---|---|
| private final Expression[] args | |
| fromLast | back to summary |
|---|---|
| private boolean fromLast | |
| ignoreNulls | back to summary |
|---|---|
| private boolean ignoreNulls | |
| type | back to summary |
|---|---|
| private final WindowFunctionType type | |
| WindowFunction | back to summary |
|---|---|
| public WindowFunction(WindowFunctionType type, Select select, Expression[] args) Creates new instance of a window function.
| |
| createAggregateData | back to summary |
|---|---|
| protected Object createAggregateData() Implements abstract org. Doc from org. Create aggregate data object specific to the subclass. | |
| getAggregatedValue | back to summary |
|---|---|
| protected Value getAggregatedValue(SessionLocal session, Object aggregateData) Implements abstract org. Doc from org. Returns aggregated value.
| |
| getCost | back to summary |
|---|---|
| public int getCost() Implements abstract org. Doc from org. Estimate the cost to process the expression. Used when optimizing the query, to calculate the query plan with the lowest estimated cost.
| |
| getCumeDist | back to summary |
|---|---|
| private void getCumeDist(HashMap<Integer, Value> result, ArrayList<Value[]> orderedData, int rowIdColumn) | |
| getFunctionType | back to summary |
|---|---|
| public WindowFunctionType getFunctionType() Returns the type of this function.
| |
| getLeadLag | back to summary |
|---|---|
| private void getLeadLag(HashMap<Integer, Value> result, ArrayList<Value[]> ordered, int rowIdColumn, SessionLocal session) | |
| getMaxArgumentCount | back to summary |
|---|---|
| public static int getMaxArgumentCount(WindowFunctionType type) Returns maximal number of arguments for the specified type.
| |
| getMinArgumentCount | back to summary |
|---|---|
| public static int getMinArgumentCount(WindowFunctionType type) Returns minimal number of arguments for the specified type.
| |
| getNth | back to summary |
|---|---|
| private void getNth(SessionLocal session, HashMap<Integer, Value> result, ArrayList<Value[]> ordered, int rowIdColumn) | |
| getNthValue | back to summary |
|---|---|
| private static Value getNthValue(Iterator<Value[]> iterator, int number, boolean ignoreNulls) | |
| getNtile | back to summary |
|---|---|
| private static void getNtile(HashMap<Integer, Value> result, ArrayList<Value[]> orderedData, int rowIdColumn) | |
| getNumExpressions | back to summary |
|---|---|
| protected int getNumExpressions() Implements abstract org. Doc from org. Returns the number of expressions, excluding OVER clause.
| |
| getOrderedResultLoop | back to summary |
|---|---|
| protected void getOrderedResultLoop(SessionLocal session, HashMap<Integer, Value> result, ArrayList<Value[]> ordered, int rowIdColumn) Implements abstract org. Doc from org. Returns result of this window function or window aggregate. This method may not be called on window aggregate without window order clause. | |
| getRank | back to summary |
|---|---|
| private void getRank(HashMap<Integer, Value> result, ArrayList<Value[]> ordered, int rowIdColumn) | |
| getRatioToReport | back to summary |
|---|---|
| private static void getRatioToReport(HashMap<Integer, Value> result, ArrayList<Value[]> ordered, int rowIdColumn) | |
| getType | back to summary |
|---|---|
| public TypeInfo getType() Implements abstract org. Implements org. Doc from org. Returns the data type. The data type may be unknown before the optimization phase. | |
| getUnenclosedSQL | back to summary |
|---|---|
| public StringBuilder getUnenclosedSQL(StringBuilder builder, int sqlFlags) Implements abstract org. Doc from org. Get the SQL statement of this expression. This may not always be the original SQL statement, especially after optimization. Enclosing '(' and ')' are never appended.
| |
| isAggregate | back to summary |
|---|---|
| public boolean isAggregate() Implements abstract org. Doc from org. Checks whether this expression is an aggregate function.
| |
| mapColumnsAnalysis | back to summary |
|---|---|
| public void mapColumnsAnalysis(ColumnResolver resolver, int level, int innerState) Overrides org. Doc from org. Map the columns of the resolver to expression columns.
| |
| optimize | back to summary |
|---|---|
| public Expression optimize(SessionLocal session) Overrides org. Doc from org. Try to optimize the expression.
| |
| rememberExpressions | back to summary |
|---|---|
| protected void rememberExpressions(SessionLocal session, Value[] array) Implements abstract org. Doc from org. Stores current values of expressions into the specified array.
| |
| setEvaluatable | back to summary |
|---|---|
| public void setEvaluatable(TableFilter tableFilter, boolean b) Overrides org. Doc from org. Tell the expression columns whether the table filter can return values now. This is used when optimizing the query.
| |
| setFromLast | back to summary |
|---|---|
| public void setFromLast(boolean fromLast) Sets FROM FIRST or FROM LAST clause value.
| |
| setIgnoreNulls | back to summary |
|---|---|
| public void setIgnoreNulls(boolean ignoreNulls) Sets RESPECT NULLS or IGNORE NULLS clause value.
| |
| updateAggregate | back to summary |
|---|---|
| protected void updateAggregate(SessionLocal session, SelectGroups groupData, int groupRowId) Implements abstract org. Doc from org. Update a row of an aggregate.
| |
| updateGroupAggregates | back to summary |
|---|---|
| protected void updateGroupAggregates(SessionLocal session, int stage) Overrides org. Doc from org. Invoked when processing group stage of grouped window queries to update arguments of this aggregate.
| |