|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.lucidera.opt.LoptMultiJoin
public class LoptMultiJoin
LoptMultiJoin is a utility class used to keep track of the join factors that make up a MultiJoinRel.
Nested Class Summary | |
---|---|
private class |
LoptMultiJoin.RemovableSelfJoin
Utility class used to keep track of the factors in a removable self-join. |
Field Summary | |
---|---|
private List<RexNode> |
allJoinFilters
All join filters associated with the MultiJoinRel, decomposed into a list. |
(package private) BitSet[] |
factorsRefByFactor
Bitmap indicating which factors each factor references in join filters that correspond to comparisons |
private Map<RexNode,BitSet> |
factorsRefByJoinFilter
For each join filter, associates a bitmap indicating all factors referenced by the filter |
(package private) int[][] |
factorWeights
Weights of each factor combination |
(package private) RelDataTypeFactory |
factory
Type factory |
private Map<RexNode,BitSet> |
fieldsRefByJoinFilter
For each join filter, associates a bitmap indicating all fields referenced by the filter |
private RelNode[] |
joinFactors
Original inputs into the MultiJoinRel |
private Map<Integer,int[]> |
joinFieldRefCountsMap
Map containing reference counts of the fields referenced in join conditions for each join factor. |
private List<RexNode> |
joinFilters
Join filters associated with the MultiJoinRel, decomposed into a list. |
(package private) Integer[] |
joinRemovalFactors
Indicates for each factor whether its join can be removed because it is the dimension table in a semijoin. |
(package private) SemiJoinRel[] |
joinRemovalSemiJoins
The semijoins that allow the join of a dimension table to be removed |
(package private) int[] |
joinStart
Starting RexInputRef index corresponding to each join factor |
private JoinRelType[] |
joinTypes
If a join factor is null generating in a left or right outer join, joinTypes indicates the join type corresponding to the factor. |
(package private) MultiJoinRel |
multiJoin
The MultiJoinRel being optimized |
(package private) int[] |
nFieldsInJoinFactor
Number of fields in each join factor |
private int |
nJoinFactors
Number of factors into the MultiJoinRel |
private int |
nTotalFields
Total number of fields in the MultiJoinRel |
private BitSet[] |
outerJoinFactors
If a join factor is null generating in a left or right outer join, the bitmap contains the non-null generating factors that the null generating factor is dependent upon |
private BitSet[] |
projFields
Bitmap corresponding to the fields projected from each join factor, after row scan processing has completed. |
(package private) Set<Integer> |
removableOuterJoinFactors
Set of null-generating factors whose corresponding outer join can be removed from the query plan |
(package private) Map<Integer,LoptMultiJoin.RemovableSelfJoin> |
removableSelfJoinPairs
Map consisting of all pairs of self-joins where the self-join can be removed because the join between the identical factors is an equality join on the same set of unique keys. |
Constructor Summary | |
---|---|
LoptMultiJoin(MultiJoinRel multiJoin)
|
Method Summary | |
---|---|
void |
addRemovableOuterJoinFactor(int factIdx)
Adds a join factor to the set of factors that can be removed because the factor is the null generating factor in an outer join, its join keys are unique, and the factor is not projected in the query |
void |
addRemovableSelfJoinPair(int factor1,
int factor2)
Adds to a map that keeps track of removable self-join pairs. |
int |
findRef(int rexInputRef)
Determines the join factor corresponding to a RexInputRef |
void |
getChildFactors(LoptJoinTree joinTree,
BitSet childFactors)
Sets a bitmap indicating all child RelNodes in a join tree |
BitSet |
getFactorsRefByFactor(int factIdx)
|
BitSet |
getFactorsRefByJoinFilter(RexNode joinFilter)
|
int[][] |
getFactorWeights()
|
BitSet |
getFieldsRefByJoinFilter(RexNode joinFilter)
|
RelNode |
getJoinFactor(int factIdx)
|
int[] |
getJoinFieldRefCounts(int factIdx)
|
RelDataTypeField[] |
getJoinFields(LoptJoinTree left,
LoptJoinTree right)
Retrieves the fields corresponding to a join between a left and right tree |
private BitSet |
getJoinFilterFactorBitmap(RexNode joinFilter,
boolean setFields)
Returns a bitmap representing the factors referenced in a join filter |
List<RexNode> |
getJoinFilters()
|
Integer |
getJoinRemovalFactor(int dimIdx)
|
SemiJoinRel |
getJoinRemovalSemiJoin(int dimIdx)
|
int |
getJoinStart(int factIdx)
|
RelDataTypeField[] |
getMultiJoinFields()
|
MultiJoinRel |
getMultiJoinRel()
|
int |
getNumFieldsInJoinFactor(int factIdx)
|
int |
getNumJoinFactors()
|
int |
getNumTotalFields()
|
Integer |
getOtherSelfJoinFactor(int factIdx)
|
RexNode |
getOuterJoinCond(int factIdx)
|
BitSet |
getOuterJoinFactors(int factIdx)
|
BitSet |
getProjFields(int factIdx)
|
Integer |
getRightColumnMapping(int rightFactor,
int rightOffset)
Determines whether there is a mapping from a column in the right factor of a self-join to a column from the left factor. |
boolean |
hasAllFactors(LoptJoinTree joinTree,
BitSet factorsNeeded)
Returns true if a join tree contains all factors required |
boolean |
isLeftFactorInRemovableSelfJoin(int factIdx)
|
boolean |
isNullGenerating(int factIdx)
|
boolean |
isRemovableOuterJoinFactor(int factIdx)
|
boolean |
isRightFactorInRemovableSelfJoin(int factIdx)
|
private void |
setFactorBitmap(BitSet factorRefBitmap,
BitSet fieldRefBitmap)
Sets the bitmap indicating which factors a filter references based on which fields it references |
private void |
setFactorWeight(int weight,
int leftFactor,
int rightFactor)
Sets an individual weight if the new weight is better than the current one |
void |
setFactorWeights()
Sets weighting for each combination of factors, depending on which join filters reference which factors. |
void |
setFieldBitmap(LoptJoinTree rel,
BitSet fields)
Sets a bitmap representing all fields corresponding to a RelNode |
private void |
setJoinFilterRefs()
Sets bitmaps indicating which factors and fields each join filter references |
void |
setJoinRemovalFactor(int dimIdx,
int factIdx)
Indicates that a dimension factor's join can be removed because of a semijoin with a fact table. |
void |
setJoinRemovalSemiJoin(int dimIdx,
SemiJoinRel semiJoin)
Indicates the semijoin that allows the join of a dimension table to be removed |
private void |
setOuterJoinInfo()
Extracts outer join information from the join factors, including the type of outer join and the factors that a null-generating factor is dependent upon. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
MultiJoinRel multiJoin
private List<RexNode> joinFilters
private List<RexNode> allJoinFilters
private int nJoinFactors
private int nTotalFields
private RelNode[] joinFactors
private JoinRelType[] joinTypes
private BitSet[] outerJoinFactors
private BitSet[] projFields
private Map<Integer,int[]> joinFieldRefCountsMap
private Map<RexNode,BitSet> factorsRefByJoinFilter
private Map<RexNode,BitSet> fieldsRefByJoinFilter
int[] joinStart
int[] nFieldsInJoinFactor
BitSet[] factorsRefByFactor
int[][] factorWeights
RelDataTypeFactory factory
Integer[] joinRemovalFactors
SemiJoinRel[] joinRemovalSemiJoins
Set<Integer> removableOuterJoinFactors
Map<Integer,LoptMultiJoin.RemovableSelfJoin> removableSelfJoinPairs
Constructor Detail |
---|
public LoptMultiJoin(MultiJoinRel multiJoin)
Method Detail |
---|
public MultiJoinRel getMultiJoinRel()
public int getNumJoinFactors()
public RelNode getJoinFactor(int factIdx)
factIdx
- factor to be returned
public int getNumTotalFields()
public int getNumFieldsInJoinFactor(int factIdx)
factIdx
- desired factor
public List<RexNode> getJoinFilters()
public BitSet getFactorsRefByJoinFilter(RexNode joinFilter)
joinFilter
- filter for which information will be returned
public RelDataTypeField[] getMultiJoinFields()
public BitSet getFieldsRefByJoinFilter(RexNode joinFilter)
joinFilter
- the filter for which information will be returned
public int[][] getFactorWeights()
public BitSet getFactorsRefByFactor(int factIdx)
factIdx
- factor for which information will be returned
public int getJoinStart(int factIdx)
factIdx
- factor for which information will be returned
public boolean isNullGenerating(int factIdx)
factIdx
- factor for which information will be returned
public BitSet getOuterJoinFactors(int factIdx)
factIdx
- factor for which information will be returned
public RexNode getOuterJoinCond(int factIdx)
factIdx
- factor for which information will be returned
public BitSet getProjFields(int factIdx)
factIdx
- factor for which information will be returned
public int[] getJoinFieldRefCounts(int factIdx)
factIdx
- factor for which information will be returned
public Integer getJoinRemovalFactor(int dimIdx)
dimIdx
- the dimension factor for which information will be returned
public SemiJoinRel getJoinRemovalSemiJoin(int dimIdx)
dimIdx
- the dimension factor for which information will be returned
public void setJoinRemovalFactor(int dimIdx, int factIdx)
dimIdx
- id of the dimension factorfactIdx
- id of the fact factorpublic void setJoinRemovalSemiJoin(int dimIdx, SemiJoinRel semiJoin)
dimIdx
- id of the dimension factorsemiJoin
- the semijoinprivate void setOuterJoinInfo()
private BitSet getJoinFilterFactorBitmap(RexNode joinFilter, boolean setFields)
joinFilter
- the join filtersetFields
- if true, add the fields referenced by the join filter
into a map
private void setJoinFilterRefs()
private void setFactorBitmap(BitSet factorRefBitmap, BitSet fieldRefBitmap)
factorRefBitmap
- bitmap representing factors referenced that will
be set by this methodfieldRefBitmap
- bitmap representing fields referencedpublic int findRef(int rexInputRef)
rexInputRef
- rexInputRef index
public void setFactorWeights()
private void setFactorWeight(int weight, int leftFactor, int rightFactor)
weight
- weight to be setleftFactor
- index of left factorrightFactor
- index of right factorpublic boolean hasAllFactors(LoptJoinTree joinTree, BitSet factorsNeeded)
joinTree
- join tree to be examinedfactorsNeeded
- bitmap of factors required
public void setFieldBitmap(LoptJoinTree rel, BitSet fields)
rel
- relnode for which fields will be setfields
- bitmap containing set bits for each field in a RelNodepublic void getChildFactors(LoptJoinTree joinTree, BitSet childFactors)
joinTree
- join tree to be examinedchildFactors
- bitmap to be setpublic RelDataTypeField[] getJoinFields(LoptJoinTree left, LoptJoinTree right)
left
- left hand side of the joinright
- right hand side of the join
public void addRemovableOuterJoinFactor(int factIdx)
factIdx
- join factorpublic boolean isRemovableOuterJoinFactor(int factIdx)
factIdx
- factor in question
public void addRemovableSelfJoinPair(int factor1, int factor2)
factor1
- one of the factors in the self-joinfactor2
- the second factor in the self-joinpublic Integer getOtherSelfJoinFactor(int factIdx)
public boolean isLeftFactorInRemovableSelfJoin(int factIdx)
factIdx
- factor in a self-join
public boolean isRightFactorInRemovableSelfJoin(int factIdx)
factIdx
- factor in a self-join
public Integer getRightColumnMapping(int rightFactor, int rightOffset)
rightFactor
- the index of the right factorrightOffset
- the column offset of the right factor
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |