You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by 徐涛 <ha...@gmail.com> on 2018/08/14 04:51:22 UTC
Flink SQL does not support rename after cast type
Hi All,
I am working on a project based on Flink SQL, but found that I can`t rename column after casting, the code is as below:
cast(json_type as INTEGER) as xxx
And the following exception is reported:
org.apache.calcite.runtime.CalciteContextException: From line 4, column 6 to line 11, column 38: Illegal mixing of types in CASE or COALESCE statement
I want to know that does Flink do not support this function because I think it is a common case? Is there a way to accomplish this function?
Thank a lot.
Best
Henry Xu
Re: Flink SQL does not support rename after cast type
Posted by 徐涛 <ha...@gmail.com>.
Hi Hequn,
Thanks a lot for your anwswer! The question is clear now.
Best
Henry
> 在 2018年8月14日,下午1:24,Hequn Cheng <chenghequn@gmail.com <ma...@gmail.com>> 写道:
>
> Hi Henry,
>
> Flink does support rename column after casting.
>
> The exception is not caused by cast. It is caused by mixing of types, for example, the query
> "CASE 1 WHEN 1 THEN true WHEN 2 THEN 'string' ELSE NULL END"
> will throw the same exception since type of true and 'string' are not same.
>
> Best, Hequn.
>
> On Tue, Aug 14, 2018 at 12:51 PM, 徐涛 <happydexutao@gmail.com <ma...@gmail.com>> wrote:
> Hi All,
> I am working on a project based on Flink SQL, but found that I can`t rename column after casting, the code is as below:
> cast(json_type as INTEGER) as xxx
>
> And the following exception is reported:
> org.apache.calcite.runtime.CalciteContextException: From line 4, column 6 to line 11, column 38: Illegal mixing of types in CASE or COALESCE statement
>
> I want to know that does Flink do not support this function because I think it is a common case? Is there a way to accomplish this function?
> Thank a lot.
>
> Best
> Henry Xu
>
Re: Flink SQL does not support rename after cast type
Posted by Hequn Cheng <ch...@gmail.com>.
Hi Henry,
Flink does support rename column after casting.
The exception is not caused by cast. It is caused by mixing of types, for
example, the query
> "CASE 1 WHEN 1 THEN *true* WHEN 2 THEN *'string'* ELSE NULL END"
will throw the same exception since type of true and 'string' are not same.
Best, Hequn.
On Tue, Aug 14, 2018 at 12:51 PM, 徐涛 <ha...@gmail.com> wrote:
> Hi All,
> I am working on a project based on Flink SQL, but found that I
> can`t rename column after casting, the code is as below:
> cast(json_type as INTEGER) as xxx
>
> And the following exception is reported:
> org.apache.calcite.runtime.CalciteContextException: From line 4,
> column 6 to line 11, column 38: Illegal mixing of types in CASE or COALESCE
> statement
>
> I want to know that does Flink do not support this function
> because I think it is a common case? Is there a way to accomplish this
> function?
> Thank a lot.
>
> Best
> Henry Xu