This is an automated email from the ASF dual-hosted git repository. starocean999 pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push: new a8120e97537 [fix](planner)cast expr should do nothing in compactForLiteral method (#34051) a8120e97537 is described below commit a8120e97537234d948545fbed5834125d097b8dd Author: starocean999 <40539150+starocean...@users.noreply.github.com> AuthorDate: Fri Apr 26 09:35:54 2024 +0800 [fix](planner)cast expr should do nothing in compactForLiteral method (#34051) --- .../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 d592f50f352..fe464bf25bd 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 @@ -586,5 +586,10 @@ 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