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

Matt McCline commented on HIVE-13935:
-------------------------------------

Well, well.

You might be amazed to know this issue *cannot be fixed*!

It only happens for tables and not for partitioned tables.  With tables there 
is no original schema kept like you get with the original schema being kept as 
the partition schema.  So, there is no way to know that the original table was 
written as CHAR and thus no way to know the STRING value needs to be white 
space trimmed.  And, we cannot indiscriminately trim all STRING fields.

> Changing char column of textfile table to string/varchar leaves white space.
> ----------------------------------------------------------------------------
>
>                 Key: HIVE-13935
>                 URL: https://issues.apache.org/jira/browse/HIVE-13935
>             Project: Hive
>          Issue Type: Bug
>    Affects Versions: 1.2.1
>            Reporter: Takahiko Saito
>
> {noformat}
> 0: jdbc:hive2://os-r6-ifsmes-hiveserver2-11-4> create table test_text (c 
> char(16)) stored as textfile;
> No rows affected (0.091 seconds)
> 0: jdbc:hive2://os-r6-ifsmes-hiveserver2-11-4> insert into table test_text 
> values ('horton works     ');
> INFO  : Session is already open
> INFO  : Dag name: insert into table test_text values ('ho...')(Stage-1)
> INFO  :
> INFO  : Status: Running (Executing on YARN cluster with App id 
> application_1464222003837_0399)
> INFO  : Map 1: 0/1
> INFO  : Map 1: 0(+1)/1
> INFO  : Map 1: 1/1
> INFO  : Loading data to table default.test_text from 
> hdfs://os-r6-ifsmes-hiveserver2-11-5.openstacklocal:8020/apps/hive/warehouse/test_text/.hive-staging_hive_2016-05-26_17-45-29_669_2888061873550824337-1/-ext-10000
> INFO  : Table default.test_text stats: [numFiles=1, numRows=1, totalSize=17, 
> rawDataSize=16]
> No rows affected (6.849 seconds)
> 0: jdbc:hive2://os-r6-ifsmes-hiveserver2-11-4> select * from test_text;
> +-------------------+--+
> |    test_text.c    |
> +-------------------+--+
> | horton works      |
> +-------------------+--+
> 1 row selected (0.098 seconds)
> 0: jdbc:hive2://os-r6-ifsmes-hiveserver2-11-4> describe test_text;
> +-----------+------------+----------+--+
> | col_name  | data_type  | comment  |
> +-----------+------------+----------+--+
> | c         | char(16)   |          |
> +-----------+------------+----------+--+
> 1 row selected (0.127 seconds)
> 0: jdbc:hive2://os-r6-ifsmes-hiveserver2-11-4> alter table test_text change 
> column c c string;
> No rows affected (0.145 seconds)
> 0: jdbc:hive2://os-r6-ifsmes-hiveserver2-11-4> describe test_text;
> +-----------+------------+----------+--+
> | col_name  | data_type  | comment  |
> +-----------+------------+----------+--+
> | c         | string     |          |
> +-----------+------------+----------+--+
> 1 row selected (0.127 seconds)
> 0: jdbc:hive2://os-r6-ifsmes-hiveserver2-11-4> select * from test_text;
> +-------------------+--+
> |    test_text.c    |
> +-------------------+--+
> | horton works      |
> +-------------------+--+
> 1 row selected (0.066 seconds)
> {noformat}



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

Reply via email to