You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Luis Belloch (JIRA)" <ji...@apache.org> on 2013/03/06 14:08:12 UTC
[jira] [Created] (PIG-3239) Unable to return multiple values from a
macro using SPLIT
Luis Belloch created PIG-3239:
---------------------------------
Summary: Unable to return multiple values from a macro using SPLIT
Key: PIG-3239
URL: https://issues.apache.org/jira/browse/PIG-3239
Project: Pig
Issue Type: Bug
Affects Versions: 0.10.0
Environment: Apache Pig version 0.10.0-cdh4.2.0 (rexported)
compiled Feb 15 2013, 12:19:17
Linux 3.2.0-38-generic #61-Ubuntu SMP Tue Feb 19 12:18:21 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Reporter: Luis Belloch
Priority: Minor
Hi, I'm unable to return multiple values from a macro when values come from a SPLIT. Here is an small example:
{code}
DEFINE my_macro(seq) RETURNS valid, invalid {
added = FOREACH $seq GENERATE $0 * 2, $1;
SPLIT added INTO $valid IF $1 == true, $invalid OTHERWISE;
}
data = LOAD 'case.csv' USING PigStorage(',') AS (value: int, valid: boolean);
P, Q = my_macro(data);
DUMP P;
DUMP Q;
{code}
Pig is unable to recognize the {{OTHERWISE}} side. Error is: {{ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: <at case.pig, line 3> Invalid macro definition: . Reason: Macro 'my_macro' missing return alias: invalid}}
Simple workaround is to force {{$invalid}} to be returned as {{FOREACH}} result:
{code}
SPLIT added INTO $valid IF $1 == true, tmp_invalid OTHERWISE;
$invalid = FOREACH tmp_invalid GENERATE *;
{code}
Samples and logs attached to the issue.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira