Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

SELECT SUM(*) does unwanted type cast #715

Closed
@SBrandeis

Description

@SBrandeis

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions