Zeyang Zhuang created TINKERPOP-2897:
----------------------------------------
Summary: Merged query using logical operator OR returns false
results
Key: TINKERPOP-2897
URL: https://issues.apache.org/jira/browse/TINKERPOP-2897
Project: TinkerPop
Issue Type: Bug
Components: driver, server
Affects Versions: 3.6.2
Environment: - TinkerGraph Version: 3.6.2
- Operating system: macOS 13.2.1
- API/Driver: Java
Reporter: Zeyang Zhuang
We discovered a bug that Syntax error using logical operator AND.
- TinkerGraph Version: 3.6.2
- Operating system: macOS 13.2.1
- API/Driver: Java
- Expected behavior:
We construct the following scenario: we randomly generate two queries Q1, Q2,
and merge these two queries using OR logical operator into a new query Q3.
Based on the OR calculation. The Q3 query result set should be the union 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().or(__.values('vp2'))` returns `[0, 18, 2]`
2) `g.V().out('el2','el1')` returns `[0, 0, 0, 0, 10, 12, 14, 16, 16, 18, 18,
2, 2, 2, 4, 6]`
3) `g.V().or(or(__.values('vp2')),out('el2','el1'))` returns `[0, 10, 14, 16,
18, 2, 4, 8]`
We calculate the union result set of Q1 and Q2, which is `[0, 0, 0, 0, 10, 12,
14, 16, 16, 18, 18, 2, 2, 2, 4, 6]`.
The union result set doesn't equal to Q3 result set.
- Actual behavior:
The union 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. This might be a duplicate but the query and logical operator is
different so I reported it just in case.
- Steps to reproduce:
We create a graph with 10 nodes and 20 edges. We try to make it clear to
reproduce the bugs, **hope** to not cause much inconvenience to your reviewing,
but we believe the problem does exist.
Following the following graph data generation query, we can reproduce the bugs:
- Create data
```
Vertex:
g.addV('vl0').property('vp2',''-|꿃x\'').property(T.id,0)
g.addV('vl0').property('vp2',''6j}ꎱY'').property(T.id,2)
g.addV('vl1').property('vp0','-1469571896011420642').property(T.id,4)
g.addV('vl1').property('vp0','-8118881859321711963').property(T.id,6)
g.addV('vl1').property('vp0','5851992385413580838').property(T.id,8)
g.addV('vl1').property('vp0','-4650710188385909827').property(T.id,10)
g.addV('vl1').property('vp0','-1088319260591605148').property(T.id,12)
g.addV('vl1').property('vp0','7016141397206128700').property(T.id,14)
g.addV('vl1').property('vp0','6786856070484969672').property(T.id,16)
g.addV('vl0').property('vp2',''6j}ꎱY'').property(T.id,18)
Edge:
g.V(10).as('10').V(18).as('18').addE('el2').from('10').to('18')
g.V(18).as('18').V(14).as('14').addE('el1').from('18').to('14')
g.V(0).as('0').V(16).as('16').addE('el1').from('0').to('16')
g.V(0).as('0').V(6).as('6').addE('el0').from('0').to('6')
g.V(18).as('18').V(12).as('12').addE('el0').from('18').to('12')
g.V(2).as('2').V(4).as('4').addE('el1').from('2').to('4')
g.V(0).as('0').V(10).as('10').addE('el1').from('0').to('10')
g.V(14).as('14').V(2).as('2').addE('el2').from('14').to('2')
g.V(0).as('0').V(4).as('4').addE('el1').from('0').to('4')
g.V(2).as('2').V(8).as('8').addE('el0').from('2').to('8')
g.V(4).as('4').V(0).as('0').addE('el2').from('4').to('0')
g.V(12).as('12').V(2).as('2').addE('el2').from('12').to('2')
g.V(2).as('2').V(8).as('8').addE('el1').from('2').to('8')
g.V(0).as('0').V(10).as('10').addE('el0').from('0').to('10')
g.V(6).as('6').V(0).as('0').addE('el2').from('6').to('0')
g.V(2).as('2').V(14).as('14').addE('el1').from('2').to('14')
g.V(16).as('16').V(0).as('0').addE('el2').from('16').to('0')
g.V(18).as('18').V(8).as('8').addE('el1').from('18').to('8')
g.V(0).as('0').V(14).as('14').addE('el1').from('0').to('14')
g.V(16).as('16').V(2).as('2').addE('el2').from('16').to('2')
```
--
This message was sent by Atlassian Jira
(v8.20.10#820010)