apache / apache/iotdb

[Bug] Support group by natural year

Open
#11,133 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
6.4k
Forks
1.2k
Avg merge
1d 23h
Merged PRs (30d)
115

Description

### Search before asking

- [X] I searched in the [issues](https://github.com/apache/iotdb/issues) and found nothing similar.

### Version

操作系统:CentOS 7.9
IoTDB:1.12

### Describe the bug and provide the minimal reproduce step

![36b286f9031b417a41072392cbcdba0](https://github.com/apache/iotdb/assets/49841963/ab0f98f8-1641-4273-ae51-efab7ce17bf5)
使用iotdb的分段分组聚合,指定聚合窗口大小和步长为1y,发现聚合结果步长是固定的365天,这并没有考虑到闰年为366天的事实。
我查询了基于月是可以实现每28|29|30|31天作为自然月来分组的
![image](https://github.com/apache/iotdb/assets/49841963/288e70b7-ac58-4a68-868d-86b7569484a1)
这应当是一个错误,请尽快解决一下

### What did you expect to see?

期望的查询结果应是
+-----------------------------+----+----+-------+------+
| Time| pv|load|selfuse|charge|
+-----------------------------+----+----+-------+------+
|2023-01-01T00:00:00.000+08:00| 39| 3| 0| 35|
|2024-01-01T00:00:00.000+08:00|null|null| null| null|
|2025-01-01T00:00:00.000+08:00|null|null| null| null|
|2026-01-01T00:00:00.000+08:00|null|null| null| null|
+-----------------------------+----+----+-------+------+

### What did you see instead?

实际的查询结果是
+-----------------------------+----+----+-------+------+
| Time| pv|load|selfuse|charge|
+-----------------------------+----+----+-------+------+
|2023-01-01T00:00:00.000+08:00| 39| 3| 0| 35|
|2024-01-01T00:00:00.000+08:00|null|null| null| null|
|2024-12-31T00:00:00.000+08:00|null|null| null| null|
|2025-12-31T00:00:00.000+08:00|null|null| null| null|
+-----------------------------+----+----+-------+------+

### Anything else?

_No response_

### Are you willing to submit a PR?

- [ ] I'm willing to submit a PR!

Contributor guide

Open the contributing guide

Research direction

Start with the minimal reproduction and the expected and actual query results described in this issue, focusing on the time-window grouping behavior for a 1y interval. The fix is done when yearly groups begin on successive calendar-year boundaries, including leap years, and the reproduced output matches the expected timestamps.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.