agensgraph
agensgraph copied to clipboard
Inconsistent row count when excute two results equivalent queries
Environment
Agensgraph commit version: a706a3966f676cc04bd285af1d2c44e4e23736cf Operating System: Ubuntu22.04 Installation Method: source code compilation
Step to reproduce:
-
Create the graph database:log37.txt
-
Execute the following two queries:
- query1:
MATCH (n0 :L1)<-[r0 :T2]-(n1 :L2)<-[r1 :T4]-(n2 :L2), (n3)<-[r2 :T4]-(n0)-[r3 :T0]->(n4 :L1), (n7 :L4) OPTIONAL MATCH (n8 :L4)<-[r6 :T4]-(n9)-[r7 :T5]->(n10 :L2) OPTIONAL MATCH (n7 :L4)-[r8 :T5]->(n11 :L2) OPTIONAL MATCH (n8)<-[ *..2]-(n10) WITH r2, r7, (r7.k60) AS a0 UNWIND [811962458, (r7.k56)] AS a1 OPTIONAL MATCH (n8)<-[]-(n10), (n0)-[r9 :T2]->(n13) OPTIONAL MATCH (n8)<-[]-(n10) WITH r9, r2 RETURN count(*);
It returns:
count
-------
400
(1 row)
- query2:
MATCH (n0 :L1)<-[r0 :T2]-(n1 :L2)<-[r1 :T4]-(n2 :L2), (n3)<-[r2 :T4]-(n0)-[r3 :T0]->(n4 :L1), (n7 :L4) OPTIONAL MATCH (n8 :L4)<-[r6 :T4]-(n9)-[r7 :T5]->(n10 :L2) OPTIONAL MATCH (n7 :L4)-[r8 :T5]->(n11 :L2) OPTIONAL MATCH (n8)<-[ *..2]-(n10) WITH r2, r7, (r7.k60) AS a0 UNWIND [811962458, (r7.k56)] AS a1 OPTIONAL MATCH (n8)<-[m0*1..1]-(n10),(n0)-[r9 :T2]->(n13) WHERE length(m0)=1 WITH r2, r7, a0, a1, n8, n10, n0, n13, r9 OPTIONAL MATCH (n8 )<-[]-(n10 ) WITH r9 , r2 RETURN count(*);
It returns:
count
-------
4
(1 row)
Expected results
Both the queries return the same results
Actual results
The second query returns different results compared with the first one
Analysis
When tested in Neo4j (after replacing length() with size()), both queries returned 384 rows. This differs from their previous outputs