|
|
Fabian Alenius 2012-05-25, 09:47
Hi,
lets say I have a large tuple or a bag and I want to see if one of the fields match a string. How would one do that?
Similarly how do you apply a function to all the fields in a tuple?
Thanks,
Fabian
+
Fabian Alenius 2012-05-25, 09:47
praveenesh kumar 2012-05-25, 10:29
Write a UDF that takes tuples/bag as input. Then do whatever processing you want to do with the values inside the bag/tuple. Look how COUNT/SUM UDF is written, you will get better picture.
Thanks, Praveenesh
On Fri, May 25, 2012 at 3:17 PM, Fabian Alenius <[EMAIL PROTECTED]>wrote:
> Hi, > > lets say I have a large tuple or a bag and I want to see if one of the > fields match a string. How would one do that? > > Similarly how do you apply a function to all the fields in a tuple? > > Thanks, > > Fabian >
+
praveenesh kumar 2012-05-25, 10:29
Руслан Аль-Факих 2012-05-25, 10:21
Hey Fabian,
You can try this:
inputData = LOAD 'input';
grouped = GROUP inputData BY $0;
result = FOREACH grouped { filtered = FILTER inputData BY $1 == 'mystring'; GENERATE group, ( (COUNT(filtered) > 0) ? 'true' : 'false' ) AS StringExists; }
Not sure whether it is the simplest or fastest way though, but it works in my local mode with little data.
Ruslan
On Fri, May 25, 2012 at 1:47 PM, Fabian Alenius <[EMAIL PROTECTED]> wrote: > Hi, > > lets say I have a large tuple or a bag and I want to see if one of the > fields match a string. How would one do that? > > Similarly how do you apply a function to all the fields in a tuple? > > Thanks, > > Fabian
+
Руслан Аль-Факих 2012-05-25, 10:21
|
|
All projects made searchable here are trademarks of the Apache Software Foundation.
Service operated by
Sematext