You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2025/11/25 08:13:13 UTC

(doris) branch branch-4.0 updated: branch-4.0: [opt](function) better signature match for time type #58193 (#58335)

This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 00ab6551ed1 branch-4.0: [opt](function) better signature match for time type #58193 (#58335)
00ab6551ed1 is described below

commit 00ab6551ed1cc7160b413f1c57b196a22e83ce4b
Author: github-actions[bot] <41...@users.noreply.github.com>
AuthorDate: Tue Nov 25 16:13:05 2025 +0800

    branch-4.0: [opt](function) better signature match for time type #58193 (#58335)
    
    Cherry-picked from #58193
    
    Co-authored-by: morrySnow <zh...@selectdb.com>
---
 .../expressions/functions/SearchSignature.java     |  46 ++++--
 .../trees/expressions/literal/TimeV2Literal.java   |  61 ++++++++
 .../literal/format/DateTimeChecker.java            |  12 +-
 .../expressions/literal/format/TimeChecker.java    |  71 +++++++++
 .../doris/nereids/util/TypeCoercionUtils.java      |   7 +
 .../expressions/literal/DateTimeLiteralTest.java   |   1 -
 .../literal/format/TimeCheckerTest.java            |  61 ++++++++
 .../sql-functions/doc_date_functions_test.out      |   6 +-
 .../data/nereids_function_p0/scalar_function/S.out | 173 +++++++++++----------
 .../nereids_function_p0/scalar_function/S.groovy   |   3 +
 10 files changed, 339 insertions(+), 102 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/SearchSignature.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/SearchSignature.java
index 42c0a98bb75..07a85f53674 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/SearchSignature.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/SearchSignature.java
@@ -79,10 +79,15 @@ public class SearchSignature {
         // search every round
         for (BiFunction<DataType, DataType, Boolean> typePredicate : typePredicatePerRound) {
             int candidateNonStrictMatched = Integer.MAX_VALUE;
+            int candidateNonStrictMatchedWithoutStringLiteralCoercion = Integer.MAX_VALUE;
             int candidateDateToDateV2Count = Integer.MIN_VALUE;
             FunctionSignature candidate = null;
             for (FunctionSignature signature : signatures) {
-                if (doMatchArity(signature, arguments) && doMatchTypes(signature, arguments, typePredicate)) {
+                if (doMatchArity(signature, arguments)) {
+                    Pair<Boolean, Integer> matchTypesResult = doMatchTypes(signature, arguments, typePredicate);
+                    if (!matchTypesResult.first) {
+                        continue;
+                    }
                     // first we need to check decimal v3 precision promotion
                     if (computeSignature instanceof ComputePrecision) {
                         if (!((ComputePrecision) computeSignature).checkPrecision(signature)) {
@@ -94,17 +99,34 @@ public class SearchSignature {
                             continue;
                         }
                     }
-                    // has most identical matched signature has the highest priority
+                    // compare identical matched, the more identical matched has higher priority
+                    // first, compare identical matched + string like literal coercion
+                    // if equals, compare identical matched itself
+                    // if equals, compare identical matched + date to datev2
                     Pair<Integer, Integer> currentNonStrictMatched = nonStrictMatchedCount(signature, arguments);
-                    if (currentNonStrictMatched.first < candidateNonStrictMatched) {
-                        candidateNonStrictMatched = currentNonStrictMatched.first;
+                    int currentNonStrictMatchedCount = currentNonStrictMatched.first;
+                    int currentNonStrictMatchedWithoutStringLiteralCoercion
+                            = currentNonStrictMatchedCount - matchTypesResult.second;
+                    if (currentNonStrictMatchedWithoutStringLiteralCoercion
+                            < candidateNonStrictMatchedWithoutStringLiteralCoercion) {
+                        candidateNonStrictMatchedWithoutStringLiteralCoercion
+                                = currentNonStrictMatchedWithoutStringLiteralCoercion;
+                        candidateNonStrictMatched = currentNonStrictMatchedCount;
                         candidateDateToDateV2Count = currentNonStrictMatched.second;
                         candidate = signature;
-                    } else if (currentNonStrictMatched.first == candidateNonStrictMatched) {
-                        // if we need to do same count cast, then we choose the signature need to do more v1 to v2 cast
-                        if (candidateDateToDateV2Count < currentNonStrictMatched.second) {
+                    } else if (currentNonStrictMatchedWithoutStringLiteralCoercion
+                            == candidateNonStrictMatchedWithoutStringLiteralCoercion) {
+                        if (currentNonStrictMatchedCount < candidateNonStrictMatched) {
+                            candidateNonStrictMatched = currentNonStrictMatchedCount;
                             candidateDateToDateV2Count = currentNonStrictMatched.second;
                             candidate = signature;
+                        } else if (currentNonStrictMatchedCount == candidateNonStrictMatched) {
+                            // if we need to do same count cast,
+                            // then we choose the signature need to do more v1 to v2 cast
+                            if (candidateDateToDateV2Count < currentNonStrictMatched.second) {
+                                candidateDateToDateV2Count = currentNonStrictMatched.second;
+                                candidate = signature;
+                            }
                         }
                     }
                 }
@@ -204,8 +226,9 @@ public class SearchSignature {
         return Pair.of(nonStrictMatched, dateToDateV2Count);
     }
 
-    private boolean doMatchTypes(FunctionSignature sig, List<Expression> arguments,
+    private Pair<Boolean, Integer> doMatchTypes(FunctionSignature sig, List<Expression> arguments,
             BiFunction<DataType, DataType, Boolean> typePredicate) {
+        int stringLiteralCoersionCount = 0;
         int arity = arguments.size();
         for (int i = 0; i < arity; i++) {
             DataType sigArgType = sig.getArgType(i);
@@ -217,12 +240,15 @@ public class SearchSignature {
             if (!argument.isNullLiteral() && argument.isLiteral() && realType.isStringLikeType()) {
                 realType = TypeCoercionUtils.characterLiteralTypeCoercion(((Literal) argument).getStringValue(),
                         sigArgType).orElse(argument).getDataType();
+                if (!realType.isStringLikeType()) {
+                    stringLiteralCoersionCount++;
+                }
             }
             if (!typePredicate.apply(sigArgType, realType)) {
-                return false;
+                return Pair.of(false, stringLiteralCoersionCount);
             }
         }
-        return true;
+        return Pair.of(true, stringLiteralCoersionCount);
     }
 
     public static void throwCanNotFoundFunctionException(String name, List<Expression> arguments) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/TimeV2Literal.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/TimeV2Literal.java
index e697ef2b2e7..0d34d75344e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/TimeV2Literal.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/TimeV2Literal.java
@@ -141,6 +141,67 @@ public class TimeV2Literal extends Literal {
         return s;
     }
 
+    /**
+     * parse time string and avoid throw exception directly for better performance.
+     */
+    public static Result<TimeV2Literal, AnalysisException> parseTimeLiteral(String s) {
+        int hour;
+        int minute;
+        int second;
+        int microsecond;
+        boolean negative = false;
+        String normalized = normalize(s);
+        if (normalized.charAt(0) == '-') {
+            negative = true;
+            normalized = normalized.substring(1);
+        } else if (normalized.charAt(0) == '+') {
+            normalized = normalized.substring(1);
+        }
+        // start parse string
+        String[] parts = normalized.split(":");
+        if (parts.length != 3) {
+            return Result.err(() -> new AnalysisException("Invalid format, must have 3 parts separated by ':'"));
+        }
+        try {
+            hour = Integer.parseInt(parts[0]);
+        } catch (NumberFormatException e) {
+            return Result.err(() -> new AnalysisException("Invalid hour format"));
+        }
+
+        try {
+            minute = Integer.parseInt(parts[1]);
+        } catch (NumberFormatException e) {
+            return Result.err(() -> new AnalysisException("Invalid minute format"));
+        }
+        // if parts[2] is 60.000 it will cause judge feed execute error
+        if (parts[2].startsWith("60")) {
+            return Result.err(() -> new AnalysisException("second out of range"));
+        }
+        double secPart;
+        try {
+            secPart = Double.parseDouble(parts[2]);
+        } catch (NumberFormatException e) {
+            return Result.err(() -> new AnalysisException("Invalid second format"));
+        }
+        secPart = secPart * (int) Math.pow(10, 6);
+        secPart = Math.round(secPart);
+        second = (int) (secPart / 1000000);
+        microsecond = (int) (secPart % 1000000);
+        if (second == 60) {
+            minute += 1;
+            second -= 60;
+            if (minute == 60) {
+                hour += 1;
+                minute -= 60;
+            }
+        }
+
+        if (checkRange(hour, minute, second, microsecond)) {
+            return Result.err(() -> new AnalysisException("time literal [" + s + "] is out of range"));
+        }
+        return Result.ok(new TimeV2Literal(hour, minute, second, microsecond, 6, negative));
+    }
+
     // should like be/src/vec/runtime/time_value.h timev2_to_double_from_str
     protected void init(String s) throws AnalysisException {
         s = normalize(s);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/format/DateTimeChecker.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/format/DateTimeChecker.java
index 7d60a01c041..6faa0277e17 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/format/DateTimeChecker.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/format/DateTimeChecker.java
@@ -38,9 +38,9 @@ public class DateTimeChecker extends FormatChecker {
                             // 2024-10-12
                             and(
                                 digit(1, 4), // year
-                                chars(DateLiteral.punctuations::contains),
+                                ch('-'),
                                 digit(1, 2), // month
-                                chars(DateLiteral.punctuations::contains),
+                                ch('-'),
                                 digit(1, 2) // day
                             )
                         )
@@ -65,19 +65,19 @@ public class DateTimeChecker extends FormatChecker {
                             // 2024-01-01 01:02:03
                             and("NormalDateTime",
                                 digit(1, 4), // year
-                                chars(DateLiteral.punctuations::contains),
+                                ch('-'),
                                 digit(1, 2), // month
-                                chars(DateLiteral.punctuations::contains),
+                                ch('-'),
                                 digit(1, 2), // day
                                 atLeast(1, c -> c == 'T' || c == ' ' || DateLiteral.punctuations.contains(c)),
                                 digit(1, 2), // hour
                                 option(
                                     and(
-                                        chars(DateLiteral.punctuations::contains),
+                                        ch(':'),
                                         digit(1, 2), // minute
                                         option(
                                             and(
-                                                chars(DateLiteral.punctuations::contains),
+                                                ch(':'),
                                                 digit(1, 2) // second
                                             )
                                         )
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/format/TimeChecker.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/format/TimeChecker.java
new file mode 100644
index 00000000000..b36332f1481
--- /dev/null
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/format/TimeChecker.java
@@ -0,0 +1,71 @@
+// 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.format;
+
+/**
+ * Time literal format checker, support two types of time string:
+ *   colon format: ([+-])?\d+:\d{1,2}(:\d{1,2}(.\d+)?)?
+ * NOTICE: only process colon format, because we do not treat numeric format as a time type
+ *   when do string literal corecion
+ */
+public class TimeChecker extends FormatChecker {
+    private static final TimeChecker INSTANCE = new TimeChecker();
+
+    private final FormatChecker checker;
+
+    private TimeChecker() {
+        super("TimeChecker");
+
+        this.checker =
+                // time
+                and("time format",
+                    option("sign", or(ch('-'), ch('+'))),
+                    // colon-format
+                    and("colon format",
+                        digit(1), // hour
+                        ch(':'),
+                        digit(1, 2), // minute
+                        option("second and micro second",
+                            and(
+                                ch(':'),
+                                digit(1, 2),
+                                option("micro second", nanoSecond())
+                            )
+                        ) // second
+                    )
+                );
+    }
+
+    public static boolean isValidTime(String str) {
+        str = str.trim();
+        StringInspect stringInspect = new StringInspect(str.trim());
+        return INSTANCE.check(stringInspect).matched && stringInspect.eos();
+    }
+
+    @Override
+    protected boolean doCheck(StringInspect stringInspect) {
+        return checker.check(stringInspect).matched;
+    }
+
+    private FormatChecker nanoSecond() {
+        return and(
+            ch('.'),
+            digit(1)
+        );
+    }
+}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/util/TypeCoercionUtils.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/util/TypeCoercionUtils.java
index 03505d579ae..b00210eadf5 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/util/TypeCoercionUtils.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/util/TypeCoercionUtils.java
@@ -67,11 +67,13 @@ import org.apache.doris.nereids.trees.expressions.literal.Result;
 import org.apache.doris.nereids.trees.expressions.literal.SmallIntLiteral;
 import org.apache.doris.nereids.trees.expressions.literal.StringLikeLiteral;
 import org.apache.doris.nereids.trees.expressions.literal.StringLiteral;
+import org.apache.doris.nereids.trees.expressions.literal.TimeV2Literal;
 import org.apache.doris.nereids.trees.expressions.literal.TinyIntLiteral;
 import org.apache.doris.nereids.trees.expressions.literal.VarcharLiteral;
 import org.apache.doris.nereids.trees.expressions.literal.format.DateTimeChecker;
 import org.apache.doris.nereids.trees.expressions.literal.format.FloatChecker;
 import org.apache.doris.nereids.trees.expressions.literal.format.IntegerChecker;
+import org.apache.doris.nereids.trees.expressions.literal.format.TimeChecker;
 import org.apache.doris.nereids.types.ArrayType;
 import org.apache.doris.nereids.types.BigIntType;
 import org.apache.doris.nereids.types.BooleanType;
@@ -637,6 +639,11 @@ public class TypeCoercionUtils {
                         ret = parseResult2.get();
                     }
                 }
+            } else if (dataType instanceof TimeV2Type && TimeChecker.isValidTime(value)) {
+                Result<TimeV2Literal, AnalysisException> parseResult = TimeV2Literal.parseTimeLiteral(value);
+                if (parseResult.isOk()) {
+                    ret = new TimeV2Literal(value);
+                }
             }
         } catch (Exception e) {
             if (LOG.isDebugEnabled()) {
diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeLiteralTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeLiteralTest.java
index 78e1ad48d8c..94499f1faa2 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeLiteralTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeLiteralTest.java
@@ -51,7 +51,6 @@ class DateTimeLiteralTest {
         check("0-08-01 13:21:03", DateTimeV2Literal::new);
         check("0-08-01 13:21:03", DateTimeV2Literal::new);
         check("0001-01-01: 00:01:01.001", DateTimeV2Literal::new);
-        check("2021?01?01 00.00.00", DateTimeV2Literal::new);
     }
 
     @Test
diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/format/TimeCheckerTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/format/TimeCheckerTest.java
new file mode 100644
index 00000000000..ec1d514fe40
--- /dev/null
+++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/format/TimeCheckerTest.java
@@ -0,0 +1,61 @@
+// 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.format;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class TimeCheckerTest {
+
+    @Test
+    public void testColon() {
+        String literal;
+        literal = "0:0";
+        Assertions.assertTrue(TimeChecker.isValidTime(literal));
+        literal = "00:0";
+        Assertions.assertTrue(TimeChecker.isValidTime(literal));
+        literal = "000:0";
+        Assertions.assertTrue(TimeChecker.isValidTime(literal));
+        literal = "+0:0";
+        Assertions.assertTrue(TimeChecker.isValidTime(literal));
+        literal = "-0:0";
+        Assertions.assertTrue(TimeChecker.isValidTime(literal));
+        literal = "0:00";
+        Assertions.assertTrue(TimeChecker.isValidTime(literal));
+        literal = "0:00:0";
+        Assertions.assertTrue(TimeChecker.isValidTime(literal));
+        literal = "0:0:00";
+        Assertions.assertTrue(TimeChecker.isValidTime(literal));
+        literal = "0:0:0.0";
+        Assertions.assertTrue(TimeChecker.isValidTime(literal));
+        literal = "0:0:0.00";
+        Assertions.assertTrue(TimeChecker.isValidTime(literal));
+
+        literal = ":0";
+        Assertions.assertFalse(TimeChecker.isValidTime(literal));
+        literal = "0:0:0:0";
+        Assertions.assertFalse(TimeChecker.isValidTime(literal));
+        literal = "0:0:0.";
+        Assertions.assertFalse(TimeChecker.isValidTime(literal));
+        literal = "0:a:0";
+        Assertions.assertFalse(TimeChecker.isValidTime(literal));
+        literal = "!0:0:0";
+        Assertions.assertFalse(TimeChecker.isValidTime(literal));
+
+    }
+}
diff --git a/regression-test/data/doc/sql-manual/sql-functions/doc_date_functions_test.out b/regression-test/data/doc/sql-manual/sql-functions/doc_date_functions_test.out
index af6299e05f1..99924258d49 100644
--- a/regression-test/data/doc/sql-manual/sql-functions/doc_date_functions_test.out
+++ b/regression-test/data/doc/sql-manual/sql-functions/doc_date_functions_test.out
@@ -831,7 +831,7 @@ gdaskpdp
 5
 
 -- !minute_3 --
-\N
+25
 
 -- !minute_4 --
 0
@@ -1200,10 +1200,10 @@ da fanadur
 -2.032258064516129
 
 -- !months_between_4 --
-1.0
+1
 
 -- !months_between_5 --
-2.0
+2
 
 -- !months_between_6 --
 0.96774194
diff --git a/regression-test/data/nereids_function_p0/scalar_function/S.out b/regression-test/data/nereids_function_p0/scalar_function/S.out
index 96c7342bf11..2c4d7d2f14f 100644
--- a/regression-test/data/nereids_function_p0/scalar_function/S.out
+++ b/regression-test/data/nereids_function_p0/scalar_function/S.out
@@ -86,6 +86,15 @@
 0
 0
 
+-- !sql_second_time_like_string_literal --
+3
+
+-- !sql_second_date_like_string_literal --
+0
+
+-- !sql_second_datetime_like_string_literal --
+6
+
 -- !sql_second_ceil_DateTime --
 \N
 2012-03-01T01:00:01
@@ -1228,7 +1237,7 @@ bd9a11352a4d84a4725035750ddea145189a72b6eb89c0e07fa9d3b21d70004a
 0.8366600265340756
 0.8944271909999159
 0.9486832980505138
-1.0
+1
 1.048808848170152
 1.095445115010332
 
@@ -1242,7 +1251,7 @@ bd9a11352a4d84a4725035750ddea145189a72b6eb89c0e07fa9d3b21d70004a
 0.8366600265340756
 0.8944271909999159
 0.9486832980505138
-1.0
+1
 1.048808848170152
 1.095445115010332
 
@@ -1431,9 +1440,9 @@ true
 3769873.088347999
 5444447.792934861
 6147671.120161625
-1.035297326293324E7
-1.144216668570059E7
-1.325024232053077E7
+10352973.26293324
+11442166.68570059
+13250242.32053077
 
 -- !sql_st_distance_sphere_Double_Double_Double_Double_notnull --
 126710.8075970755
@@ -1445,9 +1454,9 @@ true
 3769873.088347999
 5444447.792934861
 6147671.120161625
-1.035297326293324E7
-1.144216668570059E7
-1.325024232053077E7
+10352973.26293324
+11442166.68570059
+13250242.32053077
 
 -- !sql_st_angle_sphere_Double_Double_Double_Double --
 \N
@@ -1460,7 +1469,7 @@ true
 33.90322998430229
 48.96301847187235
 55.28724786489494
-93.1063792676294
+93.10637926762941
 102.9017156739413
 119.1621049868142
 
@@ -1474,7 +1483,7 @@ true
 33.90322998430229
 48.96301847187235
 55.28724786489494
-93.1063792676294
+93.10637926762941
 102.9017156739413
 119.1621049868142
 
@@ -1569,40 +1578,40 @@ true
 
 -- !sql_st_area_square_meters_polygon --
 \N
-7.437458708775987E10
-1.111857832827603E11
-1.854239874244372E11
-1.233204703525308E12
-1.700152567402145E12
-2.758057013762126E12
-3.626905565533547E12
-4.961916929237377E12
-7.513981106323984E12
-1.290596105132623E13
-1.886514910145882E13
-3.688074164508929E13
+74374587087.75987
+111185783282.7603
+185423987424.4372
+1233204703525.308
+1700152567402.145
+2758057013762.126
+3626905565533.547
+4961916929237.377
+7513981106323.984
+12905961051326.23
+18865149101458.82
+36880741645089.29
 
 -- !sql_st_area_square_meters_polygon_notnull --
-7.437458708775987E10
-1.111857832827603E11
-1.854239874244372E11
-1.233204703525308E12
-1.700152567402145E12
-2.758057013762126E12
-3.626905565533547E12
-4.961916929237377E12
-7.513981106323984E12
-1.290596105132623E13
-1.886514910145882E13
-3.688074164508929E13
+74374587087.75987
+111185783282.7603
+185423987424.4372
+1233204703525.308
+1700152567402.145
+2758057013762.126
+3626905565533.547
+4961916929237.377
+7513981106323.984
+12905961051326.23
+18865149101458.82
+36880741645089.29
 
 -- !sql_st_area_km_circle --
 \N
-1.692388987658693E-5
-3.464875625131964E-5
-5.865680793323106E-5
-8.824734399097151E-5
-1.68380074822031E-4
+1.692388987658693e-05
+3.464875625131964e-05
+5.865680793323106e-05
+8.824734399097151e-05
+0.000168380074822031
 0.003488075715660701
 0.006452809204777549
 0.01381821651960589
@@ -1612,11 +1621,11 @@ true
 0.03161793995783701
 
 -- !sql_st_area_km_circle_notnull --
-1.692388987658693E-5
-3.464875625131964E-5
-5.865680793323106E-5
-8.824734399097151E-5
-1.68380074822031E-4
+1.692388987658693e-05
+3.464875625131964e-05
+5.865680793323106e-05
+8.824734399097151e-05
+0.000168380074822031
 0.003488075715660701
 0.006452809204777549
 0.01381821651960589
@@ -1636,9 +1645,9 @@ true
 3626905.565533547
 4961916.929237378
 7513981.106323985
-1.290596105132624E7
-1.886514910145883E7
-3.688074164508929E7
+12905961.05132624
+18865149.10145883
+36880741.64508929
 
 -- !sql_st_area_km_polygon_notnull --
 74374.58708775988
@@ -1650,9 +1659,9 @@ true
 3626905.565533547
 4961916.929237378
 7513981.106323985
-1.290596105132624E7
-1.886514910145883E7
-3.688074164508929E7
+12905961.05132624
+18865149.10145883
+36880741.64508929
 
 -- !sql_st_geometryfromtext_Varchar --
 \N
@@ -2091,66 +2100,66 @@ POLYGON ((4 4, 45 4, 45 45, 4 45, 4 4))
 
 -- !sql_st_x_Varchar --
 \N
--74.35620117
+-74.35620117000001
 -46.35620117
-5.0
+5
 16.35620117
 43.35620117
 47.35620117
-90.35620117
-90.35620117
-90.35620117
-90.35620117
-98.35620117
+90.35620117000001
+90.35620117000001
+90.35620117000001
+90.35620117000001
+98.35620117000001
 126.35620117
 
 -- !sql_st_x_Varchar_notnull --
--74.35620117
+-74.35620117000001
 -46.35620117
-5.0
+5
 16.35620117
 43.35620117
 47.35620117
-90.35620117
-90.35620117
-90.35620117
-90.35620117
-98.35620117
+90.35620117000001
+90.35620117000001
+90.35620117000001
+90.35620117000001
+98.35620117000001
 126.35620117
 
 -- !sql_st_x_String --
 \N
--74.35620117
+-74.35620117000001
 -46.35620117
-5.0
+5
 16.35620117
 43.35620117
 47.35620117
-90.35620117
-90.35620117
-90.35620117
-90.35620117
-98.35620117
+90.35620117000001
+90.35620117000001
+90.35620117000001
+90.35620117000001
+98.35620117000001
 126.35620117
 
 -- !sql_st_x_String_notnull --
--74.35620117
+-74.35620117000001
 -46.35620117
-5.0
+5
 16.35620117
 43.35620117
 47.35620117
-90.35620117
-90.35620117
-90.35620117
-90.35620117
-98.35620117
+90.35620117000001
+90.35620117000001
+90.35620117000001
+90.35620117000001
+98.35620117000001
 126.35620117
 
 -- !sql_st_y_Varchar --
 \N
 -39.939093
-5.0
+5
 19.939093
 26.939093
 35.939093
@@ -2164,7 +2173,7 @@ POLYGON ((4 4, 45 4, 45 45, 4 45, 4 4))
 
 -- !sql_st_y_Varchar_notnull --
 -39.939093
-5.0
+5
 19.939093
 26.939093
 35.939093
@@ -2179,7 +2188,7 @@ POLYGON ((4 4, 45 4, 45 45, 4 45, 4 4))
 -- !sql_st_y_String --
 \N
 -39.939093
-5.0
+5
 19.939093
 26.939093
 35.939093
@@ -2193,7 +2202,7 @@ POLYGON ((4 4, 45 4, 45 45, 4 45, 4 4))
 
 -- !sql_st_y_String_notnull --
 -39.939093
-5.0
+5
 19.939093
 26.939093
 35.939093
diff --git a/regression-test/suites/nereids_function_p0/scalar_function/S.groovy b/regression-test/suites/nereids_function_p0/scalar_function/S.groovy
index e5c4aaf3ad6..ef993f2775b 100644
--- a/regression-test/suites/nereids_function_p0/scalar_function/S.groovy
+++ b/regression-test/suites/nereids_function_p0/scalar_function/S.groovy
@@ -25,6 +25,9 @@ suite("nereids_scalar_fn_S") {
 	qt_sql_second_DateTimeV2_notnull "select second(kdtmv2s1) from fn_test_not_nullable order by kdtmv2s1"
 	qt_sql_second_DateV2 "select second(kdtv2) from fn_test order by kdtv2"
 	qt_sql_second_DateV2_notnull "select second(kdtv2) from fn_test_not_nullable order by kdtv2"
+	qt_sql_second_time_like_string_literal "select second('01:02:03')"
+	qt_sql_second_date_like_string_literal "select second('01-02-03')"
+	qt_sql_second_datetime_like_string_literal "select second('01-02-03 04:05:06')"
 	qt_sql_second_ceil_DateTime "select second_ceil(kdtm) from fn_test order by kdtm"
 	qt_sql_second_ceil_DateTime_notnull "select second_ceil(kdtm) from fn_test_not_nullable order by kdtm"
 	qt_sql_second_ceil_DateTimeV2 "select second_ceil(kdtmv2s1) from fn_test order by kdtmv2s1"


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