Skip to content

Commit 7a7f1dc

Browse files
committed
Clarify the use of Structs vs Maps #34
1 parent 82b536b commit 7a7f1dc

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
3030
### Fixed
3131

3232
- Various minor clarifications and editorial enhancements
33-
- GeoParquet encoding: Properties that are optional can be omitted if all values are null values
34-
- GeoJSON encoding: Clarify the encoding of the top-level properties (including `links` and `fiboa`)
35-
- GeoJSON encoding: Clarify the use of RFC 7946
36-
- GeoParquet encoding for bounding boxes and objects
3733
- Added descriptions to the allowed values for `determination_method`
34+
- GeoJSON: Clarify the encoding of the top-level properties (including `links` and `fiboa`)
35+
- GeoJSON: Clarify the use of RFC 7946
36+
- GeoParquet: Properties that are optional can be omitted if all values are null values
37+
- GeoParquet: Added encoding for bounding boxes and objects
38+
- GeoParquet: Clarified the use of Map and Struct data types
3839

3940
## [v0.2.0] - 2024-04-10
4041

geoparquet/datatypes.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ It also shows the mapping to the GeoParquet data types.
1919
| binary | BYTE_ARRAY | as string, base64-encoded |
2020
| string<br />charset: UTF-8 | STRING (BYTE_ARRAY) | yes |
2121
| array | LIST | yes |
22-
| object<br />keys: string<br />values: any | STRUCT / MAP | yes |
22+
| object<br />keys: string<br />values: any | STRUCT or MAP (see below) | yes |
2323
| date | DATE (INT32) | as string, compliant to ISO8601 |
2424
| date-time<br />with milliseconds<br />timezone: UTC | TimestampType (INT64)<br />isAdjustedToUTC: true<br />unit: MILLIS<br />(deprecated: TIMESTAMP_MILLIS) | as string, compliant to ISO8601 |
2525
| geometry | BYTE_ARRAY<br />encoded as WKB | no |
@@ -29,6 +29,14 @@ It also shows the mapping to the GeoParquet data types.
2929
The integer data types and the data type string can also be mapped to the ENUM data type in Parquet
3030
if a pre-defined set of values is available.
3131

32+
## Struct vs Map
33+
34+
Parquet has both Map and Struct types. The struct type is similar to a named dictionary while the map type is similar to a list of ordered (key, value) pairs. The main difference is that you need to know up-front the keys for the struct type, while you don't for the map type.
35+
36+
Due to this difference, the **Struct** type can only be used if `additionalProperties` is `false` (the default value) and only `properties` is provided to clearly specify the exact names of the properties.
37+
38+
Any variability in the keys through the use of `additionalProperties` (except for the default `false`) or `patternProperties` requires the use of the **Map** data type. Please note that the order of the Map type is guaranteed to be preserved.
39+
3240
## Unsupported Data Types
3341

3442
The following data types occur in Parquet, but are not currently supported in fiboa:

0 commit comments

Comments
 (0)