tupleschema *def = (tupleschema *) this;
tuple *kp = (tuple*) key;
int i = 0;
- unsigned long value = 0;
+ unsigned long value = 5381;
for ( ; i < def->arity; i++ ) {
if ( COLUMN[i] ) {
value <<= 3;
- value += COLUMN[i]->hashcode( COLUMN[i], (*kp)[i] );
+ if ( (*kp)[i] ) {
+ value += COLUMN[i]->hashcode( COLUMN[i], (*kp)[i] );
+ } else {
+ value += 17;
+ }
}
}
return value;
tuple *tp = (tuple*) item;
int i = 0;
for ( ; i < def->arity; i++ ) {
- if ( COLUMN[i] == 0 ) {
- if ( (*kp)[i] && (*tp)[i] != (*kp)[i] ) {
+ if ( COLUMN[i] && (*kp)[i] ) {
+ if ( COLUMN[i]->haskey( COLUMN[i], (*tp)[i], (*kp)[i] ) == 0 ) {
return 0;
}
- continue;
- }
- if ( (*kp)[i] &&
- COLUMN[i]->haskey( COLUMN[i], (*tp)[i], (*kp)[i] ) == 0 ) {
- return 0;
}
}
return 1;