Hi,
When i try to create a macro in grunt> shell. its not allowing me.?
[training@localhost ~]$ pig -x local;
2015-07-26 21:31:54,863 [main] INFO org.apache.pig.Main – Logging error messages to: /home/training/pig_1437971514862.log
2015-07-26 21:31:55,094 [main] INFO org.apache.pig.backend.hadoop.executionengine.HExecutionEngine – Connecting to hadoop file system at: file:///
grunt> DEFINE call_Macro(B1)
>> returns Ans{
>> D = GROUP $B1 BY Class;
>> $Ans = FOREACH D GENERATE group,SUM(B.Marks);
>> };
2015-07-26 21:33:07,294 [main] ERROR org.apache.pig.tools.grunt.Grunt – ERROR 1000: Error during parsing. Encountered ” “(” “( “” at line 1, column 18.
Was expecting one of:
<IDENTIFIER> …
<EXECCOMMAND> …
Details at logfile: /home/training/pig_1437971514862.log
grunt>
The below query need to write in grunt> shell.
Macro Declartion part:
A = load ‘/home/hduser/stud.txt’ as (StudId:int,StudName:chararray,Class:int,Marks:double);
B = FOREACH A GENERATE $2,$3;
C = call_Macro(B);
STORE C INTO ‘/home/hduser/call_out1’;