com.metamatrix.query.processor.relational
Class PartitionedSortJoin

java.lang.Object
  extended by com.metamatrix.query.processor.relational.JoinStrategy
      extended by com.metamatrix.query.processor.relational.MergeJoinStrategy
          extended by com.metamatrix.query.processor.relational.PartitionedSortJoin

public class PartitionedSortJoin
extends MergeJoinStrategy

Extends the basic fully sorted merge join to check for conditions necessary to not fully sort one of the sides Will be used for inner joins and only if both sorts are not required. Degrades to a normal merge join if the tuples are balanced.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.metamatrix.query.processor.relational.MergeJoinStrategy
MergeJoinStrategy.SortOption
 
Field Summary
static int MAX_PARTITIONS
          This is a compromise between the max size of the smaller side and effective partitioning assuming that we only want to hold two batches in memory during partitioning.
 
Fields inherited from class com.metamatrix.query.processor.relational.MergeJoinStrategy
processingSortLeft, processingSortRight, sortLeft, sortRight
 
Fields inherited from class com.metamatrix.query.processor.relational.JoinStrategy
joinNode, leftSource, rightSource
 
Constructor Summary
PartitionedSortJoin(MergeJoinStrategy.SortOption sortLeft, MergeJoinStrategy.SortOption sortRight)
           
 
Method Summary
 int binarySearch(java.util.List<?> tuple, java.util.List[] tuples, int[] leftIndexes, int[] rightIndexes)
           
 java.lang.Object clone()
           
 void close()
           
 void computeBatchBounds(com.metamatrix.query.processor.relational.SourceState state)
           
 java.lang.String getName()
           
 void initialize(JoinNode joinNode)
           
protected  void loadLeft()
           
protected  void loadRight()
           
protected  java.util.List nextTuple()
           
protected  void postLoadLeft()
           
protected  void postLoadRight()
           
 
Methods inherited from class com.metamatrix.query.processor.relational.MergeJoinStrategy
compare, compareToPrevious, setProcessingSortRight, sortRight, toString
 
Methods inherited from class com.metamatrix.query.processor.relational.JoinStrategy
outputTuple
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_PARTITIONS

public static final int MAX_PARTITIONS
This is a compromise between the max size of the smaller side and effective partitioning assuming that we only want to hold two batches in memory during partitioning. TODO: apply partitioning recursively and/or have a better mechanism for buffermanager reserve/release of memory (would also help the sort utility)

See Also:
Constant Field Values
Constructor Detail

PartitionedSortJoin

public PartitionedSortJoin(MergeJoinStrategy.SortOption sortLeft,
                           MergeJoinStrategy.SortOption sortRight)
Method Detail

close

public void close()
           throws TupleSourceNotFoundException,
                  MetaMatrixComponentException
Overrides:
close in class MergeJoinStrategy
Throws:
TupleSourceNotFoundException
MetaMatrixComponentException
See Also:
JoinStrategy.close()

initialize

public void initialize(JoinNode joinNode)
                throws MetaMatrixComponentException
Overrides:
initialize in class MergeJoinStrategy
Throws:
MetaMatrixComponentException
See Also:
JoinStrategy.initialize(com.metamatrix.query.processor.relational.JoinNode)

computeBatchBounds

public void computeBatchBounds(com.metamatrix.query.processor.relational.SourceState state)
                        throws TupleSourceNotFoundException,
                               MetaMatrixComponentException
Throws:
TupleSourceNotFoundException
MetaMatrixComponentException

loadLeft

protected void loadLeft()
                 throws MetaMatrixComponentException,
                        MetaMatrixProcessingException
Overrides:
loadLeft in class MergeJoinStrategy
Throws:
MetaMatrixComponentException
MetaMatrixProcessingException
See Also:
JoinStrategy.loadLeft()

loadRight

protected void loadRight()
                  throws MetaMatrixComponentException,
                         MetaMatrixProcessingException
Overrides:
loadRight in class JoinStrategy
Throws:
MetaMatrixComponentException
MetaMatrixProcessingException

postLoadLeft

protected void postLoadLeft()
                     throws MetaMatrixComponentException,
                            MetaMatrixProcessingException
Overrides:
postLoadLeft in class MergeJoinStrategy
Throws:
MetaMatrixComponentException
MetaMatrixProcessingException

postLoadRight

protected void postLoadRight()
                      throws MetaMatrixComponentException,
                             MetaMatrixProcessingException
Overrides:
postLoadRight in class MergeJoinStrategy
Throws:
MetaMatrixComponentException
MetaMatrixProcessingException

nextTuple

protected java.util.List nextTuple()
                            throws MetaMatrixComponentException,
                                   CriteriaEvaluationException,
                                   MetaMatrixProcessingException
Overrides:
nextTuple in class MergeJoinStrategy
Throws:
MetaMatrixComponentException
CriteriaEvaluationException
MetaMatrixProcessingException

binarySearch

public int binarySearch(java.util.List<?> tuple,
                        java.util.List[] tuples,
                        int[] leftIndexes,
                        int[] rightIndexes)

clone

public java.lang.Object clone()
Overrides:
clone in class MergeJoinStrategy
See Also:
JoinStrategy.clone()

getName

public java.lang.String getName()
Overrides:
getName in class MergeJoinStrategy


Copyright © 2009. All Rights Reserved.