-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Description
Bug report
System info:
- RHEL7, Influxdb 1.2.4
Steps to reproduce:
- Push some data with the 'cpu'-plugin of telegraf to the DB
- Query this data
- Resulting field data types vary in a single column from row to row
Expected behavior:
One field shall always have the same data type
Actual behavior:
If a float-field value is zero, it's returned as '0' instead of '0.0'. Re-Importing this data to InfluxDB leads to a field type conflict: e.g. 400: {"error":"partial write: field type conflict: input field \"usage_user\" on measurement \"cpu\" is type integer, already exists as type float dropped=1"}
- Test
SELECT usage_user::integer FROM telegraf.raw.cpu
: all results arrive as integers - Test
SELECT usage_user::float FROM telegraf.raw.cpu
: some results arrive as ints, some as floats - Test
SELECT usage_user + 0.0 FROM telegraf.raw.cpu
: some results arrive as ints, some as floats - Test
SELECT usage_user + 0.5 FROM telegraf.raw.cpu
: all results arrive as floats - Test
SELECT usage_user + 1.0 FROM telegraf.raw.cpu
: some results arrive as ints, some as floats - At least Python's JSON package can differ between int and float zero:
aa=json.loads('{"bla":0.0, "ble":0}')
Additional info:
- Similar issues were reported at Proposal: Stop using JSON as the standard response format #8330, [BUG] Non descriptive field type error #8332 and Kapacitor record query converts integer to float kapacitor#1338
- Example results:
curl -G 'http://localhost:8086/query?pretty=true' --data-urlencode "db=telegraf" --data-urlencode "q=SHOW FIELD KEYS FROM cpu"
{
"results": [
{
"statement_id": 0,
"series": [
{
"name": "cpu",
"columns": [
"fieldKey",
"fieldType"
],
"values": [
[
"usage_guest",
"float"
],
[
"usage_guest_nice",
"float"
],
[
"usage_idle",
"float"
],
[
"usage_iowait",
"float"
],
[
"usage_irq",
"float"
],
[
"usage_nice",
"float"
],
[
"usage_softirq",
"float"
],
[
"usage_steal",
"float"
],
[
"usage_system",
"float"
],
[
"usage_user",
"float"
]
]
}
]
}
]
}
curl -G 'http://localhost:8086/query?pretty=true' --data-urlencode "db=telegraf" --data-urlencode "q=SELECT usage_user + 0.0 FROM telegraf.raw.cpu WHERE \"cpu\"='cpu3' GROUP BY * ORDER BY time DESC LIMIT 3"
{
"results": [
{
"statement_id": 0,
"series": [
{
"name": "cpu",
"tags": {
"cpu": "cpu3",
"host": "salt-probe"
},
"columns": [
"time",
"usage_user"
],
"values": [
[
"2017-08-16T11:38:00Z",
0.6018054162312702
],
[
"2017-08-16T11:37:50Z",
0
],
[
"2017-08-16T11:37:40Z",
0.799200799217918
]
]
}
]
}
]
}
gusutabopb, SM616, ilcorvo, DRab7792 and lovasoa
Metadata
Metadata
Assignees
Labels
No labels