zhangjun0x01 commented on code in PR #547:
URL: https://github.com/apache/flink-table-store/pull/547#discussion_r1118244978
##########
flink-table-store-core/src/main/java/org/apache/flink/table/store/CoreOptions.java:
##########
@@ -474,6 +474,20 @@ public class CoreOptions implements Serializable {
+ "$hour:00:00'."))
.build());
+ public static final ConfigOption<String> PRIMARY_KEY =
+ key("primary-key")
+ .stringType()
+ .noDefaultValue()
+ .withDescription(
+ "Define primary key by table options, cannot
define primary key on DDL and table options at the same time.");
Review Comment:
For Spark, the syntax for specifying partitions and primary keys is the same
in `crate table` and `create table as select`.
But for Flink, `create table as select` cannot specify the partition and
primary key . So we use the option parameter to specify it. However, if the
user writes a following sql
```
CREATE TABLE MyTable (
user_id BIGINT,
item_id BIGINT,
behavior STRING,
dt STRING,
hh STRING,
PRIMARY KEY (dt, hh, user_id) NOT ENFORCED
) WITH ('primary-key' = 'dt' );
```
we cannot determine which primary key to use. Therefore, we add verification
to prevent the primary key and partition from appearing at the same time in ddl
and option.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]