You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Stephen Mallette (Jira)" <ji...@apache.org> on 2023/04/26 11:08:00 UTC

[jira] [Commented] (TINKERPOP-2933) LazyBarrierStrategy affects the output order of query result

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

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

Gremlin does not enforce order as most underlying graph systems typically can't support that requirement. If you need order you must explicitly {{order()}} to retain the same results.

> 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)