hypertable/hypertable — pull request #9 by toidi (2014-06-11 09:08:36+00:00)
Title: add HypertableStorage for Pig

Hi there.

I have added support Apache Pig.
`HypertableStorage` class add ability to read/write hypertable using pig scripts.

Example of read pig script
```
REGISTER '/opt/hypertable/current/lib/java/hypertable.jar';
REGISTER '/opt/hypertable/current/lib/java/libthrift.jar';
REGISTER '/usr/local/pig_mras/lib/pig-mras.jar';

-- SET hypertable.mapreduce.input.scan-spec $scan_spec;
-- SET hypertable.mapreduce.thriftclient.framesize $t_client_fsize;
-- SET hypertable.mapreduce.thriftbroker.framesize $t_broker_fsize;

data1 = LOAD 'hypertable://namespace/tablename1'
USING ru.mail.pig.HypertableStorage('', 'E <= ROW <= N') as (row:chararray,
column_family:chararray, column_qualifier:chararray, value);

DEFINE FStatHTStorage ru.mail.pig.HypertableStorage('stat:s');
data2 = LOAD 'hypertable://namespace/tablename2' USING FStatHTStorage() as (row:chararray,
column_family:chararray, column_qualifier:chararray, value);
data2_l = LIMIT data2 1000;

data = UNION data1, data2_l;

STORE data INTO 'hypertable_output';
```

example for write pig script
```
REGISTER '/opt/hypertable/current/lib/java/hypertable.jar';
REGISTER '/opt/hypertable/current/lib/java/libthrift.jar';
REGISTER '/usr/local/pig_mras/lib/pig-mras.jar';

-- SET hypertable.mapreduce.output.mutator-flags $val;
-- SET hypertable.mapreduce.output.mutator-flush-interval $f_interval';
-- SET hypertable.mapreduce.thriftclient.framesize $t_client_fsize;
-- SET hypertable.mapreduce.thriftbroker.framesize $t_broker_fsize;

DEFINE HTStorage ru.mail.pig.HypertableStorage();

data = load 'ht_data' AS (row, family, qualifier, value);

-- Store into 2 different locations
STORE data INTO 'hypertable://pig/ht_test' USING HTStorage();
STORE data INTO 'hypertable://pig/ht_test1' USING HTStorage();
```