You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Renjie Liu (Jira)" <ji...@apache.org> on 2024/01/04 08:45:00 UTC

[jira] [Created] (AVRO-3925) Decimal serialization/deserialization is incorrect.

Renjie Liu created AVRO-3925:
--------------------------------

             Summary: Decimal serialization/deserialization is incorrect.
                 Key: AVRO-3925
                 URL: https://issues.apache.org/jira/browse/AVRO-3925
             Project: Apache Avro
          Issue Type: Bug
          Components: rust
            Reporter: Renjie Liu


The output of following code is:
{code:java}
let avro_schema = AvroSchema::Decimal(
    DecimalSchema {
        precision: 36,
        scale: 10,
        inner: Box::new(AvroSchema::Fixed(FixedSchema {
            name: Name::new("decimal_36_10").unwrap(),
            aliases: None,
            doc: None,
            size: 16,
            attributes: Default::default(),
        })),
    }
);
println!("{}", serde_json::to_string(&avro_schema).unwrap()); {code}
{code:java}
{"type":{"type":"fixed","name":"decimal_36_10","size":16},"logicalType":"decimal","scale":10,"precision":36}
{code}
This is incorrect, the correct result in java is:
{code:java}
{"type":"fixed","name":"test","size":16,"logicalType":"decimal","precision":36,"scale":10} {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)