influxdata / influxdata/influxdb
[2.x] aggregateWindow could allow different functions for different fields
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
__Proposal: / Desired behavior:__
I'd love to be able to simply aggregate multiple columns with different functions, with a syntax like this:
`aggregateWindow(every: 1d, columns:["TempAvg", "RainfallTotal"], fns:[avg,sum] )`
__Current behavior:__
I guess one needs to do pivot and reduce to build the dataset.
or two separate tables:
```js
from(bucket: "weather_1h")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "Temp_Avg")
|> aggregateWindow(every: 1d, fn: avg)
|> yield(name: "TempAvg")
from(bucket: "weather_1h")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "RainfallTotal")
|> aggregateWindow(every: 1d, fn: sum)
|> yield(name: "RainSum")
```
__Use case:__
Why is this important (helps with prioritizing requests)?
There are many situations that I want to compare different series on one chart, and different fields need different accumulation strategies.
Contributor guide
Assessment
This issue has not been assessed yet.