influxdata / influxdata/influxdb

[1.x,2.x] Subqueries do not correctly handle aggregation functions

Open
#24,622 1 comment 0 reactions 1 assignee Claimed by @davidby-influx View on GitHub
1.x area/2.x area/compat-v1x severity/sev-3
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

It seems Influx (v1.8) doesn't handle aggregation functions on subqueries correctly, or I'm misunderstanding how they should behave.

__Steps to reproduce:__
List the minimal actions needed to reproduce the behaviour.

1. Make a query with a LIMIT, return a handful of rows.
2. Make a query with an aggregator function, using the first query in the FROM.

__Expected behaviour:__
The aggregator function is correctly applied to the rows returned by the subquery.

__Actual behaviour:__
I have no idea what calculation is done now, but it's not the expected result.

__Environment info:__

* Version: 1.8

Example:
![image](https://github.com/influxdata/influxdb/assets/144002263/f89f3b5c-7586-4f5a-a616-93b18ef35dab)

I would expect the sum of 1 + 1 + 0 + 0 + 0 to be 2, not 5.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.