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

Jason Dere commented on HIVE-9537:
----------------------------------

- char(64) is correct per the rules mentioned above, since the combined length 
(32+32 = 64) is less than the char max length of 255. If the lengths exceed 
that (like concat(cchar, cchar, cchar, cchar), I believe it reverts to string 
type.
- As for (2), that depends on what we decide are the semantics regarding 
trailing spaces for char. Currently for Hive we ignore them for the purposes of 
comparison, length, and concatenation. As mentioned earlier this is similar to 
the MySQL/Postgres char semantics (which has often been done when for Hive 
dev). It's not impossible to change this, though we might have to think about 
backward compatibility issues again if we do.

> string expressions on a fixed length character do not preserve trailing spaces
> ------------------------------------------------------------------------------
>
>                 Key: HIVE-9537
>                 URL: https://issues.apache.org/jira/browse/HIVE-9537
>             Project: Hive
>          Issue Type: Bug
>          Components: SQL
>            Reporter: N Campbell
>            Assignee: Aihua Xu
>
> When a string expression such as upper or lower is applied to a fixed length 
> column the trailing spaces of the fixed length character are not preserved.
> {code:sql}
> CREATE TABLE  if not exists TCHAR ( 
> RNUM int, 
> CCHAR char(32)    
> )
> ROW FORMAT DELIMITED 
> FIELDS TERMINATED BY '|' 
> LINES TERMINATED BY '\n' 
> STORED AS TEXTFILE;
> {code}
> {{cchar}} as a {{char(32)}}.
> {code:sql}
> select cchar, concat(cchar, cchar), concat(lower(cchar), cchar), 
> concat(upper(cchar), cchar) 
> from tchar;
> {code}
> 0|\N
> 1|
> 2| 
> 3|BB
> 4|EE
> 5|FF



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

Reply via email to