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

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

 think this is part of the float madness.
I'm concluding that TEXTFILE format tables are not a good gold standard for 
what needs to be produced.
For Schema Evolution, I think that when there is a data type conversion the 
gold standard for ORC is CAST.
If you take the TEXTFILE table with float data type and do a "select cast(f as 
double) from test_text;" you will get:
-35664.76171875
29497.33984375
but after the column is changed to double a plain select * will produce:
-35664.76
29497.34
And, because there is no history that the file was written as float there is no 
hope of fixing this problem.

> 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)

Reply via email to