Hello,
I am trying to send <String, Double> values from mapper to reducer.
For some reason, Strings are being correctly sent, but Double values ARE
double - but they have no digits after decimal point. That is, like they
are somehow rounded up.
E.g.
public class GPMapTask implements MapTask {
public void map(MapOutputCollector collector, Key key,
Value val) throws TwisterException {
DoubleValue value = new
DoubleValue(fittnesses.get(strKey));
StringKey exp = new StringKey(strKey);
*System.out.println("[Mapper]" +
exp.getString() + " = " + value.getVal());*
collector.collect(exp, value);
}
}
public class GPReduceTask implements ReduceTask {
public void reduce(ReduceOutputCollector collector, Key key,
List<Value> values) throws TwisterException {
String exp = ((StringKey) key).getString();
Double d_val = ((DoubleValue) values.get(0)).getVal();
*System.out.println("[Reducer]" + exp + " = " + d_val);*
collector.collect(key, values.get(0));
}
}
The result of System.out.printlns are:
*[Mapper] ( ( sqr ( ( 9 / ( -2 ) ) ) ) - ( sqr ( ( 5 * ( 0 ) ) ) ) ) =
20.25[Reducer] ( ( sqr ( ( 9 / ( -2 ) ) ) ) - ( sqr ( ( 5 * ( 0 ) ) ) ) ) =
20.0*Am I sending values in the correct manner at all?
--
You received this message because you are subscribed to the Google Groups
"twister-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.