Skip to content

Conversation

@nicosuave
Copy link
Member

Summary: expand AGGREGATE inside CTE subqueries before top-level rewrite and add a CTE regression test.
Tests: make test (fails: extension-ci-tools/makefiles/duckdb_extension.Makefile missing).

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

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 3866 to 3869
let query = sql.trim().trim_end_matches(';').trim();
if let Some(group_by_pos) = find_top_level_keyword(query, "GROUP BY", 0) {
let start = group_by_pos + "GROUP BY".len();
let end = find_first_top_level_keyword(

Choose a reason for hiding this comment

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

P2 Badge Advance past actual GROUP BY spacing

The new find_top_level_keyword will match valid GROUP BY (multiple spaces), but start is calculated as group_by_pos + "GROUP BY".len(), which assumes exactly one space. For inputs like GROUP BY col, start points at the B in BY, so group_by_content becomes BY col and the first extracted column is BY col, which then feeds incorrect group_by_cols into AT correlation and expansion. Consider advancing past the real keyword end (e.g., skip whitespace after GROUP and BY) so arbitrary spacing doesn’t corrupt the parsed columns.

Useful? React with 👍 / 👎.

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.

2 participants