Class ToTimestampLtzFunction
java.lang.Object
org.apache.flink.table.functions.UserDefinedFunction
org.apache.flink.table.functions.ScalarFunction
org.apache.flink.table.runtime.functions.scalar.BuiltInScalarFunction
org.apache.flink.table.runtime.functions.scalar.ToTimestampLtzFunction
- All Implemented Interfaces:
Serializable,org.apache.flink.table.functions.FunctionDefinition
Implementation of
BuiltInFunctionDefinitions.TO_TIMESTAMP_LTZ.
A function that converts various time formats to TIMESTAMP_LTZ type.
Supported function signatures:
TO_TIMESTAMP_LTZ(numeric)-> TIMESTAMP_LTZ(3)
Converts numeric epoch time in milliseconds to timestamp with local timezoneTO_TIMESTAMP_LTZ(numeric, precision)-> TIMESTAMP_LTZ(precision)
Converts numeric epoch time to timestamp with specified precision (0 as seconds, 3 as milliseconds)TO_TIMESTAMP_LTZ(timestamp)-> TIMESTAMP_LTZ(3)
Parses string timestamp using default format 'yyyy-MM-dd HH:mm:ss'TO_TIMESTAMP_LTZ(timestamp, format)-> TIMESTAMP_LTZ(3)
Parses string timestamp using input string of formatTO_TIMESTAMP_LTZ(timestamp, format, timezone)-> TIMESTAMP_LTZ(3)
Parses string timestamp using input strings of format and timezone
Example:
TO_TIMESTAMP_LTZ('2023-01-01 10:00:00') // Parses string using default format
TO_TIMESTAMP_LTZ(1234567890123) // Converts epoch milliseconds
TO_TIMESTAMP_LTZ(1234567890, 0) // Converts epoch seconds
TO_TIMESTAMP_LTZ(1234567890123, 3) // Converts epoch milliseconds
TO_TIMESTAMP_LTZ('2023-01-01 10:00:00') // Parses string using default format
TO_TIMESTAMP_LTZ('2023-01-01T10:00:00', 'yyyy-MM-dd\'T\'HH:mm:ss') // Parses string using input format
TO_TIMESTAMP_LTZ('2023-01-01 10:00:00', 'yyyy-MM-dd HH:mm:ss', 'UTC') // Parses string using input format and timezone
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionToTimestampLtzFunction(org.apache.flink.table.functions.SpecializedFunction.SpecializedContext context) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.flink.table.data.TimestampDataorg.apache.flink.table.data.TimestampDataorg.apache.flink.table.data.TimestampDataeval(org.apache.flink.table.data.DecimalData epoch) org.apache.flink.table.data.TimestampDataorg.apache.flink.table.data.TimestampDataeval(org.apache.flink.table.data.StringData timestamp) org.apache.flink.table.data.TimestampDataeval(org.apache.flink.table.data.StringData timestamp, org.apache.flink.table.data.StringData format) org.apache.flink.table.data.TimestampDataeval(org.apache.flink.table.data.StringData dateStr, org.apache.flink.table.data.StringData format, org.apache.flink.table.data.StringData timezone) Methods inherited from class org.apache.flink.table.runtime.functions.scalar.BuiltInScalarFunction
getArgumentDataTypes, getOutputDataType, getRequirements, getTypeInference, isDeterministicMethods inherited from class org.apache.flink.table.functions.ScalarFunction
getKind, getParameterTypes, getResultTypeMethods inherited from class org.apache.flink.table.functions.UserDefinedFunction
close, functionIdentifier, open, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.flink.table.functions.FunctionDefinition
supportsConstantFolding
-
Constructor Details
-
ToTimestampLtzFunction
public ToTimestampLtzFunction(org.apache.flink.table.functions.SpecializedFunction.SpecializedContext context)
-
-
Method Details
-
eval
-
eval
@Nullable public org.apache.flink.table.data.TimestampData eval(org.apache.flink.table.data.DecimalData epoch, Integer precision) -
eval
-
eval
@Nullable public org.apache.flink.table.data.TimestampData eval(org.apache.flink.table.data.DecimalData epoch) -
eval
@Nullable public org.apache.flink.table.data.TimestampData eval(org.apache.flink.table.data.StringData timestamp) -
eval
@Nullable public org.apache.flink.table.data.TimestampData eval(org.apache.flink.table.data.StringData timestamp, org.apache.flink.table.data.StringData format) -
eval
@Nullable public org.apache.flink.table.data.TimestampData eval(org.apache.flink.table.data.StringData dateStr, org.apache.flink.table.data.StringData format, org.apache.flink.table.data.StringData timezone)
-