java - How to read a string from HBase result? -


i using hbase mapreduce (docs) read strings hbase table. here part of 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 reducer output string hbase table, works fine when try testing hard code strings mapper. have checked hbase shell string read set correctly.

however, when try input table in hbase row id, becomes unknown string 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 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 possible reason?

you writing string name of array [b@fe6526 or similar.

i think wanted one:

byte[] testing = values.getvalue(bytes.tobytes("data"), bytes.tobytes("lastline")); context.write(new immutablebyteswritable(testing), new intwritable(1)); 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -