From 4551c7964de55f9ab1a72ccc0787fde0619ccc51 Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Wed, 30 Oct 2024 10:20:56 +0800 Subject: [PATCH] GH-465: Clarify backward-compatibility rules on LIST type --- LogicalTypes.md | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/LogicalTypes.md b/LogicalTypes.md index b55a90884..d7d55be0d 100644 --- a/LogicalTypes.md +++ b/LogicalTypes.md @@ -654,13 +654,16 @@ should always be determined by the following rules: 1. If the repeated field is not a group, then its type is the element type and elements are required. -2. If the repeated field is a group with multiple fields, then its type is the +2. If the repeated field is a group with `LIST` or `MAP` annotation, then the + element type is a List or Map type and elements are required. +3. If the repeated field is a group with multiple fields, then the element type + is a multi-field Tuple type and elements are required. +4. If the repeated field is a group with one `required` or `optional` field, + and is named either `array` or uses the `LIST`-annotated group's name with + `_tuple` appended, then the repeated type (a single-field Tuple type) is the element type and elements are required. -3. If the repeated field is a group with one field and is named either `array` - or uses the `LIST`-annotated group's name with `_tuple` appended then the - repeated type is the element type and elements are required. -4. Otherwise, the repeated field's type is the element type with the repeated - field's repetition. +5. Otherwise, the repeated field's type is the element type with the repeated + field's repetition and elements are required. Examples that can be interpreted using these rules: @@ -691,6 +694,14 @@ optional group my_list (LIST) { required binary str (STRING); }; } + +// List> (outer list is nullable with non-null elements, +// inner list is non-null with non-null elements) +optional group my_list (LIST) { + repeated group array (LIST) { + repeated int32 array; + } +} ``` ### Maps