Use HCatLoader to load Hive table data using Pig
A = LOAD 'hivedb.hivetable' using org.apache.hive.hcatalog.pig.HCatLoader();
-- Load table 'sample_07'
sample_07 = LOAD 'sample_07' USING org.apache.hcatalog.pig.HCatLoader();
-- Compute the average salary of the table
salaries = GROUP sample_07 ALL;
out = FOREACH salaries GENERATE AVG(sample_07.salary);
DUMP out;
Similar to HCatLoader, use HCatStorer to update the table, e.g.:
STORE alias INTO 'sample_07' USING org.apache.hcatalog.pig.HCatStorer();
No comments:
Post a Comment