|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.pig.EvalFunc<Tuple>
org.apache.pig.piggybank.evaluation.MaxTupleBy1stField
public class MaxTupleBy1stField
MaxTupleBy1stField UDF returns a tuple with max value of the first field in a given bag. Caveat: first field assumed to have type 'long'. You may need to enforece this via schema when loading data, as sown in sample usage below. Sample usage: A = load 'test.tsv' as (first: long, second, third); B = GROUP A by second; C = FOREACH B GENERATE group, MaxTupleBy1stField(A);
| Nested Class Summary | |
|---|---|
static class |
MaxTupleBy1stField.Final
|
static class |
MaxTupleBy1stField.Initial
|
static class |
MaxTupleBy1stField.Intermediate
|
| Nested classes/interfaces inherited from class org.apache.pig.EvalFunc |
|---|
EvalFunc.SchemaType |
| Field Summary |
|---|
| Fields inherited from class org.apache.pig.EvalFunc |
|---|
log, pigLogger, reporter, returnType |
| Constructor Summary | |
|---|---|
MaxTupleBy1stField()
|
|
| Method Summary | |
|---|---|
Tuple |
exec(Tuple input)
This callback method must be implemented by all subclasses. |
String |
getFinal()
Get the final function. |
String |
getInitial()
Get the initial function. |
String |
getIntermed()
Get the intermediate function. |
protected static Tuple |
max(Tuple input,
PigProgressable reporter)
|
Schema |
outputSchema(Schema input)
Report the schema of the output of this UDF. |
| Methods inherited from class org.apache.pig.EvalFunc |
|---|
finish, getArgToFuncMapping, getCacheFiles, getInputSchema, getLogger, getPigLogger, getReporter, getReturnType, getSchemaName, getSchemaType, 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 |
|---|
public MaxTupleBy1stField()
| Method Detail |
|---|
public Schema outputSchema(Schema input)
EvalFunc
The default implementation interprets the OutputSchema annotation,
if one is present. Otherwise, it returns null (no known output schema).
outputSchema in class EvalFunc<Tuple>input - Schema of the input
public Tuple exec(Tuple input)
throws IOException
EvalFunc
exec in class EvalFunc<Tuple>input - the Tuple to be processed.
IOException
protected static Tuple max(Tuple input,
PigProgressable reporter)
throws ExecException
ExecExceptionpublic String getInitial()
Algebraic
getInitial in interface Algebraicpublic String getIntermed()
Algebraic
getIntermed in interface Algebraicpublic String getFinal()
Algebraic
getFinal in interface Algebraic
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||