class FromBaseTable extends FromTable
Positioned Update: Currently, all columns of an updatable cursor are selected to deal with a positioned update. This is because we don't know what columns will ultimately be needed from the UpdateNode above us. For example, consider:
get c as 'select cint from t for update of ctinyint' update t set ctinyint = csmallintIdeally, the cursor only selects cint. Then, something akin to an IndexRowToBaseRow is generated to take the CursorResultSet and get the appropriate columns out of the base table from the RowLocation returned by the cursor. Then the update node can generate the appropriate NormalizeResultSet (or whatever else it might need) to get things into the correct format for the UpdateResultSet. See CurrentOfNode for more information.
ResultSetNode.QueryExpressionClauses
Modifier and Type | Field and Description |
---|---|
private boolean |
authorizeSYSUSERS |
(package private) ConglomerateDescriptor |
baseConglomerateDescriptor |
(package private) PredicateList |
baseTableRestrictionList
Restriction as a PredicateList
|
(package private) int |
bulkFetch |
(package private) boolean |
bulkFetchTurnedOff |
private java.lang.String[] |
columnNames |
(package private) ConglomerateDescriptor[] |
conglomDescs |
(package private) static int |
DELETE |
private JBitSet |
dependencyMap |
private boolean |
distinctScan |
private boolean |
existsBaseTable |
private int[] |
fkColArray |
private long |
fkIndexConglomId |
private boolean |
getUpdateLocks |
private boolean |
gotRowCount |
private boolean |
hasCheckedIndexStats
Whether or not we have checked the index statistics for staleness.
|
private boolean |
isNotExists |
(package private) boolean |
multiProbing |
(package private) PredicateList |
nonBaseTableRestrictionList |
(package private) PredicateList |
nonStoreRestrictionList |
private boolean |
raDependentScan
Information for dependent table scan for Referential Actions
|
private java.lang.String |
raParentResultSetId |
private FormatableBitSet |
referencedCols |
(package private) PredicateList |
requalificationRestrictionList |
(package private) PredicateList |
restrictionList |
private long |
rowCount |
private java.lang.String |
rowLocationColumnName |
private double |
singleScanRowCount |
private boolean |
specialMaxScan |
(package private) PredicateList |
storeRestrictionList |
(package private) TableDescriptor |
tableDescriptor |
(package private) TableName |
tableName |
private java.lang.String |
targetTableUUIDString |
private ResultColumnList |
templateColumns |
(package private) static int |
UNSET |
(package private) static int |
UPDATE |
(package private) int |
updateOrDelete |
private boolean |
validatingCheckConstraint |
ADD_PLAN, bestAccessPath, bestCostEstimate, bestSortAvoidancePath, correlationName, corrTableName, currentAccessPath, hashKeyColumns, initialCapacity, level, LOAD_PLAN, loadFactor, maxCapacity, origTableName, REMOVE_PLAN, tableNumber, tableProperties, trulyTheBestAccessPath, userSpecifiedJoinStrategy
AUTOINCREMENT_CREATE_MODIFY, AUTOINCREMENT_CYCLE, AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX
Constructor and Description |
---|
FromBaseTable(TableName tableName,
java.lang.String correlationName,
int updateOrDelete,
ResultColumnList derivedRCL,
ContextManager cm)
Initializer for a table in a FROM list.
|
FromBaseTable(TableName tableName,
java.lang.String correlationName,
ResultColumnList derivedRCL,
java.util.Properties tableProperties,
ContextManager cm)
Constructor for a table in a FROM list.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
acceptChildren(Visitor v)
Accept the visitor for all visitable children of this node.
|
(package private) ResultColumnList |
addColsToList(ResultColumnList inputRcl,
FormatableBitSet colsWeWant)
Augment the RCL to include the columns in the FormatableBitSet.
|
(package private) void |
adjustForSortElimination()
Notify the underlying result set tree that the optimizer has chosen
to "eliminate" a sort.
|
(package private) void |
adjustForSortElimination(RequiredRowOrdering rowOrdering)
Same goal as adjustForSortElimination above, but this version
takes a RequiredRowOrdering to allow nodes to adjust based on
the ORDER BY clause, if needed.
|
private long |
baseRowCount() |
(package private) void |
bindExpressions(FromList fromListParam)
Bind the expressions in this FromBaseTable.
|
(package private) ResultSetNode |
bindNonVTITables(DataDictionary dataDictionary,
FromList fromListParam)
Bind the table in this FromBaseTable.
|
(package private) void |
bindResultColumns(FromList fromListParam)
Bind the result columns of this ResultSetNode when there is no
base table to bind them to.
|
private TableDescriptor |
bindTableDescriptor()
Bind the table descriptor for this table.
|
protected boolean |
canBeOrdered()
Tell super-class that this Optimizable can be ordered
|
(package private) ResultSetNode |
changeAccessPath()
The optimizer's decision on the access path for a result set
may require the generation of extra result sets.
|
(package private) void |
clearDependency(java.util.List<java.lang.Integer> locations)
Clear the bits from the dependency map when join nodes are flattened
|
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 |
disableBulkFetch()
Turn off bulk fetch
|
(package private) void |
doSpecialMaxScan()
Do a special scan for max.
|
CostEstimate |
estimateCost(OptimizablePredicateList predList,
ConglomerateDescriptor cd,
CostEstimate outerCost,
Optimizer optimizer,
RowOrdering rowOrdering)
Estimate the cost of scanning this
FromBaseTable using the
given predicate list with the given conglomerate. |
boolean |
forUpdate()
Return true if this is the target table of an update
|
(package private) void |
generate(ActivationClassBuilder acb,
MethodBuilder mb)
Generation on a FromBaseTable creates a scan on the
optimizer-selected conglomerate.
|
private void |
generateDistinctScan(ExpressionClassBuilder acb,
MethodBuilder mb) |
private void |
generateMaxSpecialResultSet(ExpressionClassBuilder acb,
MethodBuilder mb) |
private void |
generateRefActionDependentTableScan(ExpressionClassBuilder acb,
MethodBuilder mb)
Generation on a FromBaseTable for a referential action dependent table.
|
(package private) void |
generateResultSet(ExpressionClassBuilder acb,
MethodBuilder mb)
Generation on a FromBaseTable for a SELECT.
|
protected ResultSetNode |
genProjectRestrict(int numTables)
Put a ProjectRestrictNode on top of each FromTable in the FromList.
|
(package private) ResultColumnList |
genResultColList()
Build a ResultColumnList based on all of the columns in this FromBaseTable.
|
(package private) ResultColumnList |
getAllResultColumns(TableName allTableName)
Return a ResultColumnList with all of the columns in this table.
|
private StoreCostController |
getBaseCostController() |
java.lang.String |
getBaseTableName()
Get the table name of this Optimizable.
|
private void |
getConglomDescs() |
private int |
getDefaultBulkFetch() |
(package private) boolean |
getExistsBaseTable()
Does this FBT represent an EXISTS FBT.
|
(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) TableName |
getExposedTableName()
Get the exposed table 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 ResultSetNode.
|
private ConglomerateDescriptor |
getFirstConglom() |
(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) ResultColumn |
getMatchingColumn(ColumnReference columnReference)
Try to find a ResultColumn in the table represented by this FromBaseTable
that matches the name in the given ColumnReference.
|
private ConglomerateDescriptor |
getNextConglom(ConglomerateDescriptor currCD) |
private DataValueDescriptor[] |
getRowTemplate(ConglomerateDescriptor cd,
StoreCostController scc) |
private int |
getScanArguments(ExpressionClassBuilder acb,
MethodBuilder mb) |
private StoreCostController |
getStoreCostController(ConglomerateDescriptor cd) |
TableDescriptor |
getTableDescriptor()
Get the table descriptor for this table (if any).
|
(package private) TableName |
getTableName()
Return a TableName node representing this FromTable.
|
(package private) TableName |
getTableNameField()
Return the table name for this table.
|
private java.lang.String |
getUserSpecifiedIndexName() |
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.
|
boolean |
isMaterializable()
Tell whether this Optimizable is materializable
|
(package private) boolean |
isNotExists()
Return whether or not this is actually a EBT for NOT EXISTS.
|
(package private) boolean |
isOneRowResultSet()
Return whether or not the underlying ResultSet tree will return
a single row, at most.
|
private boolean |
isOneRowResultSet(ConglomerateDescriptor cd,
OptimizablePredicateList predList)
Is this a one-row result set with the given conglomerate descriptor?
|
(package private) boolean |
isOneRowResultSet(OptimizablePredicateList predList) |
boolean |
isOneRowScan()
Will the optimizable return at most 1 row per scan?
|
private boolean |
isOrdered(ColumnReference[] crs,
ConglomerateDescriptor cd)
Return whether or not this index is ordered on a permutation of the specified columns.
|
(package private) boolean |
isOrderedOn(ColumnReference[] crs,
boolean permuteOrdering,
java.util.List<FromBaseTable> fbtHolder)
Return whether or not the underlying ResultSet tree
is ordered on the specified columns.
|
(package private) boolean |
isPossibleDistinctScan(java.util.Set<BaseColumnNode> distinctColumns)
Is it possible to do a distinct scan on this ResultSet tree.
|
private boolean |
isStrictlyOrdered(ColumnReference[] crs,
ConglomerateDescriptor cd)
Return whether or not this index is ordered on a permutation of the specified columns.
|
boolean |
isTargetTable()
Is the optimizable the target table of an update or delete?
|
private boolean |
isValidatingCheckConstraint() |
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 base table.
|
(package private) JBitSet |
LOJgetReferencedTables(int numTables) |
private int |
mapAbsoluteToRelativeColumnPosition(int absolutePosition)
Convert an absolute to a relative 0-based column position.
|
private ResultSetNode |
mapTableAsVTI(TableDescriptor td,
java.lang.String correlationName,
ResultColumnList resultColumns,
java.util.Properties tableProperties,
ContextManager cm)
Return a node that represents invocation of the virtual table for the
given table descriptor.
|
(package private) boolean |
markAsCursorTargetTable()
Mark this ResultSetNode as the target table of an updatable
cursor.
|
(package private) void |
markForDistinctScan()
Mark the underlying scan as a distinct scan.
|
(package private) void |
markUpdated(ResultColumnList 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.
|
boolean |
memoryUsageOK(double rowCount,
int maxMemoryPerTable) |
private ResultColumnList |
newResultColumns(ResultColumnList oldColumns,
ConglomerateDescriptor idxCD,
ConglomerateDescriptor heapCD,
boolean cloneRCs)
Create a new ResultColumnList to reflect the columns in the
index described by the given ConglomerateDescriptor.
|
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) ResultSetNode |
preprocess(int numTables,
GroupByList gbl,
FromList fromList)
Preprocess a ResultSetNode - this currently means:
o Generating a referenced table map for each ResultSetNode.
|
void |
pullOptPredicates(OptimizablePredicateList optimizablePredicates)
Pull all the OptimizablePredicates from this Optimizable and put them
in the given OptimizablePredicateList.
|
private void |
pushIndexName(ConglomerateDescriptor cd,
MethodBuilder mb) |
boolean |
pushOptPredicate(OptimizablePredicate optimizablePredicate)
Push an OptimizablePredicate down, if this node accepts it.
|
private boolean |
qualifiesForStatisticsUpdateCheck(TableDescriptor td)
Tells if the given table qualifies for a statistics update check in the
current configuration.
|
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.
|
private double |
scanCostAfterSelectivity(double originalScanCost,
double initialPositionCost,
double selectivity,
boolean anotherIndexUnique) |
(package private) void |
setExistsBaseTable(boolean existsBaseTable,
JBitSet dependencyMap,
boolean isNotExists)
Set whether or not this FBT represents an
EXISTS FBT.
|
private void |
setLockingBasedOnThreshold(Optimizer optimizer,
double rowsTouched) |
(package private) void |
setRefActionInfo(long fkIndexConglomId,
int[] fkColArray,
java.lang.String parentResultSetId,
boolean dependentScan)
set the Information gathered from the parent table that is
required to perform a referential action on dependent table.
|
(package private) void |
setRowLocationColumnName(java.lang.String rowLocationColumnName)
Set the name of the row location column
|
(package private) void |
setTableProperties(java.util.Properties tableProperties)
Set the table properties for this table.
|
void |
startOptimizing(Optimizer optimizer,
RowOrdering rowOrdering)
Begin the optimization process for this Optimizable.
|
protected boolean |
supersetOfUniqueIndex(boolean[] eqCols)
Determine whether or not the columns marked as true in
the passed in array are a superset of any unique index
on this table.
|
protected boolean |
supersetOfUniqueIndex(JBitSet[] tableColMap)
Determine whether or not the columns marked as true in
the passed in join table matrix are a superset of any single column unique index
on this table.
|
java.lang.String |
toString()
Convert this object to a String.
|
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.
|
(package private) int |
updateTargetLockMode()
Get the lock mode for the target table heap of an update or delete
statement.
|
void |
verifyProperties(DataDictionary dDictionary)
Verify that the Properties list with optimizer overrides, if specified, is valid
|
assignCostEstimate, columnsAreUpdatable, considerSortAvoidancePath, decrementLevel, feasibleJoinStrategy, fillInReferencedTableMap, flatten, getBestAccessPath, getBestSortAvoidancePath, getCorrelationName, getCostEstimate, getCurrentAccessPath, getLevel, getMergeTableID, getName, getNumColumnsReturned, getOrigTableName, getProperties, getResultColumnsForList, getSchemaDescriptor, getSchemaDescriptor, getScratchCostEstimate, getTableNumber, getTrulyTheBestAccessPath, getUserSpecifiedJoinStrategy, hashKeyColumns, hasLargeObjectColumns, hasTableNumber, initAccessPaths, isFlattenableJoinNode, isJoinColumnForRightOuterJoin, markUpdatableByCursor, maxCapacity, modifyAccessPath, needsSpecialRCLBinding, optimizeSubqueries, pushExpressions, rememberAsBest, rememberJoinStrategyAsBest, rememberSortAvoidancePath, resetJoinStrategies, setCostEstimateCost, setHashKeyColumns, setLevel, setMergeTableID, setOrigTableName, setProperties, setTableNumber, supportsMultipleInstantiations, tellRowOrderingAboutConstantColumns, transformOuterJoins, updateBestPlanMap
addNewPredicate, assignResultSetNumber, bindExpressionsWithTables, bindResultColumns, bindTargetExpressions, bindUntypedNullsToResultColumns, bindVTITables, columnTypesAndLengthsMatch, considerMaterialization, enhanceRCLForInsert, ensurePredicateList, flattenableInFromSubquery, generateNormalizationResultSet, genProjectRestrict, genProjectRestrictForReordering, getCandidateFinalCostEstimate, getCostEstimate, getCursorTargetTable, getFromList, getNewCostEstimate, getOptimizer, getOptimizerImpl, getRCLForInsert, getReferencedTableMap, getResultColumns, getResultSetNumber, getScratchCostEstimate, isCursorTargetTable, isInsertSource, isStatementResultSet, isUpdatableCursor, makeResultDescription, makeResultDescriptors, markStatementResultSet, modifyAccessPaths, modifyAccessPaths, notCursorTargetTable, notFlattenableJoin, numDistinctAggregates, optimize, parseDefault, performMaterialization, printQueryExpressionSuffixClauses, printSubNodes, projectResultColumns, pushOffsetFetchFirst, pushOrderByList, pushQueryExpressionSuffix, rejectParameters, rejectXMLValues, renameGeneratedResultNames, replaceOrForbidDefaults, returnsAtMostOneRow, setCandidateFinalCostEstimate, setCostEstimate, setCursorTargetTable, setInsertSource, setOptimizer, setReferencedTableMap, setResultColumns, setResultSetNumber, setResultToBooleanTrueNode, setScratchCostEstimate, setTableConstructorTypes, subqueryReferencesTarget, verifySelectStarSubquery
accept, addTag, addUDTUsagePriv, addUDTUsagePriv, bindOffsetFetch, bindRowMultiSet, bindUserCatalogType, bindUserType, checkReliability, checkReliability, convertDefaultNode, copyTagsFrom, createTypeDependency, debugFlush, debugPrint, disablePrivilegeCollection, formatNodeString, 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, stackPrint, taggedWith, treePrint, treePrint, verifyClassExist
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDataDictionary, getOptimizerTracer, getReferencedTableMap, getResultSetNumber, optimizerTracingIsOn
accept, addTag, taggedWith
static final int UNSET
private boolean hasCheckedIndexStats
TableName tableName
TableDescriptor tableDescriptor
ConglomerateDescriptor baseConglomerateDescriptor
ConglomerateDescriptor[] conglomDescs
int updateOrDelete
int bulkFetch
private java.lang.String targetTableUUIDString
private boolean validatingCheckConstraint
boolean bulkFetchTurnedOff
boolean multiProbing
private double singleScanRowCount
private FormatableBitSet referencedCols
private ResultColumnList templateColumns
private java.lang.String[] columnNames
private boolean specialMaxScan
private boolean distinctScan
private boolean raDependentScan
private java.lang.String raParentResultSetId
private long fkIndexConglomId
private int[] fkColArray
PredicateList baseTableRestrictionList
PredicateList nonBaseTableRestrictionList
PredicateList restrictionList
PredicateList storeRestrictionList
PredicateList nonStoreRestrictionList
PredicateList requalificationRestrictionList
static final int UPDATE
static final int DELETE
private boolean existsBaseTable
private boolean isNotExists
private JBitSet dependencyMap
private boolean getUpdateLocks
private boolean authorizeSYSUSERS
private java.lang.String rowLocationColumnName
private boolean gotRowCount
private long rowCount
FromBaseTable(TableName tableName, java.lang.String correlationName, ResultColumnList derivedRCL, java.util.Properties tableProperties, ContextManager cm)
tableName
- The name of the tablecorrelationName
- The correlation namederivedRCL
- The derived column listtableProperties
- The Properties list associated with the table.cm
- The context managerFromBaseTable(TableName tableName, java.lang.String correlationName, int updateOrDelete, ResultColumnList derivedRCL, ContextManager cm)
tableName
- The name of the tablecorrelationName
- The correlation nameupdateOrDelete
- Table is being updated/deleted from.derivedRCL
- The derived column listcm
- The context managervoid setRowLocationColumnName(java.lang.String rowLocationColumnName)
boolean LOJ_reorderable(int numTables) throws StandardException
LOJ_reorderable
in class FromTable
StandardException
JBitSet LOJgetReferencedTables(int numTables) throws StandardException
LOJgetReferencedTables
in class ResultSetNode
StandardException
public boolean nextAccessPath(Optimizer optimizer, OptimizablePredicateList predList, RowOrdering rowOrdering) throws StandardException
Optimizable
nextAccessPath
in interface Optimizable
nextAccessPath
in class FromTable
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()
canBeOrdered
in class FromTable
public CostEstimate optimizeIt(Optimizer optimizer, OptimizablePredicateList predList, CostEstimate outerCost, RowOrdering rowOrdering) throws StandardException
Optimizable
optimizeIt
in interface Optimizable
optimizeIt
in class FromTable
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 TableDescriptor getTableDescriptor()
Optimizable
getTableDescriptor
in interface Optimizable
getTableDescriptor
in class FromTable
Optimizable.getTableDescriptor()
public boolean isMaterializable() throws StandardException
Optimizable
isMaterializable
in interface Optimizable
isMaterializable
in class FromTable
StandardException
- Thrown on errorOptimizable.isMaterializable()
public boolean pushOptPredicate(OptimizablePredicate optimizablePredicate) throws StandardException
Optimizable
pushOptPredicate
in interface Optimizable
pushOptPredicate
in class FromTable
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
pullOptPredicates
in class FromTable
optimizablePredicates
- The list to put the pulled predicates
in.StandardException
- Thrown on errorOptimizable.pullOptPredicates(org.apache.derby.iapi.sql.compile.OptimizablePredicateList)
public boolean isCoveringIndex(ConglomerateDescriptor cd) throws StandardException
Optimizable
isCoveringIndex
in interface Optimizable
isCoveringIndex
in class FromTable
cd
- ConglomerateDesriptor for index to considerStandardException
- Thrown on errorOptimizable.isCoveringIndex(org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor)
public void verifyProperties(DataDictionary dDictionary) throws StandardException
Optimizable
verifyProperties
in interface Optimizable
verifyProperties
in class FromTable
dDictionary
- The DataDictionary to use.StandardException
- Thrown on errorOptimizable.verifyProperties(org.apache.derby.iapi.sql.dictionary.DataDictionary)
private boolean isValidatingCheckConstraint() throws StandardException
StandardException
public java.lang.String getBaseTableName()
Optimizable
getBaseTableName
in interface Optimizable
getBaseTableName
in class FromTable
Optimizable.getBaseTableName()
public void startOptimizing(Optimizer optimizer, RowOrdering rowOrdering)
Optimizable
startOptimizing
in interface Optimizable
startOptimizing
in class FromTable
Optimizable.startOptimizing(org.apache.derby.iapi.sql.compile.Optimizer, org.apache.derby.iapi.sql.compile.RowOrdering)
public int convertAbsoluteToRelativeColumnPosition(int absolutePosition)
Optimizable
convertAbsoluteToRelativeColumnPosition
in interface Optimizable
convertAbsoluteToRelativeColumnPosition
in class FromTable
absolutePosition
- The absolute 0-based column position for the column.Optimizable.convertAbsoluteToRelativeColumnPosition(int)
public CostEstimate estimateCost(OptimizablePredicateList predList, ConglomerateDescriptor cd, CostEstimate outerCost, Optimizer optimizer, RowOrdering rowOrdering) throws StandardException
Estimate the cost of scanning this FromBaseTable
using the
given predicate list with the given conglomerate.
If the table contains little data, the cost estimate might be adjusted to make it more likely that an index scan will be preferred to a table scan, and a unique index will be preferred to a non-unique index. Even though such a plan may be slightly suboptimal when seen in isolation, using indexes, unique indexes in particular, needs fewer locks and allows more concurrency.
estimateCost
in interface Optimizable
estimateCost
in class FromTable
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)
private double scanCostAfterSelectivity(double originalScanCost, double initialPositionCost, double selectivity, boolean anotherIndexUnique) throws StandardException
StandardException
private void setLockingBasedOnThreshold(Optimizer optimizer, double rowsTouched)
public boolean isBaseTable()
Optimizable
isBaseTable
in interface Optimizable
isBaseTable
in class FromTable
Optimizable.isBaseTable()
public boolean forUpdate()
Optimizable
forUpdate
in interface Optimizable
forUpdate
in class FromTable
Optimizable.forUpdate()
public int initialCapacity()
Optimizable
initialCapacity
in interface Optimizable
initialCapacity
in class FromTable
Optimizable.initialCapacity()
public float loadFactor()
Optimizable
loadFactor
in interface Optimizable
loadFactor
in class FromTable
Optimizable.loadFactor()
public boolean memoryUsageOK(double rowCount, int maxMemoryPerTable) throws StandardException
memoryUsageOK
in interface Optimizable
memoryUsageOK
in class FromTable
StandardException
- standard error policyOptimizable.memoryUsageOK(double, int)
public boolean isTargetTable()
Optimizable
isTargetTable
in interface Optimizable
isTargetTable
in class FromTable
Optimizable.isTargetTable()
public double uniqueJoin(OptimizablePredicateList predList) throws StandardException
Optimizable
uniqueJoin
in interface Optimizable
uniqueJoin
in class FromTable
predList
- The predicate list to checkStandardException
- Thrown on errorOptimizable.uniqueJoin(org.apache.derby.iapi.sql.compile.OptimizablePredicateList)
public boolean isOneRowScan() throws StandardException
Optimizable
isOneRowScan
in interface Optimizable
isOneRowScan
in class FromTable
StandardException
- Thrown on errorOptimizable.isOneRowScan()
public boolean legalJoinOrder(JBitSet assignedTableMap)
Optimizable
legalJoinOrder
in interface Optimizable
legalJoinOrder
in class FromTable
assignedTableMap
- The tables that have been placed so far in the join order.Optimizable.legalJoinOrder(org.apache.derby.iapi.util.JBitSet)
public java.lang.String toString()
boolean getExistsBaseTable()
void setExistsBaseTable(boolean existsBaseTable, JBitSet dependencyMap, boolean isNotExists)
existsBaseTable
- Whether or not an EXISTS FBT.dependencyMap
- The dependency map for the EXISTS FBT.isNotExists
- Whether or not for NOT EXISTS, more specifically.void clearDependency(java.util.List<java.lang.Integer> locations)
locations
- list of bit numbers to be clearedvoid setTableProperties(java.util.Properties tableProperties)
tableProperties
- The new table properties.ResultSetNode bindNonVTITables(DataDictionary dataDictionary, FromList fromListParam) throws StandardException
bindNonVTITables
in class ResultSetNode
dataDictionary
- The DataDictionary to use for bindingfromListParam
- FromList to use/append to.StandardException
- Thrown on errorprivate ResultSetNode mapTableAsVTI(TableDescriptor td, java.lang.String correlationName, ResultColumnList resultColumns, java.util.Properties tableProperties, ContextManager cm) throws StandardException
StandardException
FromTable getFromTableByName(java.lang.String name, java.lang.String schemaName, boolean exactMatch) throws StandardException
getFromTableByName
in class FromTable
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 errorprivate TableDescriptor bindTableDescriptor() throws StandardException
StandardException
- Thrown on errorvoid bindExpressions(FromList fromListParam) throws StandardException
bindExpressions
in class ResultSetNode
fromListParam
- FromList to use/append to.StandardException
- Thrown on errorvoid bindResultColumns(FromList fromListParam) throws StandardException
bindResultColumns
in class ResultSetNode
fromListParam
- FromList to use/append to.StandardException
- Thrown on errorResultColumn getMatchingColumn(ColumnReference columnReference) throws StandardException
getMatchingColumn
in class ResultSetNode
columnReference
- The columnReference whose name we're looking
for in the given table.StandardException
- Thrown on errorResultSetNode preprocess(int numTables, GroupByList gbl, FromList fromList) throws StandardException
preprocess
in class ResultSetNode
numTables
- The number of tables in the DML Statementgbl
- The group by list, if anyfromList
- The from list, if anyStandardException
- Thrown on errorprotected ResultSetNode genProjectRestrict(int numTables) throws StandardException
genProjectRestrict
in class ResultSetNode
numTables
- Number of tables in the DML StatementStandardException
- Thrown on errorResultSetNode changeAccessPath() throws StandardException
ResultSetNode
changeAccessPath
in class ResultSetNode
StandardException
- Thrown on errorResultSetNode.changeAccessPath()
private ResultColumnList newResultColumns(ResultColumnList oldColumns, ConglomerateDescriptor idxCD, ConglomerateDescriptor heapCD, boolean cloneRCs) throws StandardException
oldColumns
- The original list of columns, which reflects
the columns in the base table.idxCD
- The ConglomerateDescriptor, which describes
the index that the new ResultColumnList will
reflect.heapCD
- The ConglomerateDescriptor for the base heapcloneRCs
- Whether or not to clone the RCsStandardException
- Thrown on errorvoid generate(ActivationClassBuilder acb, MethodBuilder mb) throws StandardException
generate
in class QueryTreeNode
acb
- The ActivationClassBuilder for the class being builtmb
- the execute() method to be builtStandardException
- Thrown on errorvoid generateResultSet(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException
generateResultSet
in class ResultSetNode
acb
- The ExpressionClassBuilder for the class being builtmb
- The execute() method to be builtStandardException
- Thrown on errorCostEstimate getFinalCostEstimate()
getFinalCostEstimate
in class FromTable
private void pushIndexName(ConglomerateDescriptor cd, MethodBuilder mb) throws StandardException
StandardException
private void generateMaxSpecialResultSet(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException
StandardException
private void generateDistinctScan(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException
StandardException
private void generateRefActionDependentTableScan(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException
acb
- The ExpressionClassBuilder for the class being builtmb
- The execute() method to be builtStandardException
- Thrown on errorprivate int getScanArguments(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException
StandardException
private int mapAbsoluteToRelativeColumnPosition(int absolutePosition)
absolutePosition
- The absolute 0-based column position.java.lang.String getExposedName()
getExposedName
in class FromTable
TableName getExposedTableName() throws StandardException
StandardException
- Thrown on errorTableName getTableNameField()
ResultColumnList getAllResultColumns(TableName allTableName) throws StandardException
getAllResultColumns
in class ResultSetNode
allTableName
- The qualifier on the "*"StandardException
- Thrown on errorResultColumnList genResultColList() throws StandardException
StandardException
- Thrown on errorResultColumnList addColsToList(ResultColumnList inputRcl, FormatableBitSet colsWeWant) throws StandardException
inputRcl
- The original listcolsWeWant
- bit set of cols we wantStandardException
- Thrown on errorTableName getTableName() throws StandardException
getTableName
in class FromTable
StandardException
- Thrown on errorboolean markAsCursorTargetTable()
markAsCursorTargetTable
in class ResultSetNode
protected boolean cursorTargetTable()
cursorTargetTable
in class FromTable
void markUpdated(ResultColumnList updateColumns)
updateColumns
- A ResultColumnList representing the columns
to be updated.boolean referencesTarget(java.lang.String name, boolean baseTable) throws StandardException
referencesTarget
in class ResultSetNode
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 errorboolean isOneRowResultSet() throws StandardException
isOneRowResultSet
in class ResultSetNode
StandardException
- Thrown on errorboolean isNotExists()
isNotExists
in class ResultSetNode
boolean isOneRowResultSet(OptimizablePredicateList predList) throws StandardException
StandardException
protected boolean supersetOfUniqueIndex(boolean[] eqCols) throws StandardException
eqCols
- The columns to considerStandardException
protected boolean supersetOfUniqueIndex(JBitSet[] tableColMap) throws StandardException
tableColMap
- The columns to considerStandardException
int updateTargetLockMode()
updateTargetLockMode
in class ResultSetNode
TransactionController
boolean isOrderedOn(ColumnReference[] crs, boolean permuteOrdering, java.util.List<FromBaseTable> fbtHolder) throws StandardException
isOrderedOn
in class ResultSetNode
crs
- The specified ColumnReference[]permuteOrdering
- Whether or not the order of the CRs in the array can be permutedfbtHolder
- List that is to be filled with the FromBaseTableStandardException
- Thrown on errorvoid disableBulkFetch()
void doSpecialMaxScan()
boolean isPossibleDistinctScan(java.util.Set<BaseColumnNode> distinctColumns)
isPossibleDistinctScan
in class ResultSetNode
distinctColumns
- the set of distinct columnsvoid markForDistinctScan()
markForDistinctScan
in class ResultSetNode
void adjustForSortElimination()
ResultSetNode
adjustForSortElimination
in class ResultSetNode
ResultSetNode.adjustForSortElimination()
void adjustForSortElimination(RequiredRowOrdering rowOrdering) throws StandardException
ResultSetNode
adjustForSortElimination
in class ResultSetNode
StandardException
ResultSetNode.adjustForSortElimination()
private boolean isOrdered(ColumnReference[] crs, ConglomerateDescriptor cd) throws StandardException
crs
- The specified ColumnReference[]cd
- The ConglomerateDescriptor for the chosen index.StandardException
- Thrown on errorprivate boolean isStrictlyOrdered(ColumnReference[] crs, ConglomerateDescriptor cd) throws StandardException
crs
- The specified ColumnReference[]cd
- The ConglomerateDescriptor for the chosen index.StandardException
- Thrown on errorprivate boolean isOneRowResultSet(ConglomerateDescriptor cd, OptimizablePredicateList predList) throws StandardException
StandardException
private int getDefaultBulkFetch() throws StandardException
StandardException
private java.lang.String getUserSpecifiedIndexName()
private StoreCostController getStoreCostController(ConglomerateDescriptor cd) throws StandardException
StandardException
private StoreCostController getBaseCostController() throws StandardException
StandardException
private long baseRowCount() throws StandardException
StandardException
private DataValueDescriptor[] getRowTemplate(ConglomerateDescriptor cd, StoreCostController scc) throws StandardException
StandardException
private ConglomerateDescriptor getFirstConglom() throws StandardException
StandardException
private ConglomerateDescriptor getNextConglom(ConglomerateDescriptor currCD)
private void getConglomDescs() throws StandardException
StandardException
void setRefActionInfo(long fkIndexConglomId, int[] fkColArray, java.lang.String parentResultSetId, boolean dependentScan)
setRefActionInfo
in class QueryTreeNode
void acceptChildren(Visitor v) throws StandardException
acceptChildren
in class FromTable
v
- the visitorStandardException
- on errorprivate boolean qualifiesForStatisticsUpdateCheck(TableDescriptor td) throws StandardException
td
- the table to checktrue
if qualified, false
if notStandardException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.