krlawrence / graph

Practical Gremlin - An Apache TinkerPop Tutorial
Apache License 2.0
830 stars 251 forks source link

Cannot retrive vertices and edges by their ID as Int #237

Closed andreazanetti92 closed 2 years ago

andreazanetti92 commented 2 years ago

Hello, I'm learning Janus and Gremlin. I noticed that if I search a vertex or an edge by its ID as Int like this: g.V(3) or g.E(3640) (I also tried g.V(3L), g.E(3640L)

Casually I found out that pass the id as String it will return the expected output.

Link to my github repo where could be find the docker-compose that i use and then see all versions of the tools.

andreazanetti92 commented 2 years ago

Query: g.V().hasId(between(1,6)) Output: Cannot compare '2306' (String) and '1' (Integer) as both need to be an instance of Number or Comparable (and of the same type)

krlawrence commented 2 years ago

Different graph databases support different ID schemes. Janus Graph requires an ID to be a Long (integer) type. TinkerGraph supports String ID values as well as other types.