Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Plain View
Pig >> mail # user >> removing last item in a bag


+
Chan, Tim 2013-03-12, 23:33
Copy link to this message
-
Re: removing last item in a bag
Hi, Chan:
I guess you might generate the bag like this
A = load 'test.txt' as (f1:chararray,f2:chararray,f3:chararray);
B = group A by f1;
C = foreach B generate *;
describe C;
C: {group: chararray,{(f1: chararray)},{(f2: chararray)},{(f3: chararray)}}

if this is the case, you can do:
A = load 'test.txt' as (f1:chararray,f2:chararray,f3:chararray);
B = group A by f1;
C = foreach B generate group, A.f1, A.f2;
describe C;
C: {group: chararray,{(f1: chararray)},{(f2: chararray)}}

does this make sense? otherwise can you share your script which generates
the bag?

Johnny Zhang
On Tue, Mar 12, 2013 at 4:33 PM, Chan, Tim <[EMAIL PROTECTED]> wrote:

> How do I remove the last item in a bag.
>
> For example:
>
> (group_1,{(2012-12-15,a),(2012-12-17,a),(2012-12-23,c)})
>
>
> I would like to remove the last item so that the following is the result:
>
>
> (group_1,{(2012-12-15,a),(2012-12-17,a)})
>
+
Chan, Tim 2013-03-13, 00:28
+
Johnny Zhang 2013-03-13, 00:40
+
Ruslan Al-Fakikh 2013-03-13, 03:06
+
Ruslan Al-Fakikh 2013-03-13, 03:09
+
Tim Chan 2013-03-13, 20:58
+
Ruslan Al-Fakikh 2013-03-15, 19:46
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB