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 30D9B173B7 for ; Fri, 24 Oct 2014 13:10:34 +0000 (UTC) Received: (qmail 33887 invoked by uid 500); 24 Oct 2014 13:10:33 -0000 Delivered-To: apmail-hive-dev-archive@hive.apache.org Received: (qmail 33811 invoked by uid 500); 24 Oct 2014 13:10:33 -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 33800 invoked by uid 500); 24 Oct 2014 13:10:33 -0000 Delivered-To: apmail-hadoop-hive-dev@hadoop.apache.org Received: (qmail 33797 invoked by uid 99); 24 Oct 2014 13:10:33 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Oct 2014 13:10:33 +0000 Date: Fri, 24 Oct 2014 13:10:33 +0000 (UTC) From: "Aidan Semple (JIRA)" To: hive-dev@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (HIVE-8592) 0 values convert to null if casting to or inserting to Hive DECIMAL where precision and scale are the same MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Aidan Semple created HIVE-8592: ---------------------------------- Summary: 0 values convert to null if casting to or inserting to Hive DECIMAL where precision and scale are the same Key: HIVE-8592 URL: https://issues.apache.org/jira/browse/HIVE-8592 Project: Hive Issue Type: Bug Components: Database/Schema, SQL Affects Versions: 0.13.0 Environment: Running Apache Hive version 0.13.0 using HortonWorks 2.1.2.1 with hadoop version 2.4.0.2.1.2.1-471, on Linux operating system centos5 (also occurs on centos6) Reporter: Aidan Semple Fix For: 0.13.0 I am trying to load zero values into Hive Decimal fields into a Hive table where the precision and scale are defined as the same e.g. DECIMAL(1,1) or DECIMAL(3,3) etc... However every time I run a hive ql insert statement to do this containing zero values or run a LOAD DATA command to load a text file of data containing zero values to these columns / fields, on performing a query on the table, these zero values are displayed and treated as NULL values. On further investigation, I was able to narrow the problem down to doing simple selects with casts. See example and output from Hive below. So attempting to do a cast for 0 or 0.0 or '.0' to DECIMAL(1,1) NULL is returned instead of 0. This is the same for precisions 1-38 where the scale is also the same If there is a work around for this then please let me know. Thanks! hive> select cast('.0' as DECIMAL(1,1)), cast('0.0' as DECIMAL(1,1)), cast('0' as DECIMAL(1,1)), cast(0 as DECIMAL(1,1)), cast(0.0 as DECIMAL(1,1)); Query ID = xxxxxxx_20141024140000_e4dfdcc1-e4ad-4f84-bd48-198e29fd3757 Total jobs = 1 Launching Job 1 out of 1 Number of reduce tasks is set to 0 since there's no reduce operator Starting Job = job_1413470329106_0052, Tracking URL = http://hdp8:8088/proxy/application_1413470329106_0052/ Kill Command = /usr/lib/hadoop/bin/hadoop job -kill job_1413470329106_0052 Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 0 2014-10-24 14:01:10,256 Stage-1 map = 0%, reduce = 0% 2014-10-24 14:01:27,644 Stage-1 map = 100%, reduce = 0%, Cumulative CPU 6.51 sec MapReduce Total cumulative CPU time: 6 seconds 510 msec Ended Job = job_1413470329106_0052 MapReduce Jobs Launched: Job 0: Map: 1 Cumulative CPU: 6.51 sec HDFS Read: 269 HDFS Write: 15 SUCCESS Total MapReduce CPU Time Spent: 6 seconds 510 msec OK NULL NULL NULL NULL NULL Time taken: 36.281 seconds, Fetched: 1 row(s) -- This message was sent by Atlassian JIRA (v6.3.4#6332)