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

[Decouple] [BUG] Dev tool console is losing big number precision due to client #4536

Closed
zhongnansu opened this issue Jul 10, 2023 · 4 comments · Fixed by #4562
Closed

[Decouple] [BUG] Dev tool console is losing big number precision due to client #4536

zhongnansu opened this issue Jul 10, 2023 · 4 comments · Fixed by #4562
Assignees
Labels
bug Something isn't working console

Comments

@zhongnansu
Copy link
Member

zhongnansu commented Jul 10, 2023

Describe the bug

Dev tool console is losing precision when displaying big number.

To Reproduce
Steps to reproduce the behavior:

  1. Go to dev tool console in OSD
  2. Index one long type data into OS, and send GET request to retrieve it.
    PUT index_0001
    {
    "mappings": {
      "properties": {
        "test_long": {
          "type": "long"
        }
      }
    }
    }
    
    PUT index_0001/_doc/0
    {
    "test_long": 1688275058533285124
    }
    
    GET index_0001/_search
    
  3. You'll get below results
    {
      "took": 58,
      "timed_out": false,
      "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
      },
      "hits": {
        "total": {
          "value": 1,
          "relation": "eq"
        },
        "max_score": 1,
        "hits": [
          {
            "_index": "index_0001",
            "_id": "0",
            "_score": 1,
            "_source": {
              "test_long": 1688275058533285000
            }
          }
        ]
      }
    }
    
  4. We can see it loses precision comparing original data 1688275058533285124 and the displayed data in OSD 1688275058533285000
  5. Also I validated the actual data in OS is stored with correct precision.

Expected behavior
OSD should display the same number as stored in OS, without losing precision

OpenSearch Version
2.5 and later

Dashboards Version
2.5 and later

Additional context

JavaScript does not support 64 bit integer values. Using a number in JavaScript results in the Number type which itself is a 64bit IEEE floating point number, thus leaving us a 52 bit mantisse to store integer values without rounding errors. Everything above what fits into 52 bit will have rounding errors.

Thus fields in OpenSearch that can contain numbers outside that safe JavaScript range(E.g. long) is prone to that rounding error in Dev tool console

@zhongnansu zhongnansu added bug Something isn't working untriaged console labels Jul 10, 2023
@zhongnansu
Copy link
Member Author

zhongnansu commented Jul 10, 2023

The bug is related to some changes we made in dev tool console starting from 2.5

@pjfitzgibbons
Copy link
Contributor

In final resolution, we might need to determine the impact of this on dashboard graphs/visualizations. It may be a challenge to find the impact of a 10^3 delta within a 10^19 number, especially in a visualization displayed on a 100x200 pixel canvas.

@wbeckler wbeckler changed the title [BUG] Dev tool console is losing precision for displaying big number [Decouple] [BUG] Dev tool console is losing big number precision due to client Jul 17, 2023
@wbeckler
Copy link

@pjfitzgibbons If a visualization is based on a delta between two numbers, it could become super obvious. I'm not sure if any visualizations do have that.

@pjfitzgibbons
Copy link
Contributor

pjfitzgibbons commented Jul 30, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working console
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants