We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 1193310 + 76def47 commit d6118eaCopy full SHA for d6118ea
core/src/main/java/com/dtstack/flink/sql/udf/TimestampUdf.java
@@ -0,0 +1,24 @@
1
+package com.dtstack.flink.sql.udf;
2
+
3
+import org.apache.flink.table.functions.FunctionContext;
4
+import org.apache.flink.table.functions.ScalarFunction;
5
6
+import java.sql.Timestamp;
7
8
+public class TimestampUdf extends ScalarFunction {
9
+ @Override
10
+ public void open(FunctionContext context) {
11
+ }
12
+ public static Timestamp eval(String timestamp) {
13
+ if (timestamp.length() == 13){
14
+ return new Timestamp(Long.parseLong(timestamp));
15
+ }else if (timestamp.length() == 10){
16
+ return new Timestamp(Long.parseLong(timestamp)*1000);
17
+ } else{
18
+ return Timestamp.valueOf(timestamp);
19
20
21
22
+ public void close() {
23
24
+}
0 commit comments