public class TableFilter extends java.lang.Object implements ColumnResolver
| Modifier and Type | Class and Description |
|---|---|
static interface |
TableFilter.TableFilterVisitor
A visitor for table filters.
|
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
joinOuterIndirect
Whether this is a direct or indirect (nested) outer join
|
static java.util.Comparator<TableFilter> |
ORDER_IN_FROM_COMPARATOR
Comparator that uses order in FROM clause as a sort key.
|
| Constructor and Description |
|---|
TableFilter(SessionLocal session,
Table table,
java.lang.String alias,
boolean rightsChecked,
Select select,
int orderInFrom,
IndexHints indexHints)
Create a new table filter object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCommonJoinColumns(Column leftColumn,
Column replacementColumn,
TableFilter replacementFilter)
Add a column to the common join column list for a left table filter.
|
void |
addCommonJoinColumnToExclude(Column columnToExclude)
Add an excluded column to the common join column list.
|
void |
addFilterCondition(Expression condition,
boolean isJoin)
Add a filter condition.
|
void |
addIndexCondition(IndexCondition condition)
Add an index condition.
|
void |
addJoin(TableFilter filter,
boolean outer,
Expression on)
Add a joined table.
|
void |
createIndexConditions()
Create the index conditions for this filter if needed.
|
Column |
findColumn(java.lang.String name)
Get the column with the specified name.
|
Row |
get()
Get the current row.
|
PlanItem |
getBestPlanItem(SessionLocal s,
TableFilter[] filters,
int filter,
AllColumnsForPlan allColumnsSet)
Get the best plan item (index, cost) to use for the current join
order.
|
Column |
getColumn(java.lang.String columnName,
boolean ifExists)
Get the column with the given name.
|
java.lang.String |
getColumnName(Column column)
Get the name of the specified column.
|
Column[] |
getColumns()
Get the column list.
|
java.util.LinkedHashMap<Column,Column> |
getCommonJoinColumns()
Returns common join columns map.
|
TableFilter |
getCommonJoinColumnsFilter()
Returns common join columns table filter.
|
Expression |
getFilterCondition() |
Index |
getIndex() |
java.util.ArrayList<IndexCondition> |
getIndexConditions() |
IndexCursor |
getIndexCursor() |
IndexHints |
getIndexHints() |
TableFilter |
getJoin() |
Expression |
getJoinCondition() |
int[] |
getMasks() |
TableFilter |
getNestedJoin() |
int |
getOrderInFrom()
Get the order number (index) of this table filter in the "from" clause of
the query.
|
java.lang.StringBuilder |
getPlanSQL(java.lang.StringBuilder builder,
boolean isJoin,
int sqlFlags)
Get the query execution plan text to use for this table filter and append
it to the specified builder.
|
Column |
getRowIdColumn()
Get the row id pseudo column, if there is one.
|
java.lang.String |
getSchemaName()
Get the schema name or null.
|
Select |
getSelect()
Get the select statement.
|
SessionLocal |
getSession() |
Column[] |
getSystemColumns()
Get the system columns that this table understands.
|
Table |
getTable() |
java.lang.String |
getTableAlias()
Get the table alias name.
|
TableFilter |
getTableFilter()
Get the table filter.
|
Value |
getValue(Column column)
Get the value for the given column.
|
boolean |
hasDerivedColumnList()
Returns whether this column resolver has a derived column list.
|
int |
hashCode() |
boolean |
hasInComparisons()
Are there any index conditions that involve IN(...).
|
boolean |
isCommonJoinColumnToExclude(Column c)
Check if the given column is an excluded common join column.
|
boolean |
isEvaluatable() |
boolean |
isJoinOuter()
Whether this is an outer joined table.
|
boolean |
isJoinOuterIndirect()
Whether this is indirectly an outer joined table (nested within an inner
join).
|
boolean |
isNoFromClauseFilter()
Returns whether this is a table filter with implicit DUAL table for a
SELECT without a FROM clause.
|
boolean |
isNullRow() |
boolean |
isUsed() |
void |
lock(SessionLocal s)
Lock the table.
|
void |
mapAndAddFilter(Expression on)
Map the columns and add the join condition.
|
boolean |
next()
Check if there are more rows to read.
|
void |
prepare()
Prepare reading rows.
|
void |
removeFilterCondition()
Remove the filter condition.
|
void |
removeJoin()
Remove the joined table
|
void |
removeJoinCondition()
Remove the join condition.
|
void |
reset()
Reset to the current position.
|
void |
set(Row current)
Set the current row.
|
void |
setAlias(java.lang.String alias) |
void |
setDerivedColumns(java.util.ArrayList<java.lang.String> derivedColumnNames)
Set derived column list.
|
void |
setEvaluatable(boolean evaluatable) |
void |
setEvaluatable(TableFilter filter,
boolean b)
Update the filter and join conditions of this and all joined tables with
the information that the given table filter and all nested filter can now
return rows or not.
|
void |
setFullCondition(Expression condition) |
void |
setIndex(Index index) |
void |
setNestedJoin(TableFilter filter)
Set a nested joined table.
|
protected void |
setNullRow()
Set the state of this and all nested tables to the NULL row.
|
void |
setPlanItem(PlanItem item)
Set what plan item (index, cost, masks) to use.
|
void |
setUsed(boolean used) |
void |
startQuery(SessionLocal s)
Start the query.
|
java.lang.String |
toString() |
void |
visit(TableFilter.TableFilterVisitor visitor)
Visit this and all joined or nested table filters.
|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitoptimizepublic static final java.util.Comparator<TableFilter> ORDER_IN_FROM_COMPARATOR
protected boolean joinOuterIndirect
public TableFilter(SessionLocal session, Table table, java.lang.String alias, boolean rightsChecked, Select select, int orderInFrom, IndexHints indexHints)
session - the sessiontable - the table from where to read dataalias - the alias namerightsChecked - true if rights are already checkedselect - the select statementorderInFrom - original order number (index) of this table filter inindexHints - the index hints to be used by the query plannerpublic int getOrderInFrom()
public IndexCursor getIndexCursor()
public Select getSelect()
ColumnResolvergetSelect in interface ColumnResolverpublic Table getTable()
public void lock(SessionLocal s)
s - the sessionpublic PlanItem getBestPlanItem(SessionLocal s, TableFilter[] filters, int filter, AllColumnsForPlan allColumnsSet)
s - the sessionfilters - all joined table filtersfilter - the current table filter indexallColumnsSet - the set of all columnspublic void setPlanItem(PlanItem item)
item - the plan itempublic void prepare()
public void startQuery(SessionLocal s)
s - the sessionpublic void reset()
public boolean next()
public boolean isNullRow()
protected void setNullRow()
public Row get()
public void set(Row current)
current - the current rowpublic java.lang.String getTableAlias()
getTableAlias in interface ColumnResolverpublic void addIndexCondition(IndexCondition condition)
condition - the index conditionpublic void addFilterCondition(Expression condition, boolean isJoin)
condition - the conditionisJoin - if this is in fact a join conditionpublic void addJoin(TableFilter filter, boolean outer, Expression on)
filter - the joined table filterouter - if this is an outer joinon - the join conditionpublic void setNestedJoin(TableFilter filter)
filter - the joined table filterpublic void mapAndAddFilter(Expression on)
on - the conditionpublic void createIndexConditions()
public TableFilter getJoin()
public boolean isJoinOuter()
public boolean isJoinOuterIndirect()
public java.lang.StringBuilder getPlanSQL(java.lang.StringBuilder builder,
boolean isJoin,
int sqlFlags)
builder - string builder to append toisJoin - if this is a joined tablesqlFlags - formatting flagspublic int[] getMasks()
public java.util.ArrayList<IndexCondition> getIndexConditions()
public Index getIndex()
public void setIndex(Index index)
public void setUsed(boolean used)
public boolean isUsed()
public void removeJoin()
public Expression getJoinCondition()
public void removeJoinCondition()
public Expression getFilterCondition()
public void removeFilterCondition()
public void setFullCondition(Expression condition)
public void setEvaluatable(TableFilter filter, boolean b)
filter - the table filterb - the new flagpublic void setEvaluatable(boolean evaluatable)
public java.lang.String getSchemaName()
ColumnResolvergetSchemaName in interface ColumnResolverpublic Column[] getColumns()
ColumnResolvergetColumns in interface ColumnResolverpublic Column findColumn(java.lang.String name)
ColumnResolverfindColumn in interface ColumnResolvername - the column name, must be a derived name if this column
resolver has a derived column listnullpublic java.lang.String getColumnName(Column column)
ColumnResolvergetColumnName in interface ColumnResolvercolumn - columnpublic boolean hasDerivedColumnList()
ColumnResolverhasDerivedColumnList in interface ColumnResolvertrue if this column resolver has a derived column list,
false otherwisepublic Column getColumn(java.lang.String columnName, boolean ifExists)
columnName - the column nameifExists - if true return null if column does not existDbException - if the column was not found and ifExists is
falsepublic Column[] getSystemColumns()
getSystemColumns in interface ColumnResolverpublic Column getRowIdColumn()
ColumnResolvergetRowIdColumn in interface ColumnResolverpublic Value getValue(Column column)
ColumnResolvergetValue in interface ColumnResolvercolumn - the columnpublic TableFilter getTableFilter()
ColumnResolvergetTableFilter in interface ColumnResolverpublic void setAlias(java.lang.String alias)
public void setDerivedColumns(java.util.ArrayList<java.lang.String> derivedColumnNames)
derivedColumnNames - names of derived columnspublic java.lang.String toString()
toString in class java.lang.Objectpublic void addCommonJoinColumns(Column leftColumn, Column replacementColumn, TableFilter replacementFilter)
leftColumn - the column on the left sidereplacementColumn - the column to use instead, may be the same as column on the
left sidereplacementFilter - the table filter for replacement columnspublic void addCommonJoinColumnToExclude(Column columnToExclude)
columnToExclude - the column to excludepublic java.util.LinkedHashMap<Column,Column> getCommonJoinColumns()
nullpublic TableFilter getCommonJoinColumnsFilter()
nullpublic boolean isCommonJoinColumnToExclude(Column c)
c - the column to checkpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean hasInComparisons()
public TableFilter getNestedJoin()
public void visit(TableFilter.TableFilterVisitor visitor)
visitor - the visitorpublic boolean isEvaluatable()
public SessionLocal getSession()
public IndexHints getIndexHints()
public boolean isNoFromClauseFilter()