[ 
https://issues.apache.org/jira/browse/TINKERPOP-2209?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16834145#comment-16834145
 ] 

Chris Hupman commented on TINKERPOP-2209:
-----------------------------------------

Thanks for the info Daniel. I have a better understanding of what was causing 
the issue now after some additional testing.  I'm still seeing an issue, but 
hopefully I can frame it better now.

Even if you surround ids with a within() step or append toArray() you won't get 
any actual results. 
{code:java}
 gremlin> ids = 
[4112,4128,4136,8232,12328,16424,20520,4296,4328,4344,8440,12536]
==>4112
==>4128
==>4136
==>8232
==>12328
==>16424
==>20520
==>4296
==>4328
==>4344
==>8440
==>12536
gremlin> paths = 
g.V(ids).until(hasId(within(ids))).repeat(bothE().otherV().simplePath()).path().limit(5)
gremlin>
{code}
but I did get results when I generated the id like this
{code:java}
gremlin> ids = g.V().id().toList()
12:47:28 WARN  org.janusgraph.graphdb.transaction.StandardJanusGraphTx  - Query 
requires iterating over all vertices [()]. For better performance, use indexes
==>4112
==>4128
==>4136
==>8232
==>12328
==>16424
==>20520
==>4296
==>4328
==>4344
==>8440
==>12536
gremlin> 
g.V(ids).until(hasId(within(ids))).repeat(bothE().otherV().simplePath()).path().limit(5)
==>[v[4112]]
==>[v[4128]]
==>[v[4136]]
==>[v[8232]]
==>[v[12328]]
{code}
It works because the array is being populated with Longs instead of ints. The 
real issue the user was having is that hasId GraphStep isn't converting the 
values to Longs, but g.V(ids) will convert them, creating confusion.

I've only really looked through the JanusGraph/Titan source, but my 
understanding is that vertex ids are always longs. It think the bug should be 
framed as hasId should try to convert ints to Longs. Strings are already 
properly converted.

> hasId is not converting properly when multiple values are passed
> ----------------------------------------------------------------
>
>                 Key: TINKERPOP-2209
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2209
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: process
>    Affects Versions: 3.3.3
>         Environment: loaded GraphOfTheGods in JanusGraph 0.3.1 on a macbook.
>            Reporter: Chris Hupman
>            Priority: Minor
>
> While [trying to answer a question on Stack Overflow 
> |[https://stackoverflow.com/questions/55912624/get-all-edges-between-multiple-vertices-janusgraph/55929179#55929179]]
>  I found that hasId is performing `~id.eq` against arrays instead of 
> `~id.within` For a workaround the user reporting the issue found that quoting 
> the values or converting them to longs worked. 
>  
> ```
> {{ids = [8440,12536]}}
> {{paths = 
> g.V(ids).until(hasId(ids)).repeat(out().simplePath()).limit(10).path().explain()}}
> {{...RepeatStep(until([HasStep([~id.eq([4112, 4128, ...])])]),}}{{}}
> {{paths = 
> g.V(ids).until(hasId("8440","12536")).repeat(outE().simplePath()).limit(10).path().explain()}}
> {{...RepeatStep(until([HasStep([~id.within([8440, 12536])])])}}
> ```



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to