Return-Path: X-Original-To: apmail-hive-dev-archive@www.apache.org Delivered-To: apmail-hive-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id ED99410F8A for ; Tue, 24 Sep 2013 23:56:22 +0000 (UTC) Received: (qmail 92149 invoked by uid 500); 24 Sep 2013 23:56:08 -0000 Delivered-To: apmail-hive-dev-archive@hive.apache.org Received: (qmail 92053 invoked by uid 500); 24 Sep 2013 23:56:05 -0000 Mailing-List: contact dev-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hive.apache.org Delivered-To: mailing list dev@hive.apache.org Received: (qmail 92029 invoked by uid 500); 24 Sep 2013 23:56:04 -0000 Delivered-To: apmail-hadoop-hive-dev@hadoop.apache.org Received: (qmail 92019 invoked by uid 99); 24 Sep 2013 23:56:03 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Sep 2013 23:56:03 +0000 Date: Tue, 24 Sep 2013 23:56:03 +0000 (UTC) From: "Gunther Hagleitner (JIRA)" To: hive-dev@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HIVE-5352) cast('1.0' as int) returns null MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HIVE-5352?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gunther Hagleitner updated HIVE-5352: ------------------------------------- Status: Patch Available (was: Open) > 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 > Attachments: HIVE-5352.1.patch > > > Casting strings to int/smallint/bigint/tinyint yields null if the string isn't a 'pure' integer. '1.0', '2.4', '1e5' 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