RussellSpitzer commented on code in PR #4301:
URL: https://github.com/apache/iceberg/pull/4301#discussion_r858009243
##########
format/spec.md:
##########
@@ -1091,9 +1117,39 @@ This serialization scheme is for storing single values
as individual binary valu
| **`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 number`** | `14.20`
| Stores the decimal as a number with S places
after the decimal |
+| **`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-07:00"` | Stores ISO-8601 standard timestamp
with microsecond precision; must include a zone offset |
+| **`string`** | **`JSON string`** | `"iceberg"`
| |
+| **`uuid`** | **`JSON string`** |
`"f79c3e09-677c-4bbd-a479-3f349cb785e7"` | Stores the lowercase uuid string |
+| **`fixed(L)`** | **`JSON string`** |
`"0x00010203"` | Stored as a hexadecimal string,
prefixed by `0x` |
+| **`binary`** | **`JSON string`** |
`"0x00010203"` | Stored as a hexadecimal string,
prefixed by `0x` |
+| **`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
+### Version 3
+
+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 that have an `initial-default` because the default is not supported,
when reading data files that are missing the required fields.
Review Comment:
The last sentence I think can be reordered a bit
"Old readers will fail to read required fields which are populated by
`initial-default` because that default is not supported." ?
--
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]