iterator
Class SortMerge
java.lang.Object
iterator.Iterator
iterator.SortMerge
- All Implemented Interfaces:
- Flags, GlobalConst
- public class SortMerge
- extends Iterator
- implements GlobalConst
This file contains the interface for the sort_merg joins.
We name the two relations being joined as R and S.
This file contains an implementation of the sort merge join
algorithm as described in the Shapiro paper. It makes use of the external
sorting utility to generate runs, and then uses the iterator interface to
get successive tuples for the final merge.
Fields inherited from interface global.GlobalConst |
INVALID_PAGE, MAX_NAME, MAX_SPACE, MAXATTRNAME, MAXFILENAME, MAXINDEXNAME, MINIBASE_BUFFER_POOL_SIZE, MINIBASE_DB_SIZE, MINIBASE_DEFAULT_SHAREDMEM_SIZE, MINIBASE_MAX_TRANSACTIONS, MINIBASE_MAXARRSIZE, MINIBASE_PAGESIZE, NUMBUF |
Constructor Summary |
SortMerge(AttrType[] in1,
int len_in1,
short[] s1_sizes,
AttrType[] in2,
int len_in2,
short[] s2_sizes,
int join_col_in1,
int sortFld1Len,
int join_col_in2,
int sortFld2Len,
int amt_of_mem,
Iterator am1,
Iterator am2,
boolean in1_sorted,
boolean in2_sorted,
TupleOrder order,
CondExpr[] outFilter,
FldSpec[] proj_list,
int n_out_flds)
constructor,initialization |
Method Summary |
void |
close()
implement the abstract method close() from super class Iterator
to finish cleaning up |
Tuple |
get_next()
The tuple is returned
All this function has to do is to get 1 tuple from one of the Iterators
(from both initially), use the sorting order to determine which one
gets sent up. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SortMerge
public SortMerge(AttrType[] in1,
int len_in1,
short[] s1_sizes,
AttrType[] in2,
int len_in2,
short[] s2_sizes,
int join_col_in1,
int sortFld1Len,
int join_col_in2,
int sortFld2Len,
int amt_of_mem,
Iterator am1,
Iterator am2,
boolean in1_sorted,
boolean in2_sorted,
TupleOrder order,
CondExpr[] outFilter,
FldSpec[] proj_list,
int n_out_flds)
throws JoinNewFailed,
JoinLowMemory,
SortException,
TupleUtilsException,
java.io.IOException
- constructor,initialization
- Parameters:
len_in1
- # of columns in Rs1_sizes
- shows the length of the string fields in R.len_in2
- # of columns in Ss2_sizes
- shows the length of the string fields in SsortFld1Len
- the length of sorted field in RsortFld2Len
- the length of sorted field in Sjoin_col_in1
- The col of R to be joined with Sjoin_col_in2
- the col of S to be joined with Ramt_of_mem
- IN PAGESam1
- access method for left input to joinam2
- access method for right input to joinin1_sorted
- is am1 sorted?in2_sorted
- is am2 sorted?order
- the order of the tuple: assending or desecnding?proj_list
- shows what input fields go where in the output tuplen_out_flds
- number of outer relation fileds
- Throws:
JoinNewFailed
- allocate failed
JoinLowMemory
- memory not enough
SortException
- exception from sorting
TupleUtilsException
- exception from using tuple utils
java.io.IOException
- some I/O fault
get_next
public Tuple get_next()
throws java.io.IOException,
JoinsException,
index.IndexException,
InvalidTupleSizeException,
InvalidTypeException,
PageNotReadException,
TupleUtilsException,
PredEvalException,
SortException,
LowMemException,
UnknowAttrType,
UnknownKeyTypeException,
java.lang.Exception
- This provides the next joined tuple.
- If there are no remaining joined tuples, null is returned.
- Specified by:
get_next
in class Iterator
- Returns:
- the joined tuple is returned
- Throws:
java.io.IOException
- I/O errors
JoinsException
- some join exception
index.IndexException
- exception from super class
InvalidTupleSizeException
- invalid tuple size
InvalidTypeException
- tuple type not valid
PageNotReadException
- exception from lower layer
TupleUtilsException
- exception from using tuple utilities
PredEvalException
- exception from PredEval class
SortException
- sort exception
LowMemException
- memory error
UnknowAttrType
- attribute type unknown
UnknownKeyTypeException
- key type unknown
java.lang.Exception
- other exceptions
close
public void close()
throws JoinsException,
java.io.IOException,
index.IndexException
- implement the abstract method close() from super class Iterator
to finish cleaning up
- Specified by:
close
in class Iterator
- Throws:
java.io.IOException
- I/O error from lower layers
JoinsException
- join error from lower layers
index.IndexException
- index access error