hba
hba

Reputation: 7780

PIG - HBASE - HBaseStorage key filter (gt, lt)

In a PIG script, I'm using HBaseStorage to load all the rows from an HBase-table. However, I'd like to filter the rows by the rowkey.

I looked at the source code, and i can send in -gt & -lt through the constructor. However, I can't figure out how to pass my value into the constructor. It is a byte[]...

Here is where I'm at:

LOAD 'hbase://TABLE' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('CF:I','-caster HBaseBinaryConverter') AS (product_id:bytearray);

If possible could you pls provide sample code...

Upvotes: 1

Views: 1211

Answers (1)

zsxwing
zsxwing

Reputation: 20816

You can use "\x" with the hex digits to express the binary value. Check the source codes here. For example,

LOAD 'hbase://TABLE' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('CF:I','-caster HBaseBinaryConverter -lt=\\x01\\x02\\xD4') AS (product_id:bytearray);

Upvotes: 1

Related Questions