public abstract class AbstractAggregate extends DataAnalysisOperation
| Modifier and Type | Field and Description |
|---|---|
protected Expression[] |
args
The arguments.
|
protected boolean |
distinct
is this a DISTINCT aggregate
|
protected Expression |
filterCondition
FILTER condition for aggregate
|
protected TypeInfo |
type
The type of the result.
|
over, overOrderBySort, select, STAGE_GROUP, STAGE_RESET, STAGE_WINDOWMAP_IN_AGGREGATE, MAP_IN_WINDOW, MAP_INITIAL| Modifier and Type | Method and Description |
|---|---|
protected java.lang.StringBuilder |
appendTailConditions(java.lang.StringBuilder builder,
boolean alwaysQuote)
Used to create SQL for the OVER and FILTER clauses.
|
protected void |
getOrderedResultLoop(Session session,
java.util.HashMap<java.lang.Integer,Value> result,
java.util.ArrayList<Value[]> ordered,
int rowIdColumn)
Returns result of this window function or window aggregate.
|
TypeInfo |
getType()
Returns the data type.
|
boolean |
isAggregate()
Checks whether this expression is an aggregate function.
|
void |
mapColumnsAnalysis(ColumnResolver resolver,
int level,
int innerState)
Map the columns of the resolver to expression columns.
|
Expression |
optimize(Session session)
Try to optimize the expression.
|
void |
setEvaluatable(TableFilter tableFilter,
boolean b)
Tell the expression columns whether the table filter can return values
now.
|
void |
setFilterCondition(Expression filterCondition)
Sets the FILTER condition.
|
protected abstract void |
updateAggregate(Session session,
java.lang.Object aggregateData)
Updates an aggregate value.
|
protected void |
updateAggregate(Session session,
SelectGroups groupData,
int groupRowId)
Update a row of an aggregate.
|
protected abstract void |
updateFromExpressions(Session session,
java.lang.Object aggregateData,
Value[] array)
Updates the provided aggregate data from the remembered expressions.
|
protected void |
updateGroupAggregates(Session session,
int stage)
Invoked when processing group stage of grouped window queries to update
arguments of this aggregate.
|
createAggregateData, createOrder, getAggregatedValue, getGroupData, getNumExpressions, getOverOrderBySort, getValue, getWindowData, isEverything, mapColumns, rememberExpressions, setOverCondition, updateAggregate, updateOrderedAggregateaddFilterConditions, createIndexConditions, getAlias, getBooleanValue, getColumnName, getCost, getExpressionColumns, getExpressionColumns, getExpressionColumns, getNonAliasExpression, getNotIfPossible, getNullable, getSchemaName, getSQL, getSQL, getSubexpression, getSubexpressionCount, getTableAlias, getTableName, getUnenclosedSQL, isAutoIncrement, isConstant, isGeneratedKey, isValueSet, toString, writeExpressions, writeExpressionsprotected final boolean distinct
protected final Expression[] args
protected Expression filterCondition
protected TypeInfo type
public final boolean isAggregate()
DataAnalysisOperationisAggregate in class DataAnalysisOperationpublic void setFilterCondition(Expression filterCondition)
filterCondition - FILTER conditionpublic TypeInfo getType()
ExpressiongetType in class Expressionpublic void mapColumnsAnalysis(ColumnResolver resolver, int level, int innerState)
DataAnalysisOperationmapColumnsAnalysis in class DataAnalysisOperationresolver - the column resolverlevel - the subquery nesting levelinnerState - one of the Expression MAP_IN_* valuespublic Expression optimize(Session session)
Expressionoptimize in class DataAnalysisOperationsession - the sessionpublic void setEvaluatable(TableFilter tableFilter, boolean b)
ExpressionsetEvaluatable in class DataAnalysisOperationtableFilter - the table filterb - true if the table filter can return valueprotected void getOrderedResultLoop(Session session, java.util.HashMap<java.lang.Integer,Value> result, java.util.ArrayList<Value[]> ordered, int rowIdColumn)
DataAnalysisOperationgetOrderedResultLoop in class DataAnalysisOperationsession - the sessionresult - the map to append result toordered - ordered datarowIdColumn - the index of row id valueprotected abstract void updateFromExpressions(Session session, java.lang.Object aggregateData, Value[] array)
session - the sessionaggregateData - aggregate dataarray - values of expressionsprotected void updateAggregate(Session session, SelectGroups groupData, int groupRowId)
DataAnalysisOperationupdateAggregate in class DataAnalysisOperationsession - the database sessiongroupData - data for the aggregate groupgroupRowId - row id of groupprotected abstract void updateAggregate(Session session, java.lang.Object aggregateData)
session - the sessionaggregateData - aggregate dataprotected void updateGroupAggregates(Session session, int stage)
DataAnalysisOperationupdateGroupAggregates in class DataAnalysisOperationsession - the sessionstage - select stageprotected java.lang.StringBuilder appendTailConditions(java.lang.StringBuilder builder,
boolean alwaysQuote)
DataAnalysisOperationappendTailConditions in class DataAnalysisOperationbuilder - string builderalwaysQuote - quote all identifiers