You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Krishna Kalyan <kr...@gmail.com> on 2014/12/06 11:18:59 UTC
Pig Writing a Pig UDF for checkandPut using HBaseStorage API
Hi,
Currently we have all our batch process written in Pig. I need to Store
some data into HBase using Pig. Before storing the data I need to check if
the value is present. If value is dont put.
I plan to write a pig UDF to do this, as all our data pipelines use Pig.
My Sample Code Below:
HTable test_table = new HTable(conf, "test");
Put put = new Put(Bytes.toBytes("1"));
put.add(Bytes.toBytes("c1"), Bytes.toBytes("a"),
Bytes.toBytes("1abc"));
test_table.checkAndPut(Bytes.toBytes("1"),
Bytes.toBytes("c1"), Bytes.toBytes("a"), Bytes.toBytes("11abc"), put);
I dont see any changes in my table.
Would appreciate guidance/references to achieve this.
Regards,
Krishna
[image: Inline image 1]