influxdata / influxdata/influxdb

aggregateWindow uses wrong _start and _stop values

Open
#24,250 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

Without `aggregateWindow`
![image](https://github.com/influxdata/influxdb/assets/12090617/4ab87213-ab72-4d0c-b93a-989650b898fa)

After applying `aggregateWindow`
![image](https://github.com/influxdata/influxdb/assets/12090617/2c37615a-94db-4780-a55f-0802c9fb0bd5)

Here's a simple exampel of `aggregateWindow` compleetly fucking up the data
```
import "array"
import "date"

d = array.from(rows: [
{_time: 2023-01-01T00:00:00Z, _value: 1},
{_time: 2023-02-01T00:00:00Z, _value: 2},
{_time: 2023-03-01T00:00:00Z, _value: 3}
])

d
|> range(start: 2023-01-01T00:00:00Z, stop: 2023-05-01T00:00:00Z)
|> map(fn: (r) => ({
_start: 2023-04-01T00:00:00Z,
_stop: 2023-04-30T00:00:00Z,
_time: date.add(d: duration(v: string(v: r._value) + "d"), to: 2023-04-10T00:00:00Z),
_value: r._value
}))
|> aggregateWindow(every: 1mo, fn: count)
|> yield()
```

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied Flux query and inspecting the aggregateWindow entry point and its handling of _start and _stop. Trace why the reported window metadata is produced, then add a regression test for this example and confirm the resulting values match the intended window boundaries.

Written by the indexing model from the issue text.

Assessment

Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.