influxdata / influxdata/influxdb

Create a planner rule to rewrite grouped mean calls

Open
#18,863 0 comments 0 reactions 0 assignees View on GitHub
team/query
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.