public class GetYear extends EvalFunc<java.lang.Integer>
Example usage: ISOin = LOAD 'test.tsv' USING PigStorage('\t') AS (dt:datetime); DESCRIBE ISOin; ISOin: {dt: datetime} DUMP ISOin; (2009-01-07T01:07:01.071Z) (2008-02-06T02:06:02.062Z) (2007-03-05T03:05:03.053Z) ... truncated = FOREACH ISO in GENERATE GetYear(dt) AS year, GetMonth(dt) as month, GetWeek(dt) as week, GetWeekYear(dt) as weekyear, GetDay(dt) AS day, GetHour(dt) AS hour, GetMinute(dt) AS min, GetSecond(dt) AS sec; GetMillSecond(dt) AS milli; DESCRIBE truncated; truncated: {year: int,month: int,week: int,weekyear: int,day: int,hour: int,min: int,sec: int,milli: int} DUMP truncated; (2009,1,2,2009,7,1,7,1,71) (2008,2,6,2008,6,2,6,2,62) (2007,3,10,2007,5,3,5,3,53)
EvalFunc.SchemaType
log, pigLogger, reporter, returnType
Constructor and Description |
---|
GetYear() |
Modifier and Type | Method and Description |
---|---|
boolean |
allowCompileTimeCalculation()
Whether the UDF should be evaluated at compile time if all inputs are constant.
|
java.lang.Integer |
exec(Tuple input)
This callback method must be implemented by all subclasses.
|
java.util.List<FuncSpec> |
getArgToFuncMapping()
Allow a UDF to specify type specific implementations of itself.
|
Schema |
outputSchema(Schema input)
Report the schema of the output of this UDF.
|
finish, getCacheFiles, getInputSchema, getLoadCaster, getLogger, getPigLogger, getReporter, getReturnType, getSchemaName, getSchemaType, getShipFiles, isAsynchronous, needEndOfAllInputProcessing, progress, setEndOfAllInput, setInputSchema, setPigLogger, setReporter, setUDFContextSignature, warn
public java.lang.Integer exec(Tuple input) throws java.io.IOException
EvalFunc
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<java.lang.Integer>
input
- Schema of the inputpublic java.util.List<FuncSpec> getArgToFuncMapping() throws FrontendException
EvalFunc
getArgToFuncMapping
in class EvalFunc<java.lang.Integer>
FrontendException
public boolean allowCompileTimeCalculation()
EvalFunc
allowCompileTimeCalculation
in class EvalFunc<java.lang.Integer>
Copyright © 2007-2017 The Apache Software Foundation