Repository navigation
CALCITE-7815 Support the SQL-standard SEARCH clause in recursive CTEs - #5370
vldpyatkov wants to merge 1 commit into
Conversation
d1ddc48 to
5945e66
Compare
|
@vldpyatkov thanks for pushing this forward! Edges: 0→1, 0→2, 1→3, 2→3. Node 3 can be reached two ways. Without Analogously, on a graph: 0→1, 1→3, 0→3 If this is the case, could we have some tests showing these cases? Shall we document somehow this phenomenon? |
c03efcf to
82be763
Compare
@rubenada The generated SEARCH column participates in duplicate elimination. Documented this behavior in the SQL reference. |
21a3677 to
9c45c0c
Compare
|
@vldpyatkov sorry, I just added two final minor remarks that I had missed on my last review. Please take a look. I think the PR is in a good shape, so you can also proceed and squash commits into a single one to prepare the merge. |
51beb74 to
a94e4d6
Compare
|
@rubenada I've addressed the last two comments and squashed everything into a single commit. |
|
|
LGTM, the build-website error seems an unrelated problem to be handled separately, no reason to block the current PR because of that. I'll merge in the next 24-48h if not further comment arrives. |
I closed and reopened PR by misclicking. |



Jira Link
CALCITE-7815
Changes Proposed
Adds support for SEARCH DEPTH FIRST BY ... SET ... and SEARCH BREADTH FIRST BY ... SET ... in recursive CTEs. The generated column can be used in ORDER BY to obtain the corresponding traversal order.
The clause is represented by SqlSearchClause on SqlWithItem. During validation, RecursiveWithRewriter builds an ARRAY<ROW<...>> path for depth-first ordering or a row containing depth and keys for breadth-first ordering. SEARCH can be combined with CYCLE.
Also updates enumerable comparators to handle composite keys in multi-column sorts and adds Java and iq tests.