iotdb1.3.1下如何写按每小时刻度求和聚合查询

Open
#17,029 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Documentation
Clarity
Needs clarification
Activity status
Stale
Tech stack
sql
Domain
databases

Research direction

Start with the IoTDB SQL query and aggregation documentation, using start_cli or DBeaver to reproduce the hourly sample and the one-year range. Determine whether the documented query features support grouping all records by hour-of-day, and consider the result complete when a tested query or a clear limitation is documented.

Written by the indexing model from the issue text.

Description

查询过去1年的数据,原始数据是写在整点的每小时1个点的数据
1天的原始数据如下


IoTDB> select C  from root.A.B
> where time >= 2025-01-01T00:00:00.000
> and time < 2025-01-02T00:00:00.000
+-----------------------------+-------------------------+
|                         Time|root.A.B.C|
+-----------------------------+-------------------------+
|2025-01-01T00:00:00.000+08:00|                   1324.0|
|2025-01-01T01:00:00.000+08:00|                   1390.0|
|2025-01-01T02:00:00.000+08:00|                    916.0|
|2025-01-01T03:00:00.000+08:00|                   1436.0|
|2025-01-01T04:00:00.000+08:00|                   2714.0|
|2025-01-01T05:00:00.000+08:00|                   2172.0|
|2025-01-01T06:00:00.000+08:00|                   1932.0|
|2025-01-01T07:00:00.000+08:00|                   9294.0|
|2025-01-01T08:00:00.000+08:00|                  11974.0|
|2025-01-01T09:00:00.000+08:00|                  10364.0|
|2025-01-01T10:00:00.000+08:00|                   6018.0|
|2025-01-01T11:00:00.000+08:00|                   5322.0|
|2025-01-01T12:00:00.000+08:00|                   3600.0|
|2025-01-01T13:00:00.000+08:00|                   1852.0|
|2025-01-01T14:00:00.000+08:00|                   1312.0|
|2025-01-01T15:00:00.000+08:00|                    692.0|
|2025-01-01T16:00:00.000+08:00|                   1484.0|
|2025-01-01T17:00:00.000+08:00|                   4562.0|
|2025-01-01T18:00:00.000+08:00|                   3532.0|
|2025-01-01T19:00:00.000+08:00|                   3540.0|
|2025-01-01T20:00:00.000+08:00|                   2586.0|
|2025-01-01T21:00:00.000+08:00|                   6798.0|
|2025-01-01T22:00:00.000+08:00|                  11088.0|
|2025-01-01T23:00:00.000+08:00|                   6404.0|
+-----------------------------+-------------------------+
Total line number = 24
It costs 0.148s

然后全年数据按照0-24小时刻度分组求和
全年0点-1点的数据累计在0点刻度
全年1点-2点的数据累计在1点刻度
以此类推
这样的sql查询要怎么写呢?好像实现不了
目前使用的工具主要是start_cli和dbeaver

Dominant language
Java
Stars
6.4k
Forks
1.2k
Avg merge
1d 12h
Merged PRs (30d)
284

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/iotdb

All issues in apache/iotdb

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.