hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Dere (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-17782) Inconsistent cast behavior from string to numeric types with regards to leading/trailing spaces
Date Thu, 12 Oct 2017 23:29:00 GMT

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

Jason Dere commented on HIVE-17782:
-----------------------------------

Sorry, forgot to post to the Jira - https://reviews.apache.org/r/62954/

> Inconsistent cast behavior from string to numeric types with regards to leading/trailing
spaces
> -----------------------------------------------------------------------------------------------
>
>                 Key: HIVE-17782
>                 URL: https://issues.apache.org/jira/browse/HIVE-17782
>             Project: Hive
>          Issue Type: Bug
>          Components: Types
>            Reporter: Jason Dere
>            Assignee: Jason Dere
>         Attachments: HIVE-17782.1.patch
>
>
> {noformat}
> select cast(' 1 ' as tinyint), cast(' 1 ' as smallint), cast(' 1 ' as int), cast(' 1
' as bigint), cast(' 1 ' as float), cast(' 1 ' as double), cast(' 1 ' as decimal(10,2))
> NULL    NULL    NULL    NULL    1.0     1.0     1
> {noformat}
> Looks like integer types (short, int, etc) fail the conversion due to the leading/trailing
spaces and return NULL, while float/double/decimal do not. In fact, Decimal used to also return
NULL in previous versions up until HIVE-10799.
> Let's try to make this behavior consistent across all of these types, should be simple
enough to strip spaces before passing to number formatter.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message