org.apache.pig.scripting.jruby
Class JrubyAlgebraicEvalFunc<T>

java.lang.Object
  extended by org.apache.pig.EvalFunc<T>
      extended by org.apache.pig.AccumulatorEvalFunc<T>
          extended by org.apache.pig.AlgebraicEvalFunc<T>
              extended by org.apache.pig.scripting.jruby.JrubyAlgebraicEvalFunc<T>
All Implemented Interfaces:
Accumulator<T>, Algebraic
Direct Known Subclasses:
JrubyAlgebraicEvalFunc.BagJrubyAlgebraicEvalFunc, JrubyAlgebraicEvalFunc.ChararrayJrubyAlgebraicEvalFunc, JrubyAlgebraicEvalFunc.DataByteArrayJrubyAlgebraicEvalFunc, JrubyAlgebraicEvalFunc.DoubleJrubyAlgebraicEvalFunc, JrubyAlgebraicEvalFunc.FloatJrubyAlgebraicEvalFunc, JrubyAlgebraicEvalFunc.IntegerJrubyAlgebraicEvalFunc, JrubyAlgebraicEvalFunc.LongJrubyAlgebraicEvalFunc, JrubyAlgebraicEvalFunc.MapJrubyAlgebraicEvalFunc, JrubyAlgebraicEvalFunc.TupleJrubyAlgebraicEvalFunc

public abstract class JrubyAlgebraicEvalFunc<T>
extends AlgebraicEvalFunc<T>

This class provides the bridge between Ruby classes that extend the AlgebraicPigUdf "interface" by implementing an initial, intermed, and final method. Unlike EvalFuncs and Accumulators, the type must be known at compile time (ie it can't return Object), as Pig inspects the type and ensures that it is valid. This is why class specific shells are provided at the bottom. This class leverages AlgebraicEvalFunc to provide the Accumulator and EvalFunc implementations.


Nested Class Summary
static class JrubyAlgebraicEvalFunc.AlgebraicFunctionWrapper<T>
          This is a lightweight wrapper shell that registers information on the method being called, and provides the initializer that the static Algebraic classes (Initial, Intermed, Final) will use to execute.
static class JrubyAlgebraicEvalFunc.BagJrubyAlgebraicEvalFunc
          Unlike EvalFuncs and Accumulators, the type must be known at compile time (ie it can't return Object), as Pig inspects the type and ensures that it is valid.
static class JrubyAlgebraicEvalFunc.ChararrayJrubyAlgebraicEvalFunc
           
static class JrubyAlgebraicEvalFunc.DataByteArrayJrubyAlgebraicEvalFunc
           
static class JrubyAlgebraicEvalFunc.DoubleJrubyAlgebraicEvalFunc
           
static class JrubyAlgebraicEvalFunc.Final<T>
          This class invokes the final method on the given Ruby class.
static class JrubyAlgebraicEvalFunc.FloatJrubyAlgebraicEvalFunc
           
static class JrubyAlgebraicEvalFunc.Initial
          This class invokes the initial method on the given Ruby class.
static class JrubyAlgebraicEvalFunc.IntegerJrubyAlgebraicEvalFunc
           
static class JrubyAlgebraicEvalFunc.Intermed
          This class invokes the intermed method on the given Ruby class.
static class JrubyAlgebraicEvalFunc.LongJrubyAlgebraicEvalFunc
           
static class JrubyAlgebraicEvalFunc.MapJrubyAlgebraicEvalFunc
           
static class JrubyAlgebraicEvalFunc.TupleJrubyAlgebraicEvalFunc
           
 
Nested classes/interfaces inherited from class org.apache.pig.EvalFunc
EvalFunc.SchemaType
 
Field Summary
protected static BagFactory mBagFactory
           
protected static TupleFactory mTupleFactory
           
protected static org.jruby.Ruby ruby
           
protected static org.jruby.embed.ScriptingContainer rubyEngine
           
 
Fields inherited from class org.apache.pig.EvalFunc
log, pigLogger, reporter, returnType
 
Constructor Summary
JrubyAlgebraicEvalFunc(String fileName, String functionName)
          The constructor takes information on the script and method being invoked and registers it with the superclass (which is necessary for AlgebraicEvalFunc).
 
Method Summary
abstract  String getFinal()
          This must be implement as per a normal Algebraic interface.
 String getInitial()
          This must be implement as per a normal Algebraic interface.
 String getIntermed()
          This must be implement as per a normal Algebraic interface.
 
Methods inherited from class org.apache.pig.AlgebraicEvalFunc
accumulate, cleanup, getValue
 
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
 

Field Detail

mBagFactory

protected static BagFactory mBagFactory

mTupleFactory

protected static final TupleFactory mTupleFactory

rubyEngine

protected static final org.jruby.embed.ScriptingContainer rubyEngine

ruby

protected static final org.jruby.Ruby ruby
Constructor Detail

JrubyAlgebraicEvalFunc

public JrubyAlgebraicEvalFunc(String fileName,
                              String functionName)
The constructor takes information on the script and method being invoked and registers it with the superclass (which is necessary for AlgebraicEvalFunc).

Method Detail

getFinal

public abstract String getFinal()
Description copied from class: AlgebraicEvalFunc
This must be implement as per a normal Algebraic interface. See Algebraic for more information.

Specified by:
getFinal in interface Algebraic
Specified by:
getFinal in class AlgebraicEvalFunc<T>
Returns:
A function name of f_final. f_final should be an eval func parametrized by the same datum as the eval func implementing this interface.

getInitial

public String getInitial()
Description copied from class: AlgebraicEvalFunc
This must be implement as per a normal Algebraic interface. See Algebraic for more information.

Specified by:
getInitial in interface Algebraic
Specified by:
getInitial in class AlgebraicEvalFunc<T>
Returns:
A function name of f_init. f_init should be an eval func. The return type of f_init.exec() has to be Tuple

getIntermed

public String getIntermed()
Description copied from class: AlgebraicEvalFunc
This must be implement as per a normal Algebraic interface. See Algebraic for more information.

Specified by:
getIntermed in interface Algebraic
Specified by:
getIntermed in class AlgebraicEvalFunc<T>
Returns:
A function name of f_intermed. f_intermed should be an eval func. The return type of f_intermed.exec() has to be Tuple


Copyright © 2007-2012 The Apache Software Foundation