org.apache.pig.builtin
Class IsEmpty

java.lang.Object
  extended by org.apache.pig.EvalFunc<Boolean>
      extended by org.apache.pig.FilterFunc
          extended by org.apache.pig.builtin.IsEmpty
All Implemented Interfaces:
Accumulator<Boolean>, TerminatingAccumulator<Boolean>

public class IsEmpty
extends FilterFunc
implements TerminatingAccumulator<Boolean>

Determine whether a bag or map is empty.


Field Summary
 
Fields inherited from class org.apache.pig.EvalFunc
log, pigLogger, reporter, returnType
 
Constructor Summary
IsEmpty()
           
 
Method Summary
 void accumulate(Tuple b)
          Pass tuples to the UDF.
 void cleanup()
          Called after getValue() to prepare processing for next key.
 Boolean exec(Tuple input)
          This callback method must be implemented by all subclasses.
 Boolean getValue()
          Called when all tuples from current key have been passed to accumulate.
 boolean isFinished()
           
 
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

IsEmpty

public IsEmpty()
Method Detail

exec

public Boolean exec(Tuple input)
             throws IOException
Description copied from class: EvalFunc
This callback method must be implemented by all subclasses. This is the method that will be invoked on every Tuple of a given dataset. Since the dataset may be divided up in a variety of ways the programmer should not make assumptions about state that is maintained between invocations of this method.

Specified by:
exec in class EvalFunc<Boolean>
Parameters:
input - the Tuple to be processed.
Returns:
result, of type T.
Throws:
IOException

isFinished

public boolean isFinished()
Specified by:
isFinished in interface TerminatingAccumulator<Boolean>

accumulate

public void accumulate(Tuple b)
                throws IOException
Description copied from interface: Accumulator
Pass tuples to the UDF.

Specified by:
accumulate in interface Accumulator<Boolean>
Parameters:
b - A tuple containing a single field, which is a bag. The bag will contain the set of tuples being passed to the UDF in this iteration.
Throws:
IOException

cleanup

public void cleanup()
Description copied from interface: Accumulator
Called after getValue() to prepare processing for next key.

Specified by:
cleanup in interface Accumulator<Boolean>

getValue

public Boolean getValue()
Description copied from interface: Accumulator
Called when all tuples from current key have been passed to accumulate.

Specified by:
getValue in interface Accumulator<Boolean>
Returns:
the value for the UDF for this key.


Copyright © 2007-2012 The Apache Software Foundation