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

Ian Hellstrom commented on DRILL-4497:
--------------------------------------

This behaviour is the same as in Java and is likely a consequence of it.

> Casting strings with leading/trailing spaces to integers does not work
> ----------------------------------------------------------------------
>
>                 Key: DRILL-4497
>                 URL: https://issues.apache.org/jira/browse/DRILL-4497
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.5.0
>            Reporter: Ian Hellstrom
>
> When casting a string with leading and/or trailing spaces to an integer type 
> (e.g. INT or BIGINT), an exception is thrown. Casting the same numbers to 
> floating-point numbers works.
> This is inconsistent and extremely confusing. Simply using TRIM() before 
> casting works though.
> {code}
> SELECT CAST(' 1' AS INT) FROM ... 
> SELECT CAST('1 ' AS INT) FROM ...
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to