About

Edit photo

Monday, November 28, 2016

Aggregation functions in PIG


Example1: year price 2015 60 2014 45 2016 34 2014 75 2015 45 2014 41 I would like to get the result as, total price of the item by year. grunt> file = load '/tmp/yearprice.txt' using PigStorage(',') as (year:int,price:float); grunt> data = foreach file generate year, price by $0 > 1; grunt> group = group data by year; grunt> sum = foreach group generate group...

Wednesday, November 16, 2016

PIG left, right outer joins error


We know that, we can perform JOIN operation using pig, as well as left outer join, right outer join. sometimes you'll face error when working of left and right outer joins, but not to inner joins. that is because of schema. Even if there is no schema can perform inner...

Monday, June 20, 2016

Friday, June 17, 2016

Advanced scripts - PIG Part 3


FILTER: filter = FILTER climate by country MATCHES 'C.*a'; -> china filter = FILTER climate by country MATCHES '.*(nda|hin).*; -> india, china SPLIT: SPLIT climate into B1992 if $1 == 1992, B2002 if $1 == 2002; it split the climate bag into two records B1992 and...