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

BigInt Datatype: Presto UI seems to round off the bigInt values #23821

Open
Ninad07 opened this issue Oct 14, 2024 · 3 comments
Open

BigInt Datatype: Presto UI seems to round off the bigInt values #23821

Ninad07 opened this issue Oct 14, 2024 · 3 comments
Assignees
Labels

Comments

@Ninad07
Copy link

Ninad07 commented Oct 14, 2024

Your Environment
Presto version used: 0.289-SNAPSHOT
Storage: File
Data source and connector used: Iceberg connector
Deployment: local

====================================================================================

Expected Behavior
Bigint values should be displayed accurately in the UI without rounding, reflecting their exact numeric representation.

====================================================================================

Current Behavior

For example, I had a use case of viewing and processing iceberg snapshot ids (big int datatype). So the following query:

select snapshot_id from iceberg.iceberg_schema."iceberg_table$snapshots" order by committed_at

rounded off the actual values. [More details in the screenshots attached]

ISSUE: Bigint values are being rounded off in the UI, which leads to incorrect representation of data. For instance, a value of 1234567890123456623 may be displayed as 1234567890123456700, causing confusion and potential data misinterpretation.

====================================================================================

Possible Solution

This may be related to how the UI handles numeric types for display. A possible solution could be to update the UI rendering logic to handle bigint values correctly without rounding.

====================================================================================

Steps to Reproduce

Load a dataset containing bigint values into Presto.
Query the dataset using a SQL statement (e.g., SELECT bigint_column FROM your_table).
Observe the results in the Presto UI.
Notice that the bigint values are rounded or displayed in scientific notation instead of their exact values.

====================================================================================

Screenshots

Presto-CLI console:
image

Presto UI:
image

@Ninad07 Ninad07 added the bug label Oct 14, 2024
@tdcmeehan
Copy link
Contributor

tdcmeehan commented Oct 15, 2024

A simpler reproduction step is SELECT 1234567890123456623, which will show as 1234567890123456500 in the UI. The CLI faithfully renders the original value.

@yhwang
Copy link
Member

yhwang commented Oct 16, 2024

After receiving the response from the server end, the JSON.parse() function is used to convert/parse the content into the regular object with names and values in proper data type. For bigint numbers, they are converted into Number data type in JavaScript and that's where the problem is. see the below example:

> obj = JSON.parse(`{"bigint": 1234567890123456623}`)
{ bigint: 1234567890123456500 }

Need to find a workaround for this known issue in JavaScript. Currently, the JSON.parse() is in presto-js-client (here). We may need help from @alonsovb

@yhwang
Copy link
Member

yhwang commented Oct 17, 2024

some updates:

  • the JSON.parse() logic in the presto-js-client will be updated to support BigInt
  • after that, the QueryResults.jsx also need a small tweak to properly display the BigInt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 📋 Prioritized Backlog
Development

No branches or pull requests

3 participants