datafu.pig.bags
Class AppendToBag

java.lang.Object
  extended by org.apache.pig.EvalFunc<T>
      extended by datafu.pig.util.SimpleEvalFunc<org.apache.pig.data.DataBag>
          extended by datafu.pig.bags.AppendToBag

public class AppendToBag
extends SimpleEvalFunc<org.apache.pig.data.DataBag>

Appends a tuple to a bag.

Example:

 define AppendToBag datafu.pig.bags.AppendToBag();
 
 -- input:
 -- ({(1),(2),(3)},(4))
 -- ({(10),(20),(30),(40),(50)},(60))
 input = LOAD 'input' AS (B: bag{T: tuple(v:INT)}, T: tuple(v:INT));

 -- output:
 -- ({(1),(2),(3),(4)})
 -- ({(10),(20),(30),(40),(50),(60)})
 output = FOREACH input GENERATE AppendToBag(B,T) as B;
 
 


Field Summary
 
Fields inherited from class org.apache.pig.EvalFunc
log, pigLogger, reporter, returnType
 
Constructor Summary
AppendToBag()
           
 
Method Summary
 org.apache.pig.data.DataBag call(org.apache.pig.data.DataBag inputBag, org.apache.pig.data.Tuple t)
           
 org.apache.pig.impl.logicalLayer.schema.Schema outputSchema(org.apache.pig.impl.logicalLayer.schema.Schema input)
          Override outputSchema so we can verify the input schema at pig compile time, instead of runtime
 
Methods inherited from class datafu.pig.util.SimpleEvalFunc
exec, getReturnType
 
Methods inherited from class org.apache.pig.EvalFunc
finish, getArgToFuncMapping, getCacheFiles, getInputSchema, getLogger, getPigLogger, getReporter, getSchemaName, isAsynchronous, 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

AppendToBag

public AppendToBag()
Method Detail

call

public org.apache.pig.data.DataBag call(org.apache.pig.data.DataBag inputBag,
                                        org.apache.pig.data.Tuple t)
                                 throws java.io.IOException
Throws:
java.io.IOException

outputSchema

public org.apache.pig.impl.logicalLayer.schema.Schema outputSchema(org.apache.pig.impl.logicalLayer.schema.Schema input)
Description copied from class: SimpleEvalFunc
Override outputSchema so we can verify the input schema at pig compile time, instead of runtime

Overrides:
outputSchema in class SimpleEvalFunc<org.apache.pig.data.DataBag>
Parameters:
input - input schema
Returns:
call to super.outputSchema in case schema was defined elsewhere


Matthew Hayes, Sam Shah