Re: Merged query using logical operator AND returns false results


Flash
 
Edited

Dear developers, I re-corrected the syntax and ran new experiments, still triggered the bugs.

### Expected behavior:
We construct the following scenario: we randomly generate two queries Q1, Q2, and merge these two queries using MATCH operator into a new query Q3. See reference at https://stackoverflow.com/questions/48067834/gremlin-intersection-operation. Based on the calculation. The Q3 query result set should be the intersection of result sets from Q1 and Q2.
We generate graph schema and data based on random strings and values. Here is one of our examples that triggered the bug.

1. `g.V().bothE('el1').outV()` returns `[8400]`.
2. `g.V().and(__.outE('el2'))` returns `[16592, 4120, 4136, 4168, 4304]`.
3. `g.V().match(__.as('a').bothE('el1').outV(),__.as('a').filter(and(__.outE('el2')))).select('a')` returns `[16592, 4120, 4168, 4304]`.

We calculate the intersection result set of Q1 and Q2, which is `[]` an empty set.
The intersection result set doesn't equal to Q3 result set.

### Actual behavior:
The intersection result set should equal to Q3 result set. We did trigger some cases conform to this requirement, but still there're some cases that violate this constraint.

### Steps to reproduce:
- Create data
```
Vertex:
g.addV('vl1').property('vp3','true').property(T.id,4168)
g.addV('vl2').property('vp0','-1270611045').property(T.id,4296)
g.addV('vl1').property('vp3','true').property(T.id,4304)
g.addV('vl0').property('vp2',''nw)0Y'').property(T.id,8400)
g.addV('vl2').property('vp0','-1270611045').property('vp2',''~kK4?'').property(T.id,4264)
g.addV('vl1').property('vp3','false').property(T.id,4120)
g.addV('vl1').property('vp3','false').property(T.id,4136)
g.addV('vl2').property('vp2',''qrΛO|'').property(T.id,12496)
g.addV('vl2').property('vp2',''qrΛO|'').property(T.id,4312)
g.addV('vl1').property('vp3','false').property(T.id,16592)

Edge:
g.V(4120).as('4120').V(4168).as('4168').addE('el2').from('4120').to('4168')
g.V(4120).as('4120').V(4136).as('4136').addE('el0').from('4120').to('4136')
g.V(4120).as('4120').V(16592).as('16592').addE('el0').from('4120').to('16592')
g.V(16592).as('16592').V(4168).as('4168').addE('el2').from('16592').to('4168')
g.V(4136).as('4136').V(4120).as('4120').addE('el2').from('4136').to('4120')
g.V(4168).as('4168').V(8400).as('8400').addE('el1').from('4168').to('8400')
g.V(4120).as('4120').V(8400).as('8400').addE('el1').from('4120').to('8400')
g.V(4136).as('4136').V(4168).as('4168').addE('el0').from('4136').to('4168')
g.V(4304).as('4304').V(4120).as('4120').addE('el2').from('4304').to('4120')
g.V(4304).as('4304').V(4136).as('4136').addE('el2').from('4304').to('4136')
g.V(16592).as('16592').V(8400).as('8400').addE('el1').from('16592').to('8400')
g.V(4168).as('4168').V(4120).as('4120').addE('el2').from('4168').to('4120')
g.V(4136).as('4136').V(4304).as('4304').addE('el2').from('4136').to('4304')
g.V(4304).as('4304').V(8400).as('8400').addE('el1').from('4304').to('8400')
g.V(4120).as('4120').V(4168).as('4168').addE('el0').from('4120').to('4168')
g.V(4168).as('4168').V(16592).as('16592').addE('el2').from('4168').to('16592')
g.V(16592).as('16592').V(4120).as('4120').addE('el2').from('16592').to('4120')
g.V(4136).as('4136').V(16592).as('16592').addE('el2').from('4136').to('16592')
g.V(4304).as('4304').V(16592).as('16592').addE('el0').from('4304').to('16592')
g.V(4168).as('4168').V(4120).as('4120').addE('el0').from('4168').to('4120')
```

Join janusgraph-users@lists.lfaidata.foundation to automatically receive all group messages.