helgikrs opened a new issue #847:
URL: https://github.com/apache/arrow-rs/issues/847


   A schema containing dictionary fields nested within structs does not 
round-trip properly through FB serialization/deserialization.
   
   Repro:
   
   ```rust
   use arrow::{
       datatypes::{DataType, Field, Schema},
       ipc::{
           self,
           convert::{fb_to_schema, schema_to_fb},
       },
   };
   use std::sync::Arc;
   
   fn main() {
       let schema = Arc::new(Schema::new(vec![Field::new(
           "struct<dictionary<int32, utf8>>",
           DataType::Struct(vec![Field::new(
               "dictionary<int32, utf8>",
               DataType::Dictionary(Box::new(DataType::Int32), 
Box::new(DataType::Utf8)),
               false,
           )]),
           false,
       )]));
   
       let fb = schema_to_fb(&schema);
       let ipc = ipc::root_as_schema(fb.finished_data()).unwrap();
       let schema2 = fb_to_schema(ipc);
       assert_eq!(*schema, schema2);
   }
   ```
   
   ```console
   thread 'main' panicked at 'assertion failed: `(left == right)`
     left: `Schema { fields: [Field { name: "struct<dictionary<int32, utf8>>", 
data_type: Struct([Field { name: "dictionary<int32, utf8>", data_type: 
Dictionary(Int32, Utf8), nullable: false, dict_id: 0, dict_is_ordered: false, 
metadata: None }]), nullable: false, dict_id: 0, dict_is_ordered: false, 
metadata: None }], metadata: {} }`,
    right: `Schema { fields: [Field { name: "struct<dictionary<int32, utf8>>", 
data_type: Struct([Field { name: "dictionary<int32, utf8>", data_type: Utf8, 
nullable: false, dict_id: 0, dict_is_ordered: false, metadata: None }]), 
nullable: false, dict_id: 0, dict_is_ordered: false, metadata: None }], 
metadata: {} }`', src/main.rs:26:5
   ```


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