JanusGraph / JanusGraph/janusgraph

Make computation for global OR queries lazy

Open
#2,407 0 comments 0 reactions 0 assignees View on GitHub
kind/enhancement kind/performance
Dominant language
Java
Stars
5.8k
Forks
1.2k
Avg merge
13h 53m
Merged PRs (30d)
6

Description

A gremlin query with global OR conditions is satisfied by the combination of multiple GraphCentricQuery. For example,
```java
g.V().or(has("name", "Totoro"),has("age", 2));
```
returns combined results of `has("name", "Totoro")` and `has("age", 2)`. If we only need a few results (for example, only the first result), then there is a chance that the second condition does not have to be evaluated at all. For example, if `g.V().has("name", "Totoro").hasNext()` is true, then we know `g.V().or(has("name", "Totoro"),has("age", 2)).hasNext()` also must be true, without evaluating `g.V().has("age", 2)` at all.

For details, see discussion on https://github.com/JanusGraph/janusgraph/pull/2365#discussion_r565367660

Contributor guide

Open the contributing guide

Research direction

Start by reading the GraphCentricQuery behavior described in the issue and the discussion on PR #2365, then trace how global OR conditions combine their queries. Verify the current hasNext() path with the provided Gremlin examples and define done as avoiding later-condition evaluation when an earlier condition already yields a result.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.