You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by "martin-g (via GitHub)" <gi...@apache.org> on 2026/07/10 09:58:28 UTC

Re: [PR] Fix for `Value::String` to `Value::Fixed` resolution ignoring the `size` from the schema. [avro-rs]

martin-g commented on code in PR #542:
URL: https://github.com/apache/avro-rs/pull/542#discussion_r3558013767


##########
avro/src/types.rs:
##########
@@ -1029,7 +1029,15 @@ impl Value {
                     Err(Details::CompareFixedSizes { size, n }.into())
                 }
             }
-            Value::String(s) => Ok(Value::Fixed(s.len(), s.into_bytes())),
+            Value::String(s) => {
+                if s.len() > size {
+                    Err(Details::CompareFixedSizes { size, n: s.len() }.into())
+                } else {
+                    let mut bytes = s.into_bytes();
+                    bytes.resize(size, 0);

Review Comment:
   @KitFieldhouse Shall we remove the padding ?



-- 
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: issues-unsubscribe@avro.apache.org

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