org.apache.pig.builtin
Class SUBTRACT

java.lang.Object
  extended by org.apache.pig.EvalFunc<DataBag>
      extended by org.apache.pig.builtin.SUBTRACT

public class SUBTRACT
extends EvalFunc<DataBag>

SUBTRACT takes two bags as arguments and returns a new bag composed of tuples of first bag not in the second bag.
If null, bag arguments are replaced by empty bags.

The implementation assumes that both bags being passed to this function will fit entirely into memory simultaneously.
If that is not the case the UDF will still function, but it will be very slow.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.pig.EvalFunc
EvalFunc.SchemaType
 
Field Summary
 
Fields inherited from class org.apache.pig.EvalFunc
log, pigLogger, reporter, returnType
 
Constructor Summary
SUBTRACT()
           
 
Method Summary
 DataBag exec(Tuple input)
          Compares the two bag fields from input Tuple and returns a new bag composed of elements of first bag not in the second bag.
 
Methods inherited from class org.apache.pig.EvalFunc
finish, getArgToFuncMapping, getCacheFiles, getInputSchema, getLogger, getPigLogger, getReporter, getReturnType, getSchemaName, getSchemaType, 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

SUBTRACT

public SUBTRACT()
Method Detail

exec

public DataBag exec(Tuple input)
             throws IOException
Compares the two bag fields from input Tuple and returns a new bag composed of elements of first bag not in the second bag.

Specified by:
exec in class EvalFunc<DataBag>
Parameters:
input - a tuple with exactly two bag fields.
Returns:
result, of type T.
Throws:
IOException - if there are not exactly two fields in a tuple or if they are not DataBag.


Copyright © 2007-2012 The Apache Software Foundation