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

Haiwei Zhou edited comment on FLINK-22460 at 4/26/21, 6:17 AM:
---------------------------------------------------------------

Here is the output of "describe result_1"

{code:java}
+------------+--------------+------+-----+--------+-----------+
|       name |         type | null | key | extras | watermark |
+------------+--------------+------+-----+--------+-----------+
|    request |       STRING | true |     |        |           |
| start_time | TIMESTAMP(3) | true |     |        |           |
|   end_time | TIMESTAMP(3) | true |     |        |           |
|     number |       BIGINT | true |     |        |           |
+------------+--------------+------+-----+--------+-----------+
4 rows in set
{code}


{code:java}
result1 = 
table.window(Tumble.over(lit(1).minutes).on(table.proctime).alias("w")) \
  .group_by(table.request, col('w')) \
  .select(table.request,
          col('w').start.alias('start_time'),
          col('w').end.alias('end_time'),
          table.ready.count.alias('number'),)
{code}



was (Author: highfly):
{code:java}
Here is the output of "describe result_1"

+------------+--------------+------+-----+--------+-----------+
|       name |         type | null | key | extras | watermark |
+------------+--------------+------+-----+--------+-----------+
|    request |       STRING | true |     |        |           |
| start_time | TIMESTAMP(3) | true |     |        |           |
|   end_time | TIMESTAMP(3) | true |     |        |           |
|     number |       BIGINT | true |     |        |           |
+------------+--------------+------+-----+--------+-----------+
4 rows in set
{code}

> 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)

Reply via email to