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)

Reply via email to