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

Bikramjeet Vig commented on IMPALA-2566:
----------------------------------------

[~tarmstrong] Ah I just saw the note 
[here|https://www.cloudera.com/documentation/enterprise/5-15-x/topics/impala_conversion_functions.html]
 seems like we should just hide all castto* methods from the builtints since 
the right way to do that is using the CAST(expr AS type) function.

> Result of casttochar() not handled properly in SQL operations
> -------------------------------------------------------------
>
>                 Key: IMPALA-2566
>                 URL: https://issues.apache.org/jira/browse/IMPALA-2566
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>    Affects Versions: Impala 2.3.0
>            Reporter: John Russell
>            Assignee: Bikramjeet Vig
>            Priority: Critical
>              Labels: crash
>
> If I use casttochar() during a CTAS to set the type of a column, Impala 
> considers the result to be STRING. However, somehow the length information 
> for the CHAR results must be getting passed back and messing things up in the 
> output. Trying to query the resulting table causes the query to hang:
> {code}
> [blah:21000] > create table char_types as select casttochar('hello world') as 
> c1, casttochar('xyz') as c2, casttochar('x') as c3;
> Query: create table char_types as select casttochar('hello world') as c1, 
> casttochar('xyz') as c2, casttochar('x') as c3
> +-------------------+
> | summary           |
> +-------------------+
> | Inserted 1 row(s) |
> +-------------------+
> Fetched 1 row(s) in 6.89s
> [blah:21000] > desc char_types;
> Query: describe char_types
> +------+--------+---------+
> | name | type   | comment |
> +------+--------+---------+
> | c1   | string |         |
> | c2   | string |         |
> | c3   | string |         |
> +------+--------+---------+
> [blah:21000] > show functions in _impala_builtins like 'casttochar';
> Query: show functions in _impala_builtins like 'casttochar'
> +-------------+--------------------------+
> | return type | signature                |
> +-------------+--------------------------+
> | CHAR(*)     | casttochar(BIGINT)       |
> | CHAR(*)     | casttochar(BOOLEAN)      |
> | CHAR(*)     | casttochar(CHAR(*))      |
> | CHAR(*)     | casttochar(DECIMAL(*,*)) |
> | CHAR(*)     | casttochar(DOUBLE)       |
> | CHAR(*)     | casttochar(FLOAT)        |
> | CHAR(*)     | casttochar(INT)          |
> | CHAR(*)     | casttochar(SMALLINT)     |
> | CHAR(*)     | casttochar(STRING)       |
> | CHAR(*)     | casttochar(TIMESTAMP)    |
> | CHAR(*)     | casttochar(TINYINT)      |
> | CHAR(*)     | casttochar(VARCHAR(*))   |
> +-------------+--------------------------+
> Fetched 12 row(s) in 0.10s
> [blah:21000] > select * from char_types;
> Query: select * from char_types
> ^C Cancelling Query
> {code}
> The HDFS data file has the original text info plus extra control characters. 
> Doing hdfs dfs -cat on the data file causes the OS X terminal to go haywire 
> and lock up.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscr...@impala.apache.org
For additional commands, e-mail: issues-all-h...@impala.apache.org

Reply via email to