You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by "Zebeljan, Nebojsa" <ne...@adtech.com> on 2013/12/24 11:51:20 UTC

ERROR 1128: Cannot find field -

Hi,
I've added a condition in my pig script which shall use in case A field x and in case B field y.

Something like:
(Schema.Version == 1 ? Field.x : Field.y) AS SomeField

The intention was to make my pig script future safe, because with the next schema (version != 1) the new "Field.y" is added and shall be used. When I run my script on the data with the "current" schema (version=1), I'm getting the following exception:

pig script failed to validate: org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1128: Cannot find field y in …

Unfortunately it looks like pig is validating every field, even if it's not used/called?!

Thanks in advance!
Nebo


Re: ERROR 1128: Cannot find field -

Posted by Cheolsoo Park <pi...@gmail.com>.
You're right.

Can you parameterize the field name and substitute it depending on the
version of schema?


On Tue, Dec 24, 2013 at 2:51 AM, Zebeljan, Nebojsa <
nebojsa.zebeljan@adtech.com> wrote:

> Hi,
> I've added a condition in my pig script which shall use in case A field x
> and in case B field y.
>
> Something like:
> (Schema.Version == 1 ? Field.x : Field.y) AS SomeField
>
> The intention was to make my pig script future safe, because with the next
> schema (version != 1) the new "Field.y" is added and shall be used. When I
> run my script on the data with the "current" schema (version=1), I'm
> getting the following exception:
>
> pig script failed to validate:
> org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1128: Cannot find
> field y in …
>
> Unfortunately it looks like pig is validating every field, even if it's
> not used/called?!
>
> Thanks in advance!
> Nebo
>
>