You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "xavier (JIRA)" <ji...@apache.org> on 2011/09/09 22:34:10 UTC

[jira] [Created] (PIG-2276) "is null" syntax error with UDF and ternary operator

"is null" syntax error with UDF and ternary operator
----------------------------------------------------

                 Key: PIG-2276
                 URL: https://issues.apache.org/jira/browse/PIG-2276
             Project: Pig
          Issue Type: Bug
          Components: parser
    Affects Versions: 0.9.0, 0.8.0
         Environment: Debian Squeeze, Mac OS X 10.7.1, java 1.6.0_26, 
            Reporter: xavier


Applying "is null" to the result of a UDF inside the ternary operator gives a syntax error: 

A = LOAD 'data.tsv' AS (a, b);
B = FOREACH A GENERATE ( parseNull(a) is null ? 1 : 0 );

gives the following error: Syntax error, unexpected symbol at or near 'parseNull'

The same error happens if parseNull is replaced by any other function, e.g. (TRIM(a) is null ? 1 : 0) will give the same error message.
However (a is null ? 1 : 0) and (parseNull(a) == '' ? 1 : 0) gets parsed without error, so it is related to the combination of "is null" and the result of a UDF.

Thanks,
X

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (PIG-2276) "is null" syntax error with UDF and ternary operator

Posted by "Daniel Dai (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-2276?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13138591#comment-13138591 ] 

Daniel Dai commented on PIG-2276:
---------------------------------

In grammar definition, we separate boolean expression (condition) and non-boolean (regular) expression. They cannot intermingle other than a few exception (bincond, eg). Filter only takes condition, and foreach only takes regular expression. It seems to be unnecessary as boolean is the first class data type in Pig now (PIG-1429). Some refactory of expression definition is needed. 
                
> "is null" syntax error with UDF and ternary operator
> ----------------------------------------------------
>
>                 Key: PIG-2276
>                 URL: https://issues.apache.org/jira/browse/PIG-2276
>             Project: Pig
>          Issue Type: Bug
>          Components: parser
>    Affects Versions: 0.8.0, 0.9.0
>         Environment: Debian Squeeze, Mac OS X 10.7.1, java 1.6.0_26, 
>            Reporter: xvrl
>
> Applying "is null" to the result of a UDF inside the ternary operator gives a syntax error: 
> A = LOAD 'data.tsv' AS (a, b);
> B = FOREACH A GENERATE ( parseNull(a) is null ? 1 : 0 );
> gives the following error: Syntax error, unexpected symbol at or near 'parseNull'
> The same error happens if parseNull is replaced by any other function, e.g. (TRIM(a) is null ? 1 : 0) will give the same error message.
> However (a is null ? 1 : 0) and (parseNull(a) == '' ? 1 : 0) gets parsed without error, so it is related to the combination of "is null" and the result of a UDF.
> Thanks,
> X

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira