Tags

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Refer this URL to load data to the sand box.

Load Data to Hive

a = LOAD ‘default.nyse_stocks’ USING org.apache.hive.hcatalog.pig.HCatLoader();
b = FILTER a BY stock_symbol == ‘IBM’;
c = GROUP b ALL;
d = FOREACH c GENERATE AVG(b.stock_volume);
DUMP d;

 

description –

a holds data loaded from hive table.

b holds records filtered by stock_symbol==’IBM’ condition.

c groups all records of b i.e. group all records like group by

d holds average which is calculated by iterating each group and calculating average

Advertisements