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

Stephen Mallette commented on TINKERPOP-2933:
---------------------------------------------

Again, it's more than {{LazyBarrierStrategy}}. Gremlin doesn't guarantee order 
for any of its steps except for {{order()}} and this stems from graph databases 
not enforcing order on the way they return data. You may or may not get the 
same order on a simple query of {{g.V()}} depending on the graph database that 
you use. So, I wouldn't focus on {{LazyBarrierStrategy}} as the reason for 
order of elements changing. If you need an expected order then you need to use 
{{order()}} step.

> LazyBarrierStrategy affects the output order of query result
> ------------------------------------------------------------
>
>                 Key: TINKERPOP-2933
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2933
>             Project: TinkerPop
>          Issue Type: Bug
>            Reporter: Lei Tang
>            Priority: Major
>
> I find that when I remove `LazyBarrierStrategy`, sometimes the output order 
> of query result can be changed.  I don't know whether it is a correct 
> behavior, but it sometimes can affect the query result, e.g., a `range()` or 
> `limit()` in a query.
> For example, I can get the consistent result with the following queries.
> {code:java}
> gremlin> :> 
> g.withoutStrategies(LazyBarrierStrategy).V().out('el0','el1').has('vp1', 
> lt(0.30755568))
> ==>v[98]
> ==>v[14]
> ==>v[94]
> gremlin> :> g.V().out('el0','el1').has('vp1', lt(0.30755568))
> ==>v[98]
> ==>v[14]
> ==>v[94]
>   {code}
> However, I retrieved a different order of results with the following two 
> queries. I think they should also execute the same query results, as well as 
> the same order. 
> {code:java}
> gremlin> :> g.V().out('el0','el1').not(__.has('vp1', lt(0.30755568)))
> ==>v[78]
> ==>v[35]
> ==>v[103]
> ==>v[103]
> ==>v[80]
> ==>v[80]
> ==>v[50]
> gremlin> :> 
> g.withoutStrategies(LazyBarrierStrategy).V().out('el0','el1').not(__.has('vp1',
>  lt(0.30755568)))
> ==>v[78]
> ==>v[35]
> ==>v[103]
> ==>v[80]
> ==>v[103]
> ==>v[80]
> ==>v[50]
>  {code}
> Thus, if I have some other operations after it, I will get different query 
> results.
> {code:java}
> gremlin> :> 
> g.withoutStrategies(LazyBarrierStrategy).V().out('el0','el1').not(__.has('vp1',
>  lt(0.30755568))).tail(3)
> ==>v[103]
> ==>v[80]
> ==>v[50]
> gremlin> :> g.V().out('el0','el1').not(__.has('vp1', lt(0.30755568))).tail(3)
> ==>v[80]
> ==>v[80]
> ==>v[50]
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to