[jira] [Commented] (HIVE-8559) DECIMAL field can not store 0 if precision = scale

2014-10-27 Thread Aidan Semple (JIRA)

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

Aidan Semple commented on HIVE-8559:


Also happens in version 0.13.0, see bug HIVE-8592, which was resolved as it was 
a duplicate of this one.

> DECIMAL field can not store 0 if precision = scale
> --
>
> Key: HIVE-8559
> URL: https://issues.apache.org/jira/browse/HIVE-8559
> Project: Hive
>  Issue Type: Bug
>Affects Versions: 0.13.1
>Reporter: Alexander Pivovarov
>
> For example the following query returns NULL instead of 0 in hive (trunk )
> select cast(0 as decimal(6,6));
> OK
> NULL
> I tried DECIMAL(6,6) in oracle.  It can store 0.



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


[jira] [Created] (HIVE-8592) 0 values convert to null if casting to or inserting to Hive DECIMAL where precision and scale are the same

2014-10-24 Thread Aidan Semple (JIRA)
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 = xxx_2014102414_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
NULLNULLNULLNULLNULL
Time taken: 36.281 seconds, Fetched: 1 row(s)















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