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

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


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 557da5b24a8 [fix](Nereids) processCharacterLiteral even if both side 
are literal (#36729) (#36921)
557da5b24a8 is described below

commit 557da5b24a8794479db259b333cdaa2b824a7e21
Author: morrySnow <101034200+morrys...@users.noreply.github.com>
AuthorDate: Fri Jun 28 11:01:01 2024 +0800

    [fix](Nereids) processCharacterLiteral even if both side are literal 
(#36729) (#36921)
    
    pick from master #36729
---
 .../doris/nereids/util/TypeCoercionUtils.java      |  4 ----
 .../test_string_literal_vs_other_literal.out       | 11 ++++++++++
 .../test_string_literal_vs_other_literal.groovy    | 24 ++++++++++++++++++++++
 3 files changed, 35 insertions(+), 4 deletions(-)

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 e6dcca83a8b..0bbd11007a0 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
@@ -505,10 +505,6 @@ public class TypeCoercionUtils {
         if (!(left instanceof Literal) && !(right instanceof Literal)) {
             return (T) op.withChildren(left, right);
         }
-        if (left instanceof Literal && right instanceof Literal) {
-            // process by constant folding
-            return (T) op.withChildren(left, right);
-        }
         if (left instanceof Literal && ((Literal) left).isStringLikeLiteral()
                 && !right.getDataType().isStringLikeType()) {
             left = TypeCoercionUtils.characterLiteralTypeCoercion(
diff --git 
a/regression-test/data/nereids_p0/type_inference/test_string_literal_vs_other_literal.out
 
b/regression-test/data/nereids_p0/type_inference/test_string_literal_vs_other_literal.out
new file mode 100644
index 00000000000..788187beeba
--- /dev/null
+++ 
b/regression-test/data/nereids_p0/type_inference/test_string_literal_vs_other_literal.out
@@ -0,0 +1,11 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !numeric_eq --
+1
+
+-- !numeric_non_eq --
+
+-- !date_eq --
+1
+
+-- !date_eq --
+
diff --git 
a/regression-test/suites/nereids_p0/type_inference/test_string_literal_vs_other_literal.groovy
 
b/regression-test/suites/nereids_p0/type_inference/test_string_literal_vs_other_literal.groovy
new file mode 100644
index 00000000000..43ad242de07
--- /dev/null
+++ 
b/regression-test/suites/nereids_p0/type_inference/test_string_literal_vs_other_literal.groovy
@@ -0,0 +1,24 @@
+// 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.
+
+suite("test_string_literal_vs_other_literal") {
+    qt_numeric_eq """select 1 where "12345678901234567890" = 
12345678901234567890;"""
+    qt_numeric_non_eq """select 1 where "12345678901234567890" = 
12345678901234567891;"""
+
+    qt_date_eq """select 1 where "2024-06-24 00:01:02.345678" = 
cast("2024-06-24 00:01:02.345678" as datetime(6)) """
+    qt_date_eq """select 1 where "2024-06-24 00:01:02.345679" = 
cast("2024-06-24 00:01:02.345678" as datetime(6)) """
+}


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

Reply via email to