[
https://issues.apache.org/jira/browse/CALCITE-7814?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated CALCITE-7814:
------------------------------------
Labels: pull-request-available (was: )
> Support the SQL-standard CYCLE clause in recursive CTEs
> -------------------------------------------------------
>
> Key: CALCITE-7814
> URL: https://issues.apache.org/jira/browse/CALCITE-7814
> Project: Calcite
> Issue Type: New Feature
> Components: core
> Reporter: Vladislav Pyatkov
> Priority: Major
> Labels: pull-request-available
>
> Add support for the SQL-standard _CYCLE_ clause in recursive common table
> expressions, including parsing, validation, relational conversion, and
> execution.
> _CYCLE_ detects repeated keys within each recursive path and adds cycle-mark
> and path columns. A cycle-closing row is returned with its mark set, but does
> not produce further recursive expansion.
> Example:
> {code:sql}
> WITH RECURSIVE
> edges(src, dst) AS (
> VALUES ('A', 'B'), ('B', 'C'), ('C', 'A')
> ),
> walk(node) AS (
> VALUES ('A')
> UNION ALL
> SELECT e.dst
> FROM walk w JOIN edges e ON e.src = w.node
> )
> CYCLE node SET is_cycle TO 'Y' DEFAULT 'N'
> USING cycle_path
> SELECT node, is_cycle, cycle_path
> FROM walk;
> {code}
> The traversal follows A → B → C → A. The final A is marked as a cycle-closing
> row, and recursion stops along that path.
> Include execution tests for single and composite cycle keys, negative
> validation tests with clear error messages, and a documented example.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)