caiconghui commented on a change in pull request #5946:
URL: https://github.com/apache/incubator-doris/pull/5946#discussion_r642369871



##########
File path: fe/fe-core/src/main/java/org/apache/doris/rewrite/FEFunctions.java
##########
@@ -225,11 +225,30 @@ public static DateLiteral now() throws AnalysisException {
         return  new 
DateLiteral(LocalDateTime.now(DateTimeZone.forTimeZone(TimeUtils.getTimeZone())),
 Type.DATETIME);
     }
 
+    @FEFunction(name = "current_timestamp", argTypes = {}, returnType = 
"DATETIME")
+    public static DateLiteral currentTimestamp() throws AnalysisException {
+        return now();
+    }
+
     @FEFunction(name = "curdate", argTypes = {}, returnType = "DATE")
     public static DateLiteral curDate() throws AnalysisException {
         return  new 
DateLiteral(LocalDateTime.now(DateTimeZone.forTimeZone(TimeUtils.getTimeZone())),
 Type.DATE);
     }
 
+    @FEFunction(name = "curtime", argTypes = {}, returnType = "TIME")
+    public static FloatLiteral curTime() throws AnalysisException {
+        DateLiteral now = now();
+        long firstTimestamp = now.unixTimestamp(TimeUtils.getTimeZone());
+        now.castToDate();
+        long secondTimestamp = now.unixTimestamp(TimeUtils.getTimeZone());
+        return new FloatLiteral((double) (firstTimestamp - secondTimestamp) / 
1000, Type.TIME);
+    }
+
+    @FEFunction(name = "current_time", argTypes = {}, returnType = "TIME")
+    public static FloatLiteral curentTime() throws AnalysisException {

Review comment:
       ```suggestion
       public static FloatLiteral currentTime() throws AnalysisException {
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to