Skip to content

Commit

Permalink
Spec: add variant type
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-aixu authored and aihuaxu committed Oct 9, 2024
1 parent 208ab20 commit 5a8acf1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions format/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ A **`list`** is a collection of values with some element type. The element field

A **`map`** is a collection of key-value pairs with a key type and a value type. Both the key field and value field each have an integer id that is unique in the table schema. Map keys are required and map values can be either optional or required. Both map keys and map values may be any type, including nested types.

A **`variant`** is a type to represent semi-structured data. A variant value can store a value of any other type, including any primitive, struct, list or map values. The variant value is encoded in its own binary [encoding](https://github.com/apache/parquet-format/blob/master/VariantEncoding.md/). Variant type is added in [v3](#version-3).

### Primitive Types

Supported primitive types are defined in the table below. Primitive types added after v1 have an "added by" version that is the first spec version in which the type is allowed. For example, nanosecond-precision timestamps are part of the v3 spec; using v3 types in v1 or v2 tables can break forward compatibility.
Expand Down Expand Up @@ -1317,6 +1319,7 @@ This serialization scheme is for storing single values as individual binary valu
## Appendix E: Format version changes

### Version 3
New type `variant` is added in V3.

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.
Expand Down

0 comments on commit 5a8acf1

Please sign in to comment.