I am learning pig myself, I am stuck with one error.
This is written in macro script to understand modular programming in Pig. the issue is that I am trying to use string parameters with $ by referencing relation name :: then immediately parameter string substitution with $. The error is:
unexpected character $
How to go ahead on this?
define dividend_analysis (daily, year, daily_symbol, daily_open, daily_close)
returns analyzed {
divs = load '/PigData1/NYSE_dividends.txt'as (exchange:chararray, symbol:chararray, date:chararray, dividends:float);
divisthisyear = filter divs by date matches '$year-.*';
dailythisyear = filter $daily by date matches '$year-.*';
jnd = join divisthisyear by symbol, dailythisyear by $daily_symbol;
$analyzed = foreach jnd generate dailythisyear.$daily_symbol,$daily_close - $daily_open;
};
daily = load '/PigData1/NYSE_daily.txt'as (exchange:chararray, symbol:chararray, date:chararray, open:float, high:float, low:float, close:float, volume:int, adj_close:float);
results = dividend_analysis(daily, '2009', 'symbol', 'open', 'close');
the error message is from pig is ...
<line 7, column 53> Unexpected character '$'
2016-12-09 16:14:04,283 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: <line 7, column 53> Unexpected character '$'
Details at logfile: /home/hadoop/pig_1481278051535.log
grunt> exec macro1.pig
<line 7, column 53> Unexpected character '$'
2016-12-09 17:00:37,723 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: <line 7, column 53> Unexpected character '$'
Details at logfile: /home/hadoop/pig_1481278051535.log