Fixes #3244 : label filtering in Cypher MATCH relationship patterns#3252
Merged
lvca merged 3 commits intoArcadeData:mainfrom Jan 27, 2026
Merged
Conversation
Two bugs caused incorrect results in multi-MATCH/OPTIONAL MATCH Cypher queries: 1. MatchRelationshipStep never filtered target vertices by label. A pattern like (a:CHUNK)<-[r:in]-(b:NER) would return ANY connected vertex as b, not just NER vertices. Fixed by passing the target NodePattern and checking vertex type against label constraints. 2. Already-bound variables with labels were treated as unbound. The sourceAlreadyBound check required !sourceNode.hasLabels(), so writing (searchedChunk:CHUNK) in a subsequent MATCH created a full type scan instead of using the already-bound value. Fixed by tracking bound variable names across MATCH clauses. Also adds identity checking: when a target variable is already bound from a previous step, the traversed vertex must match the bound vertex identity. https://claude.ai/code/session_017hhsQf7fzBvXcGSeg48hfP
AssertJ's assertThat() has ambiguous overloads for Object return types from getProperty(). Switched to JUnit assertEquals/assertTrue/assertFalse. https://claude.ai/code/session_017hhsQf7fzBvXcGSeg48hfP
Contributor
🧪 CI InsightsHere's what we observed from your CI run for 1fc22ba. 🟢 All jobs passed!But CI Insights is watching 👀 |
Contributor
Author
|
Claude code did what gemini could not do. Claude code wrote all of this. |
Collaborator
|
@claude review this pr |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Contributor
|
@claude please check this again |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Contributor
Author
Contributor
|
@ExtReMLapin could you please rebase from main? Maybe claude is confused because it's too far apart? |
Contributor
Author
|
Claude is confused because it's not a branch on your repo but on mine. |
Contributor
|
@claude please review this PR |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Contributor
|
I'm checking it manually - old fashion. |
lvca
approved these changes
Jan 27, 2026
Contributor
|
Merged thanks! |
robfrank
pushed a commit
that referenced
this pull request
Feb 17, 2026
…3252) * fix: Cypher target node label filtering and bound variable tracking Two bugs caused incorrect results in multi-MATCH/OPTIONAL MATCH Cypher queries: 1. MatchRelationshipStep never filtered target vertices by label. A pattern like (a:CHUNK)<-[r:in]-(b:NER) would return ANY connected vertex as b, not just NER vertices. Fixed by passing the target NodePattern and checking vertex type against label constraints. 2. Already-bound variables with labels were treated as unbound. The sourceAlreadyBound check required !sourceNode.hasLabels(), so writing (searchedChunk:CHUNK) in a subsequent MATCH created a full type scan instead of using the already-bound value. Fixed by tracking bound variable names across MATCH clauses. Also adds identity checking: when a target variable is already bound from a previous step, the traversed vertex must match the bound vertex identity. https://claude.ai/code/session_017hhsQf7fzBvXcGSeg48hfP * fix: use JUnit assertions instead of AssertJ to avoid ambiguous overload AssertJ's assertThat() has ambiguous overloads for Object return types from getProperty(). Switched to JUnit assertEquals/assertTrue/assertFalse. https://claude.ai/code/session_017hhsQf7fzBvXcGSeg48hfP --------- Co-authored-by: Claude <noreply@anthropic.com> (cherry picked from commit def0349)
mergify bot
added a commit
that referenced
this pull request
Feb 22, 2026
…from 3.5.4 to 3.5.5 [skip ci] Bumps [org.apache.maven.plugins:maven-failsafe-plugin](https://github.com/apache/maven-surefire) from 3.5.4 to 3.5.5. Release notes *Sourced from [org.apache.maven.plugins:maven-failsafe-plugin's releases](https://github.com/apache/maven-surefire/releases).* > 3.5.5 > ----- > > 🚀 New features and improvements > ------------------------------- > > * Replace runing external process and parsing output with simple ProcessHandle if available (Java9+) ([#3252](https://redirect.github.com/apache/maven-surefire/pull/3252)) [`@olamy`](https://github.com/olamy) > * Pass slf4j context to spawned thread ([#3241](https://redirect.github.com/apache/maven-surefire/pull/3241)) [`@scottrw93`](https://github.com/scottrw93) > * [[SUREFIRE-3239]](https://issues.apache.org/jira/browse/SUREFIRE-3239) - allow override of statistics file checksum ([#3247](https://redirect.github.com/apache/maven-surefire/pull/3247)) [`@XN137`](https://github.com/XN137) > * Reduce log level for skipped tests result to info ([#3232](https://redirect.github.com/apache/maven-surefire/pull/3232)) [`@strangelookingnerd`](https://github.com/strangelookingnerd) > > 🐛 Bug Fixes > ----------- > > * Use PowerShell instead of WMIC for detecting zombie process on Windows ([#3258](https://redirect.github.com/apache/maven-surefire/pull/3258)) [`@jbliznak`](https://github.com/jbliznak). Please note if you are using Windows with Java 8 and not PowerShell (you have options to: use Java 9+, install PowerShell or stay on Surefire 3.5.4) > * Properly work with test failures caused during beforeAll phase ([#3194](https://redirect.github.com/apache/maven-surefire/pull/3194)) [`@Frawless`](https://github.com/Frawless) > > 📝 Documentation updates > ----------------------- > > * Clarify how late placeholder replacement (@{...}) deals with ([#3208](https://redirect.github.com/apache/maven-surefire/pull/3208)) [`@kwin`](https://github.com/kwin) > > 👻 Maintenance > ------------- > > * Fix Jenkin badges in README ([#3254](https://redirect.github.com/apache/maven-surefire/pull/3254)) [`@slawekjaranowski`](https://github.com/slawekjaranowski) > * Use JUnit5 in failsafe ITs ([#3251](https://redirect.github.com/apache/maven-surefire/pull/3251)) [`@slawekjaranowski`](https://github.com/slawekjaranowski) > * Remove long-deprecated unused encoding property from VerifyMojo ([#3198](https://redirect.github.com/apache/maven-surefire/pull/3198)) [`@Tomlincoln`](https://github.com/Tomlincoln) > * Add IT and deal with corner cases of handling beforeAll failures ([#3200](https://redirect.github.com/apache/maven-surefire/pull/3200)) [`@Frawless`](https://github.com/Frawless) > * Revert PR [#3194](https://redirect.github.com/apache/maven-surefire/issues/3194) that handle beforeAll failures to follow proper contributing rules ([#3211](https://redirect.github.com/apache/maven-surefire/pull/3211)) [`@Frawless`](https://github.com/Frawless) > > 🔧 Build > ------- > > * Missing many files in the GH Artifacts of CI ex-post. ([#3219](https://redirect.github.com/apache/maven-surefire/pull/3219)) [`@Tibor17`](https://github.com/Tibor17) > > 📦 Dependency updates > -------------------- > > * Bump org.xmlunit:xmlunit-core from 2.10.4 to 2.11.0 ([#3209](https://redirect.github.com/apache/maven-surefire/pull/3209)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.apache.maven.plugin-testing:maven-plugin-testing-harness from 3.4.0 to 3.5.1 ([#3260](https://redirect.github.com/apache/maven-surefire/pull/3260)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump parent from 44 to 47 ([#3253](https://redirect.github.com/apache/maven-surefire/pull/3253)) [`@slawekjaranowski`](https://github.com/slawekjaranowski) > * Bump org.assertj:assertj-core from 3.16.1 to 3.27.7 in /surefire-its/src/test/resources/surefire-1733-testng ([#3246](https://redirect.github.com/apache/maven-surefire/pull/3246)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.assertj:assertj-core from 3.27.6 to 3.27.7 ([#3245](https://redirect.github.com/apache/maven-surefire/pull/3245)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.codehaus.mojo:animal-sniffer-maven-plugin from 1.26 to 1.27 ([#3243](https://redirect.github.com/apache/maven-surefire/pull/3243)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.htmlunit:htmlunit from 4.20.0 to 4.21.0 ([#3236](https://redirect.github.com/apache/maven-surefire/pull/3236)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.codehaus.plexus:plexus-java from 1.5.1 to 1.5.2 ([#3235](https://redirect.github.com/apache/maven-surefire/pull/3235)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.apache.logging.log4j:log4j-core from 2.17.1 to 2.25.3 in /surefire-its/src/test/resources/surefire-1659-stream-corruption ([#3234](https://redirect.github.com/apache/maven-surefire/pull/3234)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.htmlunit:htmlunit from 4.19.0 to 4.20.0 ([#3228](https://redirect.github.com/apache/maven-surefire/pull/3228)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.htmlunit:htmlunit from 4.18.0 to 4.19.0 ([#3224](https://redirect.github.com/apache/maven-surefire/pull/3224)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.apache.commons:commons-lang3 from 3.19.0 to 3.20.0 ([#3223](https://redirect.github.com/apache/maven-surefire/pull/3223)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.codehaus.plexus:plexus-interpolation from 1.28 to 1.29 ([#3221](https://redirect.github.com/apache/maven-surefire/pull/3221)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.codehaus.plexus:plexus-i18n from 1.0.0 to 1.1.0 ([#3220](https://redirect.github.com/apache/maven-surefire/pull/3220)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump commons-io:commons-io from 2.20.0 to 2.21.0 ([#3217](https://redirect.github.com/apache/maven-surefire/pull/3217)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.apache.maven.plugin-testing:maven-plugin-testing-harness from 3.3.0 to 3.4.0 ([#3214](https://redirect.github.com/apache/maven-surefire/pull/3214)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.codehaus.plexus:plexus-java from 1.5.0 to 1.5.1 ([#3218](https://redirect.github.com/apache/maven-surefire/pull/3218)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.htmlunit:htmlunit from 4.16.0 to 4.18.0 ([#3213](https://redirect.github.com/apache/maven-surefire/pull/3213)) @[dependabot[bot]](https://github.com/apps/dependabot) ... (truncated) Commits * [`968cb38`](apache/maven-surefire@968cb38) [maven-release-plugin] prepare release surefire-3.5.5 * [`8e7dc41`](apache/maven-surefire@8e7dc41) Reapply "Replace runing external process and parsing output with simple Proce... * [`4ced57c`](apache/maven-surefire@4ced57c) Revert "Replace runing external process and parsing output with simple Proces…" * [`8496d9a`](apache/maven-surefire@8496d9a) Bump org.xmlunit:xmlunit-core from 2.10.4 to 2.11.0 ([#3209](https://redirect.github.com/apache/maven-surefire/issues/3209)) * [`68265e5`](apache/maven-surefire@68265e5) Bump org.apache.maven.plugin-testing:maven-plugin-testing-harness ([#3260](https://redirect.github.com/apache/maven-surefire/issues/3260)) * [`0b19014`](apache/maven-surefire@0b19014) Replace runing external process and parsing output with simple ProcessHandle ... * [`688f8c4`](apache/maven-surefire@688f8c4) Use PowerShell instead of WMIC for detecting zombie process on Windows ([#3258](https://redirect.github.com/apache/maven-surefire/issues/3258)) * [`e5c01a6`](apache/maven-surefire@e5c01a6) Build only by the latest Maven on Jenkins ([#3255](https://redirect.github.com/apache/maven-surefire/issues/3255)) * [`9c99e97`](apache/maven-surefire@9c99e97) Fix Jenkin badges in README ([#3254](https://redirect.github.com/apache/maven-surefire/issues/3254)) * [`20930ea`](apache/maven-surefire@20930ea) Bump parent from 44 to 47 ([#3253](https://redirect.github.com/apache/maven-surefire/issues/3253)) * Additional commits viewable in [compare view](apache/maven-surefire@surefire-3.5.4...surefire-3.5.5) [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
mergify bot
added a commit
that referenced
this pull request
Feb 22, 2026
…from 3.5.4 to 3.5.5 [skip ci] Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.5.4 to 3.5.5. Release notes *Sourced from [org.apache.maven.plugins:maven-surefire-plugin's releases](https://github.com/apache/maven-surefire/releases).* > 3.5.5 > ----- > > 🚀 New features and improvements > ------------------------------- > > * Replace runing external process and parsing output with simple ProcessHandle if available (Java9+) ([#3252](https://redirect.github.com/apache/maven-surefire/pull/3252)) [`@olamy`](https://github.com/olamy) > * Pass slf4j context to spawned thread ([#3241](https://redirect.github.com/apache/maven-surefire/pull/3241)) [`@scottrw93`](https://github.com/scottrw93) > * [[SUREFIRE-3239]](https://issues.apache.org/jira/browse/SUREFIRE-3239) - allow override of statistics file checksum ([#3247](https://redirect.github.com/apache/maven-surefire/pull/3247)) [`@XN137`](https://github.com/XN137) > * Reduce log level for skipped tests result to info ([#3232](https://redirect.github.com/apache/maven-surefire/pull/3232)) [`@strangelookingnerd`](https://github.com/strangelookingnerd) > > 🐛 Bug Fixes > ----------- > > * Use PowerShell instead of WMIC for detecting zombie process on Windows ([#3258](https://redirect.github.com/apache/maven-surefire/pull/3258)) [`@jbliznak`](https://github.com/jbliznak). Please note if you are using Windows with Java 8 and not PowerShell (you have options to: use Java 9+, install PowerShell or stay on Surefire 3.5.4) > * Properly work with test failures caused during beforeAll phase ([#3194](https://redirect.github.com/apache/maven-surefire/pull/3194)) [`@Frawless`](https://github.com/Frawless) > > 📝 Documentation updates > ----------------------- > > * Clarify how late placeholder replacement (@{...}) deals with ([#3208](https://redirect.github.com/apache/maven-surefire/pull/3208)) [`@kwin`](https://github.com/kwin) > > 👻 Maintenance > ------------- > > * Fix Jenkin badges in README ([#3254](https://redirect.github.com/apache/maven-surefire/pull/3254)) [`@slawekjaranowski`](https://github.com/slawekjaranowski) > * Use JUnit5 in failsafe ITs ([#3251](https://redirect.github.com/apache/maven-surefire/pull/3251)) [`@slawekjaranowski`](https://github.com/slawekjaranowski) > * Remove long-deprecated unused encoding property from VerifyMojo ([#3198](https://redirect.github.com/apache/maven-surefire/pull/3198)) [`@Tomlincoln`](https://github.com/Tomlincoln) > * Add IT and deal with corner cases of handling beforeAll failures ([#3200](https://redirect.github.com/apache/maven-surefire/pull/3200)) [`@Frawless`](https://github.com/Frawless) > * Revert PR [#3194](https://redirect.github.com/apache/maven-surefire/issues/3194) that handle beforeAll failures to follow proper contributing rules ([#3211](https://redirect.github.com/apache/maven-surefire/pull/3211)) [`@Frawless`](https://github.com/Frawless) > > 🔧 Build > ------- > > * Missing many files in the GH Artifacts of CI ex-post. ([#3219](https://redirect.github.com/apache/maven-surefire/pull/3219)) [`@Tibor17`](https://github.com/Tibor17) > > 📦 Dependency updates > -------------------- > > * Bump org.xmlunit:xmlunit-core from 2.10.4 to 2.11.0 ([#3209](https://redirect.github.com/apache/maven-surefire/pull/3209)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.apache.maven.plugin-testing:maven-plugin-testing-harness from 3.4.0 to 3.5.1 ([#3260](https://redirect.github.com/apache/maven-surefire/pull/3260)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump parent from 44 to 47 ([#3253](https://redirect.github.com/apache/maven-surefire/pull/3253)) [`@slawekjaranowski`](https://github.com/slawekjaranowski) > * Bump org.assertj:assertj-core from 3.16.1 to 3.27.7 in /surefire-its/src/test/resources/surefire-1733-testng ([#3246](https://redirect.github.com/apache/maven-surefire/pull/3246)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.assertj:assertj-core from 3.27.6 to 3.27.7 ([#3245](https://redirect.github.com/apache/maven-surefire/pull/3245)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.codehaus.mojo:animal-sniffer-maven-plugin from 1.26 to 1.27 ([#3243](https://redirect.github.com/apache/maven-surefire/pull/3243)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.htmlunit:htmlunit from 4.20.0 to 4.21.0 ([#3236](https://redirect.github.com/apache/maven-surefire/pull/3236)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.codehaus.plexus:plexus-java from 1.5.1 to 1.5.2 ([#3235](https://redirect.github.com/apache/maven-surefire/pull/3235)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.apache.logging.log4j:log4j-core from 2.17.1 to 2.25.3 in /surefire-its/src/test/resources/surefire-1659-stream-corruption ([#3234](https://redirect.github.com/apache/maven-surefire/pull/3234)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.htmlunit:htmlunit from 4.19.0 to 4.20.0 ([#3228](https://redirect.github.com/apache/maven-surefire/pull/3228)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.htmlunit:htmlunit from 4.18.0 to 4.19.0 ([#3224](https://redirect.github.com/apache/maven-surefire/pull/3224)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.apache.commons:commons-lang3 from 3.19.0 to 3.20.0 ([#3223](https://redirect.github.com/apache/maven-surefire/pull/3223)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.codehaus.plexus:plexus-interpolation from 1.28 to 1.29 ([#3221](https://redirect.github.com/apache/maven-surefire/pull/3221)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.codehaus.plexus:plexus-i18n from 1.0.0 to 1.1.0 ([#3220](https://redirect.github.com/apache/maven-surefire/pull/3220)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump commons-io:commons-io from 2.20.0 to 2.21.0 ([#3217](https://redirect.github.com/apache/maven-surefire/pull/3217)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.apache.maven.plugin-testing:maven-plugin-testing-harness from 3.3.0 to 3.4.0 ([#3214](https://redirect.github.com/apache/maven-surefire/pull/3214)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.codehaus.plexus:plexus-java from 1.5.0 to 1.5.1 ([#3218](https://redirect.github.com/apache/maven-surefire/pull/3218)) @[dependabot[bot]](https://github.com/apps/dependabot) > * Bump org.htmlunit:htmlunit from 4.16.0 to 4.18.0 ([#3213](https://redirect.github.com/apache/maven-surefire/pull/3213)) @[dependabot[bot]](https://github.com/apps/dependabot) ... (truncated) Commits * [`968cb38`](apache/maven-surefire@968cb38) [maven-release-plugin] prepare release surefire-3.5.5 * [`8e7dc41`](apache/maven-surefire@8e7dc41) Reapply "Replace runing external process and parsing output with simple Proce... * [`4ced57c`](apache/maven-surefire@4ced57c) Revert "Replace runing external process and parsing output with simple Proces…" * [`8496d9a`](apache/maven-surefire@8496d9a) Bump org.xmlunit:xmlunit-core from 2.10.4 to 2.11.0 ([#3209](https://redirect.github.com/apache/maven-surefire/issues/3209)) * [`68265e5`](apache/maven-surefire@68265e5) Bump org.apache.maven.plugin-testing:maven-plugin-testing-harness ([#3260](https://redirect.github.com/apache/maven-surefire/issues/3260)) * [`0b19014`](apache/maven-surefire@0b19014) Replace runing external process and parsing output with simple ProcessHandle ... * [`688f8c4`](apache/maven-surefire@688f8c4) Use PowerShell instead of WMIC for detecting zombie process on Windows ([#3258](https://redirect.github.com/apache/maven-surefire/issues/3258)) * [`e5c01a6`](apache/maven-surefire@e5c01a6) Build only by the latest Maven on Jenkins ([#3255](https://redirect.github.com/apache/maven-surefire/issues/3255)) * [`9c99e97`](apache/maven-surefire@9c99e97) Fix Jenkin badges in README ([#3254](https://redirect.github.com/apache/maven-surefire/issues/3254)) * [`20930ea`](apache/maven-surefire@20930ea) Bump parent from 44 to 47 ([#3253](https://redirect.github.com/apache/maven-surefire/issues/3253)) * Additional commits viewable in [compare view](apache/maven-surefire@surefire-3.5.4...surefire-3.5.5) [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
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.
What does this PR do?
This PR fixes a critical bug in Cypher query execution where target node labels in relationship patterns were not being filtered, and bound variables with repeated labels in subsequent MATCH clauses were not being properly recognized. This caused:
(chunk:CHUNK)<-[r:in]-(target:NER)would return vertices of all types connected via the "in" edge, not just NER verticessearchedChunk:CHUNKin multiple clauses) was not recognized as referring to the same bound variable, causing unnecessary cross-joinsMotivation
This fix addresses a user-reported issue where complex Cypher queries with multiple OPTIONAL MATCH clauses and repeated labels on bound variables were returning incorrect data. The root causes were:
MatchRelationshipStepwas not filtering target vertices by their labelsRelated issues
This fixes the issue reported in the user's query pattern where
searchedChunkswas incorrectly containing NER nodes instead of only CHUNK nodes.Changes Made
CypherExecutionPlan.java
boundVariablestracking across MATCH clauses to detect already-bound variablesbuildMatchStep()to skip creating new MatchNodeStep for variables already bound in previous MATCH clausesboundVariablesset and the old heuristicMatchRelationshipStepinstantiation to pass target node pattern and bound variables for filteringMatchRelationshipStep.java
targetNodePatternandboundVariableNamesfields to support label filtering and bound variable checkingmatchesTargetLabel()method to filter target vertices by their labelsCypherLabelFilteringTest.java (new)
Issue3218Test.java
Additional Notes
MatchRelationshipStepconstructor has an overload that maintains the old behaviorChecklist
mvn clean packagecommandhttps://claude.ai/code/session_017hhsQf7fzBvXcGSeg48hfP