You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by pob <pe...@gmail.com> on 2011/04/24 16:06:25 UTC

bag in UDF

Hello,

is it possible to return a bag from UDF?


When I def. my python UDF like this... it simply doesnt work....

@outputSchema("y:bag{key:int, t:tuple(len:int,word:chararray)}")
def toTuple(bag):



2011-04-24 16:06:08,794 [main] ERROR org.apache.pig.tools.grunt.Grunt -
ERROR 2998: Unhandled internal error. Error parsing schema for script
function from the decorator
org.apache.pig.impl.logicalLayer.parser.ParseException: Encountered " "bag"
"bag "" at line 1, column 3.
Was expecting one of:
    "int" ...
    "long" ...
    "float" ...
    "double" ...
    "chararray" ...
    "bytearray" ...
    "int" ...
    "long" ...
    "float" ...
    "double" ...
    "chararray" ...
    "bytearray" ...



Thanks.

Re: bag in UDF

Posted by pob <pe...@gmail.com>.
FIXED





2011/4/24 pob <pe...@gmail.com>

> When Im trying return bag of tuples
> @outputSchema("bag:{t:tuple(domain:chararray, spam:int, size:long,
> time:float)}") .... after apply it on line in pig -> it returns bytearray,
> whats wrong with that?
>
>
> I supposed when i return bag with tuple then apply flatten($0) on it i will
> be possible access tuple fields.
>
>
>
> 2011/4/24 pob <pe...@gmail.com>
>
>> Ok,
>>
>> bag is suppose to be collection of tuples... then how can I return from
>> UDF
>>
>>
>> @outputSchema("key:int, y:bag{t:tuple(len:int,word:chararray)}")
>>
>> ?
>>
>> Thanks
>>
>>
>> 2011/4/24 pob <pe...@gmail.com>
>>
>>> Hello,
>>>
>>> is it possible to return a bag from UDF?
>>>
>>>
>>> When I def. my python UDF like this... it simply doesnt work....
>>>
>>> @outputSchema("y:bag{key:int, t:tuple(len:int,word:chararray)}")
>>> def toTuple(bag):
>>>
>>>
>>>
>>> 2011-04-24 16:06:08,794 [main] ERROR org.apache.pig.tools.grunt.Grunt -
>>> ERROR 2998: Unhandled internal error. Error parsing schema for script
>>> function from the decorator
>>> org.apache.pig.impl.logicalLayer.parser.ParseException: Encountered " "bag"
>>> "bag "" at line 1, column 3.
>>> Was expecting one of:
>>>     "int" ...
>>>     "long" ...
>>>     "float" ...
>>>     "double" ...
>>>     "chararray" ...
>>>     "bytearray" ...
>>>     "int" ...
>>>     "long" ...
>>>     "float" ...
>>>     "double" ...
>>>     "chararray" ...
>>>     "bytearray" ...
>>>
>>>
>>>
>>> Thanks.
>>>
>>
>>
>

Re: bag in UDF

Posted by pob <pe...@gmail.com>.
When Im trying return bag of tuples
@outputSchema("bag:{t:tuple(domain:chararray, spam:int, size:long,
time:float)}") .... after apply it on line in pig -> it returns bytearray,
whats wrong with that?


I supposed when i return bag with tuple then apply flatten($0) on it i will
be possible access tuple fields.



2011/4/24 pob <pe...@gmail.com>

> Ok,
>
> bag is suppose to be collection of tuples... then how can I return from
> UDF
>
>
> @outputSchema("key:int, y:bag{t:tuple(len:int,word:chararray)}")
>
> ?
>
> Thanks
>
>
> 2011/4/24 pob <pe...@gmail.com>
>
>> Hello,
>>
>> is it possible to return a bag from UDF?
>>
>>
>> When I def. my python UDF like this... it simply doesnt work....
>>
>> @outputSchema("y:bag{key:int, t:tuple(len:int,word:chararray)}")
>> def toTuple(bag):
>>
>>
>>
>> 2011-04-24 16:06:08,794 [main] ERROR org.apache.pig.tools.grunt.Grunt -
>> ERROR 2998: Unhandled internal error. Error parsing schema for script
>> function from the decorator
>> org.apache.pig.impl.logicalLayer.parser.ParseException: Encountered " "bag"
>> "bag "" at line 1, column 3.
>> Was expecting one of:
>>     "int" ...
>>     "long" ...
>>     "float" ...
>>     "double" ...
>>     "chararray" ...
>>     "bytearray" ...
>>     "int" ...
>>     "long" ...
>>     "float" ...
>>     "double" ...
>>     "chararray" ...
>>     "bytearray" ...
>>
>>
>>
>> Thanks.
>>
>
>

Re: bag in UDF

Posted by pob <pe...@gmail.com>.
Ok,

bag is suppose to be collection of tuples... then how can I return from UDF


@outputSchema("key:int, y:bag{t:tuple(len:int,word:chararray)}")

?

Thanks


2011/4/24 pob <pe...@gmail.com>

> Hello,
>
> is it possible to return a bag from UDF?
>
>
> When I def. my python UDF like this... it simply doesnt work....
>
> @outputSchema("y:bag{key:int, t:tuple(len:int,word:chararray)}")
> def toTuple(bag):
>
>
>
> 2011-04-24 16:06:08,794 [main] ERROR org.apache.pig.tools.grunt.Grunt -
> ERROR 2998: Unhandled internal error. Error parsing schema for script
> function from the decorator
> org.apache.pig.impl.logicalLayer.parser.ParseException: Encountered " "bag"
> "bag "" at line 1, column 3.
> Was expecting one of:
>     "int" ...
>     "long" ...
>     "float" ...
>     "double" ...
>     "chararray" ...
>     "bytearray" ...
>     "int" ...
>     "long" ...
>     "float" ...
>     "double" ...
>     "chararray" ...
>     "bytearray" ...
>
>
>
> Thanks.
>