You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Sudarshan (JIRA)" <ji...@apache.org> on 2018/11/14 19:42:01 UTC

[jira] [Created] (IMPALA-7850) INSERT using VALUES with "CAST" can cause trailing spaces.

Sudarshan created IMPALA-7850:
---------------------------------

             Summary: INSERT using VALUES with "CAST" can cause trailing spaces.
                 Key: IMPALA-7850
                 URL: https://issues.apache.org/jira/browse/IMPALA-7850
             Project: IMPALA
          Issue Type: Bug
            Reporter: Sudarshan


INSERT using VALUES with "CAST" can cause trailing spaces. p.s.b.

 

Schema :-
 ============

 
{code:java}
create database tmp;
 CREATE TABLE tmp.tablename ( col_id int,col_second string, col_third string);{code}
 

Insert statement :-
 =====================

 
{code:java}
INSERT INTO tmp.tablename(col_id, col_second, col_third) values (100, CAST('AWESOME' AS CHAR(7)), CAST('TEST' AS CHAR(4))), (1, CAST('I' AS CHAR(1)), CAST('AI' AS CHAR(2))){code}
 

 

File on HDFS :-
 ================

 
{noformat}
[admin@host-10-17-101-151 ~]$ cat 9d42419642cbf42e-ffb7c99c00000000_1661109707_data.0.
 100,AWESOME,TEST
 1,I ,AI <== Trailing space
 [admin@host-10-17-101-151 ~]${noformat}
 

Query showing length of "I" as 7

 
{noformat}
Query: select col_id, length(col_second), col_second from tmp.tablename
| col_id | length(col_second) | col_second |
+------------+--------------+---------+
| 100 | 7 | AWESOME |
| 1 | 7 | I |
+------------+--------------+---------+
[host-10-17-102-128.coe.cloudera.com:21000] >{noformat}
 

Workaround :-

=============

Workaround would be to remove CAST from above statements.

 

 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)