influxdata / influxdata/influxdb
The results of the aggregation query do not meet expectations
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
__Steps to reproduce:__
List the minimal actions needed to reproduce the behaviour.
1. use influxdb **v1.12**
2. write data
There are two sets of data here:
test88:
```
test88,tagkey=a,year_v=2025 v1=1,v2=6.6,v3=2 1748707200000000000
test88,tagkey=b,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test88,tagkey=c,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test88,tagkey=d,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test88,tagkey=e,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test88,tagkey=f,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test88,tagkey=g,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test88,tagkey=h,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test88,tagkey=i,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test88,tagkey=j,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test88,tagkey=k,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test88,tagkey=l,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test88,tagkey=m,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test88,tagkey=n,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test88,tagkey=o,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test88,tagkey=p,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test88,tagkey=q,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
```
test99:
```
test99,tagkey=z,year_v=2025 v1=1,v2=6.6,v3=2 1748707200000000000
test99,tagkey=b,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test99,tagkey=c,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test99,tagkey=d,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test99,tagkey=e,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test99,tagkey=f,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test99,tagkey=g,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test99,tagkey=h,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test99,tagkey=i,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test99,tagkey=j,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test99,tagkey=k,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test99,tagkey=l,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test99,tagkey=m,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test99,tagkey=n,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test99,tagkey=o,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test99,tagkey=p,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
test99,tagkey=q,year_v=2025 v1=0,v2=6.6,v3=0 1751299200000000000
```
__Expected behaviour:__
Describe what you expected to happen.
Use the following InfluxQL query to retrieve the above two sets of data.
```
select station_code, time, v3, v1, v2 from (select max(v3) as v3, sum(v1) as v1, sum(v2) as v2 from autogen.test88 where time >='2024-12-31 16:00:00' and time <= '2025-12-31 15:59:59' group by tagkey,year_v) where time >='2024-12-31 16:00:00' and time <= '2025-12-31 15:59:59' order by time desc limit 20 offset 0
```
Both `test88` and `test99` are expected to return `17` lines of data.
__Actual behaviour:__
Describe What actually happened.
`test99` returned `18` lines of data, and `tagkey=z` was split into two lines in the return.
__Environment info:__
* Please provide the command you used to build the project, including any `RUSTFLAGS`.
* System info: Run `uname -srm` or similar and copy the output here (we want to know your OS, architecture etc).
* If you're running IOx in a containerised environment then details about that would be helpful.
* Other relevant environment details: disk info, hardware setup etc.
__Config:__
Copy any non-default config values here or attach the full config as a gist or file.
__Logs:__
Include snippet of errors in logs or stack traces here.
Sometimes you can get useful information by running the program with the `RUST_BACKTRACE=full` environment variable.
Finally, the IOx server has a `-vv` for verbose logging.
Contributor guide
Research direction
Start by reproducing the InfluxQL query against the provided test88 and test99 data in InfluxDB v1.12, focusing on the grouped aggregation and outer query. Compare the returned row counts and tagkey=z grouping; done means test99 returns 17 lines with tagkey=z represented as one line, matching test88.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100