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

Stephen Mallette commented on TINKERPOP-2887:
---------------------------------------------

Sorry, it has taken a long time to get to this one, but it was complex and each 
time i looked i had a hard time getting my head into the issue. 

I believe that the Gremlin of those two queries is not doing the same thing. 
The second uses {{dedup()}} on only the first part of the path. Note that if 
you move it to the end, you get the same counts:

{code:java}
gremlin> g.V().as('cccccccc').
......1>   hasLabel('A').
......2>   bothE().
......3>   otherV().as('hketwcbf').
......4>   hasLabel('B').emit(__.loops().is(gte(1))).
......5>   repeat(__.inE().outV()).times(2).emit(__.loops().is(gte(1))).
......6>   repeat(__.inE().outV()).times(2).as('test').
......7>   where(__.select('test').where(eq('cccccccc'))).
......8>   dedup().by(__.path()).
......9>   select('hketwcbf').
.....10>   count()
==>2263
{code}

doesn't look like there is a problem here. 
 

> Suspicious buggy queries
> ------------------------
>
>                 Key: TINKERPOP-2887
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2887
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: process
>    Affects Versions: 3.6.2
>            Reporter: Yuancheng
>            Priority: Major
>
> Here are two queries translated from equivalent cypher queries:
> (1) 
> {code:java}
> MATCH (cccccccc:A)-[]-(hketwcbf:B)<-[*1..2]-(ahdnqvvl)<-[*1..2]-(cccccccc:A) 
> RETURN count(hketwcbf) {code}
> {code:java}
> g.V().as('cccccccc').hasLabel('A').emit(__.loops().is(gte(1))).repeat(__.outE().inV()).times(2).emit(__.loops().is(gte(1))).repeat(__.outE().inV()).times(2).as('hketwcbf').hasLabel('B').bothE().dedup().by(__.path()).otherV().as('test').where(__.select('test').where(eq('cccccccc'))).select('hketwcbf').count()
> // Result: 2263{code}
> (2) 
> {code:java}
> MATCH (cccccccc:A)-[*1..2]->(ahdnqvvl)-[*1..2]->(hketwcbf:B)-[]-(cccccccc:A) 
> RETURN count(hketwcbf){code}
> {code:java}
> g.V().as('cccccccc').hasLabel('A').bothE().dedup().by(__.path()).otherV().as('hketwcbf').hasLabel('B').emit(__.loops().is(gte(1))).repeat(__.inE().outV()).times(2).emit(__.loops().is(gte(1))).repeat(__.inE().outV()).times(2).as('test').where(__.select('test').where(eq('cccccccc'))).select('hketwcbf').count()
>  
> // Result: 2631{code}
>  
> (I am not sure whether they are still equivalent in gremlin)
> Dataset:
>  
> {code:java}
> g.addV('A').as('n1').property(single, 'name', 56).property(single, 'id', 
> 2).property(single, 'undefined', 18).addV('A').as('n2').property(single, 
> 'name', 61).property(single, 'id', 61).addV('A').as('n3').property(single, 
> 'name', 49).property(single, 'id', 92).property(single, 'undefined', 
> 16).addV('B').as('n4').property(single, 'name', 79).property(single, 'id', 
> 47).addV('B').as('n5').property(single, 'name', 22).property(single, 'id', 
> 17).property(single, 'undefined', 74).addV('A').as('n6').property(single, 
> 'name', 99).property(single, 'id', 95).addV('B').as('n7').property(single, 
> 'name', 29).property(single, 'id', 25).property(single, 'undefined', 
> 1).addV('A').as('n8').property(single, 'name', 65).property(single, 'id', 
> 62).addV('B').as('n9').property(single, 'name', 34).property(single, 'id', 
> 83).property(single, 'undefined', 24).addV('B').as('n10').property(single, 
> 'name', 91).property(single, 'id', 
> 74).addE('x').from('n1').to('n8').addE('y').from('n2').to('n9').addE('x').from('n3').to('n3').addE('y').from('n4').to('n1').addE('x').from('n5').to('n5').addE('y').from('n6').to('n5').addE('x').from('n7').to('n6').addE('y').from('n8').to('n7').addE('x').from('n9').to('n5').addE('y').from('n10').to('n5').addE('x').from('n1').to('n5').addE('y').from('n2').to('n8').addE('x').from('n3').to('n2').addE('y').from('n4').to('n3').addE('x').from('n5').to('n6').addE('y').from('n6').to('n10').addE('x').from('n7').to('n7').addE('y').from('n8').to('n8').addE('x').from('n9').to('n9').addE('y').from('n10').to('n9').addE('x').from('n1').to('n8').addE('y').from('n2').to('n3').addE('x').from('n3').to('n1').addE('y').from('n4').to('n6').addE('x').from('n5').to('n9').addE('y').from('n6').to('n6').addE('x').from('n7').to('n5').addE('y').from('n8').to('n5').addE('x').from('n9').to('n10').addE('y').from('n10').to('n3').addE('x').from('n1').to('n10').addE('y').from('n2').to('n6').addE('x').from('n3').to('n2').addE('y').from('n4').to('n4').addE('x').from('n5').to('n3').addE('y').from('n6').to('n8').addE('x').from('n7').to('n4').addE('y').from('n8').to('n3').addE('x').from('n9').to('n8').addE('y').from('n10').to('n9').addE('x').from('n1').to('n9').addE('y').from('n2').to('n5').addE('x').from('n3').to('n7').addE('y').from('n4').to('n9').addE('x').from('n5').to('n5').addE('y').from('n6').to('n5').addE('x').from('n7').to('n7').addE('y').from('n8').to('n7').addE('x').from('n9').to('n9').addE('y').from('n10').to('n5').barrier().limit(0)
>  {code}
>  
>  



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

Reply via email to