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

starocean999 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 837b5e83d0b [fix](planner)cast expr should do nothing in 
compactForLiteral method (#34047)
837b5e83d0b is described below

commit 837b5e83d0b30391c1847e58dfd84c40dcca6e7b
Author: starocean999 <40539150+starocean...@users.noreply.github.com>
AuthorDate: Fri Apr 26 09:35:47 2024 +0800

    [fix](planner)cast expr should do nothing in compactForLiteral method 
(#34047)
---
 .../src/main/java/org/apache/doris/analysis/CastExpr.java     |  5 +++++
 .../suites/correctness_p0/test_cast_decimal.groovy            | 11 +++++++++++
 2 files changed, 16 insertions(+)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java
index 739901b7929..c73afac14c8 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/CastExpr.java
@@ -592,4 +592,9 @@ public class CastExpr extends Expr {
     public boolean isNotFold() {
         return this.notFold;
     }
+
+    @Override
+    protected void compactForLiteral(Type type) {
+        // do nothing
+    }
 }
diff --git a/regression-test/suites/correctness_p0/test_cast_decimal.groovy 
b/regression-test/suites/correctness_p0/test_cast_decimal.groovy
index 88859ea1d52..21a1ab6d0c3 100644
--- a/regression-test/suites/correctness_p0/test_cast_decimal.groovy
+++ b/regression-test/suites/correctness_p0/test_cast_decimal.groovy
@@ -34,4 +34,15 @@ suite("test_cast_decimal") {
         sql """select cast(32123.34212456734 as decimal(3,2));"""
         contains "CAST(32123.34212456734 AS DECIMALV3(3, 2))"
     }
+
+    sql """drop table if exists test_ttt"""
+    sql """create table test_ttt(big_key bigint)DISTRIBUTED BY HASH(big_key) 
BUCKETS 1 PROPERTIES ("replication_num" = "1");"""
+    sql """set enable_nereids_planner=false;"""
+    sql """set enable_fold_constant_by_be = false; """
+    sql """SELECT 1
+            FROM test_ttt e1
+            HAVING truncate(100, 2) < -2308.57
+            AND cast(round(round(465.56, min(-5.987)), 2) AS DECIMAL) in
+            (SELECT cast(truncate(round(8990.65 - 4556.2354, 2.4652), 2)AS 
DECIMAL)
+            FROM test_ttt r2);"""
 }


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

Reply via email to