friendlymatthew opened a new issue, #7730:
URL: https://github.com/apache/arrow-rs/issues/7730

   **Describe the bug**
   Today, users are able to append multiple fields with the same field name to 
an object. 
   
   Per the Parquet Variant spec: 
   ```
   Field names are case-sensitive. Field names are required to be unique for 
each object. It is an error for an object to contain two fields with the same 
name, whether or not they have distinct dictionary IDs.
   ```
   
   
   **To Reproduce**
   ```rs
   #[test]
   fn test_object_duplicate_field_names() {
       let mut builder = VariantBuilder::new();
   
       {
           let mut obj = builder.new_object();
           obj.append_value("name", "John");
           obj.append_value("name", "Alice");
           obj.finish();
       }
   
       let (metadata, value) = builder.finish();
       assert!(!metadata.is_empty());
       assert!(!value.is_empty());
   
       let Variant::Object(obj_variant) = Variant::try_new(&metadata, 
&value).unwrap() else {
           panic!()
       };
   
       /*
       [parquet-variant/src/builder.rs:760:9] 
obj_variant.iter().collect::<Vec<_>>() = [
           (
               "name",
               ShortString(
                   ShortString(
                       "John",
                   ),
               ),
           ),
           (
               "name",
               ShortString(
                   ShortString(
                       "Alice",
                   ),
               ),
           ),
       ]
       */
       dbg!(obj_variant.iter().collect::<Vec<_>>());
   }
   ```
   
   **Expected behavior**
   It should raise an error on the second `obj.append_value` call


-- 
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.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to