[ 
https://issues.apache.org/jira/browse/DATAFU-130?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eyal Allweil updated DATAFU-130:
--------------------------------
    Description: 
In our 
[guide|http://datafu.incubator.apache.org/blog/2013/09/04/datafu-1-0.html], a 
macro is described for making a three-way left outer join conveniently. We can 
add this macro to DataFu to make it even easier to use.

The macro's code is as follows:


{noformat}
DEFINE left_outer_join(relation1, key1, relation2, key2, relation3, key3) 
returns joined {
  cogrouped = COGROUP $relation1 BY $key1, $relation2 BY $key2, $relation3 BY 
$key3;
  $joined = FOREACH cogrouped GENERATE
    FLATTEN($relation1),
    FLATTEN(EmptyBagToNullFields($relation2)),
    FLATTEN(EmptyBagToNullFields($relation3));
}

{noformat}

(we would obviously want to add a test for this, too)



  was:
In our 
[guide|http://datafu.incubator.apache.org/blog/2013/09/04/datafu-1-0.html], a 
macro is described for making a three-way left outer join conveniently. We can 
add this macro to DataFu to make it even easier to use.

The macro's code is as follows:


{noformat}
DEFINE left_outer_join(relation1, key1, relation2, key2, relation3, key3) 
returns joined {
  cogrouped = COGROUP $relation1 BY $key1, $relation2 BY $key2, $relation3 BY 
$key3;
  $joined = FOREACH cogrouped GENERATE
    FLATTEN($relation1),
    FLATTEN(EmptyBagToNullFields($relation2)),
    FLATTEN(EmptyBagToNullFields($relation3));
}

(we would obviously want to add a test for this, too)

{noformat}




> Add left outer join macro described in the DataFu guide
> -------------------------------------------------------
>
>                 Key: DATAFU-130
>                 URL: https://issues.apache.org/jira/browse/DATAFU-130
>             Project: DataFu
>          Issue Type: New Feature
>            Reporter: Eyal Allweil
>              Labels: macro, newbie
>
> In our 
> [guide|http://datafu.incubator.apache.org/blog/2013/09/04/datafu-1-0.html], a 
> macro is described for making a three-way left outer join conveniently. We 
> can add this macro to DataFu to make it even easier to use.
> The macro's code is as follows:
> {noformat}
> DEFINE left_outer_join(relation1, key1, relation2, key2, relation3, key3) 
> returns joined {
>   cogrouped = COGROUP $relation1 BY $key1, $relation2 BY $key2, $relation3 BY 
> $key3;
>   $joined = FOREACH cogrouped GENERATE
>     FLATTEN($relation1),
>     FLATTEN(EmptyBagToNullFields($relation2)),
>     FLATTEN(EmptyBagToNullFields($relation3));
> }
> {noformat}
> (we would obviously want to add a test for this, too)



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to