Database Reference
In-Depth Information
Replace the path below with the path where you loaded StockTest.tsv
into HDFS:
StockData = LOAD '/user/test/StockTest.tsv' USING
PigStorage() as
(RowKey:chararray,stock_symbol:chararray,date:chararray,
stock_price_open:double,stock_price_close:double,
stock_volume:long);
Now you can load the HBase stock_test table using the HBaseStorage
function. This function expects the row key for the table to be pasted first,
and then the rest of the fields are passed to the columns designated in the
input string:
STORE StockData INTO 'hbase://stock_test'
USING
org.apache.pig.backend.hadoop.hbase.HBaseStorage
('info:symbol info:date price:open price:close
trade:volume');
To test the load, you can run some scans with various filters passed in. The
following scan filters on the symbol to look for the stock symbol ADCT:
SingleColumnValueFilter filter = new
SingleColumnValueFilter(
info,
symbol,
CompareOp.EQUAL,
Bytes.toBytes("ADCT")
);
scan.setFilter(filter);
Managing Data with HCatalog
HCatalog creates a table abstraction layer over data stored on an HDFS
cluster. This table abstraction layer presents the data in a familiar relational
format and makes it easier to read and write data using familiar query
Search WWH ::




Custom Search