[CALCITE-7814] Support the SQL-standard CYCLE clause in recursive CTEs - #5294
Open
vldpyatkov wants to merge 7 commits into
Open
vldpyatkov wants to merge 7 commits into
vldpyatkov wants to merge 7 commits into
Conversation
vldpyatkov
force-pushed
the
calcite-7814
branch
from
September 25, 2026 20:37
3ded2a6 to
d71cc68
Compare
vldpyatkov
force-pushed
the
calcite-7814
branch
from
September 27, 2026 17:24
92a7635 to
e7e736e
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



CALCITE-7814
The implemented CYCLE syntax
Explicit mark values must be distinct, non-null Boolean literals or compatible single-character string literals. Omitting TO ... DEFAULT ... uses TRUE and FALSE, respectively.
The clause is represented by SqlCycleClause on SqlWithItem. During validation, CycleRewriter rewrites the query to maintain the cycle mark and an ARRAY<ROW<...>> path. A row that closes a cycle is returned but is not expanded further.
During implementation, I found an issue with comparing ARRAY<ROW<...>> values and fixed the comparer to compare their elements by content. This is needed for correct duplicate elimination when the result includes a cycle path column.