Data Types Supported by Iceberg Tables
Primitive Types
Supported primitive types are defined in Table 1.
- Timestamp values without time zone represent a date and time of day regardless of zone. The time value is independent of zone adjustments (for example, 2017-11-16 17:10:34 is always retrieved as 2017-11-16 17:10:34).
- Timestamp values with a time zone (Timestamptz) represent a point in time. They are stored as UTC and do not retain a source time zone (for example, 2017-11-16 17:10:34 PST is stored/retrieved as 2017-11-17 01:10:34 UTC and these values are considered identical).
- Character strings must be stored as UTF-8 encoded byte arrays.
| Primitive Type | Description |
|---|---|
| boolean | True or false |
| int | 32-bit signed integers. They can promote to the long type. |
| long | 64-bit signed integers |
| float | 32-bit IEEE 754 floating points. They can promote to the double type. |
| double | 64-bit IEEE 754 floating points |
| decimal(P,S) | Fixed-point decimals. P specifies the precision (the total number of digits), and S specifies the scale (the number of digits in the fractional part). Scale is fixed, and precision must be 38 or less. |
| date | Calendar dates without the time zone or time |
| timestamp | Timestamps with microsecond precision, excluding the time zone |
| timestamp_tz | Timestamps with microsecond precision and the time zone |
| string | Arbitrary-length character sequences encoded with UTF-8 |
| binary | Arbitrary-length byte arrays |
| geometry | Plane geometric types, including two-dimensional spatial data for points, lines, and planes |
| geography | Geographic coordinate types, including spherical geographic location data based on longitude and latitude |
| timestamp_ns | Timestamp with nanosecond precision, excluding the time zone |
| timestamp_tz_ns | Timestamp with nanosecond precision and the time zone |
| unknown | Unknown type (used only as a placeholder when the schema is not determined). It can only be NULL and is not written to data files. |
Nested Types
- A struct is a tuple of typed values. Each field in the tuple is named and has an integer ID that is unique in the table schema. Each field can be either optional or required, meaning that values can (or cannot) be null. Fields can be of any type and may have an optional comment or doc string. They can have default values.
- A list is a collection of values with some element type. The element field has an integer ID that is unique in the table schema. Elements can be either optional or required. They can be of any type.
- A map is a collection of key-value pairs with a key type and a value type. Both the key field and value field 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.
Semi-structured Types
- Variants are similar to JSON with a wider set of primitive values including dates, timestamps, timestamptz, binary, and decimals.
- Variant values may contain nested types:
- An array is an ordered collection of variant values.
- An object is a collection of fields, each of which contains a string key and a variant value.
- As a semi-structured type, variants differ from other Iceberg data types in the following ways:
- Variant arrays are similar to lists, but may contain any variant value rather than a fixed element type.
- Variant objects are similar to structs, but may contain variable fields identified by name and field values may be any variant value rather than a fixed field type.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot