java.lang.Iterable<ResultSetNode>
, OptimizableList
, Visitable
class FromList extends QueryTreeNodeVector<ResultSetNode> implements OptimizableList
Modifier and Type | Field | 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_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
eltClass
Constructor | Description |
---|---|
FromList(boolean optimizeJoinOrder,
ContextManager cm) |
Constructor for a FromList
|
FromList(boolean optimizeJoinOrder,
FromTable fromTable,
ContextManager cm) |
Constructor for a FromList
|
FromList(ContextManager cm) |
Does not change the default for join order optimization, i.e.
|
Modifier and Type | Method | Description |
---|---|---|
(package private) void |
addFromTable(FromTable fromTable) |
Add a table to the FROM list.
|
(package private) ResultColumn |
bindColumnReference(ColumnReference columnReference) |
Bind a column reference to one of the tables in this FromList.
|
(package private) void |
bindExpressions(FromList fromListParam) |
Bind the expressions in this FromList.
|
(package private) void |
bindResultColumns(FromList fromListParam) |
Bind the result columns of the ResultSetNodes in this FromList when there is no
base table to bind them to.
|
(package private) void |
bindTables(DataDictionary dataDictionary,
FromList fromListParam) |
|
(package private) void |
bindUntypedNullsToResultColumns(ResultColumnList bindingRCL) |
Bind any untyped null nodes to the types in the given ResultColumnList.
|
private void |
constructorMinion(boolean optimizeJoinOrder) |
|
(package private) void |
decrementLevel(int decrement) |
Decrement (query block) level (0-based) for
all of the tables in this from list.
|
(package private) ResultColumnList |
expandAll(TableName allTableName) |
Expand a "*" into the appropriate ResultColumnList.
|
(package private) 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.
|
(package private) 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.
|
(package private) 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) 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 |
initAccessPaths(Optimizer optimizer) |
Init the access paths for these optimizables.
|
(package private) 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.
|
(package private) 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.
|
(package private) 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)
|
(package private) boolean |
referencesTarget(java.lang.String name,
boolean baseTable) |
Search to see if a query references the specifed table name.
|
(package private) 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.
|
(package private) 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.
|
(package private) void |
setProperties(java.util.Properties props) |
Set the Properties list for this FromList.
|
(package private) void |
setWindows(WindowList windows) |
Set windows field to the supplied value.
|
(package private) boolean |
tableNumberIsNotExists(int tableNumber) |
determine whether this table is NOT EXISTS.
|
(package private) 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
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
size
accept, addTag, addUDTUsagePriv, addUDTUsagePriv, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, copyTagsFrom, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, generate, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContext, getContextManager, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getLongProperty, getNullNode, getOffsetOrderedNodes, getOptimizerFactory, getOptimizerTracer, getParameterTypes, getSchemaDescriptor, getSchemaDescriptor, getStatementType, getTableDescriptor, getTypeCompiler, getUDTDesc, isAtomic, isPrivilegeCollectionRequired, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, makeTableName, nodeHeader, optimizerTracingIsOn, orReliability, parseSearchCondition, parseStatement, printLabel, resolveTableToSynonym, setBeginOffset, setEndOffset, setRefActionInfo, stackPrint, taggedWith, toString, treePrint, treePrint, verifyClassExist
acceptChildren, addElement, destructiveAppend, elementAt, indexOf, insertElementAt, iterator, nondestructiveAppend, printSubNodes, removeAllElements, removeElement, removeElementAt, setElementAt, size
java.util.Properties properties
boolean fixedJoinOrder
boolean useStatistics
private boolean referencesSessionSchema
private boolean isTransparent
private WindowList windows
FromList(ContextManager cm)
false
.cm
- context managerFromList(boolean optimizeJoinOrder, ContextManager cm)
optimizeJoinOrder
- true
if join order optimization is to
be performedcm
- context managerFromList(boolean optimizeJoinOrder, FromTable fromTable, ContextManager cm) throws StandardException
optimizeJoinOrder
- true
if join order optimization is to
be performedfromTable
- initialize list with this tablecm
- context managerStandardException
- Thrown on errorprivate void constructorMinion(boolean optimizeJoinOrder)
public 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)
final void addFromTable(FromTable fromTable) throws StandardException
fromTable
- A FromTable to add to the listStandardException
- Thrown on errorboolean 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 errorFromTable 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 errorvoid isJoinColumnForRightOuterJoin(ResultColumn rc)
void bindTables(DataDictionary dataDictionary, FromList fromListParam) throws StandardException
StandardException
void bindExpressions(FromList fromListParam) throws StandardException
StandardException
- Thrown on errorvoid bindResultColumns(FromList fromListParam) throws StandardException
fromListParam
- FromList to use/append to.StandardException
- Thrown on errorResultColumnList expandAll(TableName allTableName) throws StandardException
allTableName
- The qualification on the "*" as a String.StandardException
- Thrown on errorResultColumn bindColumnReference(ColumnReference columnReference) throws StandardException
Bind a column reference to one of the tables in this FromList. The column name must be unique within the tables in the FromList. An exception is thrown if a column name is not unique. This method fills in various fields in the column reference.
NOTE: Callers are responsible for ordering the FromList by nesting level, with tables at the deepest (current) nesting level first. We will try to match against all FromTables at a given nesting level. If no match is found at a nesting level, then we proceed to the next level. We stop walking the list when the nesting level changes and we have found a match.
NOTE: If the ColumnReference is qualified, then we will stop the search at the first nesting level where there is a match on the exposed table name. For example,
s (a, b, c), t (d, e, f) select * from s where exists (select * from t s where s.c = a)
will not find a match for s.c, which is the expected ANSI behavior.
bindTables() must have already been called on this FromList before calling this method.
columnReference
- The ColumnReference describing the column to bindnull
if
there is no matching columnStandardException
- Thrown on errorvoid rejectParameters() throws StandardException
StandardException
- Thrown if a ? parameter found
directly under a ResultColumnboolean LOJ_reorderable(int numTables) throws StandardException
StandardException
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 errorvoid 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 errorvoid setLevel(int level)
level
- The query block level for this table.FromTable getFromTableByResultColumn(ResultColumn rc)
rc
- The ResultColumn match on.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)
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
int updateTargetLockMode()
boolean hashJoinSpecified()
void markAsTransparent()
void setWindows(WindowList windows)
windows
- list of window definitions associated with a SELECT.WindowList getWindows()
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.