Skip to content

The results of the aggregation query do not meet expectations #26909

@zhiwangdu

Description

@zhiwangdu

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.

Image

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions