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

match query's result is incorrect #5209

Closed
nevermore3 opened this issue Jan 5, 2023 · 7 comments · Fixed by #5268
Closed

match query's result is incorrect #5209

nevermore3 opened this issue Jan 5, 2023 · 7 comments · Fixed by #5268
Assignees
Labels
affects/none PR/issue: this bug affects none version. process/fixed Process of bug severity/none Severity of bug type/bug Type: something is unexpected
Milestone

Comments

@nevermore3
Copy link
Contributor

Please check the FAQ documentation before raising an issue

Describe the bug (required)

Your Environments (required)

  • OS: uname -a
  • Compiler: g++ --version or clang++ --version
  • CPU: lscpu
  • Commit id (e.g. a3ffc7d8)

How To Reproduce(required)

    MATCH (v:player{name: 'Tim Duncan'})-[e:like*3]->(n), (t:team {name: "Spurs"})
     WITH v, e, collect(distinct n) AS ns
       UNWIND [n in ns | ()-[e*3]->(n:player)] AS p
       RETURN p

neo4j's result:
image

our's result:

(root@nebula) [nba]>  MATCH (v:player{name: 'Tim Duncan'})-[e:like*3]->(n), (t:team {name: "Spurs"})  WITH v, e, collect(distinct n) AS ns  UNWIND [n in ns | ()-[e*3]->(n:player)] AS p  RETURN p 
+----+
| p  |
+----+
| [] |
| [] |
| [] |
| [] |
| [] |
+----+
Got 5 rows (time spent 125497/126082 us)

Steps to reproduce the behavior:

  1. Step 1
  2. Step 2
  3. Step 3

Expected behavior

Additional context

@nevermore3 nevermore3 added the type/bug Type: something is unexpected label Jan 5, 2023
@github-actions github-actions bot added affects/none PR/issue: this bug affects none version. severity/none Severity of bug labels Jan 5, 2023
@nevermore3
Copy link
Contributor Author

If this fixes it, please fix the test case, Scenario: pattern in where in the PathExpr.feature file

@yixinglu
Copy link
Contributor

yixinglu commented Jan 9, 2023

It seems related to the issue #5221

@nevermore3
Copy link
Contributor Author

(root@nebula) [nba]> MATCH (v:player{name: 'Tim Duncan'})-[e:like*3]->(n)   WITH  e,collect(distinct n) AS ns        unwind [a in ns | ()-[e*3]->(a:player)] AS p   return p
+----+
| p  |
+----+
| [] |
| [] |
| [] |
| [] |
| [] |
+----+
Got 5 rows (time spent 121702/122480 us)

when we modify the steps to 3, there is no result

(root@nebula) [nba]> MATCH (v:player{name: 'Tim Duncan'})-[e:like*2]->(n)   WITH  e,collect(distinct n) AS ns        unwind [a in ns | ()-[e*2]->(a:player)] AS p   return p
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| p                                                                                                                                                                                                                                                                                       |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| [<("Tony Parker" :player{age: 36, name: "Tony Parker"})<-[:like@0 {likeness: 95}]-("Tim Duncan" :player{age: 42, name: "Tim Duncan"} :bachelor{name: "Tim Duncan", speciality: "psychology"})<-[:like@0 {likeness: 95}]-("Tony Parker" :player{age: 36, name: "Tony Parker"})>]         |
| []                                                                                                                                                                                                                                                                                      |
| [<("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})<-[:like@0 {likeness: 95}]-("Tim Duncan" :player{age: 42, name: "Tim Duncan"} :bachelor{name: "Tim Duncan", speciality: "psychology"})<-[:like@0 {likeness: 90}]-("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})>] |
| []                                                                                                                                                                                                                                                                                      |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Got 4 rows (time spent 69774/70703 us)

@nevermore3
Copy link
Contributor Author

nevermore3 commented Jan 10, 2023

another case

(root@nebula) [nba]> profile MATCH (v:player{name: 'Tim Duncan'})-[e:like*2]->(n)      return   ()-[e:like*2]->(n)
+-----------------------------------------+
| ()-[e:like*2]->(n) = ()-[e:like*2]->(n) |
+-----------------------------------------+
| []                                      |
| []                                      |
| []                                      |
| []                                      |
+-----------------------------------------+
Got 4 rows (time spent 48293/49909 us)

neo4j's result

╒══════════════════════════════════════════════════════════════════════╕
│"()-[e:like*2]->(n)"                                                  │
╞══════════════════════════════════════════════════════════════════════╡
│[[{"name":"Tim Duncan","age":42,"player":"Tim Duncan"},{"likeness":95}│
│,{"name":"Tony Parker","age":36,"player":"Tony Parker"},{"name":"Tony │
│Parker","age":36,"player":"Tony Parker"},{"likeness":95},{"name":"Tim │
│Duncan","age":42,"player":"Tim Duncan"}]]                             │
├──────────────────────────────────────────────────────────────────────┤
│[[{"name":"Tim Duncan","age":42,"player":"Tim Duncan"},{"likeness":95}│
│,{"name":"Tony Parker","age":36,"player":"Tony Parker"},{"name":"Tony │
│Parker","age":36,"player":"Tony Parker"},{"likeness":95},{"name":"Manu│
│ Ginobili","age":41,"player":"Manu Ginobili"}]]                       │
├──────────────────────────────────────────────────────────────────────┤
│[[{"name":"Tim Duncan","age":42,"player":"Tim Duncan"},{"likeness":95}│
│,{"name":"Tony Parker","age":36,"player":"Tony Parker"},{"name":"Tony │
│Parker","age":36,"player":"Tony Parker"},{"likeness":90},{"name":"LaMa│
│rcus Aldridge","age":33,"player":"LaMarcus Aldridge"}]]               │
├──────────────────────────────────────────────────────────────────────┤
│[[{"name":"Tim Duncan","age":42,"player":"Tim Duncan"},{"likeness":95}│
│,{"name":"Manu Ginobili","age":41,"player":"Manu Ginobili"},{"name":"M│
│anu Ginobili","age":41,"player":"Manu Ginobili"},{"likeness":90},{"nam│
│e":"Tim Duncan","age":42,"player":"Tim Duncan"}]]                     │
└──────────────────────────────────────────────────────────────────────┘

@nevermore3
Copy link
Contributor Author

nevermore3 commented Jan 10, 2023

Debug the RollUpApply operator
It can be seen that hashTable can never find the desired key, Because the directions of the edges stored in the two patterns are different

build HashTable From  ()-[e:like*2]->(n):  
KEY:  ["LaMarcus Aldridge",[("LaMarcus Aldridge")-[like(-15)]->("Tony Parker")@0 likeness:90,("Tony Parker")-[like(-15)]->("Tim Duncan")@0 likeness:95]]
VALUE :  (("Tim Duncan") Tag: player, age:42,name:"Tim Duncan"Tag: bachelor, speciality:"psychology",name:"Tim Duncan") -[like(15)]->(("Tony Parker") Tag: player, age:36,name:"Tony Parker")@0 likeness:95 -[like(15)]->(("LaMarcus Aldridge") Tag: player, age:33,name:"LaMarcus Aldridge")@0 likeness:90
Row from (v:player{name: 'Tim Duncan'})-[e:like*2]->(n) 
 KEY : ["LaMarcus Aldridge",[("Tim Duncan")-[like(15)]->("Tony Parker")@0 ,("Tony Parker")-[like(15)]->("LaMarcus Aldridge")@0]]
 ROW: [("Tim Duncan"),[("Tim Duncan")-[like(15)]->("Tony Parker")@0,("Tony Parker")-[like(15)]->("LaMarcus Aldridge")@0],("LaMarcus Aldridge") Tag: player, ]

@nevermore3 nevermore3 self-assigned this Jan 10, 2023
@Sophie-Xie Sophie-Xie added this to the v3.4.0 milestone Jan 11, 2023
@xtcyclist
Copy link
Contributor

xtcyclist commented Jan 11, 2023

I moved this issue to 3.5, which would allow the team more time to rethink related issues and provide good PRs for it. We are running out of time for 3.4 right now and 3.4 priorities stability. It is ok for 3.4 to have known incorrect results.

@xtcyclist xtcyclist modified the milestones: v3.4.0, v3.5.0 Jan 11, 2023
@nevermore3 nevermore3 mentioned this issue Jan 12, 2023
11 tasks
@nevermore3 nevermore3 mentioned this issue Feb 2, 2023
11 tasks
@nevermore3
Copy link
Contributor Author

After offline discussions, this function is currently disabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects/none PR/issue: this bug affects none version. process/fixed Process of bug severity/none Severity of bug type/bug Type: something is unexpected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants