Hi,
i am trying to do some simple evaluations of peregrine still.
while doing so i encountered some strange behaviour.
given a ,apper that for a number of numbers does this:
private void doEmit(long a, long b){
if (a != b){
long min = Math.min(a, b);
long max = Math.max(a, b);
emit(
new StructWriter(24).writeHashcode(min).writeLong(min).writeLong(max).toStructReader() , StructReaders.wrap(1));
}
}
and a reducer that reduces them like this:
@Override
public void reduce( StructReader key, List<StructReader> values ) {
final long hashcode = key.readLong();
final long a = key.readLong();
final long b = key.readLong();
long sum = 0L;
for (StructReader val : values){
sum += val.readInt();
}
log.info( "reducing key of length %d hash %d min %d max %d, numValues was %d.", key.length(), hashcode, a, b, values.size());
emit(new StructWriter(16).writeHashcode(a).writeLong(a).toStructReader(), new StructWriter(16).writeLong(b).writeLong(cor).toStructReader());
emit(new StructWriter(16).writeHashcode(b).writeLong(b).toStructReader(), new StructWriter(16).writeLong(a).writeLong(cor).toStructReader());
}
i can see in the logs that the reduce function is called multiple times for the same key with a subset of the values for that key instead of once with all values for that key.
Of course this completely screws up the expected results.
I am not sure whether this is due to an error of my code or a bug in peregrine.