Takahiko Saito created HIVE-13851:
-------------------------------------

             Summary: Change columns 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)

Reply via email to