org.apache.pig
Class EvalFunc<T extends Datum>

java.lang.Object
  extended by org.apache.pig.EvalFunc<T>
Direct Known Subclasses:
ADD, ARITY, AVG, AVG.Final, AVG.Initial, AVG.Intermed, COUNT, COUNT.Final, COUNT.Initial, COUNT.Intermed, DIFF, DIVIDE, FindQuantiles, GFAny, GFCross, GFReplicate, MAX, MAX.Final, MAX.Initial, MIN, MIN.Final, MIN.Initial, MULTIPLY, ShellBagEvalFunc, SUBTRACT, SUM, SUM.Final, SUM.Initial, TOKENIZE

public abstract class EvalFunc<T extends Datum>
extends Object

The class is used to implement functions to be applied to a dataset. The function is applied to each Tuple in the set. The programmer should not make assumptions about state maintained between invocations of the invoke() method since the Pig runtime will schedule and localize invocations based on information provided at runtime. The programmer should not directly extend this class but instead extend one of the subclasses where we have bound the parameter T to a specific Datum

Author:
database-systems@yahoo.research

Field Summary
protected  Type returnType
           
 
Constructor Summary
EvalFunc()
           
 
Method Summary
abstract  void exec(Tuple input, T output)
          This callback method must be implemented by all subclasses.
 void finish()
          Placeholder for cleanup to be performed at the end.
 Type getReturnType()
           
 boolean isAsynchronous()
          This function should be overriden to return true for functions that return their values asynchronously.
 Schema outputSchema(Schema input)
           
protected  void progress()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

returnType

protected Type returnType
Constructor Detail

EvalFunc

public EvalFunc()
Method Detail

getReturnType

public Type getReturnType()

progress

protected void progress()

finish

public void finish()
Placeholder for cleanup to be performed at the end. User defined functions can override.


exec

public abstract void exec(Tuple input,
                          T output)
                   throws IOException
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.

Parameters:
input - the Tuple to be processed.
Throws:
IOException

outputSchema

public Schema outputSchema(Schema input)
Parameters:
input - Schema of the input
Returns:
Schema of the output

isAsynchronous

public boolean isAsynchronous()
This function should be overriden to return true for functions that return their values asynchronously.

Returns:


Copyright © ${year} The Apache Software Foundation