datafu.pig.util
Class TransposeTupleToBag
java.lang.Object
org.apache.pig.EvalFunc<T>
datafu.pig.util.ContextualEvalFunc<T>
datafu.pig.util.AliasableEvalFunc<org.apache.pig.data.DataBag>
datafu.pig.util.TransposeTupleToBag
public class TransposeTupleToBag
- extends AliasableEvalFunc<org.apache.pig.data.DataBag>
Performs a transpose on a tuple, resulting in a bag of key, value fields where
the key is the column name and the value is the value of that column in the tuple.
Example:
define Transpose datafu.pig.util.Transpose();
-- input: 1,10,11,12
input = LOAD 'input' AS (id:int,val1:int,val2:int,val3:int);
-- produces: 1,{("val1",10),("val2",11),("val3",12)}
output = FOREACH input GENERATE id, Transpose(val1 .. val3);
- Author:
- "William Vaughan "
Fields inherited from class org.apache.pig.EvalFunc |
log, pigLogger, reporter, returnType |
Method Summary |
org.apache.pig.data.DataBag |
exec(org.apache.pig.data.Tuple input)
|
org.apache.pig.impl.logicalLayer.schema.Schema |
getOutputSchema(org.apache.pig.impl.logicalLayer.schema.Schema input)
Specify the output schema as in {link EvalFunc#outputSchema(Schema)}. |
Methods inherited from class datafu.pig.util.AliasableEvalFunc |
getBag, getBoolean, getDouble, getDouble, getFieldAliases, getFloat, getFloat, getInteger, getInteger, getLong, getLong, getObject, getPosition, getPosition, getPrefixedAliasName, getString, getString, outputSchema |
Methods inherited from class org.apache.pig.EvalFunc |
finish, getArgToFuncMapping, getCacheFiles, getInputSchema, getLogger, getPigLogger, getReporter, getReturnType, getSchemaName, isAsynchronous, progress, setInputSchema, setPigLogger, setReporter, warn |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TransposeTupleToBag
public TransposeTupleToBag()
getOutputSchema
public org.apache.pig.impl.logicalLayer.schema.Schema getOutputSchema(org.apache.pig.impl.logicalLayer.schema.Schema input)
- Description copied from class:
AliasableEvalFunc
- Specify the output schema as in {link EvalFunc#outputSchema(Schema)}.
- Specified by:
getOutputSchema
in class AliasableEvalFunc<org.apache.pig.data.DataBag>
- Returns:
- outputSchema
exec
public org.apache.pig.data.DataBag exec(org.apache.pig.data.Tuple input)
throws java.io.IOException
- Specified by:
exec
in class org.apache.pig.EvalFunc<org.apache.pig.data.DataBag>
- Throws:
java.io.IOException
Matthew Hayes, Sam Shah