JanusGraph / JanusGraph/janusgraph

Inconsistent behavior when comparing a counted value with a negative value

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

Description

Please include configurations and logs if available.

For confirmed bugs, please report:

- Version: 0.6.3
- Storage Backend: inmemory
- Mixed Index Backend: Lucene
- Link to discussed bug:
- Expected Behavior:
- Current Behavior:

When I compare a counted number with a negative value that is less than -2, an exception (e.g., `Not a legal range: [0, -2]`) is thrown. However, a negative value -1 or -2 cannot trigger this exception.

```
gremlin> :> g.V().where(__.inE('knows').count().is(not(lte(-3))))
Not a legal range: [0, -2]

gremlin> :> g.V().where(__.inE('knows').count().is(not(lte(-2))))
==>v[4216]
==>v[8312]
==>v[4312]
```

### Steps to Reproduce

```
Vertex bob = g.addV("person").property("name", "Bob").next();
Vertex alice = g.addV("person").property("name", "Alice").next();
Vertex book = g.addV("book").property("name", "book1").next();
Edge edge1 = g.addE("knows").from(bob).to(alice).next();
Edge edge2 = g.addE("write").from(alice).to(book).next();
g.E(edge2).property("duration", new Float(0.94461)).iterate();
```

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied Gremlin traversals against JanusGraph 0.6.3 with the in-memory storage backend and Lucene mixed index. Trace the count comparison and negative lte values to identify where the range exception is produced. Done means the behavior for negative values is consistent and the reproduction no longer produces an unexpected exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Bug
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.