Jibing-Li commented on code in PR #50425:
URL: https://github.com/apache/doris/pull/50425#discussion_r2065384436


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnFE.java:
##########
@@ -515,6 +519,22 @@ public Expression visitCast(Cast cast, 
ExpressionRewriteContext context) {
         }
     }
 
+    // Check if the given literal value is safe to cast to the targetType.
+    // We need to guarantee FE cast result is identical with BE cast result.
+    // Otherwise, it's not safe.
+    protected boolean safeToCast(Cast cast) {
+        if (cast == null || cast.child() == null || cast.getDataType() == 
null) {
+            return true;
+        }
+        // Check double type.
+        if (cast.child() instanceof DoubleLiteral && 
cast.getDataType().isStringLikeType()) {
+            Double value = ((DoubleLiteral) cast.child()).getValue();
+            return -1E16 < value && value < 1E16;

Review Comment:
   Yes, it would return false. But I will change it to true so that the 
behavior would be the same with be.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to