How do I handle floating point in Aerospike? [Resolved]


#1

I know that floating points are not in the list of supported data types. Java doubles maybe serialized as blobs. Could anyone share their experience on processing floating point values? Do they use byte arrays? Can I do some processing LUA? Can I represent a fixed point value with the int64? Thx.


#2

A 64-bit double (floating point) can be stored as a 64-bit integer (long) since they’re the same size.

The C# client does this using the .Net framework System.BitConverter methods, if you’re using Java you can recreate them with some work:

http://referencesource.microsoft.com/#mscorlib/system/bitconverter.cs


#3

I am facing similar issue. Using 3.40 version. Bin with float value doent appear. I am using python client. When I converted float to bytearray using struct.pack(‘f’, 20.5) method and inserted to a bin, the value appears as the string something like ‘B2e’ when I read from aql prompt. If I tried to get from python client, It throws segmentation fault (cored dumped ) error. I need to retrieved value to be float. Also if any alternative solution please suggest. Thanks.


#4

The database now natively supports doubles (3.6). The C# client has the support in the recent versions, and you’ll have to update both the client and server, and obviously stop packing your doubles.