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 = GROUP a BY stock_symbol;
c = FOREACH b GENERATE FLATTEN(a.(stock_symbol)), MAX(a.stock_price_high), MIN(a.stock_price_low);
d = DISTINCT c;
dump d;

description –

a holds data from nyse_stock table from Hive
b holds records group by stock_symbol
c gets max, min stock for each stock_symbol and flattens
d gets unique records for each stock_symbol
and dumps;

Advertisements