|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pig.EvalFunc<T>
org.apache.pig.AccumulatorEvalFunc<T>
org.apache.pig.AlgebraicEvalFunc<T>
public abstract class AlgebraicEvalFunc<T>
This class is used to provide a free implementation of the Accumulator interface
and EvalFunc class in the case of an Algebraic function. Instead of having to provide
redundant implementations for Accumulator and EvalFunc, implementing the
getInitial, getIntermed, and getFinal methods (which implies implementing the static classes
they reference) will give you an implementation of each of those for free.
One key thing to note is that if a subclass of AlgebraicEvalFunc wishes to use any constructor
arguments, it MUST call super(args).
IMPORTANT: the implementation of the Accumulator interface that this class provides is good,
but it is simulated. For maximum efficiency, it is important to manually implement the accumulator
interface. See Accumulator
for more information on how to do so.
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 | |
---|---|
AlgebraicEvalFunc(String... constructorArgs)
It is key that if a subclass has a constructor, that it calls super(args...) or else this class will not instantiate properly. |
Method Summary | |
---|---|
void |
accumulate(Tuple input)
This is the free accumulate implementation based on the static classes provided by the Algebraic static classes. |
void |
cleanup()
Per the Accumulator interface, this clears all of the variables used in the implementation. |
abstract String |
getFinal()
This must be implement as per a normal Algebraic interface. |
abstract String |
getInitial()
This must be implement as per a normal Algebraic interface. |
abstract String |
getIntermed()
This must be implement as per a normal Algebraic interface. |
T |
getValue()
This function returns the ultimate result. |
Methods inherited from class org.apache.pig.AccumulatorEvalFunc |
---|
exec |
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 |
---|
public AlgebraicEvalFunc(String... constructorArgs)
Method Detail |
---|
public abstract String getFinal()
Algebraic
for
more information.
getFinal
in interface Algebraic
public abstract String getInitial()
Algebraic
for
more information.
getInitial
in interface Algebraic
public abstract String getIntermed()
Algebraic
for
more information.
getIntermed
in interface Algebraic
public void accumulate(Tuple input) throws IOException
accumulate
in interface Accumulator<T>
accumulate
in class AccumulatorEvalFunc<T>
input
- 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.
IOException
public void cleanup()
cleanup
in interface Accumulator<T>
cleanup
in class AccumulatorEvalFunc<T>
public T getValue()
getValue
in interface Accumulator<T>
getValue
in class AccumulatorEvalFunc<T>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |