A table filter represents a table that is used in a query. There is one such
object whenever a table (or view) is used in a query. For example the
following query has 2 table filters: SELECT * FROM TEST T1, TEST T2.
| Methods |
|
TableFilter(Session session, Table table, String alias, boolean rightsChecked, Select select, int orderInFrom, IndexHints indexHints)
Create a new table filter object.
|
|
TableFilter(Session session, Table table, String alias, boolean rightsChecked, Select select, int orderInFrom, IndexHints indexHints)
Create a new table filter object.
Parameters:
session - the session
table - the table from where to read data
alias - the alias name
rightsChecked - true if rights are already checked
select - the select statement
orderInFrom - original order number (index) of this table filter in
indexHints - the index hints to be used by the query planner
|
| void |
addFilterCondition(Expression condition, boolean isJoin)
Add a filter condition.
|
| void |
addFilterCondition(Expression condition, boolean isJoin)
Add a filter condition.
Parameters:
condition - the condition
isJoin - if this is in fact a join condition
|
| void |
addIndexCondition(IndexCondition condition)
Add an index condition.
|
| void |
addIndexCondition(IndexCondition condition)
Add an index condition.
Parameters:
condition - the index condition
|
| void |
addJoin(TableFilter filter, boolean outer, Expression on)
Add a joined table.
|
| void |
addJoin(TableFilter filter, boolean outer, Expression on)
Add a joined table.
Parameters:
filter - the joined table filter
outer - if this is an outer join
on - the join condition
|
| void |
addNaturalJoinColumn(Column c)
Add a column to the natural join key column list.
|
| void |
addNaturalJoinColumn(Column c)
Add a column to the natural join key column list.
Parameters:
c - the column to add
|
| Row |
get()
Get the current row.
|
| Row |
get()
Get the current row.
Returns:
the current row, or null
|
| PlanItem |
getBestPlanItem(Session s, TableFilter[] filters, int filter, HashSet allColumnsSet)
Get the best plan item (index, cost) to use use for the current join
order.
|
| PlanItem |
getBestPlanItem(Session s, TableFilter[] filters, int filter, HashSet allColumnsSet)
Get the best plan item (index, cost) to use use for the current join
order.
Parameters:
s - the session
filters - all joined table filters
filter - the current table filter index
allColumnsSet - the set of all columns
Returns:
the best plan item
|
| Column[] |
getColumns()
|
| Column[] |
getColumns()
|
| String |
getDerivedColumnName(Column column)
|
| String |
getDerivedColumnName(Column column)
|
| Expression |
getFilterCondition()
|
| Expression |
getFilterCondition()
|
| Index |
getIndex()
|
| Index |
getIndex()
|
| ArrayList |
getIndexConditions()
|
| ArrayList |
getIndexConditions()
|
| IndexCursor |
getIndexCursor()
|
| IndexCursor |
getIndexCursor()
|
| IndexHints |
getIndexHints()
|
| IndexHints |
getIndexHints()
|
| TableFilter |
getJoin()
|
| TableFilter |
getJoin()
|
| JoinBatch |
getJoinBatch()
|
| JoinBatch |
getJoinBatch()
|
| Expression |
getJoinCondition()
|
| Expression |
getJoinCondition()
|
| int |
getJoinFilterId()
|
| int |
getJoinFilterId()
|
| int[] |
getMasks()
|
| int[] |
getMasks()
|
| TableFilter |
getNestedJoin()
|
| TableFilter |
getNestedJoin()
|
| int |
getOrderInFrom()
Get the order number (index) of this table filter in the "from" clause of
the query.
|
| int |
getOrderInFrom()
Get the order number (index) of this table filter in the "from" clause of
the query.
Returns:
the index (0, 1, 2,...)
|
| String |
getPlanSQL(boolean isJoin)
Get the query execution plan text to use for this table filter.
|
| String |
getPlanSQL(boolean isJoin)
Get the query execution plan text to use for this table filter.
Parameters:
isJoin - if this is a joined table
Returns:
the SQL statement snippet
|
| Column |
getRowIdColumn()
|
| Column |
getRowIdColumn()
|
| String |
getSchemaName()
|
| String |
getSchemaName()
|
| Select |
getSelect()
|
| Select |
getSelect()
|
| Session |
getSession()
|
| Session |
getSession()
|
| Column[] |
getSystemColumns()
Get the system columns that this table understands.
|
| Column[] |
getSystemColumns()
Get the system columns that this table understands. This is used for
compatibility with other databases. The columns are only returned if the
current mode supports system columns.
Returns:
the system columns
|
| Table |
getTable()
|
| Table |
getTable()
|
| String |
getTableAlias()
Get the table alias name.
|
| String |
getTableAlias()
Get the table alias name. If no alias is specified, the table name is
returned.
Returns:
the alias name
|
| TableFilter |
getTableFilter()
|
| TableFilter |
getTableFilter()
|
| Value |
getValue(Column column)
|
| Value |
getValue(Column column)
|
| boolean |
hasInComparisons()
Are there any index conditions that involve IN(...).
|
| boolean |
hasInComparisons()
Are there any index conditions that involve IN(...).
Returns:
whether there are IN(...) comparisons
|
| int |
hashCode()
|
| int |
hashCode()
|
| boolean |
isEvaluatable()
|
| boolean |
isEvaluatable()
|
| boolean |
isJoinOuter()
Whether this is an outer joined table.
|
| boolean |
isJoinOuter()
Whether this is an outer joined table.
Returns:
true if it is
|
| boolean |
isJoinOuterIndirect()
Whether this is indirectly an outer joined table (nested within an inner
join).
|
| boolean |
isJoinOuterIndirect()
Whether this is indirectly an outer joined table (nested within an inner
join).
Returns:
true if it is
|
| boolean |
isNaturalJoinColumn(Column c)
Check if the given column is a natural join column.
|
| boolean |
isNaturalJoinColumn(Column c)
Check if the given column is a natural join column.
Parameters:
c - the column to check
Returns:
true if this is a joined natural join column
|
| boolean |
isOk(Expression condition)
Whether the current value of the condition is true, or there is no
condition.
|
| boolean |
isOk(Expression condition)
Whether the current value of the condition is true, or there is no
condition.
Parameters:
condition - the condition (null for no condition)
Returns:
true if yes
|
| boolean |
isUsed()
|
| boolean |
isUsed()
|
| void |
lock(Session s, boolean exclusive, boolean forceLockEvenInMvcc)
Lock the table.
|
| void |
lock(Session s, boolean exclusive, boolean forceLockEvenInMvcc)
Lock the table. This will also lock joined tables.
Parameters:
s - the session
exclusive - true if an exclusive lock is required
forceLockEvenInMvcc - lock even in the MVCC mode
|
| void |
lockRowAdd(ArrayList rows)
Add the current row to the array, if there is a current row.
|
| void |
lockRowAdd(ArrayList rows)
Add the current row to the array, if there is a current row.
Parameters:
rows - the rows to lock
|
| void |
lockRows(ArrayList forUpdateRows)
Lock the given rows.
|
| void |
lockRows(ArrayList forUpdateRows)
Lock the given rows.
Parameters:
forUpdateRows - the rows to lock
|
| void |
mapAndAddFilter(Expression on)
Map the columns and add the join condition.
|
| void |
mapAndAddFilter(Expression on)
Map the columns and add the join condition.
Parameters:
on - the condition
|
| boolean |
next()
Check if there are more rows to read.
|
| boolean |
next()
Check if there are more rows to read.
Returns:
true if there are
|
| Expression |
optimize(ExpressionColumn expressionColumn, Column column)
|
| Expression |
optimize(ExpressionColumn expressionColumn, Column column)
|
| void |
optimizeFullCondition(boolean fromOuterJoin)
Optimize the full condition.
|
| void |
optimizeFullCondition(boolean fromOuterJoin)
Optimize the full condition. This will add the full condition to the
filter condition.
Parameters:
fromOuterJoin - if this method was called from an outer joined table
|
| void |
prepare()
Prepare reading rows.
|
| void |
prepare()
Prepare reading rows. This method will remove all index conditions that
can not be used, and optimize the conditions.
|
| JoinBatch |
prepareJoinBatch(JoinBatch jb, TableFilter[] filters, int filter)
Attempt to initialize batched join.
|
| JoinBatch |
prepareJoinBatch(JoinBatch jb, TableFilter[] filters, int filter)
Attempt to initialize batched join.
Parameters:
jb - join batch if it is already created
filters - the table filters
filter - the filter index (0, 1,...)
Returns:
join batch if query runs over index which supports batched
lookups, {@code null} otherwise
|
| void |
removeFilterCondition()
Remove the filter condition.
|
| void |
removeFilterCondition()
Remove the filter condition.
|
| void |
removeJoin()
Remove the joined table
|
| void |
removeJoin()
Remove the joined table
|
| void |
removeJoinCondition()
Remove the join condition.
|
| void |
removeJoinCondition()
Remove the join condition.
|
| void |
removeUnusableIndexConditions()
Remove all index conditions that are not used by the current index.
|
| void |
removeUnusableIndexConditions()
Remove all index conditions that are not used by the current index.
|
| void |
reset()
Reset to the current position.
|
| void |
reset()
Reset to the current position.
|
| void |
set(Row current)
Set the current row.
|
| void |
set(Row current)
Set the current row.
Parameters:
current - the current row
|
| void |
setAlias(String alias)
|
| void |
setAlias(String alias)
|
| void |
setDerivedColumns(ArrayList derivedColumnNames)
Set derived column list.
|
| void |
setDerivedColumns(ArrayList derivedColumnNames)
Set derived column list.
Parameters:
derivedColumnNames - names of derived columns
|
| 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 |
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.
Parameters:
filter - the table filter
b - the new flag
|
| void |
setEvaluatable(boolean evaluatable)
|
| void |
setEvaluatable(boolean evaluatable)
|
| void |
setFullCondition(Expression condition)
|
| void |
setFullCondition(Expression condition)
|
| void |
setIndex(Index index)
|
| void |
setIndex(Index index)
|
| void |
setNestedJoin(TableFilter filter)
Set a nested joined table.
|
| void |
setNestedJoin(TableFilter filter)
Set a nested joined table.
Parameters:
filter - the joined table filter
|
| void |
setNullRow()
Set the state of this and all nested tables to the NULL row.
|
| 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 |
setPlanItem(PlanItem item)
Set what plan item (index, cost, masks) to use.
Parameters:
item - the plan item
|
| void |
setSession(Session session)
Set the session of this table filter.
|
| void |
setSession(Session session)
Set the session of this table filter.
Parameters:
session - the new session
|
| void |
setUsed(boolean used)
|
| void |
setUsed(boolean used)
|
| void |
startQuery(Session s)
Start the query.
|
| void |
startQuery(Session s)
Start the query. This will reset the scan counts.
Parameters:
s - the session
|
| String |
toString()
|
| String |
toString()
|
| void |
visit(TableFilter.TableFilterVisitor visitor)
Visit this and all joined or nested table filters.
|
| void |
visit(TableFilter.TableFilterVisitor visitor)
Visit this and all joined or nested table filters.
Parameters:
visitor - the visitor
|