flink table primary key与format 有一定关联性,不是所有format都可以支持PK.
如出现如下错误:
Caused by: org.apache.flink.table.api.ValidationException: The Kafka table ‘default_catalog.default_database.KafkaVersionTable’ with ‘csv’ format doesn’t support defining PRIMARY KEY constraint on the table, because it can’t guarantee the semantic of primary key.
即代表format是不支持的,关键代码如下:
private static void validatePKConstraints(
ObjectIdentifier tableName, CatalogTable catalogTable, Format format)