Skip to content

Commit

Permalink
Docs: Enhance documentation on identifier fields (#9478)
Browse files Browse the repository at this point in the history
  • Loading branch information
manuzhang authored Jan 16, 2024
1 parent 684f7a7 commit 3684152
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/spark-ddl.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Spark 3 can create tables in any Iceberg catalog with the clause `USING iceberg`

```sql
CREATE TABLE prod.db.sample (
id bigint COMMENT 'unique id',
id bigint NOT NULL COMMENT 'unique id',
data string)
USING iceberg;
```
Expand Down Expand Up @@ -459,7 +459,8 @@ ALTER TABLE prod.db.sample WRITE DISTRIBUTED BY PARTITION LOCALLY ORDERED BY cat

### `ALTER TABLE ... SET IDENTIFIER FIELDS`

Iceberg supports setting identifier fields to a spec using `SET IDENTIFIER FIELDS`:
Iceberg supports setting [identifier fields](https://iceberg.apache.org/spec/#identifier-field-ids) to a spec using `SET IDENTIFIER FIELDS`:
Spark table can support Flink SQL upsert operation if the table has identifier fields.

```sql
ALTER TABLE prod.db.sample SET IDENTIFIER FIELDS id
Expand All @@ -468,7 +469,8 @@ ALTER TABLE prod.db.sample SET IDENTIFIER FIELDS id, data
-- multiple columns
```

identifier fields must be `NOT NULL`, The later `ALTER` statement will overwrite the previous setting.
Identifier fields must be `NOT NULL` columns when they are created or added.
The later `ALTER` statement will overwrite the previous setting.

### `ALTER TABLE ... DROP IDENTIFIER FIELDS`

Expand Down

0 comments on commit 3684152

Please sign in to comment.