Github user vvysotskyi commented on a diff in the pull request:
https://github.com/apache/drill/pull/863#discussion_r125331522
--- Diff: exec/java-exec/src/main/codegen/templates/CastFunctions.java ---
@@ -54,14 +56,14 @@ public void setup() {}
public void eval() {
<#if (type.from.startsWith("Float") && type.to.endsWith("Int"))>
boolean sign = (in.value < 0);
- in.value = java.lang.Math.abs(in.value);
- ${type.native} fractional = in.value % 1;
+ ${type.native} value = java.lang.Math.abs(in.value);
+ ${type.native} fractional = value % 1;
--- End diff --
Thanks for the pointing this. Drill uses `half away from zero` rounding
mode, so method `Math.round()` wouldn't help. I rewrote current code and now it
handles boundary cases in the same way as the `Math.round()`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---