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

JSON protocol doesn't handle negative numbers correctly #3058

Closed
beckettsean opened this issue Jun 19, 2015 · 2 comments
Closed

JSON protocol doesn't handle negative numbers correctly #3058

beckettsean opened this issue Jun 19, 2015 · 2 comments

Comments

@beckettsean
Copy link
Contributor

Negative numbers (I only tested with floats) end up stored as 0:

cat json
{
    "database": "mydb",
    "points": [
        {
            "measurement": "amount",
            "fields": {
                "value_int": -0.001
            },
            "tags": {
                "domain": "123",
                "os": "linux",
                "browser": "chrome"
            }
        }
    ]
}

curl -XPOST 'http://localhost:8086/write' -d @json

> select * from amount
name: amount
tags: browser=chrome, domain=123, os=linux
time                value_int
----                ---------
2015-06-19T19:44:42.29335633Z   0

From https://groups.google.com/forum/#!msg/influxdb/T6yZbnh-eXg/aBop7ekgTFYJ

@dstreppa
Copy link

It works with integers. In a Grafana plot I see always 0 and sometimes falls to -1, -8, etc. (practically only the negative integer values are different by 0).

@plopp
Copy link

plopp commented Jun 26, 2015

Seems to be solved in v0.9.1-rc1. From CHANGELOG.MD:
#2919: Unable to insert negative floats

That issue is closed, so I guess this can be closed as well.

Test:

cat json
{
    "database": "test",
    "points": [
        {
            "measurement": "amount",
            "fields": {
                "value_int": -0.001
            },
            "tags": {
                "domain": "123",
                "os": "linux",
                "browser": "chrome"
            }
        }
    ]
}

curl -XPOST 'http://localhost:8086/write' -d @json

> select * from amount
name: amount
tags: browser=chrome, domain=123, os=linux
time                value_int
----                ---------
2015-06-26T10:26:54.24871135Z   -0.001

@pauldix pauldix closed this as completed Jun 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants