public class ToDate extends EvalFunc<org.joda.time.DateTime>
ToDate converts the ISO or the customized string or the Unix timestamp to the DateTime object.
ToDate is overloaded.
DateTime ToDate(Long millis)
.the milliseconds
.the DateTime object
.DateTime ToDate(String dtStr)
.the ISO format date time string
.the DateTime object
.DateTime ToDate(String dtStr, String format)
.dtStr: the string that represents a date time
.format: the format string
.the DateTime object
.DateTime ToDate(String dtStr, String format, String timezone)
.dtStr: the string that represents a date time
.format: the format string
.timezone: the timezone string
.the DateTime object
.EvalFunc.SchemaType
log, pigLogger, reporter, returnType
Constructor and Description |
---|
ToDate() |
Modifier and Type | Method and Description |
---|---|
boolean |
allowCompileTimeCalculation()
Whether the UDF should be evaluated at compile time if all inputs are constant.
|
org.joda.time.DateTime |
exec(Tuple input)
This callback method must be implemented by all subclasses.
|
static org.joda.time.DateTime |
extractDateTime(String dtStr) |
static org.joda.time.DateTimeZone |
extractDateTimeZone(String dtStr) |
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, getLogger, getPigLogger, getReporter, getReturnType, getSchemaName, getSchemaType, getShipFiles, isAsynchronous, needEndOfAllInputProcessing, progress, setEndOfAllInput, setInputSchema, setPigLogger, setReporter, setUDFContextSignature, warn
public org.joda.time.DateTime exec(Tuple input) throws IOException
EvalFunc
exec
in class EvalFunc<org.joda.time.DateTime>
input
- the Tuple to be processed.IOException
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<org.joda.time.DateTime>
input
- Schema of the inputpublic List<FuncSpec> getArgToFuncMapping() throws FrontendException
EvalFunc
getArgToFuncMapping
in class EvalFunc<org.joda.time.DateTime>
FrontendException
public static org.joda.time.DateTimeZone extractDateTimeZone(String dtStr)
public static org.joda.time.DateTime extractDateTime(String dtStr)
public boolean allowCompileTimeCalculation()
EvalFunc
allowCompileTimeCalculation
in class EvalFunc<org.joda.time.DateTime>
Copyright © 2007-2012 The Apache Software Foundation