Class MergeJoinStrategy
- java.lang.Object
-
- org.teiid.query.processor.relational.JoinStrategy
-
- org.teiid.query.processor.relational.MergeJoinStrategy
-
- Direct Known Subclasses:
EnhancedSortMergeJoinStrategy
,NestedLoopJoinStrategy
public class MergeJoinStrategy extends JoinStrategy
MergeJoinStrategy supports generalized Full, Left Outer, and Inner Joins (containing non-equi join criteria) as long as there is at least one equi-join criteria Additionally supports Semi and Anti-Semi Joins. These too allow for generalized non-equi join criteria. TODO: when there is no non-equi join criteria matching duplicates from the outer side can be output immediately TODO: semi joins should only output left tuples Support for Intersect and Except is controlled by the grouping flag, which changes comparisons to check for null equality.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MergeJoinStrategy.SortOption
-
Field Summary
Fields Modifier and Type Field Description protected MergeJoinStrategy.SortOption
processingSortLeft
protected MergeJoinStrategy.SortOption
processingSortRight
protected boolean
singleMatch
false if default processing, true if only a single outer match is allowedprotected MergeJoinStrategy.SortOption
sortLeft
protected MergeJoinStrategy.SortOption
sortRight
-
Fields inherited from class org.teiid.query.processor.relational.JoinStrategy
joinNode, leftSource, reserved, rightSource
-
-
Constructor Summary
Constructors Constructor Description MergeJoinStrategy(MergeJoinStrategy.SortOption sortLeft, MergeJoinStrategy.SortOption sortRight, boolean grouping)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MergeJoinStrategy
clone()
void
close()
protected int
compare(List leftProbe, List rightProbe, int[] leftExpressionIndecies, int[] rightExpressionIndecies)
protected boolean
compareToPrevious(org.teiid.query.processor.relational.SourceState target)
static int
compareTuples(List<?> leftProbe, List<?> rightProbe, int[] leftExpressionIndecies, int[] rightExpressionIndecies, boolean nullEquals, boolean columnDiff)
0 if the values match positive if right is greater than left negative if left is greater than right In column diff mode, return -1 if the they are the same else return the index where they differString
getName()
void
initialize(JoinNode joinNode)
protected void
loadLeft()
protected void
loadRight()
protected void
process()
protected void
resetMatchState()
void
setProcessingSortLeft(boolean processingSortLeft)
void
setProcessingSortRight(boolean processingSortRight)
MergeJoinStrategy
singleMatch(boolean b)
Optional flag for a left outer join to enforce the single row restriction of a scalar subqueryString
toString()
-
Methods inherited from class org.teiid.query.processor.relational.JoinStrategy
openLeft, openRight, outputTuple
-
-
-
-
Field Detail
-
sortLeft
protected MergeJoinStrategy.SortOption sortLeft
-
sortRight
protected MergeJoinStrategy.SortOption sortRight
-
singleMatch
protected boolean singleMatch
false if default processing, true if only a single outer match is allowed
-
processingSortLeft
protected MergeJoinStrategy.SortOption processingSortLeft
-
processingSortRight
protected MergeJoinStrategy.SortOption processingSortRight
-
-
Constructor Detail
-
MergeJoinStrategy
public MergeJoinStrategy(MergeJoinStrategy.SortOption sortLeft, MergeJoinStrategy.SortOption sortRight, boolean grouping)
-
-
Method Detail
-
clone
public MergeJoinStrategy clone()
- Specified by:
clone
in classJoinStrategy
- See Also:
JoinStrategy.clone()
-
initialize
public void initialize(JoinNode joinNode)
- Overrides:
initialize
in classJoinStrategy
- See Also:
JoinStrategy.initialize(org.teiid.query.processor.relational.JoinNode)
-
resetMatchState
protected void resetMatchState()
-
close
public void close()
- Overrides:
close
in classJoinStrategy
- See Also:
JoinStrategy.close()
-
process
protected void process() throws TeiidComponentException, TeiidProcessingException
- Specified by:
process
in classJoinStrategy
- Throws:
TeiidComponentException
TeiidProcessingException
-
compareToPrevious
protected boolean compareToPrevious(org.teiid.query.processor.relational.SourceState target) throws TeiidComponentException, TeiidProcessingException
-
compare
protected int compare(List leftProbe, List rightProbe, int[] leftExpressionIndecies, int[] rightExpressionIndecies)
-
compareTuples
public static int compareTuples(List<?> leftProbe, List<?> rightProbe, int[] leftExpressionIndecies, int[] rightExpressionIndecies, boolean nullEquals, boolean columnDiff)
0 if the values match positive if right is greater than left negative if left is greater than right In column diff mode, return -1 if the they are the same else return the index where they differ- Parameters:
leftProbe
-rightProbe
-leftExpressionIndecies
-rightExpressionIndecies
-nullEquals
-columnDiff
-- Returns:
-
loadLeft
protected void loadLeft() throws TeiidComponentException, TeiidProcessingException
- Overrides:
loadLeft
in classJoinStrategy
- Throws:
TeiidComponentException
TeiidProcessingException
-
loadRight
protected void loadRight() throws TeiidComponentException, TeiidProcessingException
- Overrides:
loadRight
in classJoinStrategy
- Throws:
TeiidComponentException
TeiidProcessingException
-
setProcessingSortRight
public void setProcessingSortRight(boolean processingSortRight)
-
setProcessingSortLeft
public void setProcessingSortLeft(boolean processingSortLeft)
-
getName
public String getName()
-
toString
public String toString()
- Overrides:
toString
in classObject
- See Also:
Object.toString()
-
singleMatch
public MergeJoinStrategy singleMatch(boolean b)
Optional flag for a left outer join to enforce the single row restriction of a scalar subquery
-
-