avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Newberger <david.newber...@wandcorp.com>
Subject Converting BigDecial to ByteBuffer
Date Tue, 19 Jan 2016 14:28:31 GMT
Hello All,

I have an avro schema that includes the following as a field:

  "name" : "currency",
  "type" : ["null","bytes"],
  "logicalType": "decimal",
  "precision": 9,
  "scale": 4

When I run the avro-tools on it  to create a java file representing the schema it produces
a property that looks like public java.nio.ByteBuffer currency;

However, in other parts of the program I'm using Scala with values in BigDecimal types.

How can I convert a BigDecimal value to the expected ByteBuffer?

Is there anything special I need to do to ensure it is compatible with avro and other tools
like Impala?

Also is this the correct form to using currency values?


David Newberger

View raw message