Re: how to operate a map type

2011-06-02 Thread Thejas M Nair
> 2011/5/24 Daniel Dai >>> >>> GetKey(m) already get the key, so you can filter the key. For value, you >>>> may need to put into UDF. >>>> >>>> Grammar support for map is based on static key, eg: m#'key1'. Your use >>>> case >

Re: how to operate a map type

2011-06-02 Thread Xiaomeng Wan
can filter the key. For value, you >>>> may need to put into UDF. >>>> >>>> Grammar support for map is based on static key, eg: m#'key1'. Your use >>>> case >>>> is mostly dealing dynamic keys, which you may rely on yourself currently

Re: how to operate a map type

2011-06-02 Thread Jameson Li
m#'key1'. Your use >>> case >>> is mostly dealing dynamic keys, which you may rely on yourself currently. >>> >>> Daniel >>> >>> -Original Message- From: Jameson Li >>> Sent: Monday, May 23, 2011 7:07 PM >>>

Re: how to operate a map type

2011-05-24 Thread Alan Gates
. Your use case is mostly dealing dynamic keys, which you may rely on yourself currently. Daniel -Original Message- From: Jameson Li Sent: Monday, May 23, 2011 7:07 PM To: Daniel Dai Cc: user@pig.apache.org Subject: Re: how to operate a map type And how to filter a map key or a map val

Re: how to operate a map type

2011-05-24 Thread Jameson Li
y 23, 2011 7:07 PM > To: Daniel Dai > Cc: user@pig.apache.org > Subject: Re: how to operate a map type > > > And how to filter a map key or a map value? And also only UDF? > > b = foreach ruls generate com.company.pig.GetURLContent($0,3,0.1) as m; > c = filter b by m.key ==

Re: how to operate a map type

2011-05-23 Thread Daniel Dai
From: Jameson Li Sent: Monday, May 23, 2011 7:07 PM To: Daniel Dai Cc: user@pig.apache.org Subject: Re: how to operate a map type And how to filter a map key or a map value? And also only UDF? b = foreach ruls generate com.company.pig.GetURLContent($0,3,0.1) as m; c = filter b by m.key =

Re: how to operate a map type

2011-05-23 Thread Jameson Li
And how to filter a map key or a map value? And also only UDF? b = foreach ruls generate com.company.pig.GetURLContent($0,3,0.1) as m; c = filter b by m.key == 'aaa' or m.value> 0.2; How could I write the code? Any other way without writing UDF? And I have a doubt since only writing UDF can oper

Re: how to operate a map type

2011-05-23 Thread Daniel Dai
I cannot think of a way without writing UDF. You can write two UDF: * GetKey, input a map, output the key of the map * GetValues, input a bag of map, output a bag of map values The script is like: b = foreach ruls generate com.company.pig.GetURLContent($0,3,0.1) as m; c = foreach b generate GetKe

how to operate a map type

2011-05-23 Thread Jameson Li
Hi all, I have the below pig code: register /home/uu/project/lib/pigudfs.jar ruls = load 'testurl' as (url:chararray); b = foreach ruls generate com.company.pig.GetURLContent($0,3,0.1); here when dump b, it will return: ([4#0.1677963]) ([193#0.16985779,81#0.10994483]) ([418#0.14138427,9#0.11075