[ https://issues.apache.org/jira/browse/FLINK-22460?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17332902#comment-17332902 ]
Shengkai Fang commented on FLINK-22460: --------------------------------------- It seems the input schema is not as same as the sink schema. You can specify the type of the column `number` in the table `table` is `BIGINT NOT NULL`. > Conversion to relational algebra failed due to NOT NULL modifier > ---------------------------------------------------------------- > > Key: FLINK-22460 > URL: https://issues.apache.org/jira/browse/FLINK-22460 > Project: Flink > Issue Type: Bug > Components: Table SQL / API > Affects Versions: 1.12.1 > Reporter: Haiwei Zhou > Priority: Major > > Flink complains that an insert sql doesn't match the table schema. The > validated type is missing a "NOT NULL" modifier. > > > {code:java} > py4j.protocol.Py4JJavaError: An error occurred while calling o18.executeSql. > : java.lang.AssertionError: Conversion to relational algebra failed to > preserve datatypes: > validated type: > RecordType(VARCHAR(2147483647) CHARACTER SET "UTF-16LE" request, CHAR(7) > CHARACTER SET "UTF-16LE" NOT NULL EXPR$1, BIGINT number, TIMESTAMP(3) > start_time, TIMESTAMP(3) end_time) NOT NULL > converted type: > RecordType(VARCHAR(2147483647) CHARACTER SET "UTF-16LE" request, CHAR(7) > CHARACTER SET "UTF-16LE" NOT NULL EXPR$1, BIGINT NOT NULL number, > TIMESTAMP(3) start_time, TIMESTAMP(3) end_time) NOT > NULL{code} > > > {code:java} > table_env.execute_sql(''' > CREATE TABLE preload_stats ( > lineitems STRING, > itype STRING, > number BIGINT NOT NULL, > start_time TIMESTAMP(3), > end_time TIMESTAMP(3) > )''' > > table_env.execute_sql( > "SELECT request, 'request', number, start_time, end_time " > "FROM result_1 ").execute_insert('preload_stats') > {code} > > > > > -- This message was sent by Atlassian Jira (v8.3.4#803005)