, ,)"`|`"decimal(9,2)"`,
`"decimal(9, 2)"`|
-|**`struct`**|`JSON object: {`
`"type": "struct",`
`"fields": [ {`
`"id":
`"name":
`"required":
`"type":
`"doc":
`"initial-default":
`"write-default":
`}, ...`
`] }`|`{`
`"type": "struct",`
`"fields": [ {`
`"id": 1,`
`"name": "id",`
`"required": true,`
`"type": "uuid",`
`"initial-default": "0db3e2a8-9d1d-42b9-aa7b-74ebe558dceb",`
`"write-default": "ec5911be-b0a7-458c-8438-c9a3e53cffae"`
`}, {`
`"id": 2,`
`"name": "data",`
`"required": false,`
`"type": {`
`"type": "list",`
`...`
`}`
`} ]`
`}`|
-|**`list`**|`JSON object: {`
`"type": "list",`
`"element-id":
`"element-required":
`"element":
`}`|`{`
`"type": "list",`
`"element-id": 3,`
`"element-required": true,`
`"element": "string"`
`}`|
-|**`map`**|`JSON object: {`
`"type": "map",`
`"key-id":
`"key":
`"value-id":
`"value-required":
`"value":
`}`|`{`
`"type": "map",`
`"key-id": 4,`
`"key": "string",`
`"value-id": 5,`
`"value-required": false,`
`"value": "double"`
`}`|
+| Type | JSON representation | Example |
+|---------------------------------------------|-----------------------------------|------------------------------------------|
+| **`boolean`** | `JSON string: "boolean"` | `"boolean"` |
+| **`int`** | `JSON string: "int"` | `"int"` |
+| **`long`** | `JSON string: "long"` | `"long"` |
+| **`float`** | `JSON string: "float"` | `"float"` |
+| **`double`** | `JSON string: "double"` | `"double"` |
+| **`string`** | `JSON string: "string"` | `"string"` |
+| **`uuid`** | `JSON string: "uuid"` | `"uuid"` |
+| **`fixed(L)`** | `JSON string: "fixed[)"` | `"decimal(9,2)"`,
`"decimal(9, 2)"` |
+| **`date`** | `JSON string: "date"` | `"date"` |
+| **`time`** | `JSON string: "time"` | `"time"` |
+| **`timestamp, microseconds, without zone`** | `JSON string: "timestamp"` | `"timestamp"` |
+| **`timestamp, microseconds, with zone`** | `JSON string: "timestamptz"` | `"timestamptz"` |
+| **`timestamp, nanoseconds, without zone`** | `JSON string: "timestamp_ns"` | `"timestamp_ns"` |
+| **`timestamp, nanoseconds, with zone`** | `JSON string: "timestamptz_ns"` | `"timestamptz_ns"` |
+| **`struct`** |`JSON object: {`
`"type": "struct",`
`"fields": [ {`
`"id":
`"name":
`"required":
`"type":
`"doc":
`"initial-default":
`"write-default":
`}, ...`
`] }`|`{`
`"type": "struct",`
`"fields": [ {`
`"id": 1,`
`"name": "id",`
`"required": true,`
`"type": "uuid",`
`"initial-default": "0db3e2a8-9d1d-42b9-aa7b-74ebe558dceb",`
`"write-default": "ec5911be-b0a7-458c-8438-c9a3e53cffae"`
`}, {`
`"id": 2,`
`"name": "data",`
`"required": false,`
`"type": {`
`"type": "list",`
`...`
`}`
`} ]`
`}`|
+| **`list`** |`JSON object: {`
`"type": "list",`
`"element-id":
`"element-required":
`"element":
`}`|`{`
`"type": "list",`
`"element-id": 3,`
`"element-required": true,`
`"element": "string"`
`}`|
+| **`map`** |`JSON object: {`
`"type": "map",`
`"key-id":
`"key":
`"value-id":
`"value-required":
`"value":
`}`|`{`
`"type": "map",`
`"key-id": 4,`
`"key": "string",`
`"value-id": 5,`
`"value-required": false,`
`"value": "double"`
`}`|
Note that default values are serialized using the JSON single-value serialization in [Appendix D](#appendix-d-single-value-serialization).
@@ -1170,49 +1190,53 @@ File scan task is serialized as a JSON object according to the following table.
This serialization scheme is for storing single values as individual binary values in the lower and upper bounds maps of manifest files.
-| Type | Binary serialization |
-|------------------------------|--------------------------------------------------------------------------------------------------------------|
-| **`boolean`** | `0x00` for false, non-zero byte for true |
-| **`int`** | Stored as 4-byte little-endian |
-| **`long`** | Stored as 8-byte little-endian |
-| **`float`** | Stored as 4-byte little-endian |
-| **`double`** | Stored as 8-byte little-endian |
-| **`date`** | Stores days from the 1970-01-01 in an 4-byte little-endian int |
-| **`time`** | Stores microseconds from midnight in an 8-byte little-endian long |
-| **`timestamp without zone`** | Stores microseconds from 1970-01-01 00:00:00.000000 in an 8-byte little-endian long |
-| **`timestamp with zone`** | Stores microseconds from 1970-01-01 00:00:00.000000 UTC in an 8-byte little-endian long |
-| **`string`** | UTF-8 bytes (without length) |
-| **`uuid`** | 16-byte big-endian value, see example in Appendix B |
-| **`fixed(L)`** | Binary value |
-| **`binary`** | Binary value (without length) |
-| **`decimal(P, S)`** | Stores unscaled value as two’s-complement big-endian binary, using the minimum number of bytes for the value |
-| **`struct`** | Not supported |
-| **`list`** | Not supported |
-| **`map`** | Not supported |
+| Type | Binary serialization |
+|----------------------|--------------------------------------------------------------------------------------------------------------|
+| **`boolean`** | `0x00` for false, non-zero byte for true |
+| **`int`** | Stored as 4-byte little-endian |
+| **`long`** | Stored as 8-byte little-endian |
+| **`float`** | Stored as 4-byte little-endian |
+| **`double`** | Stored as 8-byte little-endian |
+| **`string`** | UTF-8 bytes (without length) |
+| **`uuid`** | 16-byte big-endian value, see example in Appendix B |
+| **`fixed(L)`** | Binary value |
+| **`binary`** | Binary value (without length) |
+| **`decimal(P, S)`** | Stores unscaled value as two’s-complement big-endian binary, using the minimum number of bytes for the value |
+| **`date`** | Stores days from the 1970-01-01 in an 4-byte little-endian int |
+| **`time`** | Stores microseconds from midnight in an 8-byte little-endian long |
+| **`timestamp`** | Stores microseconds from 1970-01-01 00:00:00.000000 in an 8-byte little-endian long |
+| **`timestamptz`** | Stores microseconds from 1970-01-01 00:00:00.000000 UTC in an 8-byte little-endian long |
+| **`timestamp_ns`** | Stores nanoseconds from 1970-01-01 00:00:00.000000000 in an 8-byte little-endian long |
+| **`timestamptz_ns`** | Stores nanoseconds from 1970-01-01 00:00:00.000000000 UTC in an 8-byte little-endian long |
+| **`struct`** | Not supported |
+| **`list`** | Not supported |
+| **`map`** | Not supported |
### JSON single-value serialization
Single values are serialized as JSON by type according to the following table:
-| Type | JSON representation | Example | Description |
-| ------------------ | ----------------------------------------- | ------------------------------------------ | -- |
-| **`boolean`** | **`JSON boolean`** | `true` | |
-| **`int`** | **`JSON int`** | `34` | |
-| **`long`** | **`JSON long`** | `34` | |
-| **`float`** | **`JSON number`** | `1.0` | |
-| **`double`** | **`JSON number`** | `1.0` | |
-| **`decimal(P,S)`** | **`JSON string`** | `"14.20"`, `"2E+20"` | Stores the string representation of the decimal value, specifically, for values with a positive scale, the number of digits to the right of the decimal point is used to indicate scale, for values with a negative scale, the scientific notation is used and the exponent must equal the negated scale |
-| **`date`** | **`JSON string`** | `"2017-11-16"` | Stores ISO-8601 standard date |
-| **`time`** | **`JSON string`** | `"22:31:08.123456"` | Stores ISO-8601 standard time with microsecond precision |
-| **`timestamp`** | **`JSON string`** | `"2017-11-16T22:31:08.123456"` | Stores ISO-8601 standard timestamp with microsecond precision; must not include a zone offset |
-| **`timestamptz`** | **`JSON string`** | `"2017-11-16T22:31:08.123456+00:00"` | Stores ISO-8601 standard timestamp with microsecond precision; must include a zone offset and it must be '+00:00' |
-| **`string`** | **`JSON string`** | `"iceberg"` | |
-| **`uuid`** | **`JSON string`** | `"f79c3e09-677c-4bbd-a479-3f349cb785e7"` | Stores the lowercase uuid string |
-| **`fixed(L)`** | **`JSON string`** | `"000102ff"` | Stored as a hexadecimal string |
-| **`binary`** | **`JSON string`** | `"000102ff"` | Stored as a hexadecimal string |
-| **`struct`** | **`JSON object by field ID`** | `{"1": 1, "2": "bar"}` | Stores struct fields using the field ID as the JSON field name; field values are stored using this JSON single-value format |
-| **`list`** | **`JSON array of values`** | `[1, 2, 3]` | Stores a JSON array of values that are serialized using this JSON single-value format |
-| **`map`** | **`JSON object of key and value arrays`** | `{ "keys": ["a", "b"], "values": [1, 2] }` | Stores arrays of keys and values; individual keys and values are serialized using this JSON single-value format |
+| Type | JSON representation | Example | Description |
+|----------------------|-------------------------------------------|--------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| **`boolean`** | **`JSON boolean`** | `true` | |
+| **`int`** | **`JSON int`** | `34` | |
+| **`long`** | **`JSON long`** | `34` | |
+| **`float`** | **`JSON number`** | `1.0` | |
+| **`double`** | **`JSON number`** | `1.0` | |
+| **`decimal(P,S)`** | **`JSON string`** | `"14.20"`, `"2E+20"` | Stores the string representation of the decimal value, specifically, for values with a positive scale, the number of digits to the right of the decimal point is used to indicate scale, for values with a negative scale, the scientific notation is used and the exponent must equal the negated scale |
+| **`string`** | **`JSON string`** | `"iceberg"` | |
+| **`uuid`** | **`JSON string`** | `"f79c3e09-677c-4bbd-a479-3f349cb785e7"` | Stores the lowercase uuid string |
+| **`fixed(L)`** | **`JSON string`** | `"000102ff"` | Stored as a hexadecimal string |
+| **`binary`** | **`JSON string`** | `"000102ff"` | Stored as a hexadecimal string |
+| **`date`** | **`JSON string`** | `"2017-11-16"` | Stores ISO-8601 standard date |
+| **`time`** | **`JSON string`** | `"22:31:08.123456"` | Stores ISO-8601 standard time with microsecond precision |
+| **`timestamp`** | **`JSON string`** | `"2017-11-16T22:31:08.123456"` | Stores ISO-8601 standard timestamp with microsecond precision; must not include a zone offset |
+| **`timestamptz`** | **`JSON string`** | `"2017-11-16T22:31:08.123456+00:00"` | Stores ISO-8601 standard timestamp with microsecond precision; must include a zone offset and it must be '+00:00' |
+| **`timestamp_ns`** | **`JSON string`** | `"2017-11-16T22:31:08.123456789"` | Stores ISO-8601 standard timestamp with nanosecond precision; must not include a zone offset |
+| **`timestamptz_ns`** | **`JSON string`** | `"2017-11-16T22:31:08.123456789+00:00"` | Stores ISO-8601 standard timestamp with nanosecond precision; must include a zone offset and it must be '+00:00' |
+| **`struct`** | **`JSON object by field ID`** | `{"1": 1, "2": "bar"}` | Stores struct fields using the field ID as the JSON field name; field values are stored using this JSON single-value format |
+| **`list`** | **`JSON array of values`** | `[1, 2, 3]` | Stores a JSON array of values that are serialized using this JSON single-value format |
+| **`map`** | **`JSON object of key and value arrays`** | `{ "keys": ["a", "b"], "values": [1, 2] }` | Stores arrays of keys and values; individual keys and values are serialized using this JSON single-value format |
## Appendix E: Format version changes
@@ -1223,6 +1247,8 @@ Default values are added to struct fields in v3.
* The `write-default` is a forward-compatible change because it is only used at write time. Old writers will fail because the field is missing.
* Tables with `initial-default` will be read correctly by older readers if `initial-default` is always null for optional fields. Otherwise, old readers will default optional columns with null. Old readers will fail to read required fields which are populated by `initial-default` because that default is not supported.
+Types `timestamp_ns` and `timestamptz_ns` are added in v3.
+
### Version 2
Writing v1 metadata: