bkietz commented on issue #7058:
URL: https://github.com/apache/arrow-rs/issues/7058#issuecomment-2648942424

   Inlining a bit further, the issue seems to be peculiar to 
`size_prefixed_root_as_message`. The schema can be roundtripped without error 
using `parse_message`
   
   ```rust
   #[test]
   fn test_roundtrip_schema() {
       let schema = Schema::new(vec![
           Field::new(
               "a",
               DataType::Dictionary(Box::new(DataType::UInt16), 
Box::new(DataType::Utf8)),
               false,
           ),
           Field::new(
               "b",
               DataType::Dictionary(Box::new(DataType::UInt16), 
Box::new(DataType::Utf8)),
               false,
           ),
       ]);
   
       let options = IpcWriteOptions::default();
       let data_gen = IpcDataGenerator::default();
       let mut dict_tracker = DictionaryTracker::new(false);
       let encoded_data =
           data_gen.schema_to_bytes_with_dictionary_tracker(&schema, &mut 
dict_tracker, &options);
       let mut schema_bytes = vec![];
       write_message(&mut schema_bytes, encoded_data, 
&options).expect("write_message");
   
       let begin_offset: usize = if schema_bytes[0..4].eq(&CONTINUATION_MARKER) 
{ 4 } else { 0 };
       size_prefixed_root_as_message(&schema_bytes[begin_offset..])
               .expect_err("size_prefixed_root_as_message");
       let msg = parse_message(&schema_bytes).expect("parse_message");
       let ipc_schema = msg.header_as_schema().expect("header_as_schema");
       let new_schema = fb_to_schema(ipc_schema);
   
       assert_eq!(schema, new_schema);
   }
   ```


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