friendlymatthew commented on code in PR #7720: URL: https://github.com/apache/arrow-rs/pull/7720#discussion_r2160335027
########## parquet-variant/src/builder.rs: ########## @@ -484,13 +486,33 @@ impl<'a> ObjectBuilder<'a> { } } + fn check_duplicate_field_name(&self, key: &str) -> Result<(), ArrowError> { + if let Some(field_name_id) = self.parent.dict.get(key) { + if self.fields.contains_key(field_name_id) { + return Err(ArrowError::InvalidArgumentError( + "field name must be unique and already exists in this object".to_string(), + )); + } + } + + Ok(()) + } + /// Add a field with key and value to the object - pub fn append_value<'m, 'd, T: Into<Variant<'m, 'd>>>(&mut self, key: &str, value: T) { - let id = self.parent.add_key(key); + pub fn append_value<'m, 'd, T: Into<Variant<'m, 'd>>>( Review Comment: Yes, I was considering that, but chose to take the Variant spec literally. I'm happy to change the implementation however -- 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