Skip to content

[Bug] 使用 GROUP BY LEVEL 搭配多個聚合函數時,結果出現不一致(sum / avg / count 異常) #17409

@paulwu-adv

Description

@paulwu-adv

Search before asking

  • I searched in the issues and found nothing similar.

Version

2.0.7

Describe the bug and provide the minimal reproduce step

在 IoTDB 中使用 GROUP BY LEVEL 查詢時,當同時使用多個聚合函數(如 sum、avg、count)會出現結果不一致的情況。

具體問題如下:

  • sum(cpu) 單獨查詢與搭配其他 aggregation 時,結果不同
  • avg(cpu) 與 count(cpu) 的結果也會異常變化
  • 同一筆資料在不同 aggregation 組合下,計算基準似乎不一致

Query 1: 僅查 sum(結果正常)

Image

Query 2: sum + avg(sum 變成 2 倍)

Image

Query 3: sum + avg + count(全部異常)

Image

Query 4: sum + count(結果又正常)

Image

What did you expect to see?

  • 不論 aggregation function 組合如何:
    • sum(cpu) 應該一致
    • count(cpu) 應該一致
    • avg(cpu) 應滿足:
      👉 avg = sum / count
  • 多個 aggregation 應基於同一批資料計算

What did you see instead?

Image

Anything else?

No response

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