influxdata / influxdata/kapacitor
"Multiple multi function" collapse in batched tasks
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
**Enterprise Kapacitor 1.3.3**
When running a task with "multiple multi function" columns like this:
` SELECT non_negative_derivative(mean(*), 1s),non_negative_derivative(max(*), 1s),min(*),mean(*),max(*) FROM ...`
The derivative columns will first lookup real column names and then prefix them with `non_negative_derivative`, but then they will get collapsed into one result column per multi function column. The right most combo will get returned.
So from the example above, `non_negative_derivative(max(*), 1s) `, are the values returned and the mean values will be suppressed/overwritten.
You can fix this by adding an `as [string]` that's different for the two, like:
` SELECT non_negative_derivative(mean(*), 1s) as mean_rate,non_negative_derivative(max(*), 1s) as max_rate,min(*),mean(*),max(*) FROM ...`
But Kapacitor should be able to fix this by itself unless you name a prefix string yourself, like above. I'm not sure which way I think is best, but probably making a multi prefix string based on all chained functions, like:
`non_negative_derivative(mean(*), 1s) => non_negative_derivative_mean_[real_column_name]`
Another way could be suffixing the result with like `_[number]` or something like that
Contributor guide
Research direction
Start by reproducing the batched task using multiple multi-function expressions such as non_negative_derivative(mean(*), 1s) and non_negative_derivative(max(*), 1s), with and without explicit aliases. Trace how the derivative columns are named and collapsed, then verify that each chained-function result remains distinct while user-provided aliases still take precedence.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100