Keep unnamed Rill timeseries expression dimensions addressable#227
Conversation
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.
There was a problem hiding this comment.
💡 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".
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.
There was a problem hiding this comment.
💡 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".
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.
Follow-up to #211.
A Rill metrics view can declare
timeseries: order_datealongside an unnamed expression dimension whose expression is that same column (e.g.dimensions: [{expression: order_date}]). The name fallback in_parse_dimensionderiveddimension_0for it, so:dimension_0;sql == timeseries_columnand skipped creating anorder_datedimension;default_time_dimensionstayedorder_date, which referenced no dimension, sovalidate_modelrejected 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_dimensionresolves.Scope: only affects the unnamed-dimension name fallback. Explicitly named dimensions and the
column/property/lookup_key_columnderivations 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.pycovering parse-level addressability/validation and the CLI-firstadd_modelimport path.