-
Notifications
You must be signed in to change notification settings - Fork 34
Description
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. 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