Optimizable
, Visitable
CurrentOfNode
, FromBaseTable
, FromSubquery
, FromVTI
, IndexToBaseRowNode
, RowResultSetNode
, SingleChildResultSetNode
, TableOperatorNode
abstract class FromTable extends ResultSetNode implements Optimizable
FromBaseTable
,
FromSubquery
,
ProjectRestrictNode
ResultSetNode.QueryExpressionClauses
Modifier and Type | Field | Description |
---|---|---|
private int |
_mergeTableID |
for resolving column references in MERGE statements in tough cases
|
protected static short |
ADD_PLAN |
|
(package private) AccessPathImpl |
bestAccessPath |
|
protected CostEstimate |
bestCostEstimate |
|
private java.util.HashMap<java.lang.Object,AccessPathImpl> |
bestPlanMap |
Set of object->trulyTheBestAccessPath mappings used to keep track
of which of this Optimizable's "trulyTheBestAccessPath" was the best
with respect to a specific outer query or ancestor node.
|
(package private) AccessPathImpl |
bestSortAvoidancePath |
|
private boolean |
considerSortAvoidancePath |
|
(package private) java.lang.String |
correlationName |
|
(package private) TableName |
corrTableName |
|
(package private) AccessPathImpl |
currentAccessPath |
|
(package private) int[] |
hashKeyColumns |
|
(package private) int |
initialCapacity |
|
private int |
joinStrategyNumber |
|
(package private) int |
level |
|
protected static short |
LOAD_PLAN |
|
(package private) float |
loadFactor |
|
(package private) int |
maxCapacity |
|
protected TableName |
origTableName |
the original unbound table name
|
private double |
perRowUsage |
|
protected static short |
REMOVE_PLAN |
Operations that can be performed on bestPlanMap.
|
(package private) int |
tableNumber |
|
(package private) java.util.Properties |
tableProperties |
|
(package private) AccessPathImpl |
trulyTheBestAccessPath |
|
protected java.lang.String |
userSpecifiedJoinStrategy |
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
Constructor | Description |
---|---|
FromTable(java.lang.String correlationName,
java.util.Properties tableProperties,
ContextManager cm) |
Constructor for a table in a FROM list.
|
Modifier and Type | Method | Description |
---|---|---|
(package private) void |
acceptChildren(Visitor v) |
Accept the visitor for all visitable children of this node.
|
protected void |
assignCostEstimate(CostEstimate newCostEstimate) |
Assign the cost estimate in this node to the given cost estimate.
|
protected boolean |
canBeOrdered() |
Most Optimizables cannot be ordered
|
(package private) boolean |
columnsAreUpdatable() |
Return true if some columns in this table are updatable.
|
boolean |
considerSortAvoidancePath() |
Check whether this optimizable's sort avoidance path should
be considered.
|
int |
convertAbsoluteToRelativeColumnPosition(int absolutePosition) |
Convert an absolute to a relative 0-based column position.
|
protected boolean |
cursorTargetTable() |
Is this a table that has a FOR UPDATE
clause.
|
(package private) void |
decrementLevel(int decrement) |
Decrement (query block) level (0-based) for this FromTable.
|
CostEstimate |
estimateCost(OptimizablePredicateList predList,
ConglomerateDescriptor cd,
CostEstimate outerCost,
Optimizer optimizer,
RowOrdering rowOrdering) |
Estimate the cost of scanning this Optimizable using the given
predicate list with the given conglomerate.
|
boolean |
feasibleJoinStrategy(OptimizablePredicateList predList,
Optimizer optimizer) |
Is the current proposed join strategy for this optimizable feasible
given the predicate list?
|
(package private) void |
fillInReferencedTableMap(JBitSet passedMap) |
Fill the referencedTableMap with this ResultSetNode.
|
(package private) FromList |
flatten(ResultColumnList rcl,
PredicateList outerPList,
SubqueryList sql,
GroupByList gbl,
ValueNode havingClause) |
Flatten this FromTable into the outer query block.
|
boolean |
forUpdate() |
Return true if this is the target table of an update
|
java.lang.String |
getBaseTableName() |
Get the table name of this Optimizable.
|
AccessPath |
getBestAccessPath() |
Get the best access path for this Optimizable.
|
AccessPath |
getBestSortAvoidancePath() |
Get the best sort-avoidance path for this Optimizable.
|
java.lang.String |
getCorrelationName() |
Get this table's correlation name, if any.
|
protected CostEstimate |
getCostEstimate(Optimizer optimizer) |
|
AccessPath |
getCurrentAccessPath() |
Get the current access path under consideration for this Optimizable
|
(package private) java.lang.String |
getExposedName() |
Get the exposed name for this table, which is the name that can
be used to refer to it in the rest of the query.
|
(package private) CostEstimate |
getFinalCostEstimate() |
Get the final CostEstimate for this FromTable.
|
(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) int |
getLevel() |
Get the (query block) level (0-based) for this FromTable.
|
(package private) int |
getMergeTableID() |
get the merge table id
|
java.lang.String |
getName() |
Get the (exposed) name of this Optimizable
|
int |
getNumColumnsReturned() |
Get the number of the number of columns returned by this Optimizable.
|
(package private) TableName |
getOrigTableName() |
Gets the original or unbound table name for this FromTable.
|
private double |
getPerRowUsage() |
|
java.util.Properties |
getProperties() |
Get the Properties list, if any, associated with this optimizable.
|
(package private) ResultColumnList |
getResultColumnsForList(TableName allTableName,
ResultColumnList inputRcl,
TableName tableName) |
Return a ResultColumnList with all of the columns in this table.
|
(package private) SchemaDescriptor |
getSchemaDescriptor() |
Get a schema descriptor for the given table.
|
(package private) SchemaDescriptor |
getSchemaDescriptor(TableName tableName) |
Get a schema descriptor for the given table.
|
protected CostEstimate |
getScratchCostEstimate(Optimizer optimizer) |
|
TableDescriptor |
getTableDescriptor() |
Get the table descriptor for this table (if any).
|
(package private) TableName |
getTableName() |
Return a TableName node representing this FromTable.
|
int |
getTableNumber() |
Get this Optimizable's table number
|
AccessPath |
getTrulyTheBestAccessPath() |
Get the best access path overall for this Optimizable.
|
(package private) java.lang.String |
getUserSpecifiedJoinStrategy() |
Return the user specified join strategy, if any for this table.
|
int[] |
hashKeyColumns() |
Return the hash key column numbers, for hash join strategy
|
boolean |
hasLargeObjectColumns() |
Check if any columns containing large objects (BLOBs or CLOBs) are
referenced in this table.
|
boolean |
hasTableNumber() |
Return true if this Optimizable has a table number
|
void |
initAccessPaths(Optimizer optimizer) |
Init the access paths for this optimizable.
|
int |
initialCapacity() |
Return the initial capacity of the hash table, for hash join strategy
|
boolean |
isBaseTable() |
Tell whether this Optimizable represents a base table
|
boolean |
isCoveringIndex(ConglomerateDescriptor cd) |
Return whether or not this is a covering index.
|
(package private) boolean |
isFlattenableJoinNode() |
Is this FromTable a JoinNode which can be flattened into
the parents FromList.
|
(package private) void |
isJoinColumnForRightOuterJoin(ResultColumn rc) |
No-op in FromTable.
|
boolean |
isMaterializable() |
Tell whether this Optimizable is materializable
|
boolean |
isOneRowScan() |
Will the optimizable return at most 1 row per scan?
|
boolean |
isTargetTable() |
Is the optimizable the target table of an update or delete?
|
boolean |
legalJoinOrder(JBitSet assignedTableMap) |
Can this Optimizable appear at the current location in the join order.
|
float |
loadFactor() |
Return the load factor of the hash table, for hash join strategy
|
(package private) boolean |
LOJ_reorderable(int numTables) |
no LOJ reordering for this FromTable.
|
protected void |
markUpdatableByCursor(java.util.List<java.lang.String> updateColumns) |
Mark as updatable all the columns in the result column list of this
FromBaseTable that match the columns in the given update column list.
|
int |
maxCapacity(JoinStrategy joinStrategy,
int maxMemoryPerTable) |
Return the maximum capacity of the hash table, for hash join strategy
|
boolean |
memoryUsageOK(double rowCount,
int maxMemoryPerTable) |
|
Optimizable |
modifyAccessPath(JBitSet outerTables) |
Modify the access path for this Optimizable, as necessary.
|
(package private) boolean |
needsSpecialRCLBinding() |
|
boolean |
nextAccessPath(Optimizer optimizer,
OptimizablePredicateList predList,
RowOrdering rowOrdering) |
Choose the next access path to evaluate for this Optimizable.
|
CostEstimate |
optimizeIt(Optimizer optimizer,
OptimizablePredicateList predList,
CostEstimate outerCost,
RowOrdering rowOrdering) |
Choose the best access path for this Optimizable.
|
(package private) void |
optimizeSubqueries(DataDictionary dd,
double rowCount) |
Optimize any subqueries that haven't been optimized any where
else.
|
void |
pullOptPredicates(OptimizablePredicateList optimizablePredicates) |
Pull all the OptimizablePredicates from this Optimizable and put them
in the given OptimizablePredicateList.
|
(package private) void |
pushExpressions(PredicateList predicateList) |
Push expressions down to the first ResultSetNode which can do expression
evaluation and has the same referenced table map.
|
boolean |
pushOptPredicate(OptimizablePredicate optimizablePredicate) |
Push an OptimizablePredicate down, if this node accepts it.
|
void |
rememberAsBest(int planType,
Optimizer optimizer) |
Remember the current access path as the best one (so far).
|
void |
rememberJoinStrategyAsBest(AccessPath ap) |
Remember the current join strategy as the best one so far in this
join order.
|
void |
rememberSortAvoidancePath() |
Mark this optimizable so that its sort avoidance path will be
considered.
|
protected void |
resetJoinStrategies(Optimizer optimizer) |
This method is called when this table is placed in a potential
join order, or when a new conglomerate is being considered.
|
protected void |
setCostEstimateCost(CostEstimate newCostEstimate) |
Set the cost estimate in this node to the given cost estimate.
|
void |
setHashKeyColumns(int[] columnNumbers) |
Set the hash key column numbers, for hash join strategy
|
(package private) void |
setLevel(int level) |
Set the (query block) level (0-based) for this FromTable.
|
(package private) void |
setMergeTableID(int mergeTableID) |
set the merge table id
|
(package private) void |
setOrigTableName(TableName tableName) |
Sets the original or unbound table name for this FromTable.
|
void |
setProperties(java.util.Properties tableProperties) |
Set the Properties list for this optimizalbe.
|
(package private) void |
setTableNumber(int tableNumber) |
Set the table # for this table.
|
void |
startOptimizing(Optimizer optimizer,
RowOrdering rowOrdering) |
Begin the optimization process for this Optimizable.
|
boolean |
supportsMultipleInstantiations() |
Tell whether this Optimizable can be instantiated multiple times
|
protected void |
tellRowOrderingAboutConstantColumns(RowOrdering rowOrdering,
OptimizablePredicateList predList) |
Tell the given RowOrdering about any columns that are constant
due to their being equality comparisons with constant expressions.
|
java.lang.String |
toString() |
Convert this object to a String.
|
(package private) FromTable |
transformOuterJoins(ValueNode predicateTree,
int numTables) |
Transform any Outer Join into an Inner Join where applicable.
|
double |
uniqueJoin(OptimizablePredicateList predList) |
Does this optimizable have a uniqueness condition on the
given predicate list, and if so, how many unique keys will be
returned per scan.
|
void |
updateBestPlanMap(short action,
java.lang.Object planKey) |
When remembering "truly the best" access path for an Optimizable, we
have to keep track of which OptimizerImpl the "truly the best" access
is for.
|
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
getDataDictionary, getOptimizerTracer, getReferencedTableMap, getResultSetNumber, optimizerTracingIsOn
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, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setEndOffset, setRefActionInfo, stackPrint, taggedWith, treePrint, treePrint, verifyClassExist
addNewPredicate, adjustForSortElimination, adjustForSortElimination, assignResultSetNumber, bindExpressions, bindExpressionsWithTables, bindNonVTITables, bindResultColumns, bindResultColumns, bindTargetExpressions, bindUntypedNullsToResultColumns, bindVTITables, changeAccessPath, columnTypesAndLengthsMatch, considerMaterialization, enhanceRCLForInsert, ensurePredicateList, flattenableInFromSubquery, generateNormalizationResultSet, generateResultSet, genProjectRestrict, genProjectRestrict, genProjectRestrictForReordering, getAllResultColumns, getCandidateFinalCostEstimate, getCostEstimate, getCursorTargetTable, getFromList, getMatchingColumn, getNewCostEstimate, getOptimizer, getOptimizerImpl, getRCLForInsert, getReferencedTableMap, getResultColumns, getResultSetNumber, getScratchCostEstimate, isCursorTargetTable, isInsertSource, isNotExists, isOneRowResultSet, isOrderedOn, isPossibleDistinctScan, isStatementResultSet, isUpdatableCursor, LOJgetReferencedTables, makeResultDescription, makeResultDescriptors, markAsCursorTargetTable, markForDistinctScan, markStatementResultSet, modifyAccessPaths, modifyAccessPaths, notCursorTargetTable, notFlattenableJoin, numDistinctAggregates, optimize, parseDefault, performMaterialization, preprocess, printQueryExpressionSuffixClauses, printSubNodes, projectResultColumns, pushOffsetFetchFirst, pushOrderByList, pushQueryExpressionSuffix, referencesTarget, rejectParameters, rejectXMLValues, renameGeneratedResultNames, replaceOrForbidDefaults, returnsAtMostOneRow, setCandidateFinalCostEstimate, setCostEstimate, setCursorTargetTable, setInsertSource, setOptimizer, setReferencedTableMap, setResultColumns, setResultSetNumber, setResultToBooleanTrueNode, setScratchCostEstimate, setTableConstructorTypes, subqueryReferencesTarget, updateTargetLockMode, verifySelectStarSubquery
accept, addTag, taggedWith
java.util.Properties tableProperties
java.lang.String correlationName
TableName corrTableName
int tableNumber
int level
int[] hashKeyColumns
int initialCapacity
float loadFactor
int maxCapacity
AccessPathImpl currentAccessPath
AccessPathImpl bestAccessPath
AccessPathImpl bestSortAvoidancePath
AccessPathImpl trulyTheBestAccessPath
private int joinStrategyNumber
protected java.lang.String userSpecifiedJoinStrategy
protected CostEstimate bestCostEstimate
private double perRowUsage
private boolean considerSortAvoidancePath
private java.util.HashMap<java.lang.Object,AccessPathImpl> bestPlanMap
protected static final short REMOVE_PLAN
protected static final short ADD_PLAN
protected static final short LOAD_PLAN
protected TableName origTableName
private int _mergeTableID
FromTable(java.lang.String correlationName, java.util.Properties tableProperties, ContextManager cm)
correlationName
- The correlation nametableProperties
- Properties list associated with the tablecm
- The context managerpublic java.lang.String getCorrelationName()
public CostEstimate optimizeIt(Optimizer optimizer, OptimizablePredicateList predList, CostEstimate outerCost, RowOrdering rowOrdering) throws StandardException
Optimizable
optimizeIt
in interface Optimizable
optimizer
- Optimizer to use.predList
- The predicate list to optimize againstouterCost
- The CostEstimate for the outer tables in the join order,
telling how many times this Optimizable will be scanned.rowOrdering
- The row ordering for all the tables in the
join order, including this one.StandardException
- Thrown on errorOptimizable.optimizeIt(org.apache.derby.iapi.sql.compile.Optimizer, org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.compile.CostEstimate, org.apache.derby.iapi.sql.compile.RowOrdering)
public boolean nextAccessPath(Optimizer optimizer, OptimizablePredicateList predList, RowOrdering rowOrdering) throws StandardException
Optimizable
nextAccessPath
in interface Optimizable
optimizer
- Optimizer to use.predList
- The predicate list for this optimizable.
The optimizer always passes null, and it is up
to the optimizable object to pass along its
own predicate list, if appropriate, when delegating
this method.rowOrdering
- The row ordering for all the outer tables in
the join order. This method will add the ordering
of the next access path to the given RowOrdering.StandardException
- Thrown on errorOptimizable.nextAccessPath(org.apache.derby.iapi.sql.compile.Optimizer, org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.compile.RowOrdering)
protected boolean canBeOrdered()
public AccessPath getCurrentAccessPath()
Optimizable
getCurrentAccessPath
in interface Optimizable
Optimizable.getCurrentAccessPath()
public AccessPath getBestAccessPath()
Optimizable
getBestAccessPath
in interface Optimizable
Optimizable.getBestAccessPath()
public AccessPath getBestSortAvoidancePath()
Optimizable
getBestSortAvoidancePath
in interface Optimizable
Optimizable.getBestSortAvoidancePath()
public AccessPath getTrulyTheBestAccessPath()
Optimizable
getTrulyTheBestAccessPath
in interface Optimizable
Optimizable.getTrulyTheBestAccessPath()
public void rememberSortAvoidancePath()
Optimizable
rememberSortAvoidancePath
in interface Optimizable
Optimizable.rememberSortAvoidancePath()
public boolean considerSortAvoidancePath()
Optimizable
considerSortAvoidancePath
in interface Optimizable
Optimizable.considerSortAvoidancePath()
public void rememberJoinStrategyAsBest(AccessPath ap)
Optimizable
rememberJoinStrategyAsBest
in interface Optimizable
Optimizable.rememberJoinStrategyAsBest(org.apache.derby.iapi.sql.compile.AccessPath)
public TableDescriptor getTableDescriptor()
Optimizable
getTableDescriptor
in interface Optimizable
Optimizable.getTableDescriptor()
public boolean pushOptPredicate(OptimizablePredicate optimizablePredicate) throws StandardException
Optimizable
pushOptPredicate
in interface Optimizable
optimizablePredicate
- OptimizablePredicate to push down.StandardException
- Thrown on errorOptimizable.pushOptPredicate(org.apache.derby.iapi.sql.compile.OptimizablePredicate)
public void pullOptPredicates(OptimizablePredicateList optimizablePredicates) throws StandardException
Optimizable
pullOptPredicates
in interface Optimizable
optimizablePredicates
- The list to put the pulled predicates
in.StandardException
- Thrown on errorOptimizable.pullOptPredicates(org.apache.derby.iapi.sql.compile.OptimizablePredicateList)
public Optimizable modifyAccessPath(JBitSet outerTables) throws StandardException
Optimizable
modifyAccessPath
in interface Optimizable
outerTables
- Bit map of the tables that are outer to this one
in the join order.StandardException
- Thrown on errorOptimizable.modifyAccessPath(org.apache.derby.iapi.util.JBitSet)
public boolean isCoveringIndex(ConglomerateDescriptor cd) throws StandardException
Optimizable
isCoveringIndex
in interface Optimizable
cd
- ConglomerateDesriptor for index to considerStandardException
- Thrown on errorOptimizable.isCoveringIndex(org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor)
public java.util.Properties getProperties()
Optimizable
getProperties
in interface Optimizable
Optimizable.getProperties()
public void setProperties(java.util.Properties tableProperties)
Optimizable
setProperties
in interface Optimizable
tableProperties
- The Properties list for this optimizable.Optimizable.setProperties(java.util.Properties)
public void verifyProperties(DataDictionary dDictionary) throws StandardException
Optimizable
verifyProperties
in interface Optimizable
dDictionary
- The DataDictionary to use.StandardException
- Thrown on errorOptimizable.verifyProperties(org.apache.derby.iapi.sql.dictionary.DataDictionary)
public java.lang.String getName() throws StandardException
Optimizable
getName
in interface Optimizable
StandardException
- Thrown on errorOptimizable.getName()
public java.lang.String getBaseTableName()
Optimizable
getBaseTableName
in interface Optimizable
Optimizable.getBaseTableName()
public int convertAbsoluteToRelativeColumnPosition(int absolutePosition)
Optimizable
convertAbsoluteToRelativeColumnPosition
in interface Optimizable
absolutePosition
- The absolute 0-based column position for the column.Optimizable.convertAbsoluteToRelativeColumnPosition(int)
public void updateBestPlanMap(short action, java.lang.Object planKey) throws StandardException
Optimizable
updateBestPlanMap
in interface Optimizable
action
- Indicates whether we're adding, loading, or removing
a best plan for the OptimizerImpl/Optimizable.planKey
- Object to use as the map key when adding/looking up
a plan. If it is an instance of OptimizerImpl then it corresponds
to an outer query; otherwise it's some Optimizable above this
Optimizable that could potentially reject plans chosen by the
OptimizerImpl to which this Optimizable belongs.StandardException
Optimizable.updateBestPlanMap(short, java.lang.Object)
public void rememberAsBest(int planType, Optimizer optimizer) throws StandardException
Optimizable
rememberAsBest
in interface Optimizable
planType
- The type of plan (one of Optimizer.NORMAL_PLAN
or Optimizer.SORT_AVOIDANCE_PLAN)optimizer
- The OptimizerImpl that is telling this Optimizable
to remember its current path as "truly the best".StandardException
- thrown on error.Optimizable.rememberAsBest(int, org.apache.derby.iapi.sql.compile.Optimizer)
public void startOptimizing(Optimizer optimizer, RowOrdering rowOrdering)
Optimizable
startOptimizing
in interface Optimizable
Optimizable.startOptimizing(org.apache.derby.iapi.sql.compile.Optimizer, org.apache.derby.iapi.sql.compile.RowOrdering)
protected void resetJoinStrategies(Optimizer optimizer)
public CostEstimate estimateCost(OptimizablePredicateList predList, ConglomerateDescriptor cd, CostEstimate outerCost, Optimizer optimizer, RowOrdering rowOrdering) throws StandardException
Optimizable
estimateCost
in interface Optimizable
predList
- The predicate list to optimize againstcd
- The conglomerate descriptor to get the cost ofouterCost
- The estimated cost of the part of the plan outer
to this optimizable.optimizer
- The optimizer to use to help estimate the costrowOrdering
- The row ordering for all the tables in the
join order, including this one.StandardException
- Thrown on errorOptimizable.estimateCost(org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor, org.apache.derby.iapi.sql.compile.CostEstimate, org.apache.derby.iapi.sql.compile.Optimizer, org.apache.derby.iapi.sql.compile.RowOrdering)
CostEstimate getFinalCostEstimate() throws StandardException
getFinalCostEstimate
in class ResultSetNode
StandardException
public boolean isBaseTable()
Optimizable
isBaseTable
in interface Optimizable
Optimizable.isBaseTable()
public boolean hasLargeObjectColumns()
hasLargeObjectColumns
in interface Optimizable
true
if at least one large object column is referenced,
false
otherwisepublic boolean isMaterializable() throws StandardException
Optimizable
isMaterializable
in interface Optimizable
StandardException
- Thrown on errorOptimizable.isMaterializable()
public boolean supportsMultipleInstantiations()
Optimizable
supportsMultipleInstantiations
in interface Optimizable
Optimizable.supportsMultipleInstantiations()
public int getTableNumber()
Optimizable
getTableNumber
in interface Optimizable
Optimizable.getTableNumber()
public boolean hasTableNumber()
Optimizable
hasTableNumber
in interface Optimizable
Optimizable.hasTableNumber()
public boolean forUpdate()
Optimizable
forUpdate
in interface Optimizable
Optimizable.forUpdate()
public int initialCapacity()
Optimizable
initialCapacity
in interface Optimizable
Optimizable.initialCapacity()
public float loadFactor()
Optimizable
loadFactor
in interface Optimizable
Optimizable.loadFactor()
public int maxCapacity(JoinStrategy joinStrategy, int maxMemoryPerTable) throws StandardException
Optimizable
maxCapacity
in interface Optimizable
maxMemoryPerTable
- The maximum number of bytes to be used. Ignored if the user has set a maximum
number of rows for the Optimizable.StandardException
- Standard error policyOptimizable.maxCapacity(org.apache.derby.iapi.sql.compile.JoinStrategy, int)
private double getPerRowUsage() throws StandardException
StandardException
public int[] hashKeyColumns()
Optimizable
hashKeyColumns
in interface Optimizable
Optimizable.hashKeyColumns()
public void setHashKeyColumns(int[] columnNumbers)
Optimizable
setHashKeyColumns
in interface Optimizable
Optimizable.setHashKeyColumns(int[])
public boolean feasibleJoinStrategy(OptimizablePredicateList predList, Optimizer optimizer) throws StandardException
Optimizable
feasibleJoinStrategy
in interface Optimizable
predList
- The predicate list that has been pushed down to
this optimizableoptimizer
- The optimizer to use.StandardException
- Thrown on errorOptimizable.feasibleJoinStrategy(org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.compile.Optimizer)
public boolean memoryUsageOK(double rowCount, int maxMemoryPerTable) throws StandardException
memoryUsageOK
in interface Optimizable
StandardException
- standard error policyOptimizable.memoryUsageOK(double, int)
void isJoinColumnForRightOuterJoin(ResultColumn rc)
public boolean legalJoinOrder(JBitSet assignedTableMap)
Optimizable
legalJoinOrder
in interface Optimizable
assignedTableMap
- The tables that have been placed so far in the join order.Optimizable.legalJoinOrder(org.apache.derby.iapi.util.JBitSet)
public int getNumColumnsReturned()
Optimizable
getNumColumnsReturned
in interface Optimizable
Optimizable.getNumColumnsReturned()
public boolean isTargetTable()
Optimizable
isTargetTable
in interface Optimizable
Optimizable.isTargetTable()
public boolean isOneRowScan() throws StandardException
Optimizable
isOneRowScan
in interface Optimizable
StandardException
- Thrown on errorOptimizable.isOneRowScan()
public void initAccessPaths(Optimizer optimizer)
Optimizable
initAccessPaths
in interface Optimizable
optimizer
- The optimizer being used.Optimizable.initAccessPaths(org.apache.derby.iapi.sql.compile.Optimizer)
public double uniqueJoin(OptimizablePredicateList predList) throws StandardException
Optimizable
uniqueJoin
in interface Optimizable
predList
- The predicate list to checkStandardException
- Thrown on errorOptimizable.uniqueJoin(org.apache.derby.iapi.sql.compile.OptimizablePredicateList)
java.lang.String getUserSpecifiedJoinStrategy()
protected boolean cursorTargetTable()
protected CostEstimate getCostEstimate(Optimizer optimizer)
protected CostEstimate getScratchCostEstimate(Optimizer optimizer)
protected void setCostEstimateCost(CostEstimate newCostEstimate)
protected void assignCostEstimate(CostEstimate newCostEstimate)
public java.lang.String toString()
toString
in class ResultSetNode
ResultColumnList getResultColumnsForList(TableName allTableName, ResultColumnList inputRcl, TableName tableName) throws StandardException
allTableName
- The qualifier on the "*"StandardException
- Thrown on errorvoid pushExpressions(PredicateList predicateList) throws StandardException
predicateList
- The PredicateList.StandardException
- Thrown on errorjava.lang.String getExposedName() throws StandardException
StandardException
- Thrown on errorvoid setTableNumber(int tableNumber)
tableNumber
- The table # for this table.TableName getTableName() throws StandardException
StandardException
- Thrown on errorvoid setLevel(int level)
level
- The query block level for this FromTable.int getLevel()
void decrementLevel(int decrement)
decrementLevel
in class ResultSetNode
decrement
- The amount to decrement by.SchemaDescriptor getSchemaDescriptor() throws StandardException
StandardException
- throws on schema name
that doesn't existSchemaDescriptor getSchemaDescriptor(TableName tableName) throws StandardException
tableName
- the table nameStandardException
- throws on schema name
that doesn't existFromTable getFromTableByName(java.lang.String name, java.lang.String schemaName, boolean exactMatch) throws StandardException
getFromTableByName
in class ResultSetNode
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 errorboolean isFlattenableJoinNode()
boolean LOJ_reorderable(int numTables) throws StandardException
StandardException
FromTable transformOuterJoins(ValueNode predicateTree, int numTables) throws StandardException
predicateTree
- The predicate tree for the query blockStandardException
- Thrown on errorvoid fillInReferencedTableMap(JBitSet passedMap)
fillInReferencedTableMap
in class ResultSetNode
passedMap
- The table map to fill in.protected void markUpdatableByCursor(java.util.List<java.lang.String> updateColumns)
updateColumns
- A list representing the columns
that can be updated.boolean columnsAreUpdatable()
FromList flatten(ResultColumnList rcl, PredicateList outerPList, SubqueryList sql, GroupByList gbl, ValueNode havingClause) throws StandardException
rcl
- The RCL from the outer queryouterPList
- PredicateList to append wherePredicates to.sql
- The SubqueryList from the outer querygbl
- The group by list, if anyhavingClause
- The HAVING clause, if anyStandardException
- Thrown on errorvoid optimizeSubqueries(DataDictionary dd, double rowCount) throws StandardException
StandardException
- Thrown on errorprotected void tellRowOrderingAboutConstantColumns(RowOrdering rowOrdering, OptimizablePredicateList predList)
boolean needsSpecialRCLBinding()
void setOrigTableName(TableName tableName)
tableName
- the unbound table nameTableName getOrigTableName()
void setMergeTableID(int mergeTableID)
int getMergeTableID()
void acceptChildren(Visitor v) throws StandardException
ResultSetNode
acceptChildren
in class ResultSetNode
v
- the visitorStandardException
- on errorApache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.