koarz commented on code in PR #47319:
URL: https://github.com/apache/doris/pull/47319#discussion_r1979642046


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/TimeV2Literal.java:
##########
@@ -0,0 +1,275 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.trees.expressions.literal;
+
+import org.apache.doris.analysis.LiteralExpr;
+import org.apache.doris.nereids.exceptions.AnalysisException;
+import org.apache.doris.nereids.trees.expressions.Expression;
+import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
+import org.apache.doris.nereids.types.TimeV2Type;
+
+import java.time.LocalDateTime;
+
+/**
+ * Time literal in Nereids.
+ */
+public class TimeV2Literal extends Literal {
+    private static final LocalDateTime START_OF_A_DAY = LocalDateTime.of(0, 1, 
1, 0, 0, 0);
+    private static final LocalDateTime END_OF_A_DAY = LocalDateTime.of(9999, 
12, 31, 23, 59, 59, 999999000);
+    private static final TimeV2Literal MIN_TIME = new TimeV2Literal(-838, 0, 
0, 0, 0);
+    private static final TimeV2Literal MAX_TIME = new TimeV2Literal(838, 59, 
59, 999999, 6);
+
+    protected int hour;
+    protected int minute;
+    protected int second;
+    protected int microsecond;
+    protected boolean negative;
+
+    public TimeV2Literal(String s) {
+        this(TimeV2Type.of(0), s);

Review Comment:
   because if the sql is`select cast("01:01:01.123456" as time)` will call this 
function directly, the sql means scale is 0, unless it use `as time(scale)` 
this situation will call another function



-- 
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.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to