JanusGraph / JanusGraph/janusgraph
Gremlin is unable to search non-string properties when searched as a String after using in/out operation on a vertex
- Dominant language
- Java
- Stars
- 5.8k
- Forks
- 1.2k
- Avg merge
- 13h 53m
- Merged PRs (30d)
- 6
Description
- Version: 0.5.3
- Storage Backend: cql, in-memory
- Expected Behavior: Gremlin should automatically convert the String argument to the corresponding datatype for the property as it is doing for simple queries when not traversing in and out of a vertex
- Current Behavior: Gremlin does not convert String argument to its equivalent non-String datatype
- Steps to Reproduce:
1. start gremlin.bat in windows
2. Execute below commands to load GraphOfTheGods
gremlin> graph = JanusGraphFactory.open('conf/janusgraph-inmemory.properties')
gremlin> GraphOfTheGodsFactory.loadWithoutMixedIndex(graph, true)
gremlin> g = graph.traversal()
3. Test the query.
gremlin> g.V().has('age',**'4500'**).valueMap()
==>[name:[neptune],age:[4500]]
4. Test the below query.
gremlin> g.V().has('name','neptune').out().in().has('age',**'4500'**).valueMap()
**Result is Empty**
5. Test the same query, now instead using String for age use the actual datatype
gremlin> g.V().has('name','neptune').out().in().has('age',**4500**).valueMap()
==>[name:[neptune],age:[4500]]
==>[name:[neptune],age:[4500]]
==>[name:[neptune],age:[4500]]
The issue exists in all the versions of gremlin.
The issue can also be reproduced with other datatypes such UUID, date etc.
I also changed the example-common program(PSA) to check if the issue is in gremlin console or the gremlin API.
In the example program I tested with adding UUID and date fields in schema, the issue got reproduced for those datatypes as well in the java program.
[example-common.zip](https://github.com/JanusGraph/janusgraph/files/6038703/example-common.zip)
### Stack Trace (if you have one)
```
paste stack trace here
```
Contributor guide
Research direction
Start by reproducing the two Gremlin traversals in the issue with the in-memory backend and compare the direct property lookup with the lookup after out().in(). Check the traversal and property-query paths involved in datatype conversion, including the UUID and date cases described. Done means string values such as '4500' match equivalent non-string properties consistently after traversal, with regression coverage for the reported cases.
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