Parse scoped measures and support view column lists - #47
Conversation
Codex Review SummaryThis 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: d8c8fda4df
ℹ️ 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".
| if (auto *native = FindNativeYardstickMeasures(sql.c_str())) { | ||
| requires_binding |= native->requires_binding; | ||
| yardstick_free_create_view_info(native); |
There was a problem hiding this comment.
Defer non-star column-list measure views too
When a newly supported column-list view does not contain *—for example, an invalid CREATE OR REPLACE VIEW v(dim, total) AS SELECT missing_column, SUM(amount * 10) AS MEASURE revenue ...—native->requires_binding remains false, so it follows RewriteMeasureViewsStatementByStatement instead of the deferred lifecycle. That path updates the Rust measure metadata and frees its rollback snapshot after parsing, before DuckDB binds the view; if binding then fails, DuckDB retains the previous view while Yardstick retains metadata from the failed replacement, causing later AGGREGATE(total) queries to fail or return incorrect results. Non-star column-list declarations also need deferred binding or rollback through QueryEnd.
Useful? React with 👍 / 👎.
Implicit measure references and CURRENT now use native expression spans and local query scope, preserving quoted identifiers and CTE shadowing. CURRENT is recognized inside AT SET and WHERE expressions, and modifier dimensions compare parsed expressions without changing string-literal semantics.
Measure views support full and partial CREATE VIEW column lists, including stars expanded in the originating session. Header aliases preserve derived measure dependencies and executable grouping aliases. Temporary metadata stays session-local, with rollback, replacement and IF NOT EXISTS behavior covered by regressions. A statement combining temporary and permanent measure views with the same name is explicitly rejected.
DuckDB 1.5.5 and native builds pass their SQL regression suites. Standalone Rust tests retain 12 pre-existing failures; the added scope and isolation checks pass.