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

Unable to filter on path pattern #4760

Closed
kikimo opened this issue Oct 20, 2022 · 1 comment · Fixed by #4788
Closed

Unable to filter on path pattern #4760

kikimo opened this issue Oct 20, 2022 · 1 comment · Fixed by #4788
Assignees
Labels
severity/major Severity of bug type/bug Type: something is unexpected
Milestone

Comments

@kikimo
Copy link
Contributor

kikimo commented Oct 20, 2022

Please check the FAQ documentation before raising an issue

Describe the bug (required)

Perhaps a similar problem to #4714 , what we want is to filter out the end vertex with tag player of an edge :

match p = (v)-[e]->(t) where id(v) == "Tim Duncan" and not (v)-[]->(t:player) return t did not work as expected:

(root@nebula) [nba]> match p = (v)-[e]->(t) where id(v) == "Tim Duncan" and not (v)-[]->(t:player)  return  t
+-------------------------------------------------------------------+
| t                                                                 |
+-------------------------------------------------------------------+
| ("Spurs" :team{name: "Spurs"})                                    |
| ("LaMarcus Aldridge" :player{age: 33, name: "LaMarcus Aldridge"}) |
| ("Tony Parker" :player{age: 36, name: "Tony Parker"})             |
| ("Tony Parker" :player{age: 36, name: "Tony Parker"})             |
| ("Danny Green" :player{age: 31, name: "Danny Green"})             |
| ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})         |
| ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})         |
+-------------------------------------------------------------------+
Got 7 rows (time spent 2866/3218 us)

Thu, 20 Oct 2022 14:54:47 CST

(root@nebula) [nba]>

while this clause work as expected match p = (v)-[e]->(t) where id(v) == "Tim Duncan" and not (v)-[e]->(t:player) return t

(root@nebula) [nba]> match p = (v)-[e]->(t) where id(v) == "Tim Duncan" and not (v)-[e]->(t:player)  return  t
+--------------------------------+
| t                              |
+--------------------------------+
| ("Spurs" :team{name: "Spurs"}) |
+--------------------------------+
Got 1 rows (time spent 2766/3095 us)

Thu, 20 Oct 2022 14:57:08 CST

(root@nebula) [nba]>

Your Environments (required)

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

How To Reproduce(required)

Steps to reproduce the behavior:

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

Expected behavior

Additional context

@kikimo kikimo added the type/bug Type: something is unexpected label Oct 20, 2022
@Sophie-Xie Sophie-Xie added this to the v3.3.0 milestone Oct 20, 2022
@kikimo
Copy link
Contributor Author

kikimo commented Oct 20, 2022

besides, filter by path pattern will make size(pattern) behave abnormaly, when the path patern filter exists, the size((v)-->()) return a BAD_TYPE error,

(root@nebula) [nba]> match p = (v)-[e]->(t) where   id(v) == "Tim Duncan" and not (v)-[e]->(t:team)   return  v, size((v)-->()), (v)-->()
+---+---------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
| v | size((v)-->() = (v)-->()) | (v)-->() = (v)-->()                                                                                                                  |
+---+---------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
|   | BAD_TYPE                  | ("Tim Duncan" :t1{name: "hello world"} :player{age: 42, name: "Tim Duncan"} :bachelor{name: "Tim Duncan", speciality: "psychology"}) |
|   | BAD_TYPE                  | ("Tim Duncan" :t1{name: "hello world"} :player{age: 42, name: "Tim Duncan"} :bachelor{name: "Tim Duncan", speciality: "psychology"}) |
|   | BAD_TYPE                  | ("Tim Duncan" :t1{name: "hello world"} :player{age: 42, name: "Tim Duncan"} :bachelor{name: "Tim Duncan", speciality: "psychology"}) |
|   | BAD_TYPE                  | ("Tim Duncan" :t1{name: "hello world"} :player{age: 42, name: "Tim Duncan"} :bachelor{name: "Tim Duncan", speciality: "psychology"}) |
|   | BAD_TYPE                  | ("Tim Duncan" :t1{name: "hello world"} :player{age: 42, name: "Tim Duncan"} :bachelor{name: "Tim Duncan", speciality: "psychology"}) |
|   | BAD_TYPE                  | ("Tim Duncan" :t1{name: "hello world"} :player{age: 42, name: "Tim Duncan"} :bachelor{name: "Tim Duncan", speciality: "psychology"}) |
+---+---------------------------+--------------------------------------------------------------------------------------------------------------------------------------+
Got 6 rows (time spent 3062/3497 us)

Thu, 20 Oct 2022 15:54:21 CST

(root@nebula) [nba]>

when we delete the path pater filte in the where clause, the result is correct:

(root@nebula) [nba]> match p = (v)-[e]->(t) where   id(v) == "Tim Duncan"   return  v, t, size((v)-->())
+--------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------+---------------------------+
| v                                                                                                                                    | t                                                                 | size((v)-->() = (v)-->()) |
+--------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------+---------------------------+
| ("Tim Duncan" :t1{name: "hello world"} :player{age: 42, name: "Tim Duncan"} :bachelor{name: "Tim Duncan", speciality: "psychology"}) | ("Spurs" :team{name: "Spurs"})                                    | 7                         |
| ("Tim Duncan" :t1{name: "hello world"} :player{age: 42, name: "Tim Duncan"} :bachelor{name: "Tim Duncan", speciality: "psychology"}) | ("LaMarcus Aldridge" :player{age: 33, name: "LaMarcus Aldridge"}) | 7                         |
| ("Tim Duncan" :t1{name: "hello world"} :player{age: 42, name: "Tim Duncan"} :bachelor{name: "Tim Duncan", speciality: "psychology"}) | ("Tony Parker" :player{age: 36, name: "Tony Parker"})             | 7                         |
| ("Tim Duncan" :t1{name: "hello world"} :player{age: 42, name: "Tim Duncan"} :bachelor{name: "Tim Duncan", speciality: "psychology"}) | ("Tony Parker" :player{age: 36, name: "Tony Parker"})             | 7                         |
| ("Tim Duncan" :t1{name: "hello world"} :player{age: 42, name: "Tim Duncan"} :bachelor{name: "Tim Duncan", speciality: "psychology"}) | ("Danny Green" :player{age: 31, name: "Danny Green"})             | 7                         |
| ("Tim Duncan" :t1{name: "hello world"} :player{age: 42, name: "Tim Duncan"} :bachelor{name: "Tim Duncan", speciality: "psychology"}) | ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})         | 7                         |
| ("Tim Duncan" :t1{name: "hello world"} :player{age: 42, name: "Tim Duncan"} :bachelor{name: "Tim Duncan", speciality: "psychology"}) | ("Manu Ginobili" :player{age: 41, name: "Manu Ginobili"})         | 7                         |
+--------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------+---------------------------+
Got 7 rows (time spent 2828/3397 us)

Thu, 20 Oct 2022 15:52:13 CST

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

Successfully merging a pull request may close this issue.

4 participants