Long numbers are not retrieved with the correct format even with 'string' option as the unit

I’m developing some queries on grafana that deal with long numbers (19 digits). Usually, if I don’t force these long numbers to be returned as a string they are rounded and I’m not able to see the precise number. The string move have been working fine up until now but, by some reason, I’m trying to do this string cast and is not working for a specific source. All these long numbers are being rounded however, when I make a simple query with a ‘where’ condition searching for one specific long number I got the desired result.

select *
from database.table TD

Result: The expected table but with a column of long numbers all rounded hence not accurate.


select *
from database.table TD
where TD.serial = 1234567890123456789

Result: Returns a row with the info related with the user that has the serial number “1234567890123456789” but the serial number itself is presented in something like this “1234567890123450000”

I already tried to use the override feature to convert the results to strings but got no joy. Does anyone have another to idea to get these numbers accurately?

1 Like

Hello :wave: and welcome to the forum, @rcmv

I would read this related comment on a GH issue.

Tl;dr = a 19 digit number is simply too large for JS to handle safely without using a special library. If you open your browser’s developer console and type:
Number.isSafeInteger(1234567890123456789) it will return false. I believe that is why the numbers are getting truncated and / or handled in strange ways.

Hello. This looks reasonable. In my case, long numbers in influxdb are stored as strings, while grafana still rounds (here I mean the behavior of the author of the topic) them. Thanks for the help.