public class PrependToBag extends SimpleEvalFunc<org.apache.pig.data.DataBag>
N.B. this copies the entire input bag, so don't use it for large bags.
Example:
define PrependToBag datafu.pig.bags.PrependToBag();
-- 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:
-- ({(4),(1),(2),(3)})
-- ({(60),(10),(20),(30),(40),(50)})
output = FOREACH input GENERATE PrependToBag(B,T) as B;
Constructor and Description |
---|
PrependToBag() |
Modifier and Type | Method and Description |
---|---|
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
|
exec, getReturnType
getContextProperties, getInstanceName, getInstanceProperties, onReady, setUDFContextSignature
public org.apache.pig.data.DataBag call(org.apache.pig.data.DataBag inputBag, org.apache.pig.data.Tuple t) throws java.io.IOException
java.io.IOException
public org.apache.pig.impl.logicalLayer.schema.Schema outputSchema(org.apache.pig.impl.logicalLayer.schema.Schema input)
SimpleEvalFunc
outputSchema
in class SimpleEvalFunc<org.apache.pig.data.DataBag>
input
- input schema