Hi:
flink版本1.11.0 connector为kafka
DDL中声明某个字段为primary key时,会报类型不匹配,去掉primary key constraint就可以正常执行。
把shop_id设置为 varchar not null也不行。


org.apache.flink.table.api.ValidationException: Type STRING NOT NULL of table 
field 'shop_id' does not match with the physical type STRING of the 'shop_id' 
field of the TableSource return type.


SQL如下:
create table source_0 (  
  `shop_id` varchar,  
  `user_id` bigint,  
  `category_id` int,  
  `ts` bigint,  
  `proc_time` as PROCTIME(),  
  `event_time` AS TO_TIMESTAMP(FROM_UNIXTIME(`ts` / 1000, 'yyyy-MM-dd 
HH:mm:ss')),  
  watermark for event_time AS event_time, 
  PRIMARY KEY (shop_id, user_id) NOT ENFORCED 
  ) with (  
  'connector.type' = 'kafka',  


  )

回复