JanusGraph / JanusGraph/janusgraph

Index with label constraint does not work for partitioned labels

Open
#1,842 1 comment 0 reactions 0 assignees View on GitHub
area/index help wanted kind/bug/confirmed
Dominant language
Java
Stars
5.8k
Forks
1.2k
Avg merge
13h 53m
Merged PRs (30d)
6

Description

Code to reproduce:

```
graph = JanusGraphFactory.open("inmemory")
mgmt = graph.openManagement()
l = mgmt.makeVertexLabel('V').partition().make()
p1 = mgmt.makePropertyKey('p').cardinality(Cardinality.SINGLE).dataType(String.class).make()
mgmt.buildIndex("i1", Vertex.class).addKey(p1).indexOnly(l).buildCompositeIndex()
mgmt.commit()
g = graph.traversal()

v1=g.addV("V").property('p','a').next()
g.tx().commit()
g.V().hasLabel('V').has('p', 'a')
```
```
gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@277bc3a5
gremlin> l = mgmt.makeVertexLabel('V').partition().make()
==>V
gremlin> p1 = mgmt.makePropertyKey('p').cardinality(Cardinality.SINGLE).dataType(String.class).make()
==>p
gremlin> mgmt.buildIndex("i1", Vertex.class).addKey(p1).indexOnly(l).buildCompositeIndex()
==>i1
gremlin> mgmt.commit()
==>null
gremlin> g = graph.traversal()
==>graphtraversalsource[standardjanusgraph[inmemory:[127.0.0.1]], standard]
gremlin>
gremlin> v1=g.addV("V").property('p','a').next()
==>v[4226]
gremlin> g.tx().commit()
==>null
gremlin> g.V().hasLabel('V').has('p', 'a')
gremlin>
```
Related issue #206

Contributor guide

Open the contributing guide

Research direction

Start by running the provided in-memory reproduction using a partitioned vertex label, a composite index with indexOnly, and the g.V().hasLabel('V').has('p', 'a') traversal. Trace composite-index handling for partitioned labels and add a regression test for this case. Done means the traversal finds the committed vertex through the index.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.