Skip to content

fix(parser)!: CTEs instead of subqueries for pipe syntax#5205

Merged
geooo109 merged 5 commits intomainfrom
geooo109/refactor_pipe_syntax_with_ctes
Jun 11, 2025
Merged

fix(parser)!: CTEs instead of subqueries for pipe syntax#5205
geooo109 merged 5 commits intomainfrom
geooo109/refactor_pipe_syntax_with_ctes

Conversation

@geooo109
Copy link
Collaborator

@geooo109 geooo109 commented Jun 10, 2025

This PR refactors the whole implementation of the pipe syntax and substitutes the subquery logic to CTEs.
This makes the generated SQL more readable and also solves issues with the scoping of the query columns.

A problem with the previous implementation can be spotted in the following example:

Input:
FROM c.x |> SELECT x.col1, x.col2

Output:
SELECT x.col1, x.col2 FROM (SELECT * FROM c.x)

The subquery "shadows" the scope.

@geooo109
Copy link
Collaborator Author

For the unique name generation of CTEs should we have a state ?

@geooo109 geooo109 requested a review from georgesittas June 11, 2025 08:30
Copy link
Collaborator

@georgesittas georgesittas left a comment

Choose a reason for hiding this comment

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

LGTM, just a few suggestions.

@geooo109 geooo109 merged commit dfdd84b into main Jun 11, 2025
7 checks passed
@geooo109 geooo109 deleted the geooo109/refactor_pipe_syntax_with_ctes branch June 11, 2025 10:43
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