influxdata / influxdata/influxdb
Create a planner rule to rewrite grouped mean calls
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
This depends on #18862.
Rewrite any call to `group(...) |> mean()` with something like the following:
```
ReadGroup(count, sum) |> map(fn: (r) => ({r with _value: float(v: r.sum) / float(v: r.count)}))
```
The `ReadGroup` call, which the output of is not designed yet, will return the aggregates together and they can be combined using a `map` call to find the mean of each group.
Contributor guide
Research direction
Start by reviewing dependent issue #18862 and the planner rule handling for grouped mean calls. Trace how `group(...) |> mean()` is represented, then verify the rewrite to `ReadGroup(count, sum) |> map(...)` against planner tests or existing rule patterns. Done means grouped mean expressions are rewritten with the intended aggregate inputs and per-group calculation.
Written by the indexing model from the issue text.
Assessment
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100