Reporter: ting668
Environment
- OS: CentOS Linux 7 (Core), inside Docker container
- CPU/Architecture: x86_64
- Docker image:
tugraph/tugraph-runtime-centos7:latest
- TuGraph-DB Version:
4.5.2 (tugraph-4.5.2-1.x86_64)
Description
While testing TuGraph using a method based on attribute-constraint analysis, I found that a comma-separated MATCH pattern list can return rows that violate the label constraint.
In the example below, a is constrained to Teacher, but TuGraph returns an Actor node as a.
How to Reproduce and Expected Behavior
Note: The queries below are a minimized, simplified example reproducing the bug.
Original graph G:
CALL db.createVertexLabel('Teacher','name','name','STRING',false,'gender','STRING',true,'faculty','STRING',true);
CALL db.createVertexLabel('Student','name','name','STRING',false,'gender','STRING',true,'faculty','STRING',true);
CALL db.createVertexLabel('Actor','name','name','STRING',false,'gender','STRING',true);
CREATE (:Teacher {name:'Bob', gender:'Male', faculty:'computer'}),
(:Actor {name:'Owen', gender:'Male'}),
(:Student {name:'Mary', gender:'Female', faculty:'computer'}),
(:Student {name:'Lily', gender:'Female', faculty:'computer'});
Query:
MATCH (a:Teacher {gender:'Male'}), (b:Student {gender:'Female'})
RETURN a.name, b.name;
Expected result on G:
Actual result on G:
Bob, Mary
Bob, Lily
Owen, Lily
Induced subgraph G1 using faculty = 'computer' removes the Actor node:
CALL db.createVertexLabel('Teacher','name','name','STRING',false,'gender','STRING',true,'faculty','STRING',true);
CALL db.createVertexLabel('Student','name','name','STRING',false,'gender','STRING',true,'faculty','STRING',true);
CREATE (:Teacher {name:'Bob', gender:'Male', faculty:'computer'}),
(:Student {name:'Mary', gender:'Female', faculty:'computer'}),
(:Student {name:'Lily', gender:'Female', faculty:'computer'});
The same query on G1 returns the expected two rows:
Equivalent query on G also returns the expected two rows:
MATCH (a:Teacher {gender:'Male'})
WITH a
MATCH (b:Student {gender:'Female'})
RETURN a.name, b.name;
Expected behavior: all equivalent formulations should return only Teacher-Student pairs.
Actual behavior: the comma-separated pattern query on G leaks the Actor node Owen into the result.
Reporter: ting668
Environment
tugraph/tugraph-runtime-centos7:latest4.5.2(tugraph-4.5.2-1.x86_64)Description
While testing TuGraph using a method based on attribute-constraint analysis, I found that a comma-separated
MATCHpattern list can return rows that violate the label constraint.In the example below,
ais constrained toTeacher, but TuGraph returns anActornode asa.How to Reproduce and Expected Behavior
Note: The queries below are a minimized, simplified example reproducing the bug.
Original graph
G:Query:
Expected result on
G:Actual result on
G:Induced subgraph
G1usingfaculty = 'computer'removes theActornode:The same query on
G1returns the expected two rows:Equivalent query on
Galso returns the expected two rows:Expected behavior: all equivalent formulations should return only Teacher-Student pairs.
Actual behavior: the comma-separated pattern query on
Gleaks theActornodeOweninto the result.