Select

This class represents a simple SELECT statement. For each select statement, visibleColumnCount <= distinctColumnCount <= expressionCount. The expression list count could include ORDER BY and GROUP BY expressions that are not in the select list. The call sequence is init(), mapColumns() if it's a subquery, prepare().

Methods
void addCondition(Expression cond)
Add a condition to the list of conditions.
void addCondition(Expression cond)
Add a condition to the list of conditions.
Parameters:
cond - the condition to add
void addGlobalCondition(Parameter param, int columnId, int comparisonType)
void addGlobalCondition(Parameter param, int columnId, int comparisonType)
void addTableFilter(TableFilter filter, boolean isTop)
Add a table to the query.
void addTableFilter(TableFilter filter, boolean isTop)
Add a table to the query.
Parameters:
filter - the table to add
isTop - if the table can be the first table in the query plan
boolean allowGlobalConditions()
boolean allowGlobalConditions()
Value[] createGroupSortedRow(Value[] keyValues, int columnCount)
Create a row with the current values, for queries with group-sort.
Value[] createGroupSortedRow(Value[] keyValues, int columnCount)
Create a row with the current values, for queries with group-sort.
Parameters:
keyValues - the key values
columnCount - the number of columns
Returns:
the row
void fireBeforeSelectTriggers()
void fireBeforeSelectTriggers()
int getColumnCount()
int getColumnCount()
Expression getCondition()
Expression getCondition()
double getCost()
double getCost()
HashMap getCurrentGroup()
HashMap getCurrentGroup()
int getCurrentGroupRowId()
int getCurrentGroupRowId()
ArrayList getExpressions()
ArrayList getExpressions()
ArrayList getGroupBy()
ArrayList getGroupBy()
Expression getHaving()
Expression getHaving()
JoinBatch getJoinBatch()
JoinBatch getJoinBatch()
String getPlanSQL()
String getPlanSQL()
SortOrder getSortOrder()
SortOrder getSortOrder()
HashSet getTables()
HashSet getTables()
ArrayList getTopFilters()
ArrayList getTopFilters()
TableFilter getTopTableFilter()
TableFilter getTopTableFilter()
int getType()
int getType()
boolean hasOrder()
boolean hasOrder()
void init()
void init()
boolean isCacheable()
boolean isCacheable()
boolean isConditionMet()
boolean isConditionMet()
boolean isEverything(ExpressionVisitor visitor)
boolean isEverything(ExpressionVisitor visitor)
boolean isQuickAggregateQuery()
Check if this is an aggregate query with direct lookup, for example a query of the type SELECT COUNT(*) FROM TEST or SELECT MAX(ID) FROM TEST.
boolean isQuickAggregateQuery()
Check if this is an aggregate query with direct lookup, for example a query of the type SELECT COUNT(*) FROM TEST or SELECT MAX(ID) FROM TEST.
Returns:
true if a direct lookup is possible
boolean isReadOnly()
boolean isReadOnly()
boolean isUnion()
boolean isUnion()
void mapColumns(ColumnResolver resolver, int level)
void mapColumns(ColumnResolver resolver, int level)
void prepare()
void prepare()
void prepareJoinBatch()
void prepareJoinBatch()
ResultInterface queryMeta()
ResultInterface queryMeta()
ResultInterface queryWithoutCache(int maxRows, ResultTarget target)
ResultInterface queryWithoutCache(int maxRows, ResultTarget target)
void resetJoinBatchAfterQuery()
Reset the batch-join after the query result is closed.
void resetJoinBatchAfterQuery()
Reset the batch-join after the query result is closed.
void setEvaluatable(TableFilter tableFilter, boolean b)
void setEvaluatable(TableFilter tableFilter, boolean b)
void setExpressions(ArrayList expressions)
void setExpressions(ArrayList expressions)
void setForUpdate(boolean b)
void setForUpdate(boolean b)
void setGroupBy(ArrayList group)
void setGroupBy(ArrayList group)
void setGroupQuery()
Called if this query contains aggregate functions.
void setGroupQuery()
Called if this query contains aggregate functions.
void setHaving(Expression having)
void setHaving(Expression having)
void setOrder(ArrayList order)
void setOrder(ArrayList order)
void updateAggregate(Session s)
void updateAggregate(Session s)

Fields
static HashMap currentGroup
static int currentGroupRowId
static ArrayList expressions
static boolean[] groupByExpression
static int[] groupIndex
static TableFilter topTableFilter
static int visibleColumnCount

currentGroup

The current group-by values.

currentGroupRowId

The id of the current group.

expressions

The column list, including synthetic columns (columns not shown in the result).

groupByExpression

Whether a column in the expression list is part of a group-by.

groupIndex

The indexes of the group-by columns.

topTableFilter

The main (top) table filter.

visibleColumnCount

The visible columns (the ones required in the result).