Skip to content

Conversation

@AVMusorin
Copy link

Summary

The grammar for CTEs was too restrictive. It required a specific order for different CTE syntax styles.

The grammar expected all CTEs to be defined before all CSEs (Common Scalar Expression).

This commit refactors the ctes grammar rule to be more flexible. It introduces a new, more generic cte rule that can represent either CTE style. The main ctes rule is now defined as a list of these generic cte elements, allowing them to appear in any order.

Checklist

Delete items not relevant to your PR:

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided to include in CHANGELOG
  • For significant changes, documentation in https://github.com/ClickHouse/clickhouse-docs was updated with further explanations or tutorials

@AVMusorin AVMusorin marked this pull request as draft October 9, 2025 14:07
Copy link
Contributor

@windsurf-bot windsurf-bot bot left a comment

Choose a reason for hiding this comment

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

💡 To request another review, post a new comment with "/windsurf-review".

The grammar for CTEs was too restrictive. It required a specific order
for different CTE syntax styles.

The grammar expected all CTEs to be defined before all CSEs (Common
Scalar Expression).

This commit refactors the `ctes` grammar rule to be more flexible.
It introduces a new, more generic `cte` rule that can represent either CTE style.
The main `ctes` rule is now defined as a list of these generic `cte` elements,
allowing them to appear in any order.
@AVMusorin AVMusorin force-pushed the fix-variables-replacing branch from d312221 to accec17 Compare October 9, 2025 14:11
@mshustov mshustov requested a review from chernser October 9, 2025 14:43
@AVMusorin AVMusorin marked this pull request as ready for review October 9, 2025 18:00
Copy link
Contributor

@windsurf-bot windsurf-bot bot left a comment

Choose a reason for hiding this comment

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

Looks good to me 🤙

💡 To request another review, post a new comment with "/windsurf-review".

@chernser
Copy link
Contributor

chernser commented Oct 9, 2025

Good day, @AVMusorin !
Thank you for the contribution!

Actually CTEs were defined incorrectly in the grammar - they were included twice.
We have fixing it in the #2579

@chernser chernser closed this Oct 9, 2025
@AVMusorin AVMusorin mentioned this pull request Oct 10, 2025
4 tasks
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