You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Tim Armstrong (Jira)" <ji...@apache.org> on 2020/12/23 23:43:00 UTC

[jira] [Resolved] (IMPALA-1921) Cast string->*int with a decimal place always returns NULL

     [ https://issues.apache.org/jira/browse/IMPALA-1921?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tim Armstrong resolved IMPALA-1921.
-----------------------------------
    Resolution: Not A Bug

I think the current behaviour is reasonable, I don't think there's a reason to be overly permissive here and drop data silently.

> Cast string->*int with a decimal place always returns NULL
> ----------------------------------------------------------
>
>                 Key: IMPALA-1921
>                 URL: https://issues.apache.org/jira/browse/IMPALA-1921
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Backend
>    Affects Versions: Impala 2.0
>         Environment: Server version: impalad version 2.0.0-cdh5 RELEASE (build ecf30af0b4d6e56ea80297df2189367ada6b7da7)
>            Reporter: gpolaert
>            Priority: Minor
>              Labels: sql-language
>
> cast ('-1.0' as int|bigint) should not return NULL but -1.
> Issue:
> {code}
> Query: select cast("-1.0" as int)
> +---------------------+
> | cast('-1.0' as int) |
> +---------------------+
> | NULL                |
> +---------------------+
> {code}
> Workaround: 
> {code}
> Query: select cast(cast ("-1.0" as double) as int)
> +-------------------------------------+
> | cast(cast('-1.0' as double) as int) |
> +-------------------------------------+
> | -1                                  |
> +-------------------------------------+
> Fetched 1 row(s) in 0.01s
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)