Takahiko Saito created HIVE-13812:
-------------------------------------
Summary: Change column from float to string group type will drop
some factional digits
Key: HIVE-13812
URL: https://issues.apache.org/jira/browse/HIVE-13812
Project: Hive
Issue Type: Bug
Affects Versions: 1.2.1
Reporter: Takahiko Saito
Create a table with a float column and insert some values:
{noformat}
0: jdbc:hive2://os-r6-pxwhrs-hiveserver2-3re-> create table test(f float);
No rows affected (0.237 seconds)
0: jdbc:hive2://os-r6-pxwhrs-hiveserver2-3re-> insert into table test
values(-35664.76171875),(29497.349609375);
INFO : Session is already open
INFO : Dag name: insert into table tes...5),(29497.349609375)(Stage-1)
INFO :
INFO : Status: Running (Executing on YARN cluster with App id
application_1463771904371_0006)
INFO : Map 1: 0/1
INFO : Map 1: 0/1
INFO : Map 1: 0/1
INFO : Map 1: 0(+1)/1
INFO : Map 1: 1/1
INFO : Loading data to table default.test from
hdfs://os-r6-pxwhrs-hiveserver2-3re-5.openstacklocal:8020/apps/hive/warehouse/test/.hive-staging_hive_2016-05-20_21-06-29_377_6487823927119226603-10/-ext-10000
INFO : Table default.test stats: [numFiles=1, numRows=2, totalSize=19,
rawDataSize=17]
No rows affected (11.069 seconds)
0: jdbc:hive2://os-r6-pxwhrs-hiveserver2-3re-> select * from test;
+------------------+--+
| test.f |
+------------------+--+
| -35664.76171875 |
| 29497.349609375 |
+------------------+--+
2 rows selected (0.137 seconds)
0: jdbc:hive2://os-r6-pxwhrs-hiveserver2-3re-> describe test;
+-----------+------------+----------+--+
| col_name | data_type | comment |
+-----------+------------+----------+--+
| f | float | |
+-----------+------------+----------+--+
1 row selected (0.173 seconds)
{noformat}
Then change float type to string successfully, but when you select table, some
fractional digits are lost:
{noformat}
0: jdbc:hive2://os-r6-pxwhrs-hiveserver2-3re-> alter table test change column f
f string;
No rows affected (0.214 seconds)
0: jdbc:hive2://os-r6-pxwhrs-hiveserver2-3re-> describe test;
+-----------+------------+----------+--+
| col_name | data_type | comment |
+-----------+------------+----------+--+
| f | string | |
+-----------+------------+----------+--+
1 row selected (0.151 seconds)
0: jdbc:hive2://os-r6-pxwhrs-hiveserver2-3re-> select * from test;
+------------+--+
| test.f |
+------------+--+
| -35664.76 |
| 29497.35 |
+------------+--+
2 rows selected (0.141 seconds)
{noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)