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
feat(dql): add keyword "every" to DQL #8976
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for updating the PR. This looks good to me, I have just one minor comment. I am also thinking that we should add test where every and after are used together. Thanks
f93b115
to
b3a2e9f
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one minor comment, LGTM otherwise. Is it possible for you to raise a corresponding docs PR on https://github.com/dgraph-io/dgraph-docs
I'd love to run tests locally, but the instructions in CONTRIBUTING.md seem outdated and following the instructions from
Running
|
b3a2e9f
to
52d436b
Compare
I have reworked the notion of This required to change the way |
I have managed to get tests working by setting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks much better too. One question before it is ready to go.
Signed-off-by: Enrico Minack <github@enrico.minack.dev>
Signed-off-by: Enrico Minack <github@enrico.minack.dev>
Signed-off-by: Enrico Minack <github@enrico.minack.dev>
Signed-off-by: Enrico Minack <github@enrico.minack.dev>
Signed-off-by: Enrico Minack <github@enrico.minack.dev>
Signed-off-by: Enrico Minack <github@enrico.minack.dev>
Signed-off-by: Enrico Minack <github@enrico.minack.dev>
52d436b
to
a8e9948
Compare
@mangalaman93 happy to finish #8977 once I understand the notion of having multiple |
…r sg.uidMatrix elements
Tests should all pass now, will look into docs PR next. |
@EnricoMi upgrade tests are failing but don't worry about those. They are failing because the older versions of Dgraph do not support "every" keyword. I will fix those. |
} | ||
|
||
// Re-merge the UID matrix. | ||
sg.DestUIDs = algo.MergeSorted(sg.uidMatrix) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also write unit test for applyEvery function?
I think you need to first MergeSort the entire uidMatrix and then take every ith element? Right now I don't think we will get the correct result.
@@ -988,6 +989,142 @@ func TestCascadeSubQuery1(t *testing.T) { | |||
}`, js) | |||
} | |||
|
|||
func TestHasEvery(t *testing.T) { | |||
query := `{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add this line as the first line of the test in each new test that you have added. This should fix the upgrade tests. Thanks
dgraphtest.ShouldSkipTest(t, "071c85b59fdf80ade88f4571e9cf8c867fae1f6a", dc.GetVersion())
@EnricoMi one more question, what is the use case of "every" word? Why can't we just use "random"? |
@mangalaman93 the use case is to partition the result set (the entire graph) into equi-sized partitions with one query to get boundary uids that are then used with Using offset is not an option as it has Looking at the code, the Line 2160 in 890c1f7
|
that does seem like an interesting idea. I just wonder whether it is feasible to do given that results may get filtered out later sometimes. If you want, you can look into it. Thanks for the explanation for adding 'every' to the query language. |
I may need some pointer to the code where that |
@mangalaman93 ping |
This adds the keyword
every
to DQL, which picks equidistant nodes. This provides a deterministic sample of the result that is proportional in size. It can be combined withfirst
,offset
, andafter
. Pagination is applied beforeevery
.This supersedes #8107
Docs PR: None