tustvold commented on code in PR #2500:
URL: https://github.com/apache/arrow-rs/pull/2500#discussion_r949145655


##########
parquet/src/arrow/array_reader/map_array.rs:
##########
@@ -43,15 +35,43 @@ impl MapArrayReader {
         data_type: ArrowType,
         def_level: i16,
         rep_level: i16,
+        nullable: bool,
     ) -> Self {
-        Self {
-            key_reader,
-            value_reader,
-            data_type,
-            // These are the wrong way round 
https://github.com/apache/arrow-rs/issues/1699
-            map_def_level: rep_level,
-            map_rep_level: def_level,
-        }
+        let struct_def_level = match nullable {
+            true => def_level + 2,
+            false => def_level + 1,
+        };
+        let struct_rep_level = rep_level + 1;
+
+        let element = match &data_type {
+            ArrowType::Map(element, _) => match element.data_type() {
+                ArrowType::Struct(fields) if fields.len() == 2 => {
+                    // The inner map field must always non-nullable (#1697)
+                    assert!(!element.is_nullable(), "map struct cannot be 
nullable");

Review Comment:
   As described in #1697 the encoding of DataType::Map permits greater 
nullability than the type can actually contain



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to