A numeric column in SQL shows different value than it actually contains in redash display

While executing SQL with Anthena datasource in redash with a numeric column shows different value than it actually contains. Casting the column to varchar displays correct value.
I am using redash:8.0.2
Can you pls suggest how we can fix it?

Not enough information provided. Is the number truncated? Rounded? Is it entirely incorrect?

Big number? Maybe caused by JS :rofl:

1 Like

What I am seeing in result is incorrect not rounded 332 vs 280 at last 3 places in number

for example 12,332 (with comma) instead of the 12280

can you pls share more info where it is happening?

In my case, my browser received 9163805594889267 from redash server, but the browser display it as 9163805594889268.
Then I type 9163805594889267 into my browser’s console but it shows 9163805594889268.
In order to ensure the normal use of query, I convert the type to string in my data source server.

I am seeing wrong result in output with formatting with comma as 12,332 when correct result is 12280

May I know which JS file does that?

I don’t think this is a rounding problem. Why would 12280 be rounded up to 12232? That doesn’t make sense…

First, you should rule out an issue with the back-end. Look at the the network inspector in your browser. Look at the response from the /results api when you run the query. What number comes through? If the number from the API is 122280, then the the problem is with the javascript somewhere. But if the number from the API is 12232 then it’s an issue with your query / database.

I have inspected the query in query editor it seems to be correct and the api response in network inspector i.e. 122280 is also the correct and matches with the query editor. The issue is what is displayed on the front end which is incorrect as 12232.

If the problem is with the javascript somewhere how can we solve it any hints ?

What are the settings for this column in your table visualisation? Is it set as a specific type (HTML, number, JSON etc.)?

settings for this column in your table visualisation - It is number

I happen to debug the library and have found that the issue is axios is not handling bigint response properly.

file - query-result.js
function - loadResult

 QueryResultResource.get({ id: this.job.query_result_id })
      .then(response => {
        this.update(response);
        this.isLoadingResult = false;
      })

Pls read this link to know better - Handling BigInt in Axios using json-big in JavaScript | by Nikhil Talwar | Medium

2 Likes

Are the numbers being sent as bigints? They don’t seem large enough for that.

Those were examples but yes they are bigints

That sure would have been helpful to know a bit earlier :joy: I spent an hour trying to debug with those numbers…

So any outcomes or solutions?

We’d welcome a pull request implementing the fix you linked, which seems to be the suggested path from the Axios maintainers.

This looks like handling in Redash js code and not an issue with axios as I understand.

Can you please help us by adding patch in redash code as suggested in the link below

Handling BigInt in Axios using json-big in JavaScript | by Nikhil Talwar | Medium