rshkv commented on code in PR #7101: URL: https://github.com/apache/arrow-rs/pull/7101#discussion_r1948076890
########## arrow-array/src/builder/map_builder.rs: ########## @@ -107,13 +108,32 @@ impl<K: ArrayBuilder, V: ArrayBuilder> MapBuilder<K, V> { field_names: field_names.unwrap_or_default(), key_builder, value_builder, + key_field: None, value_field: None, } } /// Override the field passed to [`MapBuilder::new`] /// - /// By default a nullable field is created with the name `values` + /// By default, a nullable field is created with the name `keys` + /// + /// This function panics if the given field is nullable as map keys are not + /// allowed to be null + /// + /// Note: [`Self::finish`] and [`Self::finish_cloned`] will panic if the + /// field's data type does not match that of `K` + pub fn with_keys_field(self, field: impl Into<FieldRef>) -> Self { + let field: FieldRef = field.into(); + assert!(!field.is_nullable(), "Key field must not be nullable"); Review Comment: Updated. I'm thinking now this check might be unnecessary because `finish` asserts [here](https://github.com/apache/arrow-rs/blob/c245a45efef9d9453f121587365e56d53c39d28f/arrow-array/src/builder/map_builder.rs#L191-L195) that there are no null-keys anyway. -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org