yongkyunlee commented on code in PR #8254:
URL: https://github.com/apache/arrow-rs/pull/8254#discussion_r2314778575


##########
arrow-avro/src/reader/record.rs:
##########
@@ -590,10 +590,23 @@ impl Decoder {
                         )));
                     }
                 }
+                // Extract the value field nullability from the schema
+                let is_value_nullable = match map_field.data_type() {
+                    DataType::Struct(fields) => fields
+                        .iter()
+                        .find(|f| f.name() == "value")
+                        .map(|f| f.is_nullable())
+                        .unwrap_or(false),
+                    _ => true, // default to nullable
+                };
                 let entries_struct = StructArray::new(
                     Fields::from(vec![
                         Arc::new(ArrowField::new("key", DataType::Utf8, 
false)),
-                        Arc::new(ArrowField::new("value", 
val_arr.data_type().clone(), true)),
+                        Arc::new(ArrowField::new(
+                            "value",
+                            val_arr.data_type().clone(),
+                            is_value_nullable,

Review Comment:
   That makes sense. I'll close this PR and raise a new PR later with only 
tests.



##########
arrow-avro/src/reader/record.rs:
##########
@@ -590,10 +590,23 @@ impl Decoder {
                         )));
                     }
                 }
+                // Extract the value field nullability from the schema
+                let is_value_nullable = match map_field.data_type() {
+                    DataType::Struct(fields) => fields
+                        .iter()
+                        .find(|f| f.name() == "value")
+                        .map(|f| f.is_nullable())
+                        .unwrap_or(false),
+                    _ => true, // default to nullable
+                };
                 let entries_struct = StructArray::new(
                     Fields::from(vec![
                         Arc::new(ArrowField::new("key", DataType::Utf8, 
false)),
-                        Arc::new(ArrowField::new("value", 
val_arr.data_type().clone(), true)),
+                        Arc::new(ArrowField::new(
+                            "value",
+                            val_arr.data_type().clone(),
+                            is_value_nullable,

Review Comment:
   Thanks for the comments!



-- 
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