datafu.pig.util
Class In

java.lang.Object
  extended by org.apache.pig.EvalFunc<java.lang.Boolean>
      extended by org.apache.pig.FilterFunc
          extended by datafu.pig.util.In

public class In
extends org.apache.pig.FilterFunc

Similar to the SQL IN function, this function provides a convenient way to filter using a logical disjunction over many values. Returns true when the first value of the tuple is contained within the remainder of the tuple.

Example:

 define In datafu.pig.util.In();
 -- cars: (alice, red), (bob, blue), (charlie, green), (dave, red);
 cars = LOAD cars AS (owner:chararray, color:chararray);
 
 -- cars: (alice, red), (bob, blue), (dave, red);
 red_blue_cars = FILTER cars BY In(color, 'red', 'blue');
 
 

Author:
wvaughan

Field Summary
 
Fields inherited from class org.apache.pig.EvalFunc
log, pigLogger, reporter, returnType
 
Constructor Summary
In()
           
 
Method Summary
 java.lang.Boolean exec(org.apache.pig.data.Tuple input)
           
 
Methods inherited from class org.apache.pig.FilterFunc
finish
 
Methods inherited from class org.apache.pig.EvalFunc
getArgToFuncMapping, getCacheFiles, getInputSchema, getLogger, getPigLogger, getReporter, getReturnType, getSchemaName, isAsynchronous, outputSchema, progress, setInputSchema, setPigLogger, setReporter, setUDFContextSignature, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

In

public In()
Method Detail

exec

public java.lang.Boolean exec(org.apache.pig.data.Tuple input)
                       throws java.io.IOException
Specified by:
exec in class org.apache.pig.EvalFunc<java.lang.Boolean>
Throws:
java.io.IOException


Matthew Hayes, Sam Shah