You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "xuting zhao (Commented) (JIRA)" <ji...@apache.org> on 2011/11/17 01:05:52 UTC

[jira] [Commented] (PIG-2311) Class cast exception thrown in STRSPLIT even after casting properly

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

xuting zhao commented on PIG-2311:
----------------------------------

In this patch, the outputschema and the mapping table have been added into STRSPLIT function.
An e2e test case has been added into the nightly.conf.
The test-commite has been successfully run with this changes.
This patch should work on both two versions.
                                                 Xuting
                
> Class cast exception thrown in STRSPLIT even after casting properly
> -------------------------------------------------------------------
>
>                 Key: PIG-2311
>                 URL: https://issues.apache.org/jira/browse/PIG-2311
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.10
>            Reporter: Anitha Raju
>            Assignee: xuting zhao
>             Fix For: 0.10
>
>         Attachments: PIG-2311.patch
>
>
> Hi,
> The below script treats 'a' as bytearray thus throwing class cast exception at STRSPLIT
> =========
> A = load 'input.txt' using PigStorage() as (a);
> A1 = filter A by NOT (a is null);
> A1 = foreach A1 generate a as a:chararray ;
> describe A1;
> B = foreach A1 generate STRSPLIT(a);
> dump B
> =========
> Input.txt (space separated)
> =========
> a b
> =========
> Here i am casting as "a as a:chararray". If you see the output of describe it gives
> A1: {a: chararray}
> When its passed in STRSPLIT, it treats as a bytearray thus throwing the following exception in the task logs
> =======
> WARN org.apache.pig.builtin.STRSPLIT: class cast exception at org.apache.pig.builtin.STRSPLIT.exec(STRSPLIT.java:55)
> =======
> hence giving null output at B.
> If we cast 'a' using
> =========
> A1 = foreach A1 generate (chararray)a as a ;
> =========
> it gives the correct output.
> ((a,b))
> In both the cases the describe gives 
> A1: {a: chararray}
> Regards,
> Anitha

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