FAQ
HI all,

How can I generate a Map from a Tuple or a Bag?
I am looking for an example.

Ruihong

Search Discussions

  • Norbert Burger at Sep 8, 2011 at 11:59 am
    Hi Ruihong -- if you can coalesce your data into (key1, value1, key2,
    value2, key3, value3...) format, then you can use the TOMAP built-in
    function:

    https://issues.apache.org/jira/browse/PIG-1809

    If you have more complex conversion requirements, then you can pass
    the data off to a UDF which returns back a map.

    Norbert

    2011/9/7 石瑞红 <ruihong.shi@ipinyou.com>:
    HI all,

    How can I generate a Map from a Tuple or a Bag?
    I am looking for an example.

    Ruihong
  • Jiang licht at Sep 8, 2011 at 8:29 pm
    Note that tomap is available in 0.9 (see the jira ticket).

    http://www.hortonworks.com/new-apache-pig-0-9-features-part-3-additional-features/

    You can write a UDF for conversion between data types.



    Michael


    ________________________________
    From: Norbert Burger <norbert.burger@gmail.com>
    To: user@pig.apache.org
    Sent: Thursday, September 8, 2011 4:58 AM
    Subject: Re: How can I generate a Map from a Tuple or a Bag

    Hi Ruihong -- if you can coalesce your data into (key1, value1, key2,
    value2, key3, value3...) format, then you can use the TOMAP built-in
    function:

    https://issues.apache.org/jira/browse/PIG-1809

    If you have more complex conversion requirements, then you can pass
    the data off to a UDF which returns back a map.

    Norbert

    2011/9/7 石瑞红 <ruihong.shi@ipinyou.com>:
    HI all,

    How can I generate a Map from a Tuple or a Bag?
    I am looking for an example.

    Ruihong

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriespig, hadoop
postedSep 8, '11 at 5:13a
activeSep 8, '11 at 8:29p
posts3
users3
websitepig.apache.org

People

Translate

site design / logo © 2021 Grokbase