roofdiver opened a new issue, #285:
URL: https://github.com/apache/avro-rs/issues/285

   Hi y'all I'm using the de-serialization method where you build out structs 
for the fields you want to extract. This works great, but I am running into an 
issue when deserializing byte arrays in avro.
   
   I have a struct like this
   
   ```
   #[derive(Debug,Deserialize)]
   struct Services{
       port: i64,
       transport: Option<String>,
       service_name: Option<String>,
       banner: Option<Vec<u8>>,
       tls: TLS
   
   }
   ```
   
   and I'm de-serializing this way
   `
   ...
   let reader = Reader::new(file)?;
   
       for value in reader {
           let value = value?;
           let record: Services = from_value::<Services>(&value)?;
           println!("{:#?}",record)
       }
   
   `
   
   I've confirmed my avro schema from the file as well
   `
   {
     'default': None,
      'name': 'banner',
      'type': ['null', 'bytes']
   }
   `
   
   
   No matter what I do I get this error.
   `Error: Error { details: Failed to deserialize Avro value into value: 
Expected an Array or Union, but got: Bytes([0, 91, 0, 0, 0, 0, 0, 0]) }`
   
   This leads me to believe that I'm supposed to use an avro built in type 
(Bytes?) to deserialize the byte array since it's not liking Vec<u8>. The issue 
there is that I'm seeing Bytes as an Enum of the apache_avro Value which 
doesn't implement Deserialize.
   
   Would really appreciate anything pointing me in the right direction. 
   
   Thanks,
   
   K
   
   


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