Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.impl.sql.compile
Class FromTable  view FromTable download FromTable.java

java.lang.Object
  extended byorg.apache.derby.impl.sql.compile.QueryTreeNode
      extended byorg.apache.derby.impl.sql.compile.ResultSetNode
          extended byorg.apache.derby.impl.sql.compile.FromTable
All Implemented Interfaces:
org.apache.derby.iapi.sql.compile.Optimizable, org.apache.derby.iapi.sql.compile.Visitable
Direct Known Subclasses:
CurrentOfNode, FromBaseTable, FromSubquery, FromVTI, IndexToBaseRowNode, RowResultSetNode, SingleChildResultSetNode, TableOperatorNode

public abstract class FromTable
extends ResultSetNode
implements org.apache.derby.iapi.sql.compile.Optimizable

A FromTable represents a table in the FROM clause of a DML statement. It can be either a base table, a subquery or a project restrict.


Field Summary
private  boolean allColumnsProjected
           
(package private)  AccessPathImpl bestAccessPath
           
protected  org.apache.derby.iapi.sql.compile.CostEstimate bestCostEstimate
           
(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
           
(package private)  float loadFactor
           
(package private)  int maxCapacity
           
private  double perRowUsage
           
private  org.apache.derby.iapi.services.io.FormatableBitSet refCols
           
(package private)  int tableNumber
           
(package private)  java.util.Properties tableProperties
           
(package private)  AccessPathImpl trulyTheBestAccessPath
           
protected  java.lang.String userSpecifiedJoinStrategy
           
 
Fields inherited from class org.apache.derby.impl.sql.compile.ResultSetNode
costEstimate, cursorTargetTable, insertSource, optimizer, referencedTableMap, resultColumns, resultSetNumber, scratchCostEstimate, statementResultSet
 
Fields inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
AUTOINCREMENT_INC_INDEX, AUTOINCREMENT_IS_AUTOINCREMENT_INDEX, AUTOINCREMENT_START_INDEX, beginOffset, endOffset
 
Constructor Summary
FromTable()
           
 
Method Summary
 boolean areAllColumnsProjected()
           
protected  void assignCostEstimate(org.apache.derby.iapi.sql.compile.CostEstimate newCostEstimate)
          Assign the cost estimate in this node to the given cost estimate.
protected  boolean canBeOrdered()
          Most Optimizables cannot be ordered
 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.
 org.apache.derby.iapi.sql.compile.CostEstimate estimateCost(org.apache.derby.iapi.sql.compile.OptimizablePredicateList predList, org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor cd, org.apache.derby.iapi.sql.compile.CostEstimate outerCost, org.apache.derby.iapi.sql.compile.Optimizer optimizer, org.apache.derby.iapi.sql.compile.RowOrdering rowOrdering)
          Estimate the cost of scanning this Optimizable using the given predicate list with the given conglomerate.
 boolean feasibleJoinStrategy(org.apache.derby.iapi.sql.compile.OptimizablePredicateList predList, org.apache.derby.iapi.sql.compile.Optimizer optimizer)
          Is the current proposed join strategy for this optimizable feasible given the predicate list?
 void fillInReferencedTableMap(org.apache.derby.iapi.util.JBitSet passedMap)
          Fill the referencedTableMap with this ResultSetNode.
 FromList flatten(ResultColumnList rcl, PredicateList outerPList, SubqueryList sql, GroupByList gbl)
          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.
 org.apache.derby.iapi.sql.compile.AccessPath getBestAccessPath()
          Get the best access path for this Optimizable.
 org.apache.derby.iapi.sql.compile.AccessPath getBestSortAvoidancePath()
          Get the best sort-avoidance path for this Optimizable.
protected  org.apache.derby.iapi.sql.compile.CostEstimate getCostEstimate(org.apache.derby.iapi.sql.compile.Optimizer optimizer)
           
 org.apache.derby.iapi.sql.compile.AccessPath getCurrentAccessPath()
          Get the current access path under consideration for this Optimizable
 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.
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.
 int getLevel()
          Get the (query block) level (0-based) for this FromTable.
 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.
private  double getPerRowUsage()
           
 java.util.Properties getProperties()
          Get the Properties list, if any, associated with this optimizalbe.
private  org.apache.derby.iapi.services.io.FormatableBitSet getRefCols()
           
 ResultColumnList getResultColumnsForList(TableName allTableName, ResultColumnList inputRcl, TableName tableName)
          Return a ResultColumnList with all of the columns in this table.
 org.apache.derby.iapi.sql.dictionary.SchemaDescriptor getSchemaDescriptor()
          Get a schema descriptor for the given table.
 org.apache.derby.iapi.sql.dictionary.SchemaDescriptor getSchemaDescriptor(TableName tableName)
          Get a schema descriptor for the given table.
protected  org.apache.derby.iapi.sql.compile.CostEstimate getScratchCostEstimate(org.apache.derby.iapi.sql.compile.Optimizer optimizer)
           
 org.apache.derby.iapi.sql.dictionary.TableDescriptor getTableDescriptor()
          Get the table descriptor for this table (if any).
 TableName getTableName()
          Return a TableName node representing this FromTable.
 int getTableNumber()
          Get this Optimizable's table number
 org.apache.derby.iapi.sql.compile.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 hasTableNumber()
          Return true if this Optimizable has a table number
 void init(java.lang.Object correlationName, java.lang.Object tableProperties)
          Initializer for a table in a FROM list.
 void initAccessPaths(org.apache.derby.iapi.sql.compile.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(org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor cd)
          Return whether or not this is a covering index.
 boolean isFlattenableJoinNode()
          Is this FromTable a JoinNode which can be flattened into the parents FromList.
 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(org.apache.derby.iapi.util.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
 boolean LOJ_reorderable(int numTables)
          no LOJ reordering for this FromTable.
protected  void markUpdatableByCursor(java.util.Vector 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(org.apache.derby.iapi.sql.compile.JoinStrategy joinStrategy, int maxMemoryPerTable)
          Return the maximum capacity of the hash table, for hash join strategy
 boolean memoryUsageOK(double rowCount, int maxMemoryPerTable)
           
 org.apache.derby.iapi.sql.compile.Optimizable modifyAccessPath(org.apache.derby.iapi.util.JBitSet outerTables)
          Modify the access path for this Optimizable, as necessary.
 boolean needsSpecialRCLBinding()
           
 boolean nextAccessPath(org.apache.derby.iapi.sql.compile.Optimizer optimizer, org.apache.derby.iapi.sql.compile.OptimizablePredicateList predList, org.apache.derby.iapi.sql.compile.RowOrdering rowOrdering)
          Choose the next access path to evaluate for this Optimizable.
 org.apache.derby.iapi.sql.compile.CostEstimate optimizeIt(org.apache.derby.iapi.sql.compile.Optimizer optimizer, org.apache.derby.iapi.sql.compile.OptimizablePredicateList predList, org.apache.derby.iapi.sql.compile.CostEstimate outerCost, org.apache.derby.iapi.sql.compile.RowOrdering rowOrdering)
          Choose the best access path for this Optimizable.
(package private)  void optimizeSubqueries(org.apache.derby.iapi.sql.dictionary.DataDictionary dd, double rowCount)
          Optimize any subqueries that haven't been optimized any where else.
 void pullOptPredicates(org.apache.derby.iapi.sql.compile.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(org.apache.derby.iapi.sql.compile.OptimizablePredicate optimizablePredicate)
          Push an OptimizablePredicate down, if this node accepts it.
 void rememberAsBest(int planType)
          Remember the current access path as the best one (so far).
 void rememberJoinStrategyAsBest(org.apache.derby.iapi.sql.compile.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(org.apache.derby.iapi.sql.compile.Optimizer optimizer)
          This method is called when this table is placed in a potential join order, or when a new conglomerate is being considered.
 void setAllColumnsProjected(boolean flag)
           
protected  void setCostEstimate(org.apache.derby.iapi.sql.compile.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
 void setLevel(int level)
          Set the (query block) level (0-based) for this FromTable.
 void setProperties(java.util.Properties tableProperties)
          Set the Properties list for this optimizalbe.
 void setTableNumber(int tableNumber)
          Set the table # for this table.
 void startOptimizing(org.apache.derby.iapi.sql.compile.Optimizer optimizer, org.apache.derby.iapi.sql.compile.RowOrdering rowOrdering)
          Begin the optimization process for this Optimizable.
 boolean supportsMultipleInstantiations()
          Tell whether this Optimizable can be instantiated multiple times
protected  void tellRowOrderingAboutConstantColumns(org.apache.derby.iapi.sql.compile.RowOrdering rowOrdering, org.apache.derby.iapi.sql.compile.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.
 FromTable transformOuterJoins(ValueNode predicateTree, int numTables)
          Transform any Outer Join into an Inner Join where applicable.
 double uniqueJoin(org.apache.derby.iapi.sql.compile.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 verifyProperties(org.apache.derby.iapi.sql.dictionary.DataDictionary dDictionary)
          Verify that the Properties list with optimizer overrides, if specified, is valid
 
Methods inherited from class org.apache.derby.impl.sql.compile.ResultSetNode
accept, addNewPredicate, assignResultSetNumber, bindExpressions, bindExpressionsWithTables, bindNonVTITables, bindResultColumns, bindResultColumns, bindTargetExpressions, bindUntypedNullsToResultColumns, bindVTITables, changeAccessPath, closeMethodArgument, columnTypesAndLengthsMatch, considerMaterialization, enhanceRCLForInsert, ensurePredicateList, flattenableInFromSubquery, generateNormalizationResultSet, generateResultSet, genNewRCForInsert, genNormalizeResultSetNode, genProjectRestrict, genProjectRestrict, genProjectRestrictForReordering, getAllResultColumns, getCostEstimate, getCursorTargetTable, getFinalCostEstimate, getFromList, getMatchingColumn, getNewCostEstimate, getOptimizer, getReferencedTableMap, getResultColumns, getResultSetNumber, isNotExists, isOneRowResultSet, isOrderedOn, isPossibleDistinctScan, isUpdatableCursor, LOJgetReferencedTables, makeResultDescription, makeResultDescriptors, markAsCursorTargetTable, markForDistinctScan, markOrderingDependent, markStatementResultSet, modifyAccessPaths, notCursorTargetTable, notFlattenableJoin, numDistinctAggregates, optimize, parseDefault, performMaterialization, preprocess, printSubNodes, projectResultColumns, pushOrderByList, referencesTarget, rejectParameters, rejectXMLValues, renameGeneratedResultNames, replaceDefaults, returnsAtMostOneRow, setInsertSource, setReferencedTableMap, setResultColumns, setResultToBooleanTrueNode, setTableConstructorTypes, subqueryReferencesTarget, updateTargetLockMode, verifySelectStarSubquery
 
Methods inherited from class org.apache.derby.impl.sql.compile.QueryTreeNode
bind, convertDefaultNode, debugFlush, debugPrint, executeSchemaName, executeStatementName, formatNodeString, foundString, generate, generate, generateAuthorizeCheck, getBeginOffset, getClassFactory, getCompilerContext, getContextManager, getCursorInfo, getDataDictionary, getDependencyManager, getEndOffset, getExecutionFactory, getGenericConstantActionFactory, getIntProperty, getLanguageConnectionContext, getNodeFactory, getNodeType, getNullNode, getParameterTypes, getRowEstimate, getSchemaDescriptor, getSchemaDescriptor, getSPSName, getStatementType, getTableDescriptor, getTypeCompiler, init, init, init, init, init, init, init, init, init, init, init, init, init, isAtomic, isInstanceOf, isSessionSchema, isSessionSchema, makeConstantAction, makeTableName, needsSavepoint, nodeHeader, optimize, parseQueryText, printLabel, referencesSessionSchema, resolveTableToSynonym, setBeginOffset, setContextManager, setEndOffset, setNodeType, setRefActionInfo, treePrint, treePrint, verifyClassExist
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.derby.iapi.sql.compile.Optimizable
getDataDictionary, getReferencedTableMap, getResultSetNumber
 

Field Detail

tableProperties

java.util.Properties tableProperties

correlationName

java.lang.String correlationName

corrTableName

TableName corrTableName

tableNumber

int tableNumber

level

int level

hashKeyColumns

int[] hashKeyColumns

initialCapacity

int initialCapacity

loadFactor

float loadFactor

maxCapacity

int maxCapacity

currentAccessPath

AccessPathImpl currentAccessPath

bestAccessPath

AccessPathImpl bestAccessPath

bestSortAvoidancePath

AccessPathImpl bestSortAvoidancePath

trulyTheBestAccessPath

AccessPathImpl trulyTheBestAccessPath

joinStrategyNumber

private int joinStrategyNumber

userSpecifiedJoinStrategy

protected java.lang.String userSpecifiedJoinStrategy

bestCostEstimate

protected org.apache.derby.iapi.sql.compile.CostEstimate bestCostEstimate

refCols

private org.apache.derby.iapi.services.io.FormatableBitSet refCols

perRowUsage

private double perRowUsage

considerSortAvoidancePath

private boolean considerSortAvoidancePath

allColumnsProjected

private boolean allColumnsProjected
Constructor Detail

FromTable

public FromTable()
Method Detail

areAllColumnsProjected

public boolean areAllColumnsProjected()

setAllColumnsProjected

public void setAllColumnsProjected(boolean flag)

init

public void init(java.lang.Object correlationName,
                 java.lang.Object tableProperties)
Initializer for a table in a FROM list.

Overrides:
init in class QueryTreeNode

optimizeIt

public org.apache.derby.iapi.sql.compile.CostEstimate optimizeIt(org.apache.derby.iapi.sql.compile.Optimizer optimizer,
                                                                 org.apache.derby.iapi.sql.compile.OptimizablePredicateList predList,
                                                                 org.apache.derby.iapi.sql.compile.CostEstimate outerCost,
                                                                 org.apache.derby.iapi.sql.compile.RowOrdering rowOrdering)
                                                          throws org.apache.derby.iapi.error.StandardException
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Choose the best access path for this Optimizable.

Specified by:
optimizeIt in interface org.apache.derby.iapi.sql.compile.Optimizable

nextAccessPath

public boolean nextAccessPath(org.apache.derby.iapi.sql.compile.Optimizer optimizer,
                              org.apache.derby.iapi.sql.compile.OptimizablePredicateList predList,
                              org.apache.derby.iapi.sql.compile.RowOrdering rowOrdering)
                       throws org.apache.derby.iapi.error.StandardException
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Choose the next access path to evaluate for this Optimizable.

Specified by:
nextAccessPath in interface org.apache.derby.iapi.sql.compile.Optimizable

canBeOrdered

protected boolean canBeOrdered()
Most Optimizables cannot be ordered


getCurrentAccessPath

public org.apache.derby.iapi.sql.compile.AccessPath getCurrentAccessPath()
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Get the current access path under consideration for this Optimizable

Specified by:
getCurrentAccessPath in interface org.apache.derby.iapi.sql.compile.Optimizable

getBestAccessPath

public org.apache.derby.iapi.sql.compile.AccessPath getBestAccessPath()
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Get the best access path for this Optimizable.

Specified by:
getBestAccessPath in interface org.apache.derby.iapi.sql.compile.Optimizable

getBestSortAvoidancePath

public org.apache.derby.iapi.sql.compile.AccessPath getBestSortAvoidancePath()
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Get the best sort-avoidance path for this Optimizable.

Specified by:
getBestSortAvoidancePath in interface org.apache.derby.iapi.sql.compile.Optimizable

getTrulyTheBestAccessPath

public org.apache.derby.iapi.sql.compile.AccessPath getTrulyTheBestAccessPath()
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Get the best access path overall for this Optimizable.

Specified by:
getTrulyTheBestAccessPath in interface org.apache.derby.iapi.sql.compile.Optimizable

rememberSortAvoidancePath

public void rememberSortAvoidancePath()
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Mark this optimizable so that its sort avoidance path will be considered.

Specified by:
rememberSortAvoidancePath in interface org.apache.derby.iapi.sql.compile.Optimizable

considerSortAvoidancePath

public boolean considerSortAvoidancePath()
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Check whether this optimizable's sort avoidance path should be considered.

Specified by:
considerSortAvoidancePath in interface org.apache.derby.iapi.sql.compile.Optimizable

rememberJoinStrategyAsBest

public void rememberJoinStrategyAsBest(org.apache.derby.iapi.sql.compile.AccessPath ap)
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Remember the current join strategy as the best one so far in this join order.

Specified by:
rememberJoinStrategyAsBest in interface org.apache.derby.iapi.sql.compile.Optimizable

getTableDescriptor

public org.apache.derby.iapi.sql.dictionary.TableDescriptor getTableDescriptor()
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Get the table descriptor for this table (if any). Only base tables have table descriptors - for the rest of the optimizables, this method returns null.

Specified by:
getTableDescriptor in interface org.apache.derby.iapi.sql.compile.Optimizable

pushOptPredicate

public boolean pushOptPredicate(org.apache.derby.iapi.sql.compile.OptimizablePredicate optimizablePredicate)
                         throws org.apache.derby.iapi.error.StandardException
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Push an OptimizablePredicate down, if this node accepts it.

Specified by:
pushOptPredicate in interface org.apache.derby.iapi.sql.compile.Optimizable

pullOptPredicates

public void pullOptPredicates(org.apache.derby.iapi.sql.compile.OptimizablePredicateList optimizablePredicates)
                       throws org.apache.derby.iapi.error.StandardException
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Pull all the OptimizablePredicates from this Optimizable and put them in the given OptimizablePredicateList.

Specified by:
pullOptPredicates in interface org.apache.derby.iapi.sql.compile.Optimizable

modifyAccessPath

public org.apache.derby.iapi.sql.compile.Optimizable modifyAccessPath(org.apache.derby.iapi.util.JBitSet outerTables)
                                                               throws org.apache.derby.iapi.error.StandardException
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Modify the access path for this Optimizable, as necessary. This includes things like adding a result set to translate from index rows to base rows

Specified by:
modifyAccessPath in interface org.apache.derby.iapi.sql.compile.Optimizable

isCoveringIndex

public boolean isCoveringIndex(org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor cd)
                        throws org.apache.derby.iapi.error.StandardException
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Return whether or not this is a covering index. We expect to call this during generation, after access path selection is complete.

Specified by:
isCoveringIndex in interface org.apache.derby.iapi.sql.compile.Optimizable

getProperties

public java.util.Properties getProperties()
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Get the Properties list, if any, associated with this optimizalbe.

Specified by:
getProperties in interface org.apache.derby.iapi.sql.compile.Optimizable

setProperties

public void setProperties(java.util.Properties tableProperties)
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Set the Properties list for this optimizalbe.

Specified by:
setProperties in interface org.apache.derby.iapi.sql.compile.Optimizable

verifyProperties

public void verifyProperties(org.apache.derby.iapi.sql.dictionary.DataDictionary dDictionary)
                      throws org.apache.derby.iapi.error.StandardException
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Verify that the Properties list with optimizer overrides, if specified, is valid

Specified by:
verifyProperties in interface org.apache.derby.iapi.sql.compile.Optimizable

getName

public java.lang.String getName()
                         throws org.apache.derby.iapi.error.StandardException
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Get the (exposed) name of this Optimizable

Specified by:
getName in interface org.apache.derby.iapi.sql.compile.Optimizable

getBaseTableName

public java.lang.String getBaseTableName()
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Get the table name of this Optimizable. Only base tables have table names (by the time we use this method, all views will have been resolved).

Specified by:
getBaseTableName in interface org.apache.derby.iapi.sql.compile.Optimizable

convertAbsoluteToRelativeColumnPosition

public int convertAbsoluteToRelativeColumnPosition(int absolutePosition)
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Convert an absolute to a relative 0-based column position. This is useful when generating qualifiers for partial rows from the store.

Specified by:
convertAbsoluteToRelativeColumnPosition in interface org.apache.derby.iapi.sql.compile.Optimizable

rememberAsBest

public void rememberAsBest(int planType)
                    throws org.apache.derby.iapi.error.StandardException
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Remember the current access path as the best one (so far).

Specified by:
rememberAsBest in interface org.apache.derby.iapi.sql.compile.Optimizable

startOptimizing

public void startOptimizing(org.apache.derby.iapi.sql.compile.Optimizer optimizer,
                            org.apache.derby.iapi.sql.compile.RowOrdering rowOrdering)
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Begin the optimization process for this Optimizable. This can be called many times for an Optimizable while optimizing a query - it will typically be called every time the Optimizable is placed in a potential join order.

Specified by:
startOptimizing in interface org.apache.derby.iapi.sql.compile.Optimizable

resetJoinStrategies

protected void resetJoinStrategies(org.apache.derby.iapi.sql.compile.Optimizer optimizer)
This method is called when this table is placed in a potential join order, or when a new conglomerate is being considered. Set this join strategy number to 0 to indicate that no join strategy has been considered for this table yet.


estimateCost

public org.apache.derby.iapi.sql.compile.CostEstimate estimateCost(org.apache.derby.iapi.sql.compile.OptimizablePredicateList predList,
                                                                   org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor cd,
                                                                   org.apache.derby.iapi.sql.compile.CostEstimate outerCost,
                                                                   org.apache.derby.iapi.sql.compile.Optimizer optimizer,
                                                                   org.apache.derby.iapi.sql.compile.RowOrdering rowOrdering)
                                                            throws org.apache.derby.iapi.error.StandardException
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Estimate the cost of scanning this Optimizable using the given predicate list with the given conglomerate. It is assumed that the predicate list has already been classified. This cost estimate is just for one scan, not for the life of the query.

Specified by:
estimateCost in interface org.apache.derby.iapi.sql.compile.Optimizable

isBaseTable

public boolean isBaseTable()
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Tell whether this Optimizable represents a base table

Specified by:
isBaseTable in interface org.apache.derby.iapi.sql.compile.Optimizable

isMaterializable

public boolean isMaterializable()
                         throws org.apache.derby.iapi.error.StandardException
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Tell whether this Optimizable is materializable

Specified by:
isMaterializable in interface org.apache.derby.iapi.sql.compile.Optimizable

supportsMultipleInstantiations

public boolean supportsMultipleInstantiations()
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Tell whether this Optimizable can be instantiated multiple times

Specified by:
supportsMultipleInstantiations in interface org.apache.derby.iapi.sql.compile.Optimizable

getTableNumber

public int getTableNumber()
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Get this Optimizable's table number

Specified by:
getTableNumber in interface org.apache.derby.iapi.sql.compile.Optimizable

hasTableNumber

public boolean hasTableNumber()
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Return true if this Optimizable has a table number

Specified by:
hasTableNumber in interface org.apache.derby.iapi.sql.compile.Optimizable

forUpdate

public boolean forUpdate()
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Return true if this is the target table of an update

Specified by:
forUpdate in interface org.apache.derby.iapi.sql.compile.Optimizable

initialCapacity

public int initialCapacity()
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Return the initial capacity of the hash table, for hash join strategy

Specified by:
initialCapacity in interface org.apache.derby.iapi.sql.compile.Optimizable

loadFactor

public float loadFactor()
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Return the load factor of the hash table, for hash join strategy

Specified by:
loadFactor in interface org.apache.derby.iapi.sql.compile.Optimizable

maxCapacity

public int maxCapacity(org.apache.derby.iapi.sql.compile.JoinStrategy joinStrategy,
                       int maxMemoryPerTable)
                throws org.apache.derby.iapi.error.StandardException
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Return the maximum capacity of the hash table, for hash join strategy

Specified by:
maxCapacity in interface org.apache.derby.iapi.sql.compile.Optimizable

getPerRowUsage

private double getPerRowUsage()
                       throws org.apache.derby.iapi.error.StandardException

hashKeyColumns

public int[] hashKeyColumns()
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Return the hash key column numbers, for hash join strategy

Specified by:
hashKeyColumns in interface org.apache.derby.iapi.sql.compile.Optimizable

setHashKeyColumns

public void setHashKeyColumns(int[] columnNumbers)
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Set the hash key column numbers, for hash join strategy

Specified by:
setHashKeyColumns in interface org.apache.derby.iapi.sql.compile.Optimizable

feasibleJoinStrategy

public boolean feasibleJoinStrategy(org.apache.derby.iapi.sql.compile.OptimizablePredicateList predList,
                                    org.apache.derby.iapi.sql.compile.Optimizer optimizer)
                             throws org.apache.derby.iapi.error.StandardException
Description copied from interface: org.apache.derby.iapi.sql.compile.Optimizable
Is the current proposed join strategy for this optimizable feasible given the predicate list?

Specified by:
feasibleJoinStrategy in interface org.apache.derby.iapi.sql.compile.Optimizable

memoryUsageOK

public boolean memoryUsageOK(double rowCount,
                             int maxMemoryPerTable)
                      throws org.apache.derby.iapi.error.StandardException
Specified by:
memoryUsageOK in interface org.apache.derby.iapi.sql.compile.Optimizable

legalJoinOrder

public boolean legalJoinOrder(org.apache.derby.iapi.util.JBitSet assignedTableMap)
Description copied from interf