Skip to content

Keep unnamed Rill timeseries expression dimensions addressable#227

Merged
nicosuave merged 3 commits into
mainfrom
fix-rill-unnamed-timeseries-dim
Jun 21, 2026
Merged

Keep unnamed Rill timeseries expression dimensions addressable#227
nicosuave merged 3 commits into
mainfrom
fix-rill-unnamed-timeseries-dim

Conversation

@nicosuave

Copy link
Copy Markdown
Member

Follow-up to #211.

A Rill metrics view can declare timeseries: order_date alongside an unnamed expression dimension whose expression is that same column (e.g. dimensions: [{expression: order_date}]). The name fallback in _parse_dimension derived dimension_0 for it, so:

  • the time dimension was only addressable as dimension_0;
  • the later auto-create check saw sql == timeseries_column and skipped creating an order_date dimension;
  • default_time_dimension stayed order_date, which referenced no dimension, so validate_model rejected the model.

Fix: when an unnamed dimension's SQL expression is the timeseries column, name it after the timeseries column so the generated time dimension stays addressable and default_time_dimension resolves.

Scope: only affects the unnamed-dimension name fallback. Explicitly named dimensions and the column/property/lookup_key_column derivations are unchanged; the auto-create-when-missing path still applies when no dimension references the timeseries column.

Adds two regression tests in tests/adapters/rill/test_modern_features.py covering parse-level addressability/validation and the CLI-first add_model import path.

When a Rill metrics view declares timeseries: order_date alongside an
unnamed expression dimension whose expression is that same column
({expression: order_date}), the name fallback produced dimension_0. The
auto-create check then saw the column already present and skipped
creating an order_date dimension, while default_time_dimension stayed
order_date, so validate_model rejected the model because the default
time dimension referenced no dimension.

Name such an unnamed dimension after the timeseries column so the
generated time dimension stays addressable and default_time_dimension
resolves.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5494325ff1

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sidemantic/adapters/rill.py Outdated
The unnamed-expression-dimension fallback renamed every dimension whose
expression equalled the timeseries column to the timeseries name. Two such
dimensions both became the timeseries column name, so validate_model rejected
the duplicate dimension names and add_model failed on an otherwise parseable
Rill project.

Only the first unnamed match now claims the timeseries name; later matches
keep their positional dimension_<i> name, matching Rill's own fallback.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: efbf83298c

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sidemantic/adapters/rill.py
An unnamed expression dimension whose SQL equals the timeseries column was
renamed to the timeseries name even when another dimension already owned that
name through Rill's name->column derivation (e.g.
[{expression: order_date}, {column: order_date}]). Both dimensions then shared
the name and validate_model rejected the duplicates, so add_model failed on an
otherwise parseable project.

Pre-scan the dimensions' natural Rill names; the expression dimension only
claims the timeseries name when no sibling already owns it, regardless of
position. Keeps the unnamed expression dimension as dimension_<i> otherwise.
@nicosuave nicosuave merged commit 37fea4b into main Jun 21, 2026
20 checks passed
@nicosuave nicosuave deleted the fix-rill-unnamed-timeseries-dim branch June 21, 2026 18:29
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