+user@pig, so others can avoid this silly, newbie mistake.
On Wed, Aug 15, 2012 at 11:21 AM, Philipp Pahl <[email protected]> wrote:
> Hi Tiago,
>
> I didn't test it, but have you tried to put [] around the tuple?
Wow! Worked like a charm! I definitely own you a beer :)
I wrote a small test function to get me acquainted with what was a
valid output of a UDF function and what wasn't. Just a one-line
function with a single return statement: `def test(): return [(1)]`.
Unfortunately I got trapped in common python pitfall: [(1)] != [(1,)].
Since Pig doesn't handle [(1)] as a valid python UDF return value I
started to think one could not return a list from a python UDF.
> @outputSchema("res:{t:(value:chararray)}")
> -- def test_list_of_items():
> -- return [ tuple([i for i in range(5)]) ]
>
> as it is done in the collectBag function here:
> https://cwiki.apache.org/PIG/udfsusingscriptinglanguages.html
I completely missed that sample function in the documentation. My bad. :(
But, anyway, sorry for the newbie question. And thanks :)
Cheers.
Tiago Alves Macambira