janusgraph icon indicating copy to clipboard operation
janusgraph copied to clipboard

hasId does not convert int to Long

Open chupman opened this issue 5 years ago • 2 comments

If an int is passed instead of a String or a Long to hasId() it does not get converted and results won't be yielded. This behavior has been report in issue #706, but I think this would be a nice improvement.

I think looking at the HasStepFolder.foldInIds() method might be a good place to start.

Additional info can be found in this stack overflow question and this tinkerpop issue

chupman avatar May 06 '19 21:05 chupman

Does this issue still exist? I am not able to reproduce https://github.com/JanusGraph/janusgraph/issues/706 using the latest master version.

li-boxuan avatar Oct 12 '19 13:10 li-boxuan

I believe this issue still exists in 0.6.0.

I'm not currently sure if this is due to the 'size' of a vertex id, however the following query fails:

gremlin> g.V([1050964136]).group().by(id()).by(__.inE().otherV().hasId(within([10398826712, 1190592680])))
Has comparisons on a collection of ids require ids to all be of the same type

However if we convert the ID's to Longs, the query will work

gremlin> g.V([1050964136L]).group().by(id()).by(__.inE().otherV().hasId(within([10398826712L, 1190592680L])))
==>{1050964136=v[1190592680]}

And if we convert the ID's to strings, the query will work

gremlin> g.V(['1050964136']).group().by(id()).by(__.inE().otherV().hasId(within(['10398826712', '1190592680'])))
==>{1050964136=v[1190592680]}

gu avatar Apr 06 '22 21:04 gu