I am using HBase MapReduce (docs) to read strings from HBase table. Here is part of the code:
public void map(ImmutableBytesWritable row, Result values, Context context) throws IOException {
String testing = values.getValue(Bytes.toBytes("data"),Bytes.toBytes("lastLine")).toString();
try {
context.write(new ImmutableBytesWritable(Bytes.toBytes(testing)), new IntWritable(1));
} catch (InterruptedException e) {
throw new IOException(e);
}
}
}
There is a reducer to output the string to another HBase table, which works fine when I try testing it with some hard code strings from mapper. I have checked from HBase shell that the string to be read is set correctly.
However, when I try to input that into another table in HBase as row id, it becomes unknown string like the following:
[B@fe2851
column=result:count, timestamp=1415868730030, value=\x00\x00\x00\x01
[B@fe331c
column=result:count, timestamp=1415868730030, value=\x00\x00\x00\x01
[B@fe6526
column=result:count, timestamp=1415868730030, value=\x00\x00\x00\x01
[B@fe7a98
column=result:count, timestamp=1415868730030, value=\x00\x00\x00\x01
The following is the expected result:
apple
column=result:count, timestamp=1415868730030, value=\x00\x00\x00\x01
orange
column=result:count, timestamp=1415868730030, value=\x00\x00\x00\x01
banana
column=result:count, timestamp=1415868730030, value=\x00\x00\x00\x01
pineapple
column=result:count, timestamp=1415868730030, value=\x00\x00\x00\x01
Any clue on what is the possible reason?