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

[Number precision] Precision lost rendering large integers for NGSIv2 attribute values #2506

Closed
fgalan opened this issue Sep 12, 2016 · 3 comments
Assignees
Milestone

Comments

@fgalan
Copy link
Member

fgalan commented Sep 12, 2016

The following behaviour has been detected, related with large integer values in NGSIv2 attributes:

$ curl -vvvv localhost:1026/v2/entities -H 'Content-Type: application/json' -d @- <<EOF
{
  "id": "E",
  "type": "T",
  "A": {
    "value": 2523232323232323,
    "type": "Number"
  }
}
EOF

* Hostname was NOT found in DNS cache
*   Trying ::1...
* Connected to localhost (::1) port 1026 (#0)
> POST /v2/entities HTTP/1.1
> User-Agent: curl/7.38.0
> Host: localhost:1026
> Accept: */*
> Content-Type: application/json
> Content-Length: 89
>
* upload completely sent off: 89 out of 89 bytes
< HTTP/1.1 201 Created
< Connection: Keep-Alive
< Content-Length: 0
< Location: /v2/entities/E?type=T
< Fiware-Correlator: ea1f4d1c-78f9-11e6-b398-d48564c29d20
< Date: Mon, 12 Sep 2016 15:02:25 GMT
<
* Connection #0 to host localhost left intact

$ curl localhost:1026/v2/entities/E
{"id":"E","type":"T","A":{"type":"Number","value":2.52323e+15,"metadata":{}}}

Thus, the render value is not exactly the one it was introduced. However, in DB the stored value is correct:

> db.entities.find().pretty()
{
        "_id" : {
                "id" : "E",
                "type" : "T",
                "servicePath" : "/"
        },
        "attrNames" : [
                "A"
        ],
        "attrs" : {
                "A" : {
                        "type" : "Number",
                        "creDate" : 1473692545,
                        "modDate" : 1473692545,
                        "value" : 2523232323232323
                }
        },
        "creDate" : 1473692545,
        "modDate" : 1473692545
}

Not sure if this is a desired behaviour or not and how difficult would be to change it in the render logic. By the moment we create this issue to be studied in the future.

@fgalan fgalan changed the title Precision lost rendering large integers for NGSIv2 attribute values [Number precision] Precision lost rendering large integers for NGSIv2 attribute values Jan 16, 2017
@fgalan fgalan self-assigned this Jan 16, 2017
@fgalan fgalan removed the APIv2 label Jul 12, 2018
@fgalan
Copy link
Member Author

fgalan commented Jul 12, 2018

This issue is not especifically related with NGISv2, so APIv2 label is removed. The issue keeps opened.

CC: @jmcanterafonseca

@fgalan
Copy link
Member Author

fgalan commented Sep 10, 2018

Once #2603, a functional test modeling the case in this issue should be implemented, to see how it behaves the current implementation.

@fgalan
Copy link
Member Author

fgalan commented Sep 13, 2018

Fixed by PR #3229 (in 1.15.0) but ftest re-enabled later in PR #3294.

@fgalan fgalan closed this as completed Sep 13, 2018
@fgalan fgalan added this to the 1.15.0 milestone Sep 13, 2018
AlvaroVega added a commit that referenced this issue Sep 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant