You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Daniel Dai (Commented) (JIRA)" <ji...@apache.org> on 2011/09/29 19:49:45 UTC

[jira] [Commented] (PIG-2309) Keyword 'NOT' is wrongly treated as a UDF in split statement

    [ https://issues.apache.org/jira/browse/PIG-2309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13117467#comment-13117467 ] 

Daniel Dai commented on PIG-2309:
---------------------------------

As a workaround, remove parenthesis after NOT:

SPLIT a INTO a1 IF (EMPTY((chararray)f1) ), a2 IF(NOT EMPTY((chararray)f1)) ;
                
> Keyword 'NOT' is wrongly treated as a UDF in split statement
> ------------------------------------------------------------
>
>                 Key: PIG-2309
>                 URL: https://issues.apache.org/jira/browse/PIG-2309
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.0
>            Reporter: Vivek Padmanabhan
>
> In the below script, the keyword NOT is wrongly interpreted as  UDF. 
> register empty.jar;
> a = load 'myinput' as (f1:chararray);
> SPLIT a INTO a1 IF (EMPTY((chararray)f1) ), a2 IF(NOT(EMPTY((chararray)f1)) );
> dump a2;
> UDF EMPTY
> ---------
> import java.io.IOException;
> import org.apache.pig.FilterFunc;
> import org.apache.pig.data.Tuple;
> public class EMPTY extends FilterFunc {
> 	    @Override
> 	    public Boolean exec(Tuple input) throws IOException {
> 	            return new Boolean ( ((String)input.get(0)).isEmpty() );
> 	    }
> }
> This is issue is observed in 0.9 most likely because of the new parser, Pig 0.8 works fine with this script. 
> Would be helpful to know any workarounds in 0.9. 

--
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