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

kxiao 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 809f67e478 [fix](nereids)fix bug of cast expr to decimalv3 without any 
check (#22466)
809f67e478 is described below

commit 809f67e47803335f33fa40c04259d41fad572927
Author: starocean999 <[email protected]>
AuthorDate: Tue Aug 1 21:59:47 2023 +0800

    [fix](nereids)fix bug of cast expr to decimalv3 without any check (#22466)
---
 .../nereids/rules/expression/rules/SimplifyComparisonPredicate.java    | 3 ++-
 .../suites/nereids_syntax_p0/test_simplify_comparison.groovy           | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicate.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicate.java
index cdc4d80a8a..c66e27e8b2 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicate.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyComparisonPredicate.java
@@ -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;
diff --git 
a/regression-test/suites/nereids_syntax_p0/test_simplify_comparison.groovy 
b/regression-test/suites/nereids_syntax_p0/test_simplify_comparison.groovy
index c252e8b86c..53c0ff9a12 100644
--- a/regression-test/suites/nereids_syntax_p0/test_simplify_comparison.groovy
+++ b/regression-test/suites/nereids_syntax_p0/test_simplify_comparison.groovy
@@ -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;"
 }
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to