[ https://issues.apache.org/jira/browse/TINKERPOP-1932?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16417214#comment-16417214 ]
stephen mallette commented on TINKERPOP-1932: --------------------------------------------- hmm....I don't know if {{inject()}} preserves order....that's a separate issue i think. that's probably a good question to send to the gremlin-users mailing list: normally, you should not rely on a traversal to preserve order though. different graph databases handle that in their own ways. since i always tend to assume that when i write traversals i never thought of how {{inject()}} should behave. > Traversal results are implicitly deduplicated when using bytecode > ----------------------------------------------------------------- > > Key: TINKERPOP-1932 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1932 > Project: TinkerPop > Issue Type: Bug > Components: process > Affects Versions: 3.3.1 > Reporter: Dimitry Solovyov > Priority: Major > > Sending the same query as Gremlin-Groovy and as bytecode yields different > results, if the result set contains duplicates. Duplicates are preserved in > results from StandardOpProcessor, but dropped in TraversalOpProcessor. > Deduplication seems to happen when traversers are bulked using a > [TraverserSet|https://github.com/apache/tinkerpop/blob/3.3.1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/util/TraverserSet.java] > in > [TraverserIterator|https://github.com/apache/tinkerpop/blob/3.3.1/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/TraverserIterator.java]. > TraverserSet intentionally collects traversers in a hash map. > Here is a test that reproduces the issue: > {code:java} > Client groovyClient = Cluster.open().connect(); > List<Long> groovyResult = groovyClient.submit("g.inject(1, > 1)").stream().map(Result::getLong).collect(toList()); > groovyClient.close(); > Client bytecodeClient = Cluster.open().connect().alias("g"); > Bytecode bytecode = __.inject(1, 1).asAdmin().getBytecode(); > List<Long> bytecodeResult = > bytecodeClient.submit(bytecode).stream().map(Result::getLong).collect(toList()); > bytecodeClient.close(); > assertEquals(groovyResult, asList(1L, 1L)); > assertEquals(bytecodeResult, asList(1L, 1L)); > {code} > -- This message was sent by Atlassian JIRA (v7.6.3#76005)