Repository navigation
feat(cypher): support WITH collect/UNWIND/MATCH reentry (#1000) - #1020
Merged
Merged
Conversation
…CH (#1000) IC-6 shape: WITH root.val AS rv, collect(b1) AS bees UNWIND bees AS b2 MATCH (b2)-[:Y]->(c) RETURN rv, c.id — currently rejected by _rewrite_collect_unwind_reentry_query() which only handles the simple WITH collect(alias) AS list UNWIND list AS alias form. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
_rewrite_collect_unwind_reentry_query() previously rejected WITH clauses with more than one item. Now it finds the collect() item among multiple WITH items, rewrites it, and places the whole-row alias first so the reentry machinery correctly identifies it as the primary projection. This unblocks LDBC SNB Interactive complex-6 and complex-9 query shapes: WITH tag.id AS knownTagId, collect(distinct friend) AS friends UNWIND friends AS f MATCH (f)<-[:HAS_CREATOR]-(post:Post) ... Tests: 3 new tests (single scalar, multiple scalars, DISTINCT collect with scalar). DRY: shared graph factory, removed duplicate test. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
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.
Summary
Support
WITH scalar, collect(alias) AS list UNWIND list AS alias MATCH ... RETURNCypher queries where carried scalars accompany thecollect(). Previously only the single-itemWITH collect(alias) AS listshape was supported.Closes #1000
Benchmark impact
Unblocks LDBC SNB Interactive:
Fix
_rewrite_collect_unwind_reentry_query()inlowering.pynow:collect()(not just the first/only)_compile_bounded_reentry_query()correctly identifies itTest plan