Skip to content

fix: inline relationship WHERE predicate is now applied#3953

Merged
robfrank merged 2 commits intomainfrom
fix/3951-inline-relationship-predicate
Apr 22, 2026
Merged

fix: inline relationship WHERE predicate is now applied#3953
robfrank merged 2 commits intomainfrom
fix/3951-inline-relationship-predicate

Conversation

@robfrank
Copy link
Copy Markdown
Collaborator

Summary

Fixes #3951

Inline relationship predicates like [r:KNOWS WHERE r.since < 2019] were silently ignored, causing ArcadeDB to return rows that should have been filtered out.

  • RelationshipPattern - added whereExpression: BooleanExpression field with accessors
  • CypherASTBuilder.visitRelationshipPattern() - now extracts ctx.expression() and parses it into the new field
  • MatchRelationshipStep - added matchesEdgeWhereExpression() that binds the relationship variable to a temporary result and evaluates the predicate before producing output rows

Test plan

  • OpenCypherPatternPredicateTest.InlineRelationshipPredicate#inlineWhereOnRelationshipIsApplied - undirected pattern, only the 2018 edge is returned
  • OpenCypherPatternPredicateTest.InlineRelationshipPredicate#inlineWhereOnRelationshipDirected - directed pattern, single row Alice->Bob:2018
  • OpenCypherPatternPredicateTest.InlineRelationshipPredicate#inlineWhereWithExternalWhereClause - inline predicate combined with outer WHERE
  • Full OpenCypher suite (5 377 tests) passes with zero regressions

🤖 Generated with Claude Code

Inline predicates like [r:KNOWS WHERE r.since < 2019] were silently
ignored because RelationshipPattern had no field for the expression,
CypherASTBuilder never extracted ctx.expression(), and
MatchRelationshipStep had no evaluation path for it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Apr 22, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

🟢 Coverage 100.00% diff coverage · -8.04% coverage variation

Metric Results
Coverage variation -8.04% coverage variation
Diff coverage 100.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (582167a) 118917 86638 72.86%
Head commit (9ea3084) 150173 (+31256) 97336 (+10698) 64.82% (-8.04%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#3953) 21 21 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes. Give us feedback

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements support for inline WHERE predicates within OpenCypher relationship patterns by updating the AST, parser, and execution logic. While the core functionality is covered, feedback suggests that the optimized execution paths (fast path) may silently ignore these predicates, potentially leading to incorrect results. Additionally, there is a performance concern regarding the frequent allocation and property copying of ResultInternal objects during edge evaluation, which could be optimized to reduce overhead in large-scale graph traversals.

…ations

canUseFastPath now returns false when the relationship pattern has an
inline WHERE expression, preventing silent predicate skipping on the
vertex-only traversal path.

matchesEdgeWhereExpression now accepts a pre-populated ResultInternal
built once per source vertex instead of allocating and copying on every
edge traversal.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@robfrank robfrank merged commit 7656946 into main Apr 22, 2026
23 of 29 checks passed
@lvca lvca deleted the fix/3951-inline-relationship-predicate branch April 22, 2026 14:13
@lvca lvca added this to the 26.4.1 milestone Apr 22, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

❌ Patch coverage is 90.47619% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.87%. Comparing base (582167a) to head (9ea3084).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
...encypher/executor/steps/MatchRelationshipStep.java 80.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3953      +/-   ##
==========================================
- Coverage   64.00%   63.87%   -0.13%     
==========================================
  Files        1591     1591              
  Lines      118917   118934      +17     
  Branches    25271    25275       +4     
==========================================
- Hits        76118    75975     -143     
- Misses      32309    32487     +178     
+ Partials    10490    10472      -18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

mergify Bot added a commit that referenced this pull request May 3, 2026
…o [skip ci]

Bumps [marked](https://github.com/markedjs/marked) from 18.0.2 to 18.0.3.
Release notes

*Sourced from [marked's releases](https://github.com/markedjs/marked/releases).*

> v18.0.3
> -------
>
> [18.0.3](markedjs/marked@v18.0.2...v18.0.3) (2026-05-01)
> -----------------------------------------------------------------------------------
>
> ### Bug Fixes
>
> * avoid task checkbox for setext heading text ([#3960](https://redirect.github.com/markedjs/marked/issues/3960)) ([2608e81](markedjs/marked@2608e81))


Commits

* [`e8dc395`](markedjs/marked@e8dc395) chore(release): 18.0.3 [skip ci]
* [`2608e81`](markedjs/marked@2608e81) fix: avoid task checkbox for setext heading text ([#3960](https://redirect.github.com/markedjs/marked/issues/3960))
* [`dba76f6`](markedjs/marked@dba76f6) chore(deps-dev): bump eslint from 10.2.0 to 10.2.1 ([#3953](https://redirect.github.com/markedjs/marked/issues/3953))
* [`015f1eb`](markedjs/marked@015f1eb) chore(deps-dev): bump typescript from 6.0.2 to 6.0.3 ([#3954](https://redirect.github.com/markedjs/marked/issues/3954))
* [`17c06e9`](markedjs/marked@17c06e9) chore: fix building license for docs ([#3952](https://redirect.github.com/markedjs/marked/issues/3952))
* [`55a54b5`](markedjs/marked@55a54b5) chore: Rename LICENSE.md to LICENSE for better compatibility with Bazel tooli...
* See full diff in [compare view](markedjs/marked@v18.0.2...v18.0.3)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=marked&package-manager=npm\_and\_yarn&previous-version=18.0.2&new-version=18.0.3)](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)
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.

ArcadeDB may ignore a relationship predicate written directly inside the relationship pattern.

2 participants