public class FromList extends QueryTreeNodeVector implements OptimizableList
Modifier and Type | Field and Description |
---|---|
(package private) boolean |
fixedJoinOrder |
private boolean |
isTransparent |
(package private) java.util.Properties |
properties |
private boolean |
referencesSessionSchema |
(package private) boolean |
useStatistics |
private WindowList |
windows
Window definitions used for resolving window functions not containing
in-line window specifications, but referring window definitions
|
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
Constructor and Description |
---|
FromList() |
Modifier and Type | Method and Description |
---|---|
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(FromList fromListParam)
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) |
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.
|
ResultColumnList |
expandAll(TableName allTableName)
Expand a "*" into the appropriate ResultColumnList.
|
void |
flattenFromTables(ResultColumnList rcl,
PredicateList predicateList,
SubqueryList sql,
GroupByList gbl,
ValueNode havingClause)
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() |
WindowList |
getWindows() |
(package private) boolean |
hashJoinSpecified()
Return whether or not the user specified a hash join for any of the
tables in this list.
|
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.
|
void |
isJoinColumnForRightOuterJoin(ResultColumn rc)
Go through the list of the tables and see if the passed ResultColumn
is a join column for a right outer join with USING/NATURAL clause.
|
boolean |
legalJoinOrder(int numTablesInQuery)
Tell whether the join order is legal.
|
boolean |
LOJ_reorderable(int numTables) |
(package private) void |
markAsTransparent()
Indicate that this FromList is "transparent", which means that
its FromTables should be bound to tables from an outer query.
|
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.
|
(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 ?
|
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.
|
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.
|
void |
setWindows(WindowList windows)
Set windows field to the supplied value.
|
(package private) boolean |
tableNumberIsNotExists(int tableNumber)
determine whether this table is NOT EXISTS.
|
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
|
acceptChildren, addElement, destructiveAppend, elementAt, indexOf, insertElementAt, nondestructiveAppend, printSubNodes, remove, removeAllElements, removeElement, removeElementAt, setElementAt, size
accept, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, foundString, generate, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getCursorInfo, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getParameterTypes, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, init, init, init, isAtomic, isInstanceOf, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, orReliability, parseStatement, printLabel, resolveTableToSynonym, setBeginOffset, setContextManager, setEndOffset, setNodeType, setRefActionInfo, stackPrint, toString, treePrint, treePrint, verifyClassExist
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
size
java.util.Properties properties
boolean fixedJoinOrder
boolean useStatistics
private boolean referencesSessionSchema
private boolean isTransparent
private WindowList windows
public void init(java.lang.Object optimizeJoinOrder)
init
in interface Node
init
in class QueryTreeNode
public void init(java.lang.Object optimizeJoinOrder, java.lang.Object fromTable) throws StandardException
init
in interface Node
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 listStandardException
- 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 tableStandardException
- 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 isJoinColumnForRightOuterJoin(ResultColumn rc)
public void bindTables(DataDictionary dataDictionary, FromList fromListParam) throws StandardException
StandardException
public void bindExpressions(FromList fromListParam) throws StandardException
StandardException
- Thrown on errorpublic void bindResultColumns(FromList fromListParam) throws StandardException
fromListParam
- FromList to use/append to.StandardException
- Thrown on errorpublic ResultColumnList expandAll(TableName 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 bindStandardException
- 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 anyStandardException
- Thrown on errorpublic void flattenFromTables(ResultColumnList rcl, PredicateList predicateList, SubqueryList sql, GroupByList gbl, ValueNode havingClause) 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 anyhavingClause
- The HAVING clause, if anyStandardException
- Thrown on errorvoid pushPredicates(PredicateList predicateList) throws StandardException
predicateList
- The query's PredicateListStandardException
- Thrown on errorpublic void setLevel(int level)
level
- The query block level for this table.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 EXISTSStandardException
- Thrown on errorboolean tableNumberIsNotExists(int tableNumber) throws StandardException
tableNumber
- which table to checkStandardException
public int updateTargetLockMode()
boolean hashJoinSpecified()
void markAsTransparent()
public void setWindows(WindowList windows)
windows
- list of window definitions associated with a SELECT.public WindowList getWindows()
Apache Derby V10.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.