Skip to content

[BUG] Merged query using logical operator AND returns false results #928

@llooFlashooll

Description

@llooFlashooll

We discovered a bug that Merged query using logical operator AND returns false results.

  • ArcadeDB Version: 22.12.1
  • Operating system: macOS 13.2.1
  • JDK Version: 11
  • API/Driver: Java

Expected behavior:

We construct the following scenario: we randomly generate two queries Q1, Q2, and merge these two queries using AND logical operator into a new query Q3. Based on the AND 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().or(__.count()) returns [#161:274, #164:274, #167:273, #170:272, #170:273, #173:272, #176:272, #179:272, #182:271, #71:239]
  2. g.V().both('el2').has('vp3') returns [#167:273, #176:272]
  3. g.V().and(or(__.count()),both('el2').has('vp3')) returns [#71:239].

We calculate the intersection result set of Q1 and Q2, which is [#167:273, #176:272].
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:

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('vl1').property('vp2',''63i9l'').property('vp5','0.14066678292441492').property('vp6','-5574972206354940567').property(T.id,#71:239)
g.addV('vl0').property('vp6','4195013728507676230').property(T.id,#170:272)
g.addV('vl0').property('vp0','0.799499').property('vp5','0.5998860219757022').property(T.id,#173:272)
g.addV('vl0').property('vp0','0.80863255').property('vp3','1078919916').property('vp5','0.3948975214411796').property('vp7','1237644344').property('vp6','6272982094831851337').property(T.id,#176:272)
g.addV('vl0').property('vp0','0.28992218').property('vp5','0.3335518593354082').property('vp4','0.6814350364181624').property('vp7','1375658644').property('vp6','-2614020617501223004').property(T.id,#179:272)
g.addV('vl0').property('vp0','0.82822555').property(T.id,#182:271)
g.addV('vl0').property('vp5','0.5054363648083372').property('vp7','2053812728').property(T.id,#161:274)
g.addV('vl0').property('vp5','0.5054363648083372').property('vp6','8678672145167339512').property(T.id,#164:274)
g.addV('vl0').property('vp3','-1847328602').property('vp5','0.9635408040183151').property('vp4','0.01842414451548091').property('vp7','919538855').property('vp6','-6388160881449779784').property(T.id,#167:273)
g.addV('vl0').property('vp3','919538855').property(T.id,#170:273)

Edge:
g.V(#71:239).as('#71:239').V(#71:239).as('#71:239').addE('el3').from('#71:239').to('#71:239')
g.V(#167:273).as('#167:273').V(#179:272).as('#179:272').addE('el0').from('#167:273').to('#179:272')
g.V(#71:239).as('#71:239').V(#176:272).as('#176:272').addE('el2').from('#71:239').to('#176:272')
g.V(#71:239).as('#71:239').V(#182:271).as('#182:271').addE('el1').from('#71:239').to('#182:271')
g.V(#71:239).as('#71:239').V(#179:272).as('#179:272').addE('el2').from('#71:239').to('#179:272')
g.V(#71:239).as('#71:239').V(#176:272).as('#176:272').addE('el1').from('#71:239').to('#176:272')
g.V(#71:239).as('#71:239').V(#173:272).as('#173:272').addE('el1').from('#71:239').to('#173:272')
g.V(#71:239).as('#71:239').V(#167:273).as('#167:273').addE('el2').from('#71:239').to('#167:273')
g.V(#173:272).as('#173:272').V(#179:272).as('#179:272').addE('el0').from('#173:272').to('#179:272')
g.V(#71:239).as('#71:239').V(#164:274).as('#164:274').addE('el1').from('#71:239').to('#164:274')
g.V(#71:239).as('#71:239').V(#173:272).as('#173:272').addE('el2').from('#71:239').to('#173:272')
g.V(#71:239).as('#71:239').V(#164:274).as('#164:274').addE('el2').from('#71:239').to('#164:274')
g.V(#179:272).as('#179:272').V(#167:273).as('#167:273').addE('el0').from('#179:272').to('#167:273')
g.V(#182:271).as('#182:271').V(#170:272).as('#170:272').addE('el0').from('#182:271').to('#170:272')
g.V(#164:274).as('#164:274').V(#167:273).as('#167:273').addE('el0').from('#164:274').to('#167:273')
g.V(#173:272).as('#173:272').V(#170:272).as('#170:272').addE('el0').from('#173:272').to('#170:272')
g.V(#170:272).as('#170:272').V(#170:272).as('#170:272').addE('el0').from('#170:272').to('#170:272')
g.V(#182:271).as('#182:271').V(#164:274).as('#164:274').addE('el0').from('#182:271').to('#164:274')
g.V(#71:239).as('#71:239').V(#182:271).as('#182:271').addE('el2').from('#71:239').to('#182:271')
g.V(#71:239).as('#71:239').V(#170:272).as('#170:272').addE('el2').from('#71:239').to('#170:272')

Metadata

Metadata

Assignees

Labels

invalidThis doesn't seem rightwontfixThis will not be worked on

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions