[fix](nereids)fix bug of cast expr to decimalv3 without any check (#22466)

This commit is contained in:
starocean999
2023-08-01 21:59:47 +08:00
committed by GitHub
parent 94dee833cd
commit 809f67e478
2 changed files with 4 additions and 1 deletions

View File

@ -203,7 +203,8 @@ public class SimplifyComparisonPredicate extends AbstractExpressionRewriteRule {
right = temp;
}
if (left instanceof Cast && right instanceof DecimalV3Literal) {
if (left instanceof Cast && left.child(0).getDataType().isDecimalV3Type()
&& right instanceof DecimalV3Literal) {
Cast cast = (Cast) left;
left = cast.child();
DecimalV3Literal literal = (DecimalV3Literal) right;

View File

@ -70,4 +70,6 @@ suite("test_simplify_comparison") {
contains ">= 111.12"
contains ">= '2023-06-16 00:00:00'"
}
sql "select cast('1234' as decimalv3(18,4)) > 2000;"
}