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)
           
 
Methods inherited from class datafu.pig.util.SimpleEvalFunc
exec, getReturnType
 
Methods inherited from class org.apache.pig.EvalFunc
finish, getArgToFuncMapping, getCacheFiles, getLogger, getPigLogger, getReporter, 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

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)
Overrides:
outputSchema in class org.apache.pig.EvalFunc<org.apache.pig.data.DataBag>


Matthew Hayes, Sam Shah