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

LIMIT <list> in GO always return the same result and can be stuck in loops #3186

Closed
randomJoe211 opened this issue Oct 22, 2021 · 3 comments
Closed
Assignees
Milestone

Comments

@randomJoe211
Copy link
Contributor

Nebula Graph version: 2021.10.18-nightly

I have 5 vertices: "1" to "5". The edges are as follows:

insert edge follow(degree) values "1"->"2":(95);
insert edge follow(degree) values "2"->"3":(95);
insert edge follow(degree) values "3"->"1":(95);
insert edge follow(degree) values "2"->"4":(95);
insert edge follow(degree) values "4"->"5":(90);
insert edge follow(degree) values "3"->"4":(90);

If I run GO 3 STEPS FROM "1" OVER follow LIMIT [1,1,1], I always get the same result "1". This test showed that:

  1. GO... LIMIT <list> always walks through the same path, probably depending on the dictionary order or the VIDs.
  2. When there is a loop, it can be stuck forever.

Is it designed to be like this?

The test nGQL are as follows.

(root@nebula) [basketballplayer]> create space test(partition_num=10,replica_factor=1,vid_type=fixed_string(32));
Execution succeeded (time spent 1670/2211 us)

Fri, 22 Oct 2021 06:09:45 UTC

(root@nebula) [basketballplayer]> use test
[ERROR (-1005)]: SpaceNotFound:

Fri, 22 Oct 2021 06:09:48 UTC

(root@nebula) [basketballplayer]> use test
Execution succeeded (time spent 511/760 us)

Fri, 22 Oct 2021 06:09:51 UTC

(root@nebula) [test]> create tag player(name string,age int);
Execution succeeded (time spent 1184/1583 us)

Fri, 22 Oct 2021 06:10:46 UTC

(root@nebula) [test]> create tag team(name string);
Execution succeeded (time spent 783/1154 us)

Fri, 22 Oct 2021 06:10:48 UTC

(root@nebula) [test]> create edge follow(degree int);
Execution succeeded (time spent 915/1181 us)

Fri, 22 Oct 2021 06:11:13 UTC

(root@nebula) [test]> insert vertex player(name,age) values "1":("Tim Duncan", 42);
Execution succeeded (time spent 1436/1942 us)

Fri, 22 Oct 2021 06:11:46 UTC

(root@nebula) [test]> insert vertex player(name,age) values "2":("Tony Parker", 36);
Execution succeeded (time spent 647/807 us)

Fri, 22 Oct 2021 06:11:46 UTC

(root@nebula) [test]> insert vertex player(name,age) values "3":("LaMarcus Aldridge", 33);
Execution succeeded (time spent 421/530 us)

Fri, 22 Oct 2021 06:11:46 UTC

(root@nebula) [test]> insert vertex player(name,age) values "4":("Rudy Gay", 32);
Execution succeeded (time spent 402/508 us)

Fri, 22 Oct 2021 06:11:46 UTC

(root@nebula) [test]> insert vertex player(name,age) values "5":("Marco Belinelli", 32);
Execution succeeded (time spent 811/1215 us)

Fri, 22 Oct 2021 06:11:48 UTC

(root@nebula) [test]> insert edge follow(degree) values "1"->"2":(95);
Execution succeeded (time spent 1252/1635 us)

Fri, 22 Oct 2021 06:13:10 UTC

(root@nebula) [test]> insert edge follow(degree) values "2"->"3":(95);
Execution succeeded (time spent 613/755 us)

Fri, 22 Oct 2021 06:13:10 UTC

(root@nebula) [test]> insert edge follow(degree) values "3"->"1":(95);
Execution succeeded (time spent 480/599 us)

Fri, 22 Oct 2021 06:13:10 UTC

(root@nebula) [test]> insert edge follow(degree) values "2"->"4":(95);
Execution succeeded (time spent 485/623 us)

Fri, 22 Oct 2021 06:13:10 UTC

(root@nebula) [test]> insert edge follow(degree) values "4"->"5":(90);
Execution succeeded (time spent 401/511 us)

Fri, 22 Oct 2021 06:13:10 UTC

(root@nebula) [test]> insert edge follow(degree) values "3"->"4":(90);
Execution succeeded (time spent 607/812 us)

Fri, 22 Oct 2021 06:13:11 UTC

(root@nebula) [test]> GO FROM "1" OVER follow LIMIT [1]
+-------------+
| follow._dst |
+-------------+
| "2"         |
+-------------+
Got 1 rows (time spent 1665/2244 us)

Fri, 22 Oct 2021 06:14:37 UTC

(root@nebula) [test]> GO FROM "1" OVER follow LIMIT [1]
+-------------+
| follow._dst |
+-------------+
| "2"         |
+-------------+
Got 1 rows (time spent 1058/1560 us)

Fri, 22 Oct 2021 06:14:41 UTC

(root@nebula) [test]> GO FROM "1" OVER follow LIMIT [1]
+-------------+
| follow._dst |
+-------------+
| "2"         |
+-------------+
Got 1 rows (time spent 814/1121 us)

Fri, 22 Oct 2021 06:14:42 UTC

(root@nebula) [test]> GO 3 STEPS FROM "1" OVER follow LIMIT [1,1,1]
+-------------+
| follow._dst |
+-------------+
| "1"         |
+-------------+
Got 1 rows (time spent 2137/2465 us)

Fri, 22 Oct 2021 06:15:21 UTC

(root@nebula) [test]> GO 3 STEPS FROM "1" OVER follow LIMIT [1,1,1]
+-------------+
| follow._dst |
+-------------+
| "1"         |
+-------------+
Got 1 rows (time spent 2023/2307 us)

Fri, 22 Oct 2021 06:15:23 UTC

(root@nebula) [test]> GO 3 STEPS FROM "1" OVER follow LIMIT [1,1,1]
+-------------+
| follow._dst |
+-------------+
| "1"         |
+-------------+
Got 1 rows (time spent 1783/1960 us)

Fri, 22 Oct 2021 06:15:24 UTC

(root@nebula) [test]> GO 3 STEPS FROM "1" OVER follow LIMIT [1,1,1]
+-------------+
| follow._dst |
+-------------+
| "1"         |
+-------------+
Got 1 rows (time spent 1485/1682 us)

Fri, 22 Oct 2021 06:15:25 UTC

(root@nebula) [test]> GO 3 STEPS FROM "1" OVER follow LIMIT [1,1,1]
+-------------+
| follow._dst |
+-------------+
| "1"         |
+-------------+
Got 1 rows (time spent 1577/1796 us)

Fri, 22 Oct 2021 06:15:26 UTC

(root@nebula) [test]> GO 3 STEPS FROM "1" OVER follow LIMIT [1,1,1]
+-------------+
| follow._dst |
+-------------+
| "1"         |
+-------------+
Got 1 rows (time spent 1760/2128 us)
@randomJoe211 randomJoe211 added the type/bug Type: something is unexpected label Oct 22, 2021
@randomJoe211 randomJoe211 changed the title LIMIT <list> in GO always return the same result and can be looped in LIMIT <list> in GO always return the same result and can be stuck in loops Oct 22, 2021
@Sophie-Xie Sophie-Xie added this to the v3.0.0 milestone Oct 25, 2021
@Shylock-Hg
Copy link
Contributor

  1. What's the problem?
  2. The detail case?

@Shylock-Hg Shylock-Hg removed the type/bug Type: something is unexpected label Oct 25, 2021
@jievince
Copy link
Contributor

jievince commented Oct 25, 2021

When there is a loop, it can be stuck forever.

How does it be stuck? Can you explain it in detail?

@randomJoe211
Copy link
Contributor Author

When there is a loop, it can be stuck forever.

How does it be stuck? Can you explain it in detail?

@jievince Suppose we have 1->2->3->1, and run GO FROM "1" OVER * LIMIT [1,1,1], the result will always be 1 itself.
If we have 1->2 and 2->1, and 1-> a number of other vertices, the first 2 rows returned are always 1 and 2, no matter how we set the list. I just think this may not be what the users would want.

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

No branches or pull requests

4 participants