This is an automated email from the ASF dual-hosted git repository.
tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new fd9cb23f1 Fix map nullable flag in `ParquetTypeConverter` (#1592)
fd9cb23f1 is described below
commit fd9cb23f12ccfbf7422df5535c2602a925cc89dd
Author: Liang-Chi Hsieh <[email protected]>
AuthorDate: Thu Apr 21 01:22:37 2022 -0700
Fix map nullable flag in `ParquetTypeConverter` (#1592)
* Fix map nullable flag
* Fix tests
* Add another map case
---
parquet/src/arrow/schema.rs | 33 ++++++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/parquet/src/arrow/schema.rs b/parquet/src/arrow/schema.rs
index b0679e361..239311ade 100644
--- a/parquet/src/arrow/schema.rs
+++ b/parquet/src/arrow/schema.rs
@@ -1018,7 +1018,7 @@ impl ParquetTypeConverter<'_> {
Box::new(Field::new(
key_item.name(),
DataType::Struct(vec![key, value]),
- false,
+ self.schema.is_optional(),
)),
false, // There is no information to tell if keys are
sorted
))),
@@ -1500,7 +1500,7 @@ mod tests {
Field::new("str", DataType::Utf8, false),
Field::new("num", DataType::Int32, false),
]),
- false,
+ true,
)),
false,
),
@@ -1525,7 +1525,7 @@ mod tests {
Field::new("key", DataType::Utf8, false),
Field::new("value", DataType::Int32, true),
]),
- false,
+ true,
)),
false,
),
@@ -2096,7 +2096,7 @@ mod tests {
true,
),
]),
- false,
+ true,
)),
false, // fails to roundtrip keys_sorted
),
@@ -2119,12 +2119,35 @@ mod tests {
true,
),
]),
- false,
+ true,
)),
false, // fails to roundtrip keys_sorted
),
true,
),
+ Field::new(
+ "c41",
+ DataType::Map(
+ Box::new(Field::new(
+ "my_entries",
+ DataType::Struct(vec![
+ Field::new("my_key", DataType::Utf8, false),
+ Field::new(
+ "my_value",
+ DataType::List(Box::new(Field::new(
+ "item",
+ DataType::Utf8,
+ true,
+ ))),
+ true,
+ ),
+ ]),
+ false,
+ )),
+ false, // fails to roundtrip keys_sorted
+ ),
+ false,
+ ),
],
metadata,
);