ollis commented on code in PR #49:
URL: https://github.com/apache/avro-rs/pull/49#discussion_r1835511926


##########
avro/src/de.rs:
##########
@@ -367,6 +369,7 @@ impl<'a, 'de> de::Deserializer<'de> for &'a 
Deserializer<'de> {
             }
             Value::Uuid(ref u) => visitor.visit_bytes(u.as_bytes()),
             Value::Decimal(ref d) => visitor.visit_bytes(&d.to_vec()?),
+            Value::BigDecimal(ref d) => visitor.visit_string(d.to_string()),

Review Comment:
   This will never match because `deserialize_bytes` is not invoked for 
bigdecimal? It is either `deserialize_any` or `deserialize_str` (if feature 
`string-only` is enabled)?



##########
avro/src/ser.rs:
##########
@@ -691,11 +694,13 @@ mod tests {
             a: 27,
             b: "foo".to_owned(),
             decimal: Decimal::from(vec![1, 24]),
+            big_decimal: BigDecimal::new(BigInt::from(12), 2),
         };
         let expected = Value::Record(vec![
             ("a".to_owned(), Value::Long(27)),
             ("b".to_owned(), Value::String("foo".to_owned())),
             ("decimal".to_owned(), Value::Bytes(vec![1, 24])),
+            ("big_decimal".to_owned(), Value::String("0.12".into())),

Review Comment:
   The deserialization tests can in some cases use a different Value type than 
what is expected i the serialization test, e.g. for decimal/big_decimal. Maybe 
one should add tests that verifies a serialization-deserialization roundtrip: 
struct = fromValue(toValue(struct)) (It works now because both Value::String 
and Value::BigDecimal ends up calling the `visit_str` on BigDecimal)



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