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

Unexpected edge direction in MATCH...WHERE... query result #4048

Closed
r9liucc opened this issue Mar 17, 2022 · 1 comment · Fixed by #4091
Closed

Unexpected edge direction in MATCH...WHERE... query result #4048

r9liucc opened this issue Mar 17, 2022 · 1 comment · Fixed by #4091
Assignees
Labels
community Source: who proposed the issue type/bug Type: something is unexpected
Milestone

Comments

@r9liucc
Copy link

r9liucc commented Mar 17, 2022

Environments

  • OS: macOS Monterey 12.1, MacBook Pro (16-inch, 2019)
  • CPU: Intel Core i7, 6 cores, 2.6 GHz
  • Nebula Graph Version: nebula-docker-compose v3.0.1 modified with 1 metad, 1 storaged and 1 graphd

How To Reproduce

Steps to reproduce the behavior:

  1. Create a graph as follow: ds1 -> j1 -> ds2 -> j2 -> ds3
# create space
CREATE SPACE IF NOT EXISTS test(vid_type=FIXED_STRING(20));
USE test;

# create schema
CREATE TAG IF NOT EXISTS dataset();
CREATE TAG IF NOT EXISTS job();
CREATE EDGE IF NOT EXISTS lineage();

CREATE TAG INDEX IF NOT EXISTS dataset_index on dataset();
CREATE TAG INDEX IF NOT EXISTS job_index on job();
CREATE EDGE INDEX IF NOT EXISTS lineage_index on lineage();

REBUILD TAG INDEX dataset_index;
REBUILD TAG INDEX job_index;
REBUILD EDGE INDEX lineage_index;

# insert data
INSERT VERTEX dataset() VALUES "ds1":();
INSERT VERTEX dataset() VALUES "ds2":();
INSERT VERTEX dataset() VALUES "ds3":();

INSERT VERTEX job() VALUES "j1":();
INSERT VERTEX job() VALUES "j2":();

INSERT EDGE lineage() VALUES "ds1" -> "j1":(), "j1" -> "ds2":(), "ds2" -> "j2":(), "j2" -> "ds3":();
  1. Make queries:
# Query A:
match p = (upstream:dataset) -[:lineage*2]-> (center) return p;

# Result:
+-----------------------------------------------------------------------------------------+
| p                                                                                       |
+-----------------------------------------------------------------------------------------+
| <("ds1" :dataset{})-[:lineage@0 {}]->("j1" :job{})-[:lineage@0 {}]->("ds2" :dataset{})> |
| <("ds2" :dataset{})-[:lineage@0 {}]->("j2" :job{})-[:lineage@0 {}]->("ds3" :dataset{})> |
+-----------------------------------------------------------------------------------------+
# Query B:
match p = (upstream:dataset) -[:lineage*2]-> (center) \
where id(center) == "ds2" \
return p;

# Result:
+-----------------------------------------------------------------------------------------+
| p                                                                                       |
+-----------------------------------------------------------------------------------------+
| <("ds1" :dataset{})-[:lineage@0 {}]->("j1" :job{})<-[:lineage@0 {}]-("ds2" :dataset{})> |
+-----------------------------------------------------------------------------------------+

Expected behavior
The ds2 should have an incoming direction edge started from j1, which was expected in Query A, but Query B has a contrary result.

@r9liucc r9liucc added the type/bug Type: something is unexpected label Mar 17, 2022
@r9liucc r9liucc changed the title Unexpected relationship direction in MATCH...WHERE... query result Unexpected edge direction in MATCH...WHERE... query result Mar 17, 2022
@Sophie-Xie Sophie-Xie added this to the v3.1.0 milestone Mar 17, 2022
@wey-gu
Copy link
Contributor

wey-gu commented Mar 23, 2022

Thanks a lot, @r9liucc for collecting info and bringing this to the community, @CPWstatic will look into it :).

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

Successfully merging a pull request may close this issue.

5 participants