Add multiple values to Hbase table -


i'm using mapreduce insert data hbase table. because can not insert image describe hbase table following:

{   "rowkey1": {     file: {       source: "path file"     }     features: {       feature1: "value 1"       feature1: "value 2"     }   }   ...... } 

in map function, values are: "path file", "value 1", "value 2" insert "rowkey1".

but problem here can put 1 value 1 family 1 qualifier @ same time.

public void map(text key, byteswritable bytes, context context)throws ioexception { put put = new put(key.getbytes()); put.add(family, qualifier, bytes.getbytes()); try { context.write(new immutablebyteswritable(key.getbytes()), put); } catch (interruptedexception e) { e.printstacktrace(); } 

so question way insert values hbase table @ same time.

thanks

couldn't following.

map(..) {    ...    for(value: valuelist) {     put = new put(...)     put.add...     context.write(new immutablebyteswritable(key.getbytes()), put);    } } 

you context.write() multiple times in single map iteration. although if number of iteration per map large, might not efficient. (consider different design or method in such case)

feel free correct me if understood problem incorrectly.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -