bitnine-oss / agensgraph

AgensGraph, a transactional graph database based on PostgreSQL
http://www.agensgraph.org
Other
1.34k stars 148 forks source link

Bug in pattern matching with multiple relations #647

Open w158937299 opened 8 months ago

w158937299 commented 8 months ago

Agensgraph version: 2.13.0 Operating system: (Windows 11) API/Driver: (psycopg2 2.9.7) Steps to reproduce 6 (2)

As shown in this picture, query 1 aims to return the count of all nodes going out through the "et0" relationship and returning through the "et3" relationship. Neo4j returns 28, while Agensgraph strangely returns a very large value, 2695, because the total number of nodes in the graph is only 100. Query 2 returns the count of nodes going out through the "et0" relationship, and query 3 returns the count of nodes returning through the "et3" relationship. The results of these two queries on both graph database engines are consistent, but we found that the product of the results of queries 2 and 3 equals the result of query 1. From this, we can infer that Agensgraph, when using the above pattern to match multiple relationships, does not consider these relationships simultaneously but matches them separately. Finally, it returns the results in a manner similar to a Cartesian product, leading to a bug.