Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase >> mail # user >> How to retrieve all columns of a CF and adding it in a put call


Copy link to this message
-
How to retrieve all columns of a CF and adding it in a put call
Hello,

I am trying to create a new table with data exactly same as BUT make
the row key in new table set as a column_value in the old table.

Following is my map method ( using a map only MR job)

public void map(ImmutableBytesWritable key, Result value, Context context) {
                throws IOException, InterruptedException {
            byte[] mod_key = value.getValue(INPUT_FAMILY, INPUT_COLUMN);
            if (mod_key != null) {
            Map<byte[], NavigableMap<byte[], byte[]>> cf value.getNoVersionMap();
            Put put = new Put(mod_key);
            for (byte[] c : cf.keySet()) {
                for (byte[] q : cf.get(c).keySet()) {
                    put.add(c, q, cf.get(c).get(q));
                }
            }
            context.write(key, put);}

I am inclined to think there has to be a more efficient way to do
this. By that I mean, not have to iterate through all the columns.
Thoughts?

Browsing code I found some usages like this :

outval.add(INPUT_FAMILY, null, value.getValue(INPUT_FAMILY, null);

What does above mean? Does it mean get bytes representing all columns
for INPUT_FAMILY and add it in put object?
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB