hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt McCline (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-13914) Changing a column of orc table from float to double adds some fractional digits
Date Fri, 10 Jun 2016 03:13:20 GMT

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

Matt McCline commented on HIVE-13914:
-------------------------------------

(Comment from Gunther):

I've tried it in java and found the same behavior.

{noformat}
    float f = 29497.34f;
    System.out.println(f);
    System.out.println((double)f);
{noformat}

yields

{noformat}
29497.34
29497.33984375
{noformat}

On the other hand I'm pretty sure 29497.34 can be represented as double (as happens with text).


> Changing a column of orc table from float to double adds some fractional digits
> -------------------------------------------------------------------------------
>
>                 Key: HIVE-13914
>                 URL: https://issues.apache.org/jira/browse/HIVE-13914
>             Project: Hive
>          Issue Type: Bug
>    Affects Versions: 2.1.0
>            Reporter: Takahiko Saito
>
> Some fractional digits are added after altering a float column of an orc table to double:
> {noformat}
> 0: jdbc:hive2://os-r7-mvjkcu-hiveserver2-11-4> drop table test;
> No rows affected (0.233 seconds)
> 0: jdbc:hive2://os-r7-mvjkcu-hiveserver2-11-4>
> 0: jdbc:hive2://os-r7-mvjkcu-hiveserver2-11-4>
> 0: jdbc:hive2://os-r7-mvjkcu-hiveserver2-11-4> create table test (f float) stored
as orc;
> No rows affected (0.095 seconds)
> 0: jdbc:hive2://os-r7-mvjkcu-hiveserver2-11-4> insert into table test values(-35664.76),(29497.34);
> No rows affected (2.206 seconds)
> 0: jdbc:hive2://os-r7-mvjkcu-hiveserver2-11-4> select * from test;
> +------------+--+
> |   test.f   |
> +------------+--+
> | -35664.76  |
> | 29497.34   |
> +------------+--+
> 2 rows selected (0.131 seconds)
> 0: jdbc:hive2://os-r7-mvjkcu-hiveserver2-11-4> alter table test change column f f
double;
> No rows affected (0.183 seconds)
> 0: jdbc:hive2://os-r7-mvjkcu-hiveserver2-11-4> select * from test;
> +------------------+--+
> |      test.f      |
> +------------------+--+
> | -35664.76171875  |
> | 29497.33984375   |
> +------------------+--+
> 2 rows selected (0.114 seconds)
> 0: jdbc:hive2://os-r7-mvjkcu-hiveserver2-11-4>
> {noformat}
> The issue is NOT seen with text formatted table:
> {noformat}
> 0: jdbc:hive2://os-r7-mvjkcu-hiveserver2-11-4> create table test (f float) ;
> No rows affected (0.131 seconds)
> 0: jdbc:hive2://os-r7-mvjkcu-hiveserver2-11-4> insert into table test values(-35664.76),(29497.34);
> No rows affected (2.114 seconds)
> 0: jdbc:hive2://os-r7-mvjkcu-hiveserver2-11-4> select * from test;
> +------------+--+
> |   test.f   |
> +------------+--+
> | -35664.76  |
> | 29497.34   |
> +------------+--+
> 2 rows selected (0.163 seconds)
> 0: jdbc:hive2://os-r7-mvjkcu-hiveserver2-11-4> alter table test change column f f
double;
> No rows affected (0.184 seconds)
> 0: jdbc:hive2://os-r7-mvjkcu-hiveserver2-11-4> select * from test;
> +------------+--+
> |   test.f   |
> +------------+--+
> | -35664.76  |
> | 29497.34   |
> +------------+--+
> 2 rows selected (0.11 seconds)
> {noformat}



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

Mime
View raw message