Skip to content

fix: scoping-only WITH collapse guard for chained patterns#210

Merged
genezhang merged 2 commits intomainfrom
fix/with-chaining-and-test-fixes
Mar 12, 2026
Merged

fix: scoping-only WITH collapse guard for chained patterns#210
genezhang merged 2 commits intomainfrom
fix/with-chaining-and-test-fixes

Conversation

@genezhang
Copy link
Copy Markdown
Owner

Summary

  • WITH chaining bug fix: The scoping_with_collapse analyzer was too aggressive — it collapsed chained scoping-only WITH clauses (e.g., WITH a, b after WITH a), losing CTE materialization boundaries and dropping JOINs for downstream variables. Added contains_with_clause() guard to skip collapse when the input subtree already contains a WithClause.
  • Denormalized VLP property fix: map_denormalized_property() in cte_manager/mod.rs now does reverse lookup by value when forward key lookup fails, fixing VLP CTE generation for denormalized schemas.
  • Test fixes: Resolved merge conflict markers in test_vlp_aggregation.py, fixed wrong property name in test_with_cte_node_expansion.py, added xfail markers for 2 denormalized VLP tests pending full CTE wiring.

Test plan

  • All 30 Rust unit tests pass (cargo test)
  • Integration tests pass (73 failures → 0 after fixes)
  • LDBC sf0.003 regression: 33/36 passing (same 3 known timeouts)
  • No new xfails beyond the 2 denormalized VLP tests

🤖 Generated with Claude Code

genezhang and others added 2 commits March 11, 2026 18:28
The scoping_with_collapse analyzer was too aggressive — it collapsed
WITH clauses in chained patterns (e.g., WITH a, b after WITH a),
losing CTE boundaries and dropping JOINs for downstream variables.
Added contains_with_clause() guard to preserve WITHs whose input
subtree already contains a WithClause node.

Also fixes denormalized VLP property lookup (reverse map lookup),
resolves merge conflict in test_vlp_aggregation.py, fixes wrong
property name in test_with_cte_node_expansion.py, and xfails two
denormalized VLP tests pending full CTE wiring.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1. Exhaustive match in contains_with_clause() — replaces _ => false
   wildcard with explicit leaf variants (Empty, ViewScan, PageRank)
   and adds missing GraphNode arm. Catches future LogicalPlan variants
   at compile time.

2. Log message when guard prevents collapsing — aids debugging chained
   WITH patterns where the optimization is intentionally skipped.

3. Two new unit tests: test_collapse_preserves_outer_with_when_input_
   contains_with (chained WITH guard) and test_collapse_works_when_
   inner_with_already_collapsed (bottom-up semantics).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@genezhang genezhang merged commit 59b6b92 into main Mar 12, 2026
4 checks passed
@genezhang genezhang deleted the fix/with-chaining-and-test-fixes branch March 12, 2026 02:10
genezhang added a commit that referenced this pull request Mar 12, 2026
Remove @pytest.mark.xfail from tests that pass after recent VLP,
shortestPath, denormalized schema, and multi-type property fixes
(PRs #206-#210).

Affected areas: VLP aggregation, shortest paths, path variables,
edge constraints, multi-type property extraction, denormalized VLP,
VLP relationship return, VLP WITH comprehension, pattern matrix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant