Skip to content

Fix Measures-in-SQL parity behavior and tests#22

Merged
nicosuave merged 2 commits intomainfrom
nicosuave/measures-sql-audit
Feb 23, 2026
Merged

Fix Measures-in-SQL parity behavior and tests#22
nicosuave merged 2 commits intomainfrom
nicosuave/measures-sql-audit

Conversation

@nicosuave
Copy link
Member

Summary

  • fix Measures-in-SQL parity behavior around mixed rollup/visible/plain measure scenarios and fallback rewrite paths
  • add HAVING-path measure/CSE coverage
  • add full Listing-12 equivalence coverage (measure, correlated subquery, self-join, window aggregate)
  • add parity matrix doc at docs/measures-sql-paper-parity.md

Validation

  • ./build/release/test/unittest test/sql/measures.test (1040 assertions, pass)

Copy link

@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: 06834c4d05

ℹ️ 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 5490 to 5494
return info
.group_by_cols
.into_iter()
.map(|c| c.trim().to_string())
.filter(|c| !c.is_empty() && !c.chars().all(|ch| ch.is_ascii_digit()))

Choose a reason for hiding this comment

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

P1 Badge Handle positional GROUP BY before returning parser columns

This fast path now returns parser group_by_cols directly after filtering numeric entries, so queries like GROUP BY 1/GROUP BY 1,2 produce an empty list and never reach the fallback that infers grouping dimensions from the SELECT list. In expand_aggregate_with_at, that empty grouping context makes measure rewrites behave as if the query were ungrouped, which can collapse per-dimension results into global totals.

Useful? React with 👍 / 👎.

Comment on lines +457 to +458
case StatementType::SELECT_STATEMENT: {
auto sql_to_check = context.GetCurrentQuery();

Choose a reason for hiding this comment

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

P2 Badge Add break after EXTENSION_STATEMENT handling

Because the EXTENSION_STATEMENT case has no terminating break, control now falls through into the new SELECT_STATEMENT rewrite path whenever parse_function != yardstick_parse. That means non-yardstick extension statements are unexpectedly passed through yardstick_has_aggregate/yardstick_expand_aggregate, and statements containing measure-like SQL text can be rebound as SELECT * FROM yardstick(...) instead of being handled by their own extension binder.

Useful? React with 👍 / 👎.

@nicosuave nicosuave merged commit f23e1ca into main Feb 23, 2026
8 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