[
https://issues.apache.org/jira/browse/HIVE-5352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13780251#comment-13780251
]
Hudson commented on HIVE-5352:
------------------------------
FAILURE: Integrated in Hive-trunk-hadoop2-ptest #117 (See
[https://builds.apache.org/job/Hive-trunk-hadoop2-ptest/117/])
HIVE-5352: cast(1.0 as int) returns null (Gunther Hagleitner via Thejas Nair)
(thejas:
http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1526797)
* /hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/udf/TestToInteger.java
* /hive/trunk/ql/src/test/queries/clientpositive/cast_to_int.q
* /hive/trunk/ql/src/test/results/clientpositive/cast_to_int.q.out
* /hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyInteger.java
* /hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyLong.java
*
/hive/trunk/serde/src/test/org/apache/hadoop/hive/serde2/lazy/TestLazySimpleSerDe.java
> cast('1.0' as int) returns null
> -------------------------------
>
> Key: HIVE-5352
> URL: https://issues.apache.org/jira/browse/HIVE-5352
> Project: Hive
> Issue Type: Bug
> Reporter: Gunther Hagleitner
> Assignee: Gunther Hagleitner
> Fix For: 0.12.0
>
> Attachments: HIVE-5352.1.patch, HIVE-5352.2.patch, HIVE-5352.3.patch,
> HIVE-5352.4.patch, HIVE-5352.5.patch
>
>
> Casting strings to int/smallint/bigint/tinyint yields null if the string
> isn't a 'pure' integer. '1.0', '2.4' all return null. I think for those cases
> the cast should return the truncated int (i.e.: if c is string, cast(c as
> int) should be the same as cast(cast(c as float) as int).
> This is in line with the standard and is the same behavior as mysql and
> oracle. (postgres and sql server throw error, see first answer here:
> http://social.msdn.microsoft.com/Forums/sqlserver/en-US/af3eff9c-737b-42fe-9016-05da9203a667/oracle-does-understand-cast10-as-int-why-sql-server-does-not)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira