Grokbase Groups Pig user April 2011
FAQ
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.

Search Discussions

  • Pob at Apr 24, 2011 at 2:08 pm
    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 <peterob333@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.
  • Pob at Apr 24, 2011 at 2:26 pm
    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 <peterob333@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 <peterob333@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.
  • Pob at Apr 24, 2011 at 4:01 pm
    FIXED





    2011/4/24 pob <peterob333@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 <peterob333@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 <peterob333@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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriespig, hadoop
postedApr 24, '11 at 2:06p
activeApr 24, '11 at 4:01p
posts4
users1
websitepig.apache.org

1 user in discussion

Pob: 4 posts

People

Translate

site design / logo © 2021 Grokbase