Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected rounding of int64 values #9136

Open
itestyoy opened this issue Jan 24, 2025 · 1 comment
Open

Unexpected rounding of int64 values #9136

itestyoy opened this issue Jan 24, 2025 · 1 comment
Labels
bug Something isn't working driver:bigquery Issues related to the BigQuery driver

Comments

@itestyoy
Copy link

itestyoy commented Jan 24, 2025

Hi! Why does Cube round the last 3 digits in int64?
Result -9222709539351054000
But expected: -9222709539351053981

Related Cube.js schema

cube(`test`, {
  sql: `SELECT
         -9222709539351053981 AS user_id`,
  dimensions: {
    user_id: {
      sql: `user_id`,
      type: `number`,
    },
  },
});

Related Cube.js generated SQL

SELECT
  `test`.user_id AS `test__user_id`
FROM
  (
    SELECT
      -9222709539351053981 AS user_id
  ) AS `test`
GROUP BY
  1
ORDER BY
  1 ASC
LIMIT
  100;

DB: BigQuery

@itestyoy itestyoy added the question The issue is a question. Please use Stack Overflow for questions. label Jan 24, 2025
@igorlukanin
Copy link
Member

igorlukanin commented Jan 24, 2025

Indeed, I was able to confirm this on v1.1.16.

My vague suspicion would be that, somewhere in the underlying client library for BigQuery, some precision loss happens because JavaScript just can't handle numbers that low/high. Or maybe it's in Cube's driver code.

Would you have the capacity to dig deeper and investigate this?

@igorlukanin igorlukanin added bug Something isn't working driver:bigquery Issues related to the BigQuery driver and removed question The issue is a question. Please use Stack Overflow for questions. labels Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working driver:bigquery Issues related to the BigQuery driver
Projects
None yet
Development

No branches or pull requests

2 participants