Articles in this section

AQL showing only few digits when reading a double type.

Detail

We do support double as a data type. 
https://aerospike.com/docs/server/guide/data-types/scalar-data-types#double

When we insert a record with such a data type and try to read from the AQL and then even take a backup and see the record, we may see a slightly different value than what was written originally. 

Example: 
aql> insert into test.demo (PK, int_type, double_type) values (1, 10, 24.33333333333333333)
OK, 1 record affected.

aql> select * from test.demo where PK=1
+----+------+----------+-------------------+
| PK | bin1 | int_type | double_type       |
+----+------+----------+-------------------+
| 1  | 10   | 10       | 24.33333333333333 |
+----+------+----------+-------------------+
1 row in set (0.005 secs)
As we can see we inserted a value with 17 digits after decimal, aql is only returning 14 digits. 

And asbackup will also show slightly different value, seems as if it is rounded off. 
- I bin1 10
- I int_type 10
- D double_type 24.333333333333332
+ k I 8
+ n test
+ d lq6+A3yoGu8UBub38a1/COETPZg=
+ s demo
+ g 1
+ t 0
+ b 1
- I bin1 10


 

Answer

This is expected as this is a limitation of the tools. AQL only shows a maximum of 14 digits after the decimal. There is nothing to be worried about here. If we try and read the same record via an aerospike client then we will see the correct value. 

Applies To Earliest Version

Current Version

Applies To Latest Version

Current Version
Was this article helpful?
0 out of 0 found this helpful