Grokbase Groups Pig user May 2013
FAQ
Hey all,

If I need to load a Hbase table with Hex values into Pig, does that require a specific UDF? IS there any inbuilt function in Pig? I searched the documentation but cannot find anything that lets me convert Hex to Int.


JM

Search Discussions

  • Alan Gates at May 6, 2013 at 3:17 pm
    I am not aware of any built in or Piggybank UDF that converts Hex to Int, but it would be a welcome contribution if you wanted to write it.

    Alan.
    On May 5, 2013, at 8:14 PM, John Meek wrote:

    Hey all,

    If I need to load a Hbase table with Hex values into Pig, does that require a specific UDF? IS there any inbuilt function in Pig? I searched the documentation but cannot find anything that lets me convert Hex to Int.


    JM
  • Jonathan Coveney at May 6, 2013 at 8:25 pm
    You could also use the following (in trunk):
    https://issues.apache.org/jira/browse/PIG-3198

    so you'd do: invoke&Integer.valueOf(x, 16); where x would be the hex string


    2013/5/6 Alan Gates <gates@hortonworks.com>
    I am not aware of any built in or Piggybank UDF that converts Hex to Int,
    but it would be a welcome contribution if you wanted to write it.

    Alan.
    On May 5, 2013, at 8:14 PM, John Meek wrote:

    Hey all,

    If I need to load a Hbase table with Hex values into Pig, does that
    require a specific UDF? IS there any inbuilt function in Pig? I searched
    the documentation but cannot find anything that lets me convert Hex to Int.

    JM
  • John Meek at May 6, 2013 at 9:05 pm
    In my case, I am loading data using:

    data = load 'hbase://data' using org.apache.pig.backend.hadoop.hbase.HBaseStorage('1:*', ' -loadKey true') AS (id:chararray, data:map[]);

    Would i call the invoke after the load?


    thanks.

    JM







    -----Original Message-----
    From: Jonathan Coveney <jcoveney@gmail.com>
    To: user <user@pig.apache.org>
    Sent: Mon, May 6, 2013 4:25 pm
    Subject: Re: Hbase Hex Values


    You could also use the following (in trunk):
    https://issues.apache.org/jira/browse/PIG-3198

    so you'd do: invoke&Integer.valueOf(x, 16); where x would be the hex string


    2013/5/6 Alan Gates <gates@hortonworks.com>
    I am not aware of any built in or Piggybank UDF that converts Hex to Int,
    but it would be a welcome contribution if you wanted to write it.

    Alan.
    On May 5, 2013, at 8:14 PM, John Meek wrote:

    Hey all,

    If I need to load a Hbase table with Hex values into Pig, does that
    require a specific UDF? IS there any inbuilt function in Pig? I searched
    the documentation but cannot find anything that lets me convert Hex to Int.

    JM
  • Jonathan Coveney at May 6, 2013 at 9:14 pm
    You would use it like any other udf. so:

    data2 = foreach data generate invoke&Integer.valueOf(id, 16);

    or perhaps

    data2 = foreach data generate invoke&Integer.valueOf((int)data#'key', 16);


    2013/5/6 John Meek <johnmeekjohn@aol.com>
    In my case, I am loading data using:

    data = load 'hbase://data' using
    org.apache.pig.backend.hadoop.hbase.HBaseStorage('1:*', ' -loadKey true')
    AS (id:chararray, data:map[]);

    Would i call the invoke after the load?


    thanks.

    JM







    -----Original Message-----
    From: Jonathan Coveney <jcoveney@gmail.com>
    To: user <user@pig.apache.org>
    Sent: Mon, May 6, 2013 4:25 pm
    Subject: Re: Hbase Hex Values


    You could also use the following (in trunk):
    https://issues.apache.org/jira/browse/PIG-3198

    so you'd do: invoke&Integer.valueOf(x, 16); where x would be the hex string


    2013/5/6 Alan Gates <gates@hortonworks.com>
    I am not aware of any built in or Piggybank UDF that converts Hex to Int,
    but it would be a welcome contribution if you wanted to write it.

    Alan.
    On May 5, 2013, at 8:14 PM, John Meek wrote:

    Hey all,

    If I need to load a Hbase table with Hex values into Pig, does that
    require a specific UDF? IS there any inbuilt function in Pig? I searched
    the documentation but cannot find anything that lets me convert Hex to
    Int.

    JM

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriespig, hadoop
postedMay 6, '13 at 3:16a
activeMay 6, '13 at 9:14p
posts5
users3
websitepig.apache.org

People

Translate

site design / logo © 2021 Grokbase