influxdata / influxdata/kapacitor

Unexpected behaviour when using groupBy property or node

Open
#2,405 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.4k
Forks
479
Avg merge
4d 16h
Merged PRs (30d)
4

Description

Description
==
* Trying to use a `|groupBy()` node after a `|from()` node is accepted at task and template definition but does not provide the same result as using the `.groupBy()` property of the `|from()` node
* The documentation does not seem clear to me about the different uses cases of these two options.
* Resulting behaviour is unexpected and the `|groupBy()` node is not applied properly. **In the example below, the resulting (and false) difference is done on the mean value of the two groups and I do not understand why**
* Using the `.groupBy()` property of `from()` node instead works fine.

```
// This code work
var diff = stream
|from()
.database(database)
.retentionPolicy(retention_policy)
.measurement(input_measurement)
.where(where_filter)
.groupBy('tag1','tag2')
|difference('value').as('value')
```
```
// This code DOES NOT work
var diff = stream
|from()
.database(database)
.retentionPolicy(retention_policy)
.measurement(input_measurement)
.where(where_filter)
|groupBy('tag1','tag2')
|difference('value').as('value')
```

Todo
==
* Either update the documentation by explaining expected usage or correct groupBy node

Contributor guide

Open the contributing guide

Research direction

Start by comparing the two provided task snippets and read the `from()` and `groupBy()` entry points and their documentation. Determine whether the separate `groupBy()` node should match the `from().groupBy()` property, or whether the documentation must define different usage. Done means the behavior is corrected or the expected distinction is clearly documented, with the reported difference explained.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
stream-processing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.