Repository navigation
fix(gfql): semi-join filter on OPTIONAL MATCH arm before left-outer-join (#1052) - #1067
Merged
Merged
Conversation
…oin (#1052) Restrict the OPTIONAL MATCH binding-row result to join-key values present in the base MATCH result before materializing the left-outer-join. Prevents the full cross-product blowup (N_opt_rows × N_base_rows) that caused ~120 GB RSS and SIGKILL on LDBC SNB sf1 IS7. Single join-col path: .isin() filter on opt_rows_df. Multi-col path: drop_duplicates() inner merge on join keys. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Add 5 targeted tests for OPTIONAL MATCH semi-join fix: - multi-col path with 2 shared aliases (duplicate-column guard) - multi-arm: arm-2 joins on arm-1-added column - multi-arm: arm-2 null-fills when arm-1 misses - edge-alias synthesis intact after semi-join filter - 5-message parameterized graph: no bleed from unscoped opt rows Fix graph topology in edge-alias test (distinct a1/a2 nodes so semi-join by a.id correctly scopes m1's opt rows). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This was referenced Apr 6, 2026
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.
Closes #1052
Summary
_apply_connected_optional_match, filter the optional arm's binding-row result to only join-key values present in the base MATCH result (semi-join)..isin()filter.drop_duplicates()+ inner merge on join keys.Problem
_apply_connected_optional_match(gfql_unified.py) ran each OPTIONAL MATCH arm against the full graph, materializing ALL matching paths before joining. For IS7 on LDBC SNB sf1:m.id = $messageId)(a:Person)-[r:KNOWS]-(p)paths (millions on sf1)N_base × N_optintermediate → ~120 GB RSS → SIGKILLFix location
graphistry/compute/gfql_unified.pylines 327–337 (_apply_connected_optional_match)Tests
Added
test_issue_1052_optional_match_semijoin_filters_opt_arm— IS7 shape with scoped base query (m.id = $mid) and disjoint m2 subgraph that would bleed through without the semi-join filter.All 706 lowering tests pass. Full suite (1931 passed, 457 skipped) green.
Related
🤖 Generated with Claude Code