Repository navigation
Add persistent measure views to the DuckDB extension - #507
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d87f352281
ℹ️ 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".
| for (const auto &column : bound.names) { | ||
| fields.push_back(make_uniq<ColumnRefExpression>(SqlctxIdentifier(SqlctxName(column)))); |
There was a problem hiding this comment.
Preserve expressions and qualifiers when expanding wildcards
When a measure declaration uses a modified or qualified wildcard, rebuilding its fields solely from bound.names discards the expressions and source qualifiers that DuckDB bound. For example, CREATE VIEW sales AS SELECT * REPLACE (amount * 2 AS amount), sum(amount) AS MEASURE revenue FROM raw_sales silently exposes the original amount rather than the doubled value; * RENAME (region AS bucket) instead attempts to bind a nonexistent source column named bucket. Qualified stars over joins can likewise become ambiguous. Preserve the expanded projection expressions and their aliases instead of constructing unqualified column references from output names.
Useful? React with 👍 / 👎.
d87f352 to
328886c
Compare
Allow an analyst to declare measures over a table or query with
CREATE VIEW … AS SELECT … AS MEASURE …after loading SQLCtx. DuckDB stores the view and SQLCtx recomputes its measures at the query’s grain. For West sales of 10 and 30 and an East sale of 80, a filteredAGGREGATE(aov)returns 20 and the overall average is 40.This layer connects the compiler to DuckDB’s parser, catalog and binder. It covers typed column discovery, persistent and attached views, replacement and rollback, and errors when a reader accesses a virtual measure without loading SQLCtx.