Grokbase Groups Pig user May 2011
FAQ
1line.txt is simply a 1 line file that has "123" as it's only line.

A = LOAD '1line.txt' AS (a:chararray); B = FOREACH A GENERATE (
REGEX_EXTRACT(a,'2',1) is null ? 1 : 0 ); DUMP B;

[main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1000: Error during
parsing. Encountered " "is" "is "" at line 1, column 49.

Not sure why this doesn't parse. I tried this:

A = LOAD '1line.txt' AS (a:chararray); B = FOREACH A GENERATE (
IsEmpty(REGEX_EXTRACT(a,'2',1)) ? 1 : 0 ); DUMP B;

and while it parsed, I got this error:

ERROR 2102: Cannot test a NULL for emptiness.

I am running pig 0.8.0. Are these known errors? Am I doing something dumb?

Thanks for any help
Jon

Search Discussions

  • Jacob at May 4, 2011 at 8:36 pm
    This works, though I'm not sure what the difference is really:

    A = LOAD '1line.txt' AS (a:chararray);
    B = FOREACH A {
    extract = REGEX_EXTRACT(a,'2',1);
    boolean = ((extract IS NULL) ? 1 : 0);
    GENERATE boolean;
    };
    DUMP B;

    --jacob
    @thedatachef
    On Wed, 2011-05-04 at 16:23 -0400, Jonathan Coveney wrote:
    1line.txt is simply a 1 line file that has "123" as it's only line.

    A = LOAD '1line.txt' AS (a:chararray); B = FOREACH A GENERATE (
    REGEX_EXTRACT(a,'2',1) is null ? 1 : 0 ); DUMP B;

    [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1000: Error during
    parsing. Encountered " "is" "is "" at line 1, column 49.

    Not sure why this doesn't parse. I tried this:

    A = LOAD '1line.txt' AS (a:chararray); B = FOREACH A GENERATE (
    IsEmpty(REGEX_EXTRACT(a,'2',1)) ? 1 : 0 ); DUMP B;

    and while it parsed, I got this error:

    ERROR 2102: Cannot test a NULL for emptiness.

    I am running pig 0.8.0. Are these known errors? Am I doing something dumb?

    Thanks for any help
    Jon

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriespig, hadoop
postedMay 4, '11 at 8:24p
activeMay 4, '11 at 8:36p
posts2
users2
websitepig.apache.org

2 users in discussion

Jonathan Coveney: 1 post Jacob: 1 post

People

Translate

site design / logo © 2022 Grokbase