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

[jira] [Commented] (CALCITE-4871) CAST a literal to DECIMAL type return wrong result

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

duan xiong commented on CALCITE-4871:
-------------------------------------

Because blocked by CALCITE-4929. So I will move it to 1.30.0.

> CAST a literal to DECIMAL type return wrong result
> --------------------------------------------------
>
>                 Key: CALCITE-4871
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4871
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 1.28.0
>            Reporter: duan xiong
>            Assignee: duan xiong
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.29.0
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> In calcite. The precision and scale can't work. 
> 1) Add judgment in decimal type precision and scale parameter(When have illegal value need to throw an exception):
> SQL EXAMPLES:
> {code:java}
> cast(155.36 as decimal(0,0)){code}
> In Postgresql:
> {noformat}
> ERROR: NUMERIC precision 0 must be between 1 and 1000{noformat}
> In Calcite:
> {noformat}
> EXPR$0=155.36{noformat}
> 2) To make sure return the right answer。
> SQL EXAMPLES:
> {code:java}
> cast(155.36 as decimal(4,1)){code}
> In Postgresql:
> {code:java}
> EXPR$0=155.4{code}
> In Calcite:
> {code:java}
> EXPR$0=155.36{code}
> The problem exists in casting different data to decimal.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)