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-13851) Change column of textfile formatted table from float to double will drop some fractional digits
Date Fri, 10 Jun 2016 03:09:20 GMT

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

Matt McCline commented on HIVE-13851:
-------------------------------------

For the TEXTFILE case, if you convert the float column to string (as a way of seeing what
is being stored in the text field!) instead of double it reveals the following digit clipped
values are what was stored:
-35664.76
29497.35
Interesting.
Now, if you create a input file and insert data with "load data local inpath ....", you get
the expected result:
-35664.76171875
29497.349609375
So, that leads to why are values specified in the INSERT VALUES clause different than data
in an input file?
Perhaps they being parsed as decimal with scale 2 and then being converted to string and stored
in the temporary file that serves as input to the INSERT statement?

> Change column of textfile formatted table from float to double will drop some fractional
digits
> -----------------------------------------------------------------------------------------------
>
>                 Key: HIVE-13851
>                 URL: https://issues.apache.org/jira/browse/HIVE-13851
>             Project: Hive
>          Issue Type: Bug
>    Affects Versions: 1.2.1
>            Reporter: Takahiko Saito
>
> In a case of texfile formatted table, changing a column from float to double will drop
some fractional digits:
> {noformat}
> 0: jdbc:hive2://os-r7-wbucju-hiveserver2-11-1> create table test(f float);
> No rows affected (0.176 seconds)
> 0: jdbc:hive2://os-r7-wbucju-hiveserver2-11-1> insert into table test values(-35664.76171875),(29497.349609375);
> INFO  : Tez session hasn't been created yet. Opening session
> INFO  : Dag name: insert into table tes...5),(29497.349609375)(Stage-1)
> INFO  :
> INFO  : Status: Running (Executing on YARN cluster with App id application_1464135801747_0400)
> INFO  : Map 1: -/-
> INFO  : Map 1: 0/1
> INFO  : Map 1: 0/1
> INFO  : Map 1: 0(+1)/1
> INFO  : Map 1: 0(+1)/1
> INFO  : Map 1: 1/1
> INFO  : Loading data to table default.test from hdfs://os-r7-wbucju-hiveserver2-11-5.openstacklocal:8020/apps/hive/warehouse/test/.hive-staging_hive_2016-05-25_17-22-03_941_5459171987449455387-1/-ext-10000
> INFO  : Table default.test stats: [numFiles=1, numRows=2, totalSize=19, rawDataSize=17]
> No rows affected (18.443 seconds)
> 0: jdbc:hive2://os-r7-wbucju-hiveserver2-11-1> select * from test;
> +------------------+--+
> |      test.f      |
> +------------------+--+
> | -35664.76171875  |
> | 29497.349609375  |
> +------------------+--+
> 2 rows selected (0.231 seconds)
> 0: jdbc:hive2://os-r7-wbucju-hiveserver2-11-1> alter table test change column f f
double;
> No rows affected (0.34 seconds)
> 0: jdbc:hive2://os-r7-wbucju-hiveserver2-11-1> select * from test;
> +------------+--+
> |   test.f   |
> +------------+--+
> | -35664.76  |
> | 29497.35   |
> +------------+--+
> 2 rows selected (0.128 seconds)
> {noformat}
> The issue is not seen with orc table:
> {noformat}
> 0: jdbc:hive2://os-r7-wbucju-hiveserver2-11-1> create table orc(f float) stored as
orc;
> No rows affected (0.162 seconds)
> 0: jdbc:hive2://os-r7-wbucju-hiveserver2-11-1> insert into table orc values(-35664.76171875),(29497.349609375);
> INFO  : Session is already open
> INFO  : Dag name: insert into table orc...5),(29497.349609375)(Stage-1)
> INFO  :
> INFO  : Status: Running (Executing on YARN cluster with App id application_1464135801747_0400)
> INFO  : Map 1: 0/1
> INFO  : Map 1: 0/1
> INFO  : Map 1: 0(+1)/1
> INFO  : Map 1: 0(+1)/1
> INFO  : Map 1: 1/1
> INFO  : Loading data to table default.orc from hdfs://os-r7-wbucju-hiveserver2-11-5.openstacklocal:8020/apps/hive/warehouse/orc/.hive-staging_hive_2016-05-25_17-25-26_569_221649193772012279-1/-ext-10000
> INFO  : Table default.orc stats: [numFiles=1, numRows=2, totalSize=253, rawDataSize=8]
> No rows affected (7.87 seconds)
> 0: jdbc:hive2://os-r7-wbucju-hiveserver2-11-1> select * from orc;
> +------------------+--+
> |      orc.f       |
> +------------------+--+
> | -35664.76171875  |
> | 29497.349609375  |
> +------------------+--+
> 2 rows selected (0.117 seconds)
> 0: jdbc:hive2://os-r7-wbucju-hiveserver2-11-1> alter table orc change column f f double;
> No rows affected (0.85 seconds)
> 0: jdbc:hive2://os-r7-wbucju-hiveserver2-11-1> select * from orc;
> +------------------+--+
> |      orc.f       |
> +------------------+--+
> | -35664.76171875  |
> | 29497.349609375  |
> +------------------+--+
> 2 rows selected (0.168 seconds)
> {noformat}



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

Mime
View raw message