datafu-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew Hayes (JIRA)" <>
Subject [jira] [Commented] (DATAFU-130) Add left outer join macro described in the DataFu guide
Date Thu, 03 Jan 2019 05:38:00 GMT


Matthew Hayes commented on DATAFU-130:

Patch looks good to me except I think we should append a number to left_outer_join to indicate
the number of relations so we can add more left join macros in the future.  Maybe call it left_outer_join2
since you are joining with 2 other relations?  We could also add a left_outer_join and left_outer_join3. 

> Add left outer join macro described in the DataFu guide
> -------------------------------------------------------
>                 Key: DATAFU-130
>                 URL:
>             Project: DataFu
>          Issue Type: New Feature
>            Reporter: Eyal Allweil
>            Assignee: Eyal Allweil
>            Priority: Major
>              Labels: macro, newbie
>         Attachments: DATAFU-130.patch
> In our [guide|], 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

View raw message