mihaibudiu commented on code in PR #3782:
URL: https://github.com/apache/calcite/pull/3782#discussion_r1594414196


##########
core/src/main/java/org/apache/calcite/rex/RexBuilder.java:
##########
@@ -1887,11 +1887,6 @@ public RexNode makeLambdaCall(RexNode expr, 
List<RexLambdaRef> parameters) {
               type.getSqlTypeName());
       return new BigDecimal(((Number) o).longValue());
     case REAL:
-      if (o instanceof BigDecimal) {
-        return o;
-      }
-      return new BigDecimal(((Number) o).doubleValue(), MathContext.DECIMAL32)
-          .stripTrailingZeros();

Review Comment:
   The truth is that float only has about 7 decimal digits of precision, so one 
could argue that the original answer provided by Calcite was legal. However, it 
makes it much easier to test code if the result provided by Calcite for 
`CAST(CAST string AS REAL) AS BIGINT)` is the same as the Java result of 
`(long)Float.parseFloat(string)`, at least when running on the same CPU.



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

Reply via email to