You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by wi...@thomsonreuters.com on 2011/04/07 17:32:31 UTC

Projecting on a pair of columns inside FOREACH() gives error 2213

I have a relation built by grouping the join (TCRaw) of a pair of basic relations (SrcFuid and NewCitationRel):

grunt> describe TCGroupedByFuid;
TCGroupedByFuid: {
  group: (SrcFuid::citingdocid: int,
          SrcFuid::col:chararray,
          SrcFuid::seq: int),
  TCRaw: {SrcFuid::citingdocid: int,
          SrcFuid::col:chararray,
          SrcFuid::seq: int,
          NewCitationRel::citeddocid: int,
          NewCitationRel::citingdocid: int,
          NewCitationRel::col: chararray,
          NewCitationRel::seq: int,
          NewCitationRel::year: int,
          NewCitationRel::eds: chararray}}

For each tuple in this relation, I’d like to get (TCRaw. NewCitationRel::citingdocid, TCRaw. NewCitationRel::col).

AA = foreach TCGroupedByFuid {
        FA = TCRaw.(NewCitationRel::citingdocid, NewCitationRel::col);
        generate group, FA;};

But that results in this error:
   ERROR org.apache.pig.tools.grunt.Grunt - ERROR 2213: Error visiting inner plan for ForEach

If I am projecting on just a single column, my result is as expected:

AA = foreach TCGroupedByFuid {
        FA = TCRaw.(NewCitationRel::citingdocid); -- OK with or without parens
        generate group, FA;};

dump AA; -- works fine

What is the syntax I need to refer to a projection on two coordinates inside foreach with relations built like this?

Thanks for any suggestions, or pointers to the docs (believe me I did look first :)

Will

William F Dowling
Sr Technical Specialist, Software Engineering
Thomson Reuters
0 +1 215 823 3853



Re: Projecting on a pair of columns inside FOREACH() gives error 2213

Posted by Daniel Dai <ji...@yahoo-inc.com>.
Before we can get a patch, run Pig with the flag 
-Dpig.exec.nosecondarykey=true

Daniel

On 04/07/2011 03:35 PM, Daniel Dai wrote:
> This is a real bug. Open https://issues.apache.org/jira/browse/PIG-1978
> for it. Thanks.
>
> Daniel
>
> On 04/07/2011 08:32 AM, william.dowling@thomsonreuters.com wrote:
>> I have a relation built by grouping the join (TCRaw) of a pair of basic relations (SrcFuid and NewCitationRel):
>>
>> grunt>   describe TCGroupedByFuid;
>> TCGroupedByFuid: {
>>     group: (SrcFuid::citingdocid: int,
>>             SrcFuid::col:chararray,
>>             SrcFuid::seq: int),
>>     TCRaw: {SrcFuid::citingdocid: int,
>>             SrcFuid::col:chararray,
>>             SrcFuid::seq: int,
>>             NewCitationRel::citeddocid: int,
>>             NewCitationRel::citingdocid: int,
>>             NewCitationRel::col: chararray,
>>             NewCitationRel::seq: int,
>>             NewCitationRel::year: int,
>>             NewCitationRel::eds: chararray}}
>>
>> For each tuple in this relation, I’d like to get (TCRaw. NewCitationRel::citingdocid, TCRaw. NewCitationRel::col).
>>
>> AA = foreach TCGroupedByFuid {
>>           FA = TCRaw.(NewCitationRel::citingdocid, NewCitationRel::col);
>>           generate group, FA;};
>>
>> But that results in this error:
>>      ERROR org.apache.pig.tools.grunt.Grunt - ERROR 2213: Error visiting inner plan for ForEach
>>
>> If I am projecting on just a single column, my result is as expected:
>>
>> AA = foreach TCGroupedByFuid {
>>           FA = TCRaw.(NewCitationRel::citingdocid); -- OK with or without parens
>>           generate group, FA;};
>>
>> dump AA; -- works fine
>>
>> What is the syntax I need to refer to a projection on two coordinates inside foreach with relations built like this?
>>
>> Thanks for any suggestions, or pointers to the docs (believe me I did look first :)
>>
>> Will
>>
>> William F Dowling
>> Sr Technical Specialist, Software Engineering
>> Thomson Reuters
>> 0 +1 215 823 3853
>>
>>


Re: Projecting on a pair of columns inside FOREACH() gives error 2213

Posted by Daniel Dai <ji...@yahoo-inc.com>.
This is a real bug. Open https://issues.apache.org/jira/browse/PIG-1978 
for it. Thanks.

Daniel

On 04/07/2011 08:32 AM, william.dowling@thomsonreuters.com wrote:
> I have a relation built by grouping the join (TCRaw) of a pair of basic relations (SrcFuid and NewCitationRel):
>
> grunt>  describe TCGroupedByFuid;
> TCGroupedByFuid: {
>    group: (SrcFuid::citingdocid: int,
>            SrcFuid::col:chararray,
>            SrcFuid::seq: int),
>    TCRaw: {SrcFuid::citingdocid: int,
>            SrcFuid::col:chararray,
>            SrcFuid::seq: int,
>            NewCitationRel::citeddocid: int,
>            NewCitationRel::citingdocid: int,
>            NewCitationRel::col: chararray,
>            NewCitationRel::seq: int,
>            NewCitationRel::year: int,
>            NewCitationRel::eds: chararray}}
>
> For each tuple in this relation, I’d like to get (TCRaw. NewCitationRel::citingdocid, TCRaw. NewCitationRel::col).
>
> AA = foreach TCGroupedByFuid {
>          FA = TCRaw.(NewCitationRel::citingdocid, NewCitationRel::col);
>          generate group, FA;};
>
> But that results in this error:
>     ERROR org.apache.pig.tools.grunt.Grunt - ERROR 2213: Error visiting inner plan for ForEach
>
> If I am projecting on just a single column, my result is as expected:
>
> AA = foreach TCGroupedByFuid {
>          FA = TCRaw.(NewCitationRel::citingdocid); -- OK with or without parens
>          generate group, FA;};
>
> dump AA; -- works fine
>
> What is the syntax I need to refer to a projection on two coordinates inside foreach with relations built like this?
>
> Thanks for any suggestions, or pointers to the docs (believe me I did look first :)
>
> Will
>
> William F Dowling
> Sr Technical Specialist, Software Engineering
> Thomson Reuters
> 0 +1 215 823 3853
>
>


RE: Projecting on a pair of columns inside FOREACH() gives error 2213

Posted by wi...@thomsonreuters.com.
Clarification: the error results after
 dump AA;

The foreach{...} definition itself is not throwing the error.

William F Dowling
Sr Technical Specialist, Software Engineering
Thomson Reuters
0 +1 215 823 3853

[...]

AA = foreach TCGroupedByFuid {
        FA = TCRaw.(NewCitationRel::citingdocid, NewCitationRel::col);
        generate group, FA;};

But that results in this error:
   ERROR org.apache.pig.tools.grunt.Grunt - ERROR 2213: Error visiting inner plan for ForEach