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 (JIRA)" <ji...@apache.org> on 2011/04/26 02:00:07 UTC
[jira] [Commented] (PIG-1989) complex type casting should return
null on casting failure
[ https://issues.apache.org/jira/browse/PIG-1989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13025011#comment-13025011 ]
Daniel Dai commented on PIG-1989:
---------------------------------
I tried some test cases, seems currently we set the inner fields which cannot cast to null:
{code}
input:
(a,b,3)
a = load '1.txt' as (t:tuple(i0, i1, i2));
b = foreach a generate (tuple(int,int,int))t;
We get: ((,,3))
{code}
{code}
input:
{(a,1)}
a = load '1.txt' as (a0:bag{t:tuple(i0,i1)});
b = foreach a generate (bag{tuple(int,int)})a0;
We get: ({(,1)})
{code}
{code}
input:
[key#value]
a = load '1.txt' as (m:map[]);
b = foreach a generate (map[int])m;
dump b;
We get: ([key#])
{code}
Sounds Ok to me. Thejas, do you see something else, or you feel this is not proper?
> complex type casting should return null on casting failure
> -----------------------------------------------------------
>
> Key: PIG-1989
> URL: https://issues.apache.org/jira/browse/PIG-1989
> Project: Pig
> Issue Type: Bug
> Affects Versions: 0.9.0
> Reporter: Thejas M Nair
> Assignee: Daniel Dai
> Fix For: 0.9.0
>
>
> When casting fails for complex objects, pig is currently returning un-casted object if the cast fails.
> It should return null instead. That is consistent with the behavior when casting to other basic types.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira