Skip to content

[Bug] The calculation logic of the standard deviation aggregation function is incorrect. #14285

Closed as not planned
@LingweiKuang

Description

@LingweiKuang

Search before asking

  • I searched in the issues and found nothing similar.

Version

version 1.3.3 (Build: ad95a7e)

Describe the bug and provide the minimal reproduce step

DROP DATABASE root.db0
CREATE DATABASE root.db0

CREATE TIMESERIES root.db0.t1 WITH datatype=INT32;
INSERT INTO root.db0(timestamp, t1) VALUES (1641024000000, 0), (1641024005000, 1);

# query 1
SELECT STDDEV(t1) FROM root.db0 GROUP BY ([1641024000000, 1641024010000),10s);

What did you expect to see?

Query 1 returned result set: 0.5

What did you see instead?

Query 1 returned result set: 0.7071067811865476

Anything else?

In Query 1, we perform a GROUP BY operation on the data of 0 and 1, and calculate the standard deviation of the aggregation result. In principle, the standard deviation should be 0.5, but the result returned by IOTDB is 0.70, which is a significant error. This issue with inaccurate calculations may cause problems for users in high-precision application scenarios.

Are you willing to submit a PR?

  • I'm willing to submit a PR!

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