influxdata / influxdata/influxdb
aggregateWindow doesn't align data to windows
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
```
t0 = 2023-05-06T05:50:00Z
t1 = 2023-05-06T06:02:00Z
from(bucket: "solar")
|> range(start: t0, stop: t1 )
|> filter(fn: (r) => r["_measurement"] == "inverter")
|> filter(fn: (r) => r["_field"] == "batt_level" or r["_field"] == "inverter_output")
|> aggregateWindow(every: 5m, fn: count, createEmpty: false)
|> yield()
```
I would expect to see up to three windows for each `_field` value:
* one starting at 05:50 containing points in the half open interval `[05:50, 05:55)`
* one starting at 05:50 containing points in the half open interval `[05:55, 06:00)`, and
* one starting at 05:50 containing points in the half open interval `[06:00, 05:05)`.
A window is created for `06:02`. How the fuck is this a multiople of 5 minites with no offset?

With `createEmpty: true` there are two empty windows -- on for each `_field` value at `05:55`.
Why does the record with `_time` 05:56 not go into the 5 minute window with `_time` 05:55?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the aggregateWindow query with the provided timestamps, both with createEmpty set to false and true. Trace how five-minute windows are aligned and how records such as the 05:56 point are assigned; done means the observed windows match the documented half-open intervals and the expected empty-window behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100