You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Dimitry Solovyov (JIRA)" <ji...@apache.org> on 2018/03/28 09:00:07 UTC

[jira] [Created] (TINKERPOP-1932) Traversal results are implicitly deduplicated when using bytecode

Dimitry Solovyov created TINKERPOP-1932:
-------------------------------------------

             Summary: 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


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)