hililiwei commented on code in PR #7382:
URL: https://github.com/apache/iceberg/pull/7382#discussion_r1198846875
##########
docs/flink-ddl.md:
##########
@@ -144,44 +144,61 @@ CREATE DATABASE iceberg_db;
USE iceberg_db;
```
-### `CREATE TABLE`
+## `CREATE TABLE`
```sql
CREATE TABLE `hive_catalog`.`default`.`sample` (
id BIGINT COMMENT 'unique id',
- data STRING
-);
+ `data` STRING NOT NULL
+)
+WITH ('format-version'='2');
```
Table create commands support the commonly used [Flink create
clauses](https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/create/)
including:
-* `PARTITION BY (column1, column2, ...)` to configure partitioning, Flink does
not yet support hidden partitioning.
* `COMMENT 'table document'` to set a table description.
* `WITH ('key'='value', ...)` to set [table configuration](../configuration)
which will be stored in Iceberg table properties.
-Currently, it does not support computed column, primary key and watermark
definition etc.
+Currently, it does not support computed column and watermark definition etc.
+
+### `PRIMARY KEY`
+
+Primary key constraint can be declared for a column or a set of columns, which
must be unique and do not contain null.
+It's required for [`UPSERT` mode](../flink/flink-writes.md#upsert).
+
+```sql
+CREATE TABLE `hive_catalog`.`default`.`sample` (
+ id BIGINT COMMENT 'unique id',
+ `data` STRING NOT NULL,
+ PRIMARY KEY(`id`) NOT ENFORCED
+)
+WITH ('format-version'='2');
+```
### `PARTITIONED BY`
To create a partition table, use `PARTITIONED BY`:
```sql
CREATE TABLE `hive_catalog`.`default`.`sample` (
- id BIGINT COMMENT 'unique
id',
- data STRING
-) PARTITIONED BY (data);
+ id BIGINT COMMENT 'unique id',
+ `data` STRING NOT NULL,
+ PRIMARY KEY(`id`) NOT ENFORCED
Review Comment:
the partition fields should be included in primary key, or we can delete
this 186 line.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]