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

linqichen commented on FLINK-27795:
-----------------------------------

Thanks shengkai fang!

I donot think so. Because most of time we cannot know the field‘s value is null 
or not。 It is very  unfriendly to add cast(xx as xx) on all field。 

I have an idea about this. that is : 

we use one configation on flink-conf.yml . Such as : cast_null_to_field_type

when we set it true,  flink engine should do something like cast(xx as xx)。 

> SqlValidatorException when insert null value
> --------------------------------------------
>
>                 Key: FLINK-27795
>                 URL: https://issues.apache.org/jira/browse/FLINK-27795
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / API
>    Affects Versions: 1.14.4
>            Reporter: linqichen
>            Priority: Major
>
> Hello , I found a problem, when i try to insert null value. 
> i think it is very common to insert null to string type value. We should 
> solve this instead of using  cast (xx as string)
> -----------------------------------------------------------------
> Flink SQL> create table print_1(
> >   name string
> > ) with(
> > 'connector'='print'
> > );
> [INFO] Execute statement succeed.
> Flink SQL> insert into print_1 (name) values (null);
> {color:#de350b}*[ERROR] Could not execute SQL statement. Reason:*{color}
> {color:#de350b}*org.apache.calcite.sql.validate.SqlValidatorException: 
> Illegal use of 'NULL'*{color}
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to