apache pig - subtracting values in two columns and obtaining a new column using pig -


i have bunch of rows filtered according criterion. need subtracted values of 2 columns , need sort them. these commands used till now.

data = load '/user/imohit01017881/jk/a2dbe50d-c6e5-42e2-8fd0-5386720ce07b_data.csv' using pigstorage(',')  (country:chararray, countrycode:chararray, series:chararray, seriescode:chararray,  yr2000: float, yr2001:float, yr2002 :float, yr2003 :float,  yr2004 :float, yr2005:float,  yr2006:float, yr2007:float, yr2008 :float,  yr2009 :float, yr2010:float, yr2011: float, yr2012 :float, yr2013 : float, yr2014 : float, yr2015:float);  

filter rows containing req data:

ggdif = filter  data series == 'improved sanitation facilities (% of population access)'  dump data  

below line giving me error:

sub_data = foreach ggdif generate subtract(yr2015, yr2000);  

source: subtract takes 2 bags arguments , returns new bag composed of tuples of first bag not in second bag. if null, bag arguments replaced empty bags

sub_data = foreach ggdif generate (yr2015 - yr2000);  

Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -