Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

SELECT SUM(*) does unwanted type cast #715

Closed
SBrandeis opened this issue May 15, 2019 · 2 comments · Fixed by #734
Closed

SELECT SUM(*) does unwanted type cast #715

SBrandeis opened this issue May 15, 2019 · 2 comments · Fixed by #734

Comments

@SBrandeis
Copy link

Software versions

Influxdb version: 1.7.6
influxdb-python version: 5.2.2

Steps to reproduce:

  1. Create a measurement named my_measurement in influxdb with following points:
time         data_type   value
----------   ----------  -----
15578637...   Num         12.5
15578637...   Num         12.5
  1. Run the following code:
>>> from influxdb import InfluxDBClient

>>> c = InfluxDBClient(...)

>>> result_set = c.query('select * from my_measurement')
... for _, generator in result_set.items():
...     for point in generator:
...         print(type(point['value']))
<class 'float'>
<class 'float'>

>>> result_set = c.query('select sum(*) from my_measurement')
... for _, generator in result_set.items():
...     for point in generator:
...         print(type(point['sum_value']))
<class 'int'>

The casting into 'int' type is incorrect since we are summing floats, result should still be a float.

This was referenced Jul 10, 2019
@lovasoa
Copy link
Contributor

lovasoa commented Jul 11, 2019

See the issue in influxsb itself: influxdata/influxdb#8707
The solution they recommend is using messagepack, which I implemented in #734.

@aviau
Copy link
Collaborator

aviau commented Jul 11, 2019

this wasn't an influxdb-python issue anyways afaik

@aviau aviau closed this as completed Jul 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants