OxQL: surprising "input tables to group_by must be aligned" error when no data

Open
#7,715 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
rust
Domain
databases

Research direction

Start with the group_by validation in oximeter/db/src/oxql/ast/table_ops/group_by.rs and the is_aligned logic in oximeter/oxql-types/src/table.rs. Reproduce the query with a time range containing no data, including ranges before and after the instance lifetime, then trace how the empty result reaches group_by. Done should be defined by the issue's no-data reproduction no longer producing a misleading alignment error.

Written by the indexing model from the issue text.

Description

bug customer Metrics oxql

I ran a query like this:

get virtual_machine:vcpu_usage | filter timestamp >= @2025-03-03T20:50:11.000 && timestamp < @2025-03-03T21:00:31.000 && instance_id == "cd434a6f-815f-446d-9e32-744c991b25ed" && state == "run" | align mean_within(10s) | group_by [vcpu_id], sum

And got errors like the below despite the manifest presence of align mean_within(10s) in the query. These are dogfood request IDs.

{
  "request_id": "38890de5-8cf3-49ab-bdf5-710956f0bb38",
  "error_code": "InvalidRequest",
  "message": "Input tables to a `group_by` must be aligned"
}

{
  "request_id": "5252c89f-07a6-44ba-b77f-373e6218fbce",
  "error_code": "InvalidRequest",
  "message": "Input tables to a `group_by` must be aligned"
}

I see that the error comes from here. I will do more investigation and really nail down exactly what query I ran to get it, but I don't think it's an issue with query construction. You can see that the console code to generate queries is written so that there is always an align mean_within(<interval>) present.

https://github.com/oxidecomputer/omicron/blob/ff715c896fbd322ee82be20c362782cd77599e89/oximeter/db/src/oxql/ast/table_ops/group_by.rs#L54-L57

This was an instance that had recently started, so I wonder if the problem was that there were no timeseries in the table, which does get you an is_aligned value of false.

https://github.com/oxidecomputer/omicron/blob/ff715c896fbd322ee82be20c362782cd77599e89/oximeter/oxql-types/src/table.rs#L336-L349

Update: yep, I can systematically reproduce the error by changing the time range so that it doesn't contain any data points. This works for a time range both before and after the lifetime of the instance.

https://github.com/user-attachments/assets/7690cc30-8cd5-420e-a45b-3cb49afd4e01

Dominant language
Rust
Stars
572
Forks
97
Avg merge
2d 12h
Merged PRs (30d)
96

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from oxidecomputer/omicron

All issues in oxidecomputer/omicron

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.