[
https://issues.apache.org/jira/browse/DRILL-988?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14033294#comment-14033294
]
Sudheesh Katkam commented on DRILL-988:
---------------------------------------
Truncate should use DOWN rather than ROUND_FLOOR. As [~mehant] pointed out
previously, trunc(-123.5) should result in -123 and not -124.
new BigDecimal(-123.5).setScale(0, BigDecimal.ROUND_FLOOR) = -124
new BigDecimal(-123.5).setScale(0, BigDecimal.DOWN) = -123
> Trunc func injects a long cast which would cause loss of data
> -------------------------------------------------------------
>
> Key: DRILL-988
> URL: https://issues.apache.org/jira/browse/DRILL-988
> Project: Apache Drill
> Issue Type: Bug
> Components: Functions - Drill
> Reporter: Yash Sharma
> Assignee: Mehant Baid
> Attachments: DRILL-988.patch
>
>
> Dill func trunc() currently injects a explicit long cast that would cause
> data loss.
--
This message was sent by Atlassian JIRA
(v6.2#6252)