hi..below is the code for implementing hash join algorithm for a DBMS..i wanted to know is it possible to approach the algorithm via a different logic or make some changes to it...
public void open() throws DBException {
hashTable = new HashMap<String, LinkedList<Object[]>>();
results = new LinkedList<Object[]>();
jcond.getLHSAttr().getAttrName();

Object[] lrow;


POP left = (POP)this.getLeftChild();
POP right = (POP)this.getLeftChild();
int lJoinIndex = findAttrIndex(left.getAttributes(), jcond.getLHSAttr().getAttrName());
int rJoinIndex = findAttrIndex(right.getAttributes(), jcond.getRHSAttr().getAttrName());

while((lrow = left.next()) != null){
if(sizeCounter <= max_size ){
if (!hashTable.keySet().contains(lrow[lJoinIndex])){
hashTable.put(String.valueOf(lrow[lJoinIndex]), new LinkedList<Object[]>());
}
sizeCounter++;
hashTable.get(String.valueOf(lrow[lJoinIndex])).add(lrow);

}else
performJoin(right, lJoinIndex, rJoinIndex);
}
if (hashTable.size() != 0 )
performJoin(right, lJoinIndex, rJoinIndex);

left.close();
}

private void performJoin(POP right, int lJoinIndex, int rJoinIndex) throws DBException{
Object[] rrow;
right.open();
while((rrow = right.next()) != null){
if(hashTable.keySet().contains(String.valueOf(rrow[rJoinIndex]))){
for(Object[] obj : hashTable.get(rrow[rJoinIndex])){
if(jcond.evaluate(obj[lJoinIndex], rrow[rJoinIndex])){
results.add(rrow);
}
}
}
}
right.close();
hashTable.clear();
sizeCounter = 0;
}

private int findAttrIndex(AttrInfo[] attrs, String attrName){
for(int i = 0 ; i < attrs.length; i++){
if(attrs[i].getAttrName().equalsIgnoreCase(attrName)){
return i;
}
}
return -1;
}

public SMHashJoin(Condition jcond) {
this.jcond = jcond;
sizeCounter=0;
}

@Override
public Object[] next() throws DBException {
// Put the left relation in the Hash table based on the hash table sixe
if (results.size() > 0)
return results.pop();
return null;