Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Pig >> mail # user >> Storing tuple into HBaseStorage

Copy link to this message
Re: Storing tuple into HBaseStorage
You should be able to use a Pig map to do this.  Use the column name as the
key in the map and the value as the value.  You should be able to use the
builtin TOMAP function to generate the map (
http://pig.apache.org/docs/r0.11.0/func.html#tomap).  The HBaseStorage
documentation gives an example of storing a map using friends:* and info:*
as the column families.


copy = STORE raw INTO 'hbase://SampleTableCopy'
       USING org.apache.pig.backend.hadoop.hbase.HBaseStorage(
       'info:first_name info:last_name friends:* info:*');
On Wed, Nov 27, 2013 at 10:57 AM, Jerry Lam <[EMAIL PROTECTED]> wrote:

> Hello Pig users,
> I want to store the entire tuple into hbase from Pig using HBaseStorage.
> I know that I can do something like:
> output = .... as (c1:bytearray, c2:bytearray, .... cN:bytearray);
> STORE output INTO 'hbase://outputtable' USING
> org.apache.pig.backend.hadoop.hbase.HBaseStorage('f1:c1 f1:c2 .....
> f1:cN');
> Since the output contains tuples of 100 fields, I don't want to write them
> manually. Additionally, I want to use the alias name of the field as the
> column name for hbase. Since the entire tuple goes into the same column
> family, I wonder if there is an easy way to express this in Pig?
> Thank you,
> Jerry