I wonder if the parser is getting confused between the inner and outer 'age' fields. What happens if you switch the name of one of them?

Alan.

On Feb 7, 2010, at 9:02 AM, Rusty Klophaus wrote:

Hello,

I am trying to FILTER and then ORDER an inner bag, for example:

A = LOAD ...blah... AS (first, last, age, kids:bag{kid:tuple(name, age)});
B = FOREACH A {
filteredkids = FILTER kids BY age != 1;
sortedkids = ORDER filteredkids BY age;
GENERATE sortedkids;
}
DUMP B;

When I run this, I get a stacktrace with a root error of:

Caused by: org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1026:
Attempt to fetch field 1 from schema of size 1
at org.apache.pig.impl.logicalLayer.schema.Schema.getField(Schema.java: 749)
at
org .apache .pig.impl.logicalLayer.LOProject.getFieldSchema(LOProject.java:289)

$ pig --version
Apache Pig version 0.5.0 (r829623)
compiled Oct 25 2009, 18:58:38

If I run just the FILTER or ORDER operation in the inner bag, it works. But
when I put them both in there, it fails.

Has anybody else experienced this problem? Am I doing something wrong?

Thanks,
Rusty Klophaus

Reply via email to