Skip to content

Stop grouping queries by an unselected default time dimension - #486

Merged
nicosuave merged 1 commit into
docker-image-repairfrom
default-time-dim-grouping
Nov 10, 2026
Merged

nicosuave merged 1 commit into
docker-image-repairfrom
default-time-dim-grouping

Conversation

@nicosuave

@nicosuave nicosuave commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Models with a default_time_dimension silently grouped every query by it. Queries with their own dimensions gained an unrequested column, and SQL queries were grouped by a column they did not return, so SELECT orders.status, orders.revenue FROM orders came back with one row per status per day. Seven importers set this field, so imported models hit it by default.

The default now applies only to metrics-only structured queries and to metrics that need a time axis (cumulative, time comparison, offset ratio); a SQL SELECT owns its projection. The Python and Rust engines follow the same rule.

Notes for review:

  • Metrics-only structured queries still return one row per default time bucket; existing fixtures pin that as intended.
  • sidemantic/codegen.py TypeScript types still list the default time column for SQL queries.

@nicosuave
nicosuave added this pull request to stack #489 November 10, 2026 00:12
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T00:13:38.410065Z b2834fa PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@nicosuave nicosuave changed the title Stop grouping explicit queries by the default time dimension Stop grouping queries by an unselected default time dimension Nov 10, 2026
A model's default_time_dimension was added to every query that selected one of its metrics without a time dimension. Queries that named their own dimensions gained an unrequested column and split their groups per time bucket, and SQL rewrites restored the SELECT list while keeping the hidden GROUP BY, so aggregates came back once per day.

The default is now applied only to a structured query that selects metrics and no dimensions, and to cumulative, time-comparison and offset-ratio metrics, which cannot be computed without a time axis. A SQL SELECT owns its projection and receives the default only for those metrics. Python and Rust follow the same rule, including the Rust visibility check for an unused hidden default.
@nicosuave
nicosuave force-pushed the default-time-dim-grouping branch from b2834fa to a860470 Compare November 10, 2026 00:31
@nicosuave
nicosuave merged commit 498f2ff into main Nov 10, 2026
31 of 32 checks passed
@nicosuave
nicosuave deleted the default-time-dim-grouping branch November 10, 2026 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant