You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "xiong duan (Jira)" <ji...@apache.org> on 2024/08/26 00:49:00 UTC

[jira] [Commented] (CALCITE-4838) Add RoundingMode in RelDataTypeSystem to specify the rounding behavior

    [ https://issues.apache.org/jira/browse/CALCITE-4838?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17876556#comment-17876556 ] 

xiong duan commented on CALCITE-4838:
-------------------------------------

Fixed in [6c7685cb56|https://github.com/apache/calcite/commit/6c7685cb568494cfe927420a157eae414d80f5e3]. Thanks for the review [~mbudiu] and [~julianhyde].

> Add RoundingMode in RelDataTypeSystem to specify the rounding behavior
> ----------------------------------------------------------------------
>
>                 Key: CALCITE-4838
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4838
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.27.0
>            Reporter: xiong duan
>            Assignee: xiong duan
>            Priority: Major
>              Labels: pull-request-available
>
> According to the SQL Strandard about how to cast an approximate numeric to int in different database have different RoundingMode. for example:
> In PostgreSQL、Mysql、Oracle(RoundingMode.HALF_UP):
> {code:java}
> select cast(5.1 as int) return 5
> select cast(5.5 as int) return 6
> select cast(-5.5 as int) return -6{code}
> In Calcite、Sql Server 2008(RoundingMode.DOWN):
> {code:java}
> select cast(5.1 as int) return 5
> select cast(5.5 as int) return 5
> select cast(-5.5 as int) return -5
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)