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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/FloatLiteral.java:
##########
@@ -68,7 +68,7 @@ protected Expression uncheckedCastTo(DataType targetType) 
throws AnalysisExcepti
             return this;
         }
         if (targetType.isDoubleType()) {
-            return new DoubleLiteral(value);
+            return new 
DoubleLiteral(Double.parseDouble(String.valueOf(value)));

Review Comment:
   Converting a float directly to a double can result in errors. e.g.
   ```
           double a = (float) 3.33;
           System.out.println(a);
   ```
   The output of the above code is 3.3299999237060547



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/DateTimeV2Literal.java:
##########
@@ -67,7 +69,9 @@ private void roundMicroSecond(int scale) {
                 "invalid datetime v2 scale: %s", scale);
         double factor = Math.pow(10, 6 - scale);
 
-        this.microSecond = Math.round(this.microSecond / factor) * (int) 
factor;
+        if (microSecond > Math.pow(10, scale)) {

Review Comment:
   Good catch, I'll fix it.



-- 
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