You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by 丁浩浩 <18...@163.com> on 2020/11/10 12:14:44 UTC
Flink sql查询NULL值错误
Select
id,
name,
if(type=1,2,null)
From
user ;
当我执行上面的sql的时候提示我
[ERROR] Could not execute SQL statement. Reason:
org.apache.calcite.sql.validate.SqlValidatorException: Illegal use of ‘NULL’
是无法将null展示吗?
Re: Flink sql查询NULL值错误
Posted by Danny Chan <da...@apache.org>.
是的 Flink SQL 现在还不支持隐式类型,需要手动设置 NULL 的类型 SQL 才能通过编译。
丁浩浩 <18...@163.com> 于2020年11月10日周二 下午8:52写道:
> 感谢大佬!!!
>
> > 在 2020年11月10日,下午8:22,hailongwang <18...@163.com> 写道:
> >
> > Hi,
> >
> >
> > 需要将 null cast 成某个具体的值,比如:
> > if(type=1,2,cast(null as int))
> >
> >
> > Best,
> > Hailong
> > 在 2020-11-10 19:14:44,"丁浩浩" <18...@163.com> 写道:
> >> Select
> >> id,
> >> name,
> >> if(type=1,2,null)
> >> From
> >> user ;
> >> 当我执行上面的sql的时候提示我
> >> [ERROR] Could not execute SQL statement. Reason:
> >> org.apache.calcite.sql.validate.SqlValidatorException: Illegal use of
> ‘NULL’
> >> 是无法将null展示吗?
> >
> >
> >
>
>
>
Re: Flink sql查询NULL值错误
Posted by 丁浩浩 <18...@163.com>.
感谢大佬!!!
> 在 2020年11月10日,下午8:22,hailongwang <18...@163.com> 写道:
>
> Hi,
>
>
> 需要将 null cast 成某个具体的值,比如:
> if(type=1,2,cast(null as int))
>
>
> Best,
> Hailong
> 在 2020-11-10 19:14:44,"丁浩浩" <18...@163.com> 写道:
>> Select
>> id,
>> name,
>> if(type=1,2,null)
>> From
>> user ;
>> 当我执行上面的sql的时候提示我
>> [ERROR] Could not execute SQL statement. Reason:
>> org.apache.calcite.sql.validate.SqlValidatorException: Illegal use of ‘NULL’
>> 是无法将null展示吗?
>
>
>
Re:Flink sql查询NULL值错误
Posted by hailongwang <18...@163.com>.
Hi,
需要将 null cast 成某个具体的值,比如:
if(type=1,2,cast(null as int))
Best,
Hailong
在 2020-11-10 19:14:44,"丁浩浩" <18...@163.com> 写道:
>Select
> id,
> name,
> if(type=1,2,null)
>From
> user ;
>当我执行上面的sql的时候提示我
>[ERROR] Could not execute SQL statement. Reason:
>org.apache.calcite.sql.validate.SqlValidatorException: Illegal use of ‘NULL’
>是无法将null展示吗?