[fix](planner)cast expr should do nothing in compactForLiteral method (#34047)

This commit is contained in:
starocean999
2024-04-26 09:35:47 +08:00
committed by yiguolei
parent fdf91759b6
commit b7b87fbb95
2 changed files with 16 additions and 0 deletions

View File

@ -592,4 +592,9 @@ public class CastExpr extends Expr {
public boolean isNotFold() {
return this.notFold;
}
@Override
protected void compactForLiteral(Type type) {
// do nothing
}
}

View File

@ -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);"""
}