iterator
Class NestedLoopsJoins

java.lang.Object
  extended byiterator.Iterator
      extended byiterator.NestedLoopsJoins
All Implemented Interfaces:
Flags

public class NestedLoopsJoins
extends Iterator

This file contains an implementation of the nested loops join algorithm as described in the Shapiro paper. The algorithm is extremely simple: foreach tuple r in R do foreach tuple s in S do if (ri == sj) then add (r, s) to the result.


Field Summary
 
Fields inherited from class iterator.Iterator
closeFlag
 
Fields inherited from interface global.Flags
DEBUG, TEST
 
Constructor Summary
NestedLoopsJoins(AttrType[] in1, int len_in1, short[] t1_str_sizes, AttrType[] in2, int len_in2, short[] t2_str_sizes, int amt_of_mem, Iterator am1, java.lang.String relationName, CondExpr[] outFilter, CondExpr[] rightFilter, FldSpec[] proj_list, int n_out_flds)
          constructor Initialize the two relations which are joined, including relation type,
 
Method Summary
 void close()
          implement the abstract method close() from super class Iterator to finish cleaning up
 Tuple get_next()
          abstract method, every subclass must implement it.
 
Methods inherited from class iterator.Iterator
free_buffer_pages, get_buffer_pages
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NestedLoopsJoins

public NestedLoopsJoins(AttrType[] in1,
                        int len_in1,
                        short[] t1_str_sizes,
                        AttrType[] in2,
                        int len_in2,
                        short[] t2_str_sizes,
                        int amt_of_mem,
                        Iterator am1,
                        java.lang.String relationName,
                        CondExpr[] outFilter,
                        CondExpr[] rightFilter,
                        FldSpec[] proj_list,
                        int n_out_flds)
                 throws java.io.IOException,
                        NestedLoopException
constructor Initialize the two relations which are joined, including relation type,

Parameters:
in1 - Array containing field types of R.
len_in1 - # of columns in R.
t1_str_sizes - shows the length of the string fields.
in2 - Array containing field types of S
len_in2 - # of columns in S
t2_str_sizes - shows the length of the string fields.
amt_of_mem - IN PAGES
am1 - access method for left i/p to join
relationName - access hfapfile for right i/p to join
outFilter - select expressions
rightFilter - reference to filter applied on right i/p
proj_list - shows what input fields go where in the output tuple
n_out_flds - number of outer relation fileds
Throws:
java.io.IOException - some I/O fault
NestedLoopException - exception from this class
Method Detail

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
Description copied from class: Iterator
abstract method, every subclass must implement it.

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