Can you serialize the BigDecimal to byte[]. Byetbuffer has a backing byte[]. It 
allows off heap mem allocation.

-regards
Seemanto Barua


From: David Newberger [mailto:[email protected]]
Sent: Tuesday, January 19, 2016 9:29 AM
To: [email protected]
Subject: Converting BigDecial to ByteBuffer

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?

Cheers,

David Newberger



PLEASE READ: This message is for the named person's use only. It may contain 
confidential, proprietary or legally privileged information. No confidentiality 
or privilege is waived or lost by any mistransmission. If you receive this 
message in error, please delete it and all copies from your system, destroy any 
hard copies and notify the sender. You must not, directly or indirectly, use, 
disclose, distribute, print, or copy any part of this message if you are not 
the intended recipient. Nomura Holding America Inc., Nomura Securities 
International, Inc, and their respective subsidiaries each reserve the right to 
monitor all e-mail communications through its networks. Any views expressed in 
this message are those of the individual sender, except where the message 
states otherwise and the sender is authorized to state the views of such 
entity. Unless otherwise stated, any pricing information in this message is 
indicative only, is subject to change and does not constitute an offer to deal 
at any price quoted. Any reference to the terms of executed transactions should 
be treated as preliminary only and subject to our formal written confirmation.

Reply via email to