Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect warning - cartesian product #13467

Closed
pjljvandelaar opened this issue Jun 5, 2024 · 2 comments
Closed

Incorrect warning - cartesian product #13467

pjljvandelaar opened this issue Jun 5, 2024 · 2 comments
Assignees

Comments

@pjljvandelaar
Copy link

Configuration

Neo4j

image

OS

image

Steps to reproduce

The following two queries are equivalent:

MATCH
	(C1) -[:CppContains]-> (P1),
	(C2) -[:CppContains]-> (P2),
	(P1) -[R:CppCalls]-> (P2)
WHERE
	C1 <> C2
RETURN
	P1, P2, Count(R) AS Relations
ORDER BY Relations DESC

and

MATCH
	(C1) -[:CppContains]-> (P1) -[R:CppCalls]-> (P2) <-[:CppContains]- (C2) 
WHERE
	C1 <> C2
RETURN
	P1, P2, Count(R) AS Relations
ORDER BY Relations DESC

Actual behavior

The query

MATCH
	(C1) -[:CppContains]-> (P1),
	(C2) -[:CppContains]-> (P2),
	(P1) -[R:CppCalls]-> (P2)
WHERE
	C1 <> C2
RETURN
	P1, P2, Count(R) AS Relations
ORDER BY Relations DESC

is shown by neo4j as follows
image

With the following warning text (that pops up on hoover over)
image

The query

MATCH
	(C1) -[:CppContains]-> (P1) -[R:CppCalls]-> (P2) <-[:CppContains]- (C2) 
WHERE
	C1 <> C2
RETURN
	P1, P2, Count(R) AS Relations
ORDER BY Relations DESC

is shown by neo4j as follows
image

Expected behavior

I would have expected that both queries are treated equally by neo4j.
In fact, I think the warning for the first query is wrong.

Questions

Can you confirm that

  • the queries are indeed equivalent.
  • if so, neo4j should treat them equally.
  • if so, the first query is wrongly treated by neo4j.

Thanks in advance for your answers and bug fix!

@pjljvandelaar
Copy link
Author

Note that the equivalent query

MATCH
	(C1) -[:CppContains]-> (P1),
	(P1) -[R:CppCalls]-> (P2),
        (C2) -[:CppContains]-> (P2)
WHERE
	C1 <> C2
RETURN
	P1, P2, Count(R) AS Relations
ORDER BY Relations DESC

is also shown without any warning:
image

@SachinVasant SachinVasant self-assigned this Jul 8, 2024
@SachinVasant
Copy link

SachinVasant commented Jul 8, 2024

Thank you so much for raising this issue @pjljvandelaar
I have pushed a fix for this which should go out in an upcoming version release.

Thanks and regards,
Sachin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants