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

optional match filter bug #4168

Closed
czpmango opened this issue Apr 18, 2022 · 1 comment
Closed

optional match filter bug #4168

czpmango opened this issue Apr 18, 2022 · 1 comment
Assignees
Labels
type/bug Type: something is unexpected
Milestone

Comments

@czpmango
Copy link
Contributor

czpmango commented Apr 18, 2022

Incorrect data filtering when the where clause of optional match refers to variables declared in other match.

Environment
version 3.0

How To Reproduce

(root@nebula) [nba]> MATCH (m)-[]-(n) WHERE id(m)=="Tim Duncan" OPTIONAL MATCH (n)-->(v) WHERE v.player.age < m.player.age RETURN count(*) AS count
+-------+
| count |
+-------+
| 19    |
+-------+
Got 1 rows (time spent 50423/51550 us)
(root@nebula) [nba]> MATCH (m)-[]-(n) WHERE id(m)=="Tim Duncan" OPTIONAL MATCH (n)-->(v) WHERE v.player.age < m.player.age RETURN n,v
+-------------------------------------------------------------------+----------+
| n                                                                 | v        |
+-------------------------------------------------------------------+----------+
| ("Tiago Splitter" :player{age: 34, name: "Tiago Splitter"})       | __NULL__ |
| ("Marco Belinelli" :player{age: 32, name: "Marco Belinelli"})     | __NULL__ |
| ("Tony Parker" :player{age: 36, name: "Tony Parker"})             | __NULL__ |
| ("Tony Parker" :player{age: 36, name: "Tony Parker"})             | __NULL__ |
| ("Tony Parker" :player{age: 36, name: "Tony Parker"})             | __NULL__ |
| ("Tony Parker" :player{age: 36, name: "Tony Parker"})             | __NULL__ |
| ("Shaquile O'Neal" :player{age: 47, name: "Shaquile O'Neal"})     | __NULL__ |
| ("LaMarcus Aldridge" :player{age: 33, name: "LaMarcus Aldridge"}) | __NULL__ |
| ("LaMarcus Aldridge" :player{age: 33, name: "LaMarcus Aldridge"}) | __NULL__ |
| ("Boris Diaw" :player{age: 36, name: "Boris Diaw"})               | __NULL__ |
| ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})         | __NULL__ |
| ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})         | __NULL__ |
| ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})         | __NULL__ |
| ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})         | __NULL__ |
| ("Spurs" :team{name: "Spurs"})                                    | __NULL__ |
| ("Dejounte Murray" :player{age: 29, name: "Dejounte Murray"})     | __NULL__ |
| ("Danny Green" :player{age: 31, name: "Danny Green"})             | __NULL__ |
| ("Danny Green" :player{age: 31, name: "Danny Green"})             | __NULL__ |
| ("Aron Baynes" :player{age: 32, name: "Aron Baynes"})             | __NULL__ |
+-------------------------------------------------------------------+----------+
Got 19 rows (time spent 49059/51244 us)

The filter WHERE v.player.age < m.player.age did incorrect data filtering.

Expected behavior
count should not be 19 and v should not be all null.

Additional context
May need to refactor the implementation of the Argument and introduce ExpandInto to fix statement like MATCH (a)--(b) MATCH (a)-->(b) return a,b

@czpmango czpmango added the type/bug Type: something is unexpected label Apr 18, 2022
@Sophie-Xie Sophie-Xie added this to the v3.2.0 milestone Apr 18, 2022
@Sophie-Xie Sophie-Xie added need to discuss Solution: issue or PR without a clear conclusion on whether to handle it priority/low-pri Priority: low labels May 26, 2022
@Sophie-Xie Sophie-Xie removed the need to discuss Solution: issue or PR without a clear conclusion on whether to handle it label Jul 1, 2022
@Sophie-Xie Sophie-Xie assigned czpmango and unassigned CPWstatic Jul 1, 2022
@Sophie-Xie Sophie-Xie modified the milestones: v3.2.0, v3.3.0 Jul 4, 2022
@Sophie-Xie Sophie-Xie removed the priority/low-pri Priority: low label Jul 4, 2022
@jinyingsunny
Copy link

image
checked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Type: something is unexpected
Projects
None yet
Development

No branches or pull requests

4 participants