Skip to content

Commit 12b1f52

Browse files
authored
Spec: Allow the use of source-id in V3 (#12644)
1 parent 04bb3ee commit 12b1f52

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

format/spec.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,12 +1430,16 @@ Each partition field in `fields` is stored as a JSON object with the following p
14301430

14311431
| V1 | V2 | V3 | Field | JSON representation | Example |
14321432
|----------|----------|----------|------------------|---------------------|--------------|
1433-
| required | required | omitted | **`source-id`** | `JSON int` | 1 |
1434-
| | | required | **`source-ids`** | `JSON list of ints` | `[1,2]` |
1433+
| required | required | optional | **`source-id`** | `JSON int` | 1 |
1434+
| | | optional | **`source-ids`** | `JSON list of ints` | `[1,2]` |
14351435
| | required | required | **`field-id`** | `JSON int` | 1000 |
14361436
| required | required | required | **`name`** | `JSON string` | `id_bucket` |
14371437
| required | required | required | **`transform`** | `JSON string` | `bucket[16]` |
14381438

1439+
Notes:
1440+
1441+
1. For partition fields with a transform with a single argument, only `source-id` is written. In case of a multi-argument transform, only `source-ids` is written.
1442+
14391443
Supported partition transforms are listed below.
14401444

14411445
|Transform or Field|JSON representation|Example|
@@ -1470,12 +1474,14 @@ Each sort field in the fields list is stored as an object with the following pro
14701474
| V1 | V2 | V3 | Field | JSON representation | Example |
14711475
|----------|----------|----------|------------------|---------------------|-------------|
14721476
| required | required | required | **`transform`** | `JSON string` | `bucket[4]` |
1473-
| required | required | omitted | **`source-id`** | `JSON int` | 1 |
1474-
| | | required | **`source-ids`** | `JSON list of ints` | `[1,2]` |
1477+
| required | required | optional | **`source-id`** | `JSON int` | 1 |
1478+
| | | optional | **`source-ids`** | `JSON list of ints` | `[1,2]` |
14751479
| required | required | required | **`direction`** | `JSON string` | `asc` |
14761480
| required | required | required | **`null-order`** | `JSON string` | `nulls-last`|
14771481

1478-
In v3 metadata, writers must use only `source-ids` because v3 requires reader support for multi-arg transforms.
1482+
Notes:
1483+
1484+
1. For sort fields with a transform with a single argument, only `source-id` is written. In case of a multi-argument transform, only `source-ids` is written.
14791485

14801486
Older versions of the reference implementation can read tables with transforms unknown to it, ignoring them. But other implementations may break if they encounter unknown transforms. All v3 readers are required to read tables with unknown transforms, ignoring them.
14811487

@@ -1622,13 +1628,8 @@ All readers are required to read tables with unknown partition transforms, ignor
16221628
Writing v3 metadata:
16231629

16241630
* Partition Field and Sort Field JSON:
1625-
* `source-ids` was added and is required
1626-
* `source-id` is no longer required and should be omitted; always use `source-ids` instead
1627-
1628-
Reading v1 or v2 metadata for v3:
1629-
1630-
* Partition Field and Sort Field JSON:
1631-
* `source-ids` should default to a single-value list of the value of `source-id`
1631+
* `source-ids` was added and must be written in the case of a multi-argument transform.
1632+
* `source-id` must be written in the case of single-argument transforms.
16321633

16331634
Row-level delete changes:
16341635

0 commit comments

Comments
 (0)