You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Philip (flip) Kromer (JIRA)" <ji...@apache.org> on 2014/06/11 08:35:01 UTC

[jira] [Commented] (PIG-2424) Add OUTER_FLATTEN operator which, on an empty bag, returns null instead of throwing away the row

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

Philip (flip) Kromer commented on PIG-2424:
-------------------------------------------

As a workaround, use the DataFu [EmptyBagToNullFields|http://datafu.incubator.apache.org/docs/datafu/1.2.0/datafu/pig/bags/EmptyBagToNullFields.html] UDF. From its documentation:

{code}
DEFINE EmptyBagToNullFields datafu.pig.bags.EmptyBagToNullFields();
data = FOREACH (COGROUP input1 BY key, input2 BY key, input3 BY key) GENERATE
  FLATTEN(input1), -- left join on this
  FLATTEN(EmptyBagToNullFields(input2)),  
  FLATTEN(EmptyBagToNullFields(input3));
{code}

> Add OUTER_FLATTEN operator which, on an empty bag, returns null instead of throwing away the row
> ------------------------------------------------------------------------------------------------
>
>                 Key: PIG-2424
>                 URL: https://issues.apache.org/jira/browse/PIG-2424
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Jonathan Coveney
>            Assignee: Jonathan Coveney
>
> It would be useful if Pig had a flatten operator which didn't throw away a row given an empty bag.



--
This message was sent by Atlassian JIRA
(v6.2#6252)