[
https://issues.apache.org/jira/browse/PIG-2529?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13206771#comment-13206771
]
Prashant Kommireddi commented on PIG-2529:
------------------------------------------
Could this be extended to a generic UDF instead of only single item tuples? By
more generic I mean it would be useful to convert any number of items within
the inner tuples to be extracted into a single tuple. Optionally, it could take
an argument (integer) that specifies the number of items from inner tuples that
need to be extracted to a single tuple.
Eg, {(1),(2),(3)} => (1,2,3)
{(1,4),(2,5),(3,6)} => (1,4,2,5,3,6)
If you pass an argument to the UDF, lets say we want only the first elements
from inner tuples the output should be
{(1,4),(2,5),(3,6)} => (1,2,3)
This way we provide some flexibility to users of the UDF.
> Creation of a Python PiggyBank
> ------------------------------
>
> Key: PIG-2529
> URL: https://issues.apache.org/jira/browse/PIG-2529
> Project: Pig
> Issue Type: New Feature
> Components: piggybank
> Reporter: Eli Finkelshteyn
> Priority: Minor
> Labels: piggybank, python
>
> As per a conversation on the Pig user list, I think it makes sense to create
> a PiggyBank for Python functions. To get us started, here's something short
> and quick I wrote to convert a bag of single item tuples to one single tuple:
> @outputSchema("t:tuple()")
>
> def bagToTuple(bag):
>
> t = tuple([item[0] for item in bag])
>
> return t
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira