Skip to content

Add Yardstick adapter format with SQL parity support#103

Closed
nicosuave wants to merge 3 commits intomainfrom
nicosuave/yardstick-parity
Closed

Add Yardstick adapter format with SQL parity support#103
nicosuave wants to merge 3 commits intomainfrom
nicosuave/yardstick-parity

Conversation

@nicosuave
Copy link
Copy Markdown
Member

@nicosuave nicosuave commented Feb 22, 2026

Summary

  • Add Yardstick as an adapter format by parsing AS MEASURE SQL into models/metrics.
  • Implement Yardstick query parity for AGGREGATE(...) and AT modifiers (ALL, ALL EXCEPT, WHERE, SET, VISIBLE) in the SQL rewriter/generator.
  • Add replay + behavior coverage for Yardstick parsing/rewriting, plus loader/dependency/validation updates to keep aggregation handling consistent.

Notes

  • Merged latest main into this branch to resolve conflicts.

Copy link
Copy Markdown

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

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: e893ce9085

ℹ️ 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/sql/query_rewriter.py Outdated
Comment on lines +60 to +61
if self._looks_like_yardstick_query(sql):
return self._rewrite_yardstick_query(sql)
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 Honor strict=False before Yardstick rewrite dispatch

rewrite() promises that non-strict mode passes through SQL it cannot safely rewrite, but this early Yardstick dispatch runs before any of the non-strict guards and always takes the Yardstick error path. In contexts that call rewrite(..., strict=False) (for example the server passthrough path), queries containing AGGREGATE(...) can now raise ValueError (e.g. the SEMANTIC-prefix check) instead of being forwarded unchanged, which breaks previously-supported passthrough behavior.

Useful? React with 👍 / 👎.

Comment thread sidemantic/sql/query_rewriter.py Outdated
Comment on lines +170 to +171
# If the query references a single model, unqualified columns map to that model.
default_alias = next(iter(source_models)) if len(source_models) == 1 else None
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restrict default aliasing to truly single-source SELECTs

This treats len(source_models) == 1 as “single-model query”, but source_models only includes semantic models and ignores non-semantic tables in the same FROM/JOIN scope. As a result, a query with one semantic model plus other joined tables will still force unqualified columns to the semantic alias, rewriting valid references from non-semantic tables to the wrong table and causing wrong results or missing-column errors.

Useful? React with 👍 / 👎.

@nicosuave nicosuave closed this Feb 25, 2026
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