[
https://issues.apache.org/jira/browse/PIG-3010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13582498#comment-13582498
]
Jonathan Coveney commented on PIG-3010:
---------------------------------------
Hmm, odd. Must be something in between...will fix tomorrow (Sverige time). As
far as the general approach, the idea is simply to replace the boolean flag of
"flatten" or "don't flatten" with an Enum that can carry more specific
information (in this case: do nothing, old flatten, or flatten without alias).
The reason the changes are so broad is because that boolean flag was read in a
lot of places (would that I could flattening would be handled differently but
alas..). The change to allow UDFs to flatten themselves itself wasn't too hard,
but IMHO the ability to return rows without alias is what makes it useful. Now
FLATTEN can be done as a UDF, as can other flatten variants. The range of what
we can right usefully is huge now, and we can more effectively manage the
namespace cruft that Pig scripts often generate.
But yeah, the change is pretty simple. I literally just changed the flag to the
enum, and followed compiler errors.
> Allow UDF's to flatten themselves
> ---------------------------------
>
> Key: PIG-3010
> URL: https://issues.apache.org/jira/browse/PIG-3010
> Project: Pig
> Issue Type: Improvement
> Reporter: Jonathan Coveney
> Assignee: Jonathan Coveney
> Fix For: 0.12
>
> Attachments: PIG-3010-0.patch, PIG-3010-1.patch,
> PIG-3010-2_nowhitespace.patch, PIG-3010-2.patch, PIG-3010-3_nows.patch,
> PIG-3010-3.patch, PIG-3010-4_nows.patch, PIG-3010-4.patch
>
>
> This is something I thought would be cool for a while, so I sat down and did
> it because I think there are some useful debugging tools it'd help with.
> The idea is that if you attach an annotation to a UDF, the Tuple or DataBag
> you output will be flattened. This is quite powerful. A very common pattern
> is:
> a = foreach data generate Flatten(MyUdf(thing)) as (a,b,c);
> This would let you just do:
> a = foreach data generate MyUdf(thing);
> With the exact same result!
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira