Skip to content

[BUG] Merged query using logical operator OR returns false results #930

Closed

Description

@llooFlashooll

We discovered a bug that Syntax error using logical operator AND.

  • 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 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().outE('el2','el3').inV().where(__.where(__.count())) returns [#74:238, #74:238, #74:238, #77:236, #77:236, #80:236, #80:236, #80:236, #80:236]
  2. g.V().both('el0').both('el0','el1','el4').and(__.count()) returns [#161:276, #164:276, #167:275, #170:275, #182:273, #74:238, #77:236]
  3. g.V().or(outE('el2','el3').inV().where(__.where(__.count())),both('el0').both('el0','el1','el4').and(__.count())) returns [#161:276, #164:276, #167:275, #173:275, #74:238, #77:236, #80:236]

We calculate the union result set of Q1 and Q2, which is [#161:276, #164:276, #167:275, #170:275, #182:273, #74:238, #77:236, #80:236, #80:236, #80:236, #80:236].
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('vp0','0.13892778325611876').property('vp2','-1645104889').property(T.id,#179:274)
g.addV('vl0').property('vp2','339251985').property(T.id,#182:273)
g.addV('vl1').property('vp1',''339251985'').property(T.id,#74:238)
g.addV('vl1').property('vp1',''gh_{O'').property('vp0','0.13366516135043682').property(T.id,#77:236)
g.addV('vl0').property('vp0','0.23033260942005307').property(T.id,#161:276)
g.addV('vl0').property('vp0','0.16477119885063363').property('vp2','339251985').property(T.id,#164:276)
g.addV('vl1').property('vp1',''T})Rl'').property('vp0','0.24647997728789628').property(T.id,#80:236)
g.addV('vl0').property('vp0','0.13892778325611876').property('vp2','339251985').property(T.id,#167:275)
g.addV('vl0').property('vp0','0.2428712548430111').property(T.id,#170:275)
g.addV('vl0').property('vp0','0.3804590941821774').property('vp2','339251985').property(T.id,#173:275)

Edge:
g.V(#80:236).as('#80:236').V(#80:236).as('#80:236').addE('el3').from('#80:236').to('#80:236')
g.V(#80:236).as('#80:236').V(#164:276).as('#164:276').addE('el2').from('#80:236').to('#164:276')
g.V(#77:236).as('#77:236').V(#74:238).as('#74:238').addE('el3').from('#77:236').to('#74:238')
g.V(#77:236).as('#77:236').V(#161:276).as('#161:276').addE('el0').from('#77:236').to('#161:276')
g.V(#161:276).as('#161:276').V(#170:275).as('#170:275').addE('el4').from('#161:276').to('#170:275')
g.V(#80:236).as('#80:236').V(#167:275).as('#167:275').addE('el2').from('#80:236').to('#167:275')
g.V(#74:238).as('#74:238').V(#161:276).as('#161:276').addE('el1').from('#74:238').to('#161:276')
g.V(#74:238).as('#74:238').V(#80:236).as('#80:236').addE('el3').from('#74:238').to('#80:236')
g.V(#167:275).as('#167:275').V(#164:276).as('#164:276').addE('el4').from('#167:275').to('#164:276')
g.V(#74:238).as('#74:238').V(#173:275).as('#173:275').addE('el1').from('#74:238').to('#173:275')
g.V(#77:236).as('#77:236').V(#164:276).as('#164:276').addE('el1').from('#77:236').to('#164:276')
g.V(#80:236).as('#80:236').V(#77:236).as('#77:236').addE('el3').from('#80:236').to('#77:236')
g.V(#77:236).as('#77:236').V(#167:275).as('#167:275').addE('el1').from('#77:236').to('#167:275')
g.V(#74:238).as('#74:238').V(#164:276).as('#164:276').addE('el2').from('#74:238').to('#164:276')
g.V(#77:236).as('#77:236').V(#173:275).as('#173:275').addE('el2').from('#77:236').to('#173:275')
g.V(#74:238).as('#74:238').V(#74:238).as('#74:238').addE('el3').from('#74:238').to('#74:238')
g.V(#173:275).as('#173:275').V(#182:273).as('#182:273').addE('el4').from('#173:275').to('#182:273')
g.V(#179:274).as('#179:274').V(#173:275).as('#173:275').addE('el4').from('#179:274').to('#173:275')
g.V(#77:236).as('#77:236').V(#182:273).as('#182:273').addE('el1').from('#77:236').to('#182:273')
g.V(#74:238).as('#74:238').V(#164:276).as('#164:276').addE('el1').from('#74:238').to('#164:276')

Activity

  1. lvca commented on Mar 10, 2023

    @lvca
    Member

    Please look at #931 (comment)

  2. lvca commented on Mar 14, 2023

    @lvca
    Member

    Closing this issue because similar to #931.

  3. self-assigned this
    on Mar 14, 2023
  4. added
    invalid
    wontfix
    on Mar 14, 2023
  5. added this to the 23.3.1 milestone on Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

invalidwontfix

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions