JoinStrategy
class HashJoinStrategy extends BaseJoinStrategy
Constructor | Description |
---|---|
HashJoinStrategy() |
Modifier and Type | Method | Description |
---|---|---|
void |
divideUpPredicateLists(Optimizable innerTable,
OptimizablePredicateList originalRestrictionList,
OptimizablePredicateList storeRestrictionList,
OptimizablePredicateList nonStoreRestrictionList,
OptimizablePredicateList requalificationRestrictionList,
DataDictionary dd) |
Divide up the predicates into different lists for different phases
of the operation.
|
boolean |
doesMaterialization() |
Is materialization built in to the join strategy?
|
void |
estimateCost(Optimizable innerTable,
OptimizablePredicateList predList,
ConglomerateDescriptor cd,
CostEstimate outerCost,
Optimizer optimizer,
CostEstimate costEstimate) |
Get the estimated cost for the join.
|
boolean |
feasible(Optimizable innerTable,
OptimizablePredicateList predList,
Optimizer optimizer) |
Is this join strategy feasible under the circumstances?
|
private int[] |
findHashKeyColumns(Optimizable innerTable,
ConglomerateDescriptor cd,
OptimizablePredicateList predList) |
Find the hash key columns, if any, to use with this join.
|
OptimizablePredicateList |
getBasePredicates(OptimizablePredicateList predList,
OptimizablePredicateList basePredicates,
Optimizable innerTable) |
Get the base predicates for this join strategy.
|
java.lang.String |
getName() |
Get the name of this join strategy
|
java.lang.String |
getOperatorSymbol() |
Get the operator symbol used to represent this join strategy in optimizer traces
|
int |
getScanArgs(TransactionController tc,
MethodBuilder mb,
Optimizable innerTable,
OptimizablePredicateList storeRestrictionList,
OptimizablePredicateList nonStoreRestrictionList,
ExpressionClassBuilderInterface acbi,
int bulkFetch,
int resultRowTemplate,
int colRefItem,
int indexColItem,
int lockMode,
boolean tableLocked,
int isolationLevel,
int maxMemoryPerTable,
boolean genInListVals) |
Get the appropriate arguments to the scan for this type of join.
|
java.lang.String |
halfOuterJoinResultSetMethodName() |
Get the name of the join result set method for the half outerjoin
|
boolean |
ignoreBulkFetch() |
Should we just ignore bulk fetch with this join strategy?
|
boolean |
isHashJoin() |
Is this a form of hash join?
|
java.lang.String |
joinResultSetMethodName() |
Get the name of the join result set method for the join
|
int |
maxCapacity(int userSpecifiedCapacity,
int maxMemoryPerTable,
double perRowUsage) |
|
boolean |
multiplyBaseCostByOuterRows() |
Returns true if the base cost of scanning the conglomerate should be
multiplied by the number of outer rows.
|
double |
nonBasePredicateSelectivity(Optimizable innerTable,
OptimizablePredicateList predList) |
Get the extra selectivity of the non-base predicates (those that were
left in the predicate list by getBasePredicates() that are not
applied to the scan of the base conglomerate.
|
void |
putBasePredicates(OptimizablePredicateList predList,
OptimizablePredicateList basePredicates) |
Put back and base predicates that were removed from the list by
getBasePredicates (see above).
|
java.lang.String |
resultSetMethodName(boolean bulkFetch,
boolean multiprobe,
boolean validatingCheckConstraint) |
Get the name of the result set method for base table scans
|
int |
scanCostType() |
Get the costing type, for use with StoreCostController.getScanCost
|
java.lang.String |
toString() |
bulkFetchOK, fillInScanArgs1, fillInScanArgs2, validForOutermostTable
public boolean feasible(Optimizable innerTable, OptimizablePredicateList predList, Optimizer optimizer) throws StandardException
JoinStrategy
innerTable
- The inner table of the joinpredList
- The predicateList for the joinoptimizer
- The optimizer to useStandardException
- Thrown on errorJoinStrategy.feasible(org.apache.derby.iapi.sql.compile.Optimizable, org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.compile.Optimizer)
public boolean ignoreBulkFetch()
JoinStrategy
ignoreBulkFetch
in interface JoinStrategy
ignoreBulkFetch
in class BaseJoinStrategy
JoinStrategy.ignoreBulkFetch()
public boolean multiplyBaseCostByOuterRows()
JoinStrategy
public OptimizablePredicateList getBasePredicates(OptimizablePredicateList predList, OptimizablePredicateList basePredicates, Optimizable innerTable) throws StandardException
JoinStrategy
predList
- The predicate list to pull from.basePredicates
- The list to put the base predicates in.innerTable
- The inner table of the joinStandardException
- Thrown on errorJoinStrategy.getBasePredicates(org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.compile.Optimizable)
public double nonBasePredicateSelectivity(Optimizable innerTable, OptimizablePredicateList predList) throws StandardException
JoinStrategy
innerTable
- The inner table of the join.predList
- The original predicate list that was passed to
getBasePredicates(), from which some base predicates
may have been pulled.StandardException
JoinStrategy.nonBasePredicateSelectivity(org.apache.derby.iapi.sql.compile.Optimizable, org.apache.derby.iapi.sql.compile.OptimizablePredicateList)
public void putBasePredicates(OptimizablePredicateList predList, OptimizablePredicateList basePredicates) throws StandardException
JoinStrategy
predList
- The list of predicates to put the base predicates
back in.basePredicates
- The base predicates to put back in the list.StandardException
- Thrown on errorJoinStrategy.putBasePredicates(org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.compile.OptimizablePredicateList)
public void estimateCost(Optimizable innerTable, OptimizablePredicateList predList, ConglomerateDescriptor cd, CostEstimate outerCost, Optimizer optimizer, CostEstimate costEstimate)
JoinStrategy
innerTable
- The inner table to join withpredList
- The predicate list for the joincd
- The conglomerate descriptor (if appropriate) to get
the cost ofouterCost
- The estimated cost of the part of the plan outer
to the inner tableoptimizer
- The optimizer to use to help estimate the costcostEstimate
- The estimated cost of doing a single scan of the
inner table, to be filled in with the cost of
doing the join.JoinStrategy.estimateCost(org.apache.derby.iapi.sql.compile.Optimizable, 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.CostEstimate)
public int maxCapacity(int userSpecifiedCapacity, int maxMemoryPerTable, double perRowUsage)
maxMemoryPerTable
- maximum number of bytes per tableperRowUsage
- number of bytes per rowJoinStrategy.maxCapacity(int, int, double)
public java.lang.String getName()
JoinStrategy
JoinStrategy.getName()
public int scanCostType()
JoinStrategy
JoinStrategy.scanCostType()
public java.lang.String getOperatorSymbol()
JoinStrategy
JoinStrategy.getOperatorSymbol()
public java.lang.String resultSetMethodName(boolean bulkFetch, boolean multiprobe, boolean validatingCheckConstraint)
JoinStrategy
bulkFetch
- True means bulk fetch is being done on the inner tablemultiprobe
- True means we are probing the inner table for rows
matching a specified list of values.validatingCheckConstraint
- True of this is a special scan to
validate a check constraint.JoinStrategy.resultSetMethodName(boolean, boolean, boolean)
public java.lang.String joinResultSetMethodName()
JoinStrategy
JoinStrategy.joinResultSetMethodName()
public java.lang.String halfOuterJoinResultSetMethodName()
JoinStrategy
public int getScanArgs(TransactionController tc, MethodBuilder mb, Optimizable innerTable, OptimizablePredicateList storeRestrictionList, OptimizablePredicateList nonStoreRestrictionList, ExpressionClassBuilderInterface acbi, int bulkFetch, int resultRowTemplate, int colRefItem, int indexColItem, int lockMode, boolean tableLocked, int isolationLevel, int maxMemoryPerTable, boolean genInListVals) throws StandardException
JoinStrategy
tc
- The TransactionControllermb
- The method to generate the arguments ininnerTable
- The inner table of the joinstoreRestrictionList
- The predicate list to be evaluated in the
storenonStoreRestrictionList
- The predicate list to be evaluated
outside of the storeacbi
- The expression class builder for the activation class
we're buildingbulkFetch
- The amount of bulk fetch to doresultRowTemplate
- The saved object index of a result row templatecolRefItem
- The item number of the column reference bit maplockMode
- The lock mode to use when scanning the table
(see TransactionController).tableLocked
- Whether or not the table is marked (in sys.systables)
as always using table lockingisolationLevel
- Isolation level specified (or not) for scansmaxMemoryPerTable
- Max memory per tablegenInListVals
- Whether or not we are going to generate IN-list
values with which to probe the inner table.StandardException
- Thrown on errorJoinStrategy.getScanArgs(org.apache.derby.iapi.store.access.TransactionController, org.apache.derby.iapi.services.compiler.MethodBuilder, org.apache.derby.iapi.sql.compile.Optimizable, org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.compile.ExpressionClassBuilderInterface, int, int, int, int, int, boolean, int, int, boolean)
public void divideUpPredicateLists(Optimizable innerTable, OptimizablePredicateList originalRestrictionList, OptimizablePredicateList storeRestrictionList, OptimizablePredicateList nonStoreRestrictionList, OptimizablePredicateList requalificationRestrictionList, DataDictionary dd) throws StandardException
JoinStrategy
innerTable
- The inner table of the joinoriginalRestrictionList
- Initially contains all predicates.
This method removes predicates from
this list and moves them to other
lists, as appropriate.storeRestrictionList
- To be filled in with predicates to
be pushed down to store.nonStoreRestrictionList
- To be filled in with predicates
that are not pushed down to the
store.requalificationRestrictionList
- Copy of predicates used to
re-qualify rows, if necessary.dd
- The DataDictionaryStandardException
- Thrown on errorJoinStrategy.divideUpPredicateLists(org.apache.derby.iapi.sql.compile.Optimizable, org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.compile.OptimizablePredicateList, org.apache.derby.iapi.sql.dictionary.DataDictionary)
public boolean isHashJoin()
JoinStrategy
isHashJoin
in interface JoinStrategy
isHashJoin
in class BaseJoinStrategy
JoinStrategy.isHashJoin()
public boolean doesMaterialization()
JoinStrategy
JoinStrategy.doesMaterialization()
private int[] findHashKeyColumns(Optimizable innerTable, ConglomerateDescriptor cd, OptimizablePredicateList predList) throws StandardException
innerTable
- The inner table of the joincd
- The conglomerate descriptor to use on inner tablepredList
- The predicate list to look for the equijoin inStandardException
- Thrown on errorpublic java.lang.String toString()
toString
in class java.lang.Object
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.