Skip to content

Parse scoped measures and support view column lists - #47

Merged
nicosuave merged 2 commits into
mainfrom
scoped-measure-parser
Sep 14, 2026
Merged

nicosuave merged 2 commits into
mainfrom
scoped-measure-parser

Conversation

@nicosuave

Copy link
Copy Markdown
Member

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.

@nicosuave
nicosuave marked this pull request as ready for review September 14, 2026 00:22
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-14T00:28:31.331556Z d8c8fda Draft marked ready
ℹ️ 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.

@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: 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".

Comment on lines +1798 to +1800
if (auto *native = FindNativeYardstickMeasures(sql.c_str())) {
requires_binding |= native->requires_binding;
yardstick_free_create_view_info(native);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

@nicosuave
nicosuave merged commit 9c6c994 into main Sep 14, 2026
11 checks passed
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