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_WINDOWAUTO_PARENTHESES, MAP_IN_AGGREGATE, MAP_IN_WINDOW, MAP_INITIAL, WITH_PARENTHESES, WITHOUT_PARENTHESESADD_PLAN_INFORMATION, DEFAULT_SQL_FLAGS, NO_CASTS, QUOTE_ONLY_WHEN_REQUIRED, REPLACE_LOBS_FOR_TRACE, TRACE_SQL_FLAGS| Modifier and Type | Method and Description |
|---|---|
protected java.lang.StringBuilder |
appendTailConditions(java.lang.StringBuilder builder,
int sqlFlags,
boolean forceOrderBy)
Used to create SQL for the OVER and FILTER clauses.
|
Expression |
getFilterCondition()
Returns the FILTER condition.
|
protected void |
getOrderedResultLoop(SessionLocal 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.
|
Expression |
getSubexpression(int index)
Returns subexpression with specified index.
|
int |
getSubexpressionCount()
Returns count of subexpressions.
|
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(SessionLocal 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(SessionLocal session,
java.lang.Object aggregateData)
Updates an aggregate value.
|
protected void |
updateAggregate(SessionLocal session,
SelectGroups groupData,
int groupRowId)
Update a row of an aggregate.
|
protected abstract void |
updateFromExpressions(SessionLocal session,
java.lang.Object aggregateData,
Value[] array)
Updates the provided aggregate data from the remembered expressions.
|
protected void |
updateGroupAggregates(SessionLocal session,
int stage)
Invoked when processing group stage of grouped window queries to update
arguments of this aggregate.
|
createAggregateData, createOrder, getAggregatedValue, getGroupData, getNumExpressions, getOverCondition, getOverOrderBySort, getValue, getWindowData, isEverything, mapColumns, rememberExpressions, setOverCondition, updateAggregate, updateOrderedAggregateaddFilterConditions, createIndexConditions, getAlias, getBooleanValue, getColumnName, getColumnNameForView, getCost, getEnclosedSQL, getNonAliasExpression, getNotIfPossible, getNullable, getSchemaName, getSQL, getSQL, getSQL, getSQL, getTableAlias, getTableName, getUnenclosedSQL, getWhenSQL, getWhenValue, isConstant, isIdentity, isNullConstant, isValueSet, isWhenConditionOperand, needParentheses, optimizeCondition, toString, writeExpressions, writeExpressionsclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetTraceSQLprotected final boolean distinct
protected final Expression[] args
protected Expression filterCondition
protected TypeInfo type
public final boolean isAggregate()
DataAnalysisOperationisAggregate in class DataAnalysisOperationpublic Expression getFilterCondition()
public void setFilterCondition(Expression filterCondition)
filterCondition - FILTER conditionpublic TypeInfo getType()
ExpressiongetType in interface TypedgetType 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(SessionLocal 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(SessionLocal 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(SessionLocal session, java.lang.Object aggregateData, Value[] array)
session - the sessionaggregateData - aggregate dataarray - values of expressionsprotected void updateAggregate(SessionLocal session, SelectGroups groupData, int groupRowId)
DataAnalysisOperationupdateAggregate in class DataAnalysisOperationsession - the database sessiongroupData - data for the aggregate groupgroupRowId - row id of groupprotected abstract void updateAggregate(SessionLocal session, java.lang.Object aggregateData)
session - the sessionaggregateData - aggregate dataprotected void updateGroupAggregates(SessionLocal session, int stage)
DataAnalysisOperationupdateGroupAggregates in class DataAnalysisOperationsession - the sessionstage - select stageprotected java.lang.StringBuilder appendTailConditions(java.lang.StringBuilder builder,
int sqlFlags,
boolean forceOrderBy)
DataAnalysisOperationappendTailConditions in class DataAnalysisOperationbuilder - string buildersqlFlags - formatting flagsforceOrderBy - whether synthetic ORDER BY clause should be generated when it
is missingpublic int getSubexpressionCount()
ExpressiongetSubexpressionCount in class Expressionpublic Expression getSubexpression(int index)
ExpressiongetSubexpression in class Expressionindex - 0-based index