Search code examples
vespa

Float and double value not getting updated in vespa


I am trying to update a field created_at with a timestamp value. This created_at field, I have stored it as a float datatype. But it is not storing the value correctly. Even after a difference of 10-15 sec, it is still storing the same timestamp value. When I am trying to update its value, it is displaying the value which was stored long before. And this is only happening in case of float or double. String values are getting updated properly. But float and double values are not getting updated accordingly.

What could be the possible reason for it?


Solution

  • float has only 24 bits of precision and is a very bad choice for timestamp; if you're using standard seconds-since-epoch you'll only get a new value every 128 seconds. "double" should be better and works just fine for me, but I would recommend using "long" instead.