|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.sql.compile.QueryTreeNode
org.apache.derby.impl.sql.compile.QueryTreeNodeVector
org.apache.derby.impl.sql.compile.FromList
A FromList represents the list of tables in a FROM clause in a DML statement. It extends QueryTreeNodeVector.
Field Summary | |
(package private) boolean |
fixedJoinOrder
|
(package private) java.util.Properties |
properties
|
(package private) boolean |
useStatistics
|
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode |
AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, beginOffset, endOffset |
Constructor Summary | |
FromList()
|
Method Summary | |
Visitable |
accept(Visitor v)
Accept a visitor, and call v.visit() on child nodes as necessary. |
void |
addElement(QueryTreeNode qt)
|
void |
addFromTable(FromTable fromTable)
Add a table to the FROM list. |
ResultColumn |
bindColumnReference(ColumnReference columnReference)
Bind a column reference to one of the tables in this FromList. |
void |
bindExpressions()
Bind the expressions in this FromList. |
void |
bindResultColumns(FromList fromListParam)
Bind the result columns of the ResultSetNodes in this FromList when there is no base table to bind them to. |
void |
bindTables(DataDictionary dataDictionary,
FromList fromListParam)
Bind the tables in this FromList. |
void |
bindUntypedNullsToResultColumns(ResultColumnList bindingRCL)
Bind any untyped null nodes to the types in the given ResultColumnList. |
(package private) void |
decrementLevel(int decrement)
Decrement (query block) level (0-based) for all of the tables in this from list. |
void |
destructiveAppend(QueryTreeNodeVector qtnv)
|
QueryTreeNode |
elementAt(int index)
|
ResultColumnList |
expandAll(java.lang.String allTableName)
Expand a "*" into the appropriate ResultColumnList. |
void |
flattenFromTables(ResultColumnList rcl,
PredicateList predicateList,
SubqueryList sql,
GroupByList gbl)
Flatten all the FromTables that are flattenable. |
(package private) void |
genExistsBaseTables(JBitSet referencedTableMap,
FromList outerFromList,
boolean isNotExists)
Mark all of the FromBaseTables in the list as EXISTS FBTs. |
protected FromTable |
getFromTableByName(java.lang.String name,
java.lang.String schemaName,
boolean exactMatch)
Determine whether or not the specified name is an exposed name in the current query block. |
FromTable |
getFromTableByResultColumn(ResultColumn rc)
Get the FromTable from this list which has the specified ResultColumn in its RCL. |
Optimizable |
getOptimizable(int index)
Return the nth Optimizable in the list. |
(package private) int[] |
getTableNumbers()
|
(package private) boolean |
hashJoinSpecified()
Return whether or not the user specified a hash join for any of the tables in this list. |
boolean |
hasOuterJoins()
Returns true if any Outer joins present. |
(package private) int |
indexOf(QueryTreeNode qt)
|
void |
init(java.lang.Object optimizeJoinOrder)
Initializer for a FromList |
void |
init(java.lang.Object optimizeJoinOrder,
java.lang.Object fromTable)
Initializer for a FromList |
void |
initAccessPaths(Optimizer optimizer)
Init the access paths for these optimizables. |
(package private) void |
insertElementAt(QueryTreeNode qt,
int index)
|
boolean |
legalJoinOrder(int numTablesInQuery)
Tell whether the join order is legal. |
boolean |
LOJ_reorderable(int numTables)
|
(package private) void |
markStatementResultSet()
Move the mark for result set being the statement's outermost result set down into the first table of the from list. |
void |
nondestructiveAppend(QueryTreeNodeVector qtnv)
|
boolean |
optimizeJoinOrder()
Tell whether the join order should be optimized. |
void |
preprocess(int numTables,
GroupByList gbl,
ValueNode predicateTree)
Preprocess the query tree - this currently means: o Generating a referenced table map for each ResultSetNode. |
void |
printSubNodes(int depth)
Prints the sub-nodes of this object. |
(package private) void |
pushPredicates(PredicateList predicateList)
Categorize and push the predicates that are pushable. |
boolean |
referencesSessionSchema()
Return true if the node references SESSION schema tables (temporary or permanent) |
boolean |
referencesTarget(java.lang.String name,
boolean baseTable)
Search to see if a query references the specifed table name. |
void |
rejectParameters()
Check for (and reject) all ? |
(package private) java.lang.Object |
remove(int index)
|
(package private) void |
removeAllElements()
|
(package private) void |
removeElement(QueryTreeNode qt)
|
(package private) void |
removeElementAt(int index)
|
void |
reOrder(int[] joinOrder)
Set the join order for this list of optimizables. |
(package private) boolean |
returnsAtMostSingleRow(ResultColumnList rcl,
ValueNode whereClause,
PredicateList wherePredicates,
DataDictionary dd)
This method is used for both subquery flattening and distinct elimination based on a uniqueness condition. |
(package private) void |
setElementAt(QueryTreeNode qt,
int index)
|
void |
setLevel(int level)
Set the (query block) level (0-based) for the FromTables in this FromList. |
void |
setOptimizable(int index,
Optimizable optimizable)
Set the nth Optimizable to the specified Optimizable. |
void |
setProperties(java.util.Properties props)
Set the Properties list for this FromList. |
int |
size()
Return the number of Optimizables in the list. |
java.lang.String |
toString()
Format this list as a string We can simply iterate through the list. |
int |
updateTargetLockMode()
Get the lock mode for the target of an update statement (a delete or update). |
boolean |
useStatistics()
user can specify that s/he doesn't want statistics to be considered when optimizing the query. |
void |
verifyProperties(DataDictionary dDictionary)
Verify that the Properties list with optimizer overrides, if specified, is valid |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.derby.iapi.sql.compile.OptimizableList |
size |
Field Detail |
java.util.Properties properties
boolean fixedJoinOrder
boolean useStatistics
Constructor Detail |
public FromList()
Method Detail |
public void init(java.lang.Object optimizeJoinOrder)
init
in class QueryTreeNode
public void init(java.lang.Object optimizeJoinOrder, java.lang.Object fromTable) throws StandardException
init
in class QueryTreeNode
StandardException
- Thrown on errorpublic Optimizable getOptimizable(int index)
OptimizableList
getOptimizable
in interface OptimizableList
index
- "index" (0 based) into the list.
OptimizableList.getOptimizable(int)
public void setOptimizable(int index, Optimizable optimizable)
OptimizableList
setOptimizable
in interface OptimizableList
index
- "index" (0 based) into the list.optimizable
- New nth Optimizable.
OptimizableList.setOptimizable(int, org.apache.derby.iapi.sql.compile.Optimizable)
public void verifyProperties(DataDictionary dDictionary) throws StandardException
OptimizableList
verifyProperties
in interface OptimizableList
dDictionary
- The DataDictionary to use.
StandardException
- Thrown on errorOptimizableList.verifyProperties(org.apache.derby.iapi.sql.dictionary.DataDictionary)
public void addFromTable(FromTable fromTable) throws StandardException
fromTable
- A FromTable to add to the list
StandardException
- Thrown on errorpublic boolean referencesTarget(java.lang.String name, boolean baseTable) throws StandardException
name
- Table name (String) to search for.baseTable
- Whether or not name is for a base table
StandardException
- Thrown on errorpublic boolean referencesSessionSchema() throws StandardException
referencesSessionSchema
in class QueryTreeNode
StandardException
- Thrown on errorprotected FromTable getFromTableByName(java.lang.String name, java.lang.String schemaName, boolean exactMatch) throws StandardException
name
- The specified name to search for as an exposed name.schemaName
- Schema name, if non-null.exactMatch
- Whether or not we need an exact match on specified schema and table
names or match on table id.
StandardException
- Thrown on errorpublic void bindTables(DataDictionary dataDictionary, FromList fromListParam) throws StandardException
dataDictionary
- The DataDictionary to use for bindingfromListParam
- FromList to use/append to.
StandardException
- Thrown on errorpublic void bindExpressions() throws StandardException
StandardException
- Thrown on errorpublic void bindResultColumns(FromList fromListParam) throws StandardException
fromListParam
- FromList to use/append to.
StandardException
- Thrown on errorpublic boolean hasOuterJoins() throws StandardException
StandardException
public ResultColumnList expandAll(java.lang.String allTableName) throws StandardException
allTableName
- The qualification on the "*" as a String.
StandardException
- Thrown on errorpublic ResultColumn bindColumnReference(ColumnReference columnReference) throws StandardException
columnReference
- The ColumnReference describing the column to bind
StandardException
- Thrown on errorpublic void rejectParameters() throws StandardException
StandardException
- Thrown if a ? parameter found
directly under a ResultColumnpublic boolean LOJ_reorderable(int numTables) throws StandardException
StandardException
public void preprocess(int numTables, GroupByList gbl, ValueNode predicateTree) throws StandardException
numTables
- The number of tables in the DML Statementgbl
- The group by list, if any
StandardException
- Thrown on errorpublic void flattenFromTables(ResultColumnList rcl, PredicateList predicateList, SubqueryList sql, GroupByList gbl) throws StandardException
rcl
- The RCL from the outer querypredicateList
- The PredicateList from the outer querysql
- The SubqueryList from the outer querygbl
- The group by list, if any
StandardException
- Thrown on errorvoid pushPredicates(PredicateList predicateList) throws StandardException
predicateList
- The query's PredicateList
StandardException
- Thrown on errorpublic void printSubNodes(int depth)
printSubNodes
in class QueryTreeNode
depth
- The depth of this node in the tree
public void setLevel(int level)
level
- The query block level for this table.
void markStatementResultSet()
public FromTable getFromTableByResultColumn(ResultColumn rc)
rc
- The ResultColumn match on.
public void setProperties(java.util.Properties props) throws StandardException
StandardException
- Thrown on errorpublic void reOrder(int[] joinOrder)
OptimizableList
reOrder
in interface OptimizableList
OptimizableList.reOrder(int[])
public boolean useStatistics()
OptimizableList
useStatistics
in interface OptimizableList
OptimizableList.useStatistics()
public boolean optimizeJoinOrder()
OptimizableList
optimizeJoinOrder
in interface OptimizableList
OptimizableList.optimizeJoinOrder()
public boolean legalJoinOrder(int numTablesInQuery)
OptimizableList
legalJoinOrder
in interface OptimizableList
OptimizableList.legalJoinOrder(int)
public void initAccessPaths(Optimizer optimizer)
OptimizableList
initAccessPaths
in interface OptimizableList
optimizer
- The optimizer being used.
OptimizableList.initAccessPaths(org.apache.derby.iapi.sql.compile.Optimizer)
public void bindUntypedNullsToResultColumns(ResultColumnList bindingRCL) throws StandardException
bindingRCL
- The ResultColumnList with the types to bind to.
StandardException
- Thrown on errorvoid decrementLevel(int decrement)
decrement
- The amount to decrement by.
boolean returnsAtMostSingleRow(ResultColumnList rcl, ValueNode whereClause, PredicateList wherePredicates, DataDictionary dd) throws StandardException
rcl
- If non-null, the RCL from the query block.
If non-null for subqueries, then entry can
be considered as part of an = comparison.whereClause
- The WHERE clause to consider.wherePredicates
- The predicates that have already been
pulled from the WHERE clause.dd
- The DataDictionary to use.
StandardException
- Thrown on errorint[] getTableNumbers()
void genExistsBaseTables(JBitSet referencedTableMap, FromList outerFromList, boolean isNotExists) throws StandardException
referencedTableMap
- The referenced table map.outerFromList
- FromList from outer query blockisNotExists
- Whether or not for NOT EXISTS
StandardException
- Thrown on errorpublic int updateTargetLockMode()
boolean hashJoinSpecified()
public Visitable accept(Visitor v) throws StandardException
accept
in interface Visitable
accept
in class QueryTreeNodeVector
v
- the visitor
StandardException
- on errorpublic final int size()
public QueryTreeNode elementAt(int index)
public final void addElement(QueryTreeNode qt)
final void removeElementAt(int index)
final void removeElement(QueryTreeNode qt)
final java.lang.Object remove(int index)
final int indexOf(QueryTreeNode qt)
final void setElementAt(QueryTreeNode qt, int index)
public void destructiveAppend(QueryTreeNodeVector qtnv)
public void nondestructiveAppend(QueryTreeNodeVector qtnv)
final void removeAllElements()
final void insertElementAt(QueryTreeNode qt, int index)
public java.lang.String toString()
toString
in class QueryTreeNode
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |