Grokbase Groups Pig user May 2011
FAQ
My goal is to be able to make functions like GREATER(a,b,c...) which can
take any number of columns, and for each row will give the greater of them.
I also want to detect what type of columns they are, and use IntGREATER or
DoubleGREATER or whatever.

A) has someone done something like this?
B) If not, how can I specify the correct Schema for getArgToFuncMapping?
Ideally it could just detect the schema of the first and go off of that, but
it looks like you have to match it directly... I tried overloading the
schema GREATER (where getArgTofuncMapping lives) and then using that to
figure out how many fields there are, but that didn't work. Should this
approach work? IE is getSchema called before getArgToFuncMapping? Is there a
cleaner way to do this?

Thanks for your help!
Jon

Search Discussions

  • Daniel Dai at May 20, 2011 at 6:24 pm
    It is not yet supported. See https://issues.apache.org/jira/browse/PIG-1577

    Daniel
    On 05/20/2011 10:42 AM, Jonathan Coveney wrote:
    My goal is to be able to make functions like GREATER(a,b,c...) which can
    take any number of columns, and for each row will give the greater of them.
    I also want to detect what type of columns they are, and use IntGREATER or
    DoubleGREATER or whatever.

    A) has someone done something like this?
    B) If not, how can I specify the correct Schema for getArgToFuncMapping?
    Ideally it could just detect the schema of the first and go off of that, but
    it looks like you have to match it directly... I tried overloading the
    schema GREATER (where getArgTofuncMapping lives) and then using that to
    figure out how many fields there are, but that didn't work. Should this
    approach work? IE is getSchema called before getArgToFuncMapping? Is there a
    cleaner way to do this?

    Thanks for your help!
    Jon
  • Thejas M Nair at May 20, 2011 at 6:42 pm
    As a workaround , you can use - MAX(TOBAG(a,b,c));

    For example , if a,b,c columns are of type int. Then, TOBAG(a,b,c) will have a schema of bag of integers, and the org.apache.pig.builtin.IntMax class will get used.

    -Thejas




    On 5/20/11 11:24 AM, "Daniel Dai" wrote:

    It is not yet supported. See https://issues.apache.org/jira/browse/PIG-1577

    Daniel
    On 05/20/2011 10:42 AM, Jonathan Coveney wrote:
    My goal is to be able to make functions like GREATER(a,b,c...) which can
    take any number of columns, and for each row will give the greater of them.
    I also want to detect what type of columns they are, and use IntGREATER or
    DoubleGREATER or whatever.

    A) has someone done something like this?
    B) If not, how can I specify the correct Schema for getArgToFuncMapping?
    Ideally it could just detect the schema of the first and go off of that, but
    it looks like you have to match it directly... I tried overloading the
    schema GREATER (where getArgTofuncMapping lives) and then using that to
    figure out how many fields there are, but that didn't work. Should this
    approach work? IE is getSchema called before getArgToFuncMapping? Is there a
    cleaner way to do this?

    Thanks for your help!
    Jon



    --

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriespig, hadoop
postedMay 20, '11 at 5:42p
activeMay 20, '11 at 6:42p
posts3
users3
websitepig.apache.org

People

Translate

site design / logo © 2022 Grokbase