|
||||||||||
| 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<Object>
org.apache.pig.scripting.jruby.JrubyAccumulatorEvalFunc
public class JrubyAccumulatorEvalFunc
This class provides a bridge between Ruby classes that extend AccumulatorPigUdf and their execution in Pig. This class passes a Bag of data to the Ruby "exec" function, and ultimate gets the value by calling "get" on the class instance that receives methods.
| Field Summary |
|---|
| Fields inherited from class org.apache.pig.EvalFunc |
|---|
log, pigLogger, reporter, returnType |
| Constructor Summary | |
|---|---|
JrubyAccumulatorEvalFunc(String path,
String methodName)
This constructor is used by JrubyScriptEngine to register a Ruby class as an Accumulator. |
|
| Method Summary | |
|---|---|
void |
accumulate(Tuple b)
This uses the "exec" method required of AccumulatorPigUdf Ruby classes. |
void |
cleanup()
Called after getValue() to prepare processing for next key. |
Object |
getValue()
This method calls "get" on the AccumulatorPigUdf Ruby class that was specified. |
Schema |
outputSchema(Schema input)
This provides the Schema of the output, and leverages the get_output_schema function on the class object that is defined on the ruby side. |
| Methods inherited from class org.apache.pig.AccumulatorEvalFunc |
|---|
exec |
| Methods inherited from class org.apache.pig.EvalFunc |
|---|
finish, getArgToFuncMapping, getCacheFiles, getLogger, getPigLogger, getReporter, getReturnType, getSchemaName, isAsynchronous, progress, setPigLogger, setReporter, warn |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JrubyAccumulatorEvalFunc(String path,
String methodName)
| Method Detail |
|---|
public void accumulate(Tuple b)
throws IOException
accumulate in interface Accumulator<Object>accumulate in class AccumulatorEvalFunc<Object>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.
IOExceptionpublic void cleanup()
Accumulator
cleanup in interface Accumulator<Object>cleanup in class AccumulatorEvalFunc<Object>public Object getValue()
getValue in interface Accumulator<Object>getValue in class AccumulatorEvalFunc<Object>public Schema outputSchema(Schema input)
outputSchema in class EvalFunc<Object>input - Schema of the input
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||