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

feat(dql): add random keyword in DQL (#7693) #8977

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

mangalaman93
Copy link
Contributor

This change implements the random function argument. If an argument random: k is provided to a dql function then random k results will be returned.

For example:
func(has(name), random:5) will choose 5 random nodes having the name predicate.

This change implements the `random` function argument.
If an argument `random: k` is provided to a dql function then
random k results will be returned.

For example:
`func(has(name), random:5)` will choose 5 random nodes having
the name predicate.
@dgraph-bot dgraph-bot added area/querylang Issues related to the query language specification and implementation. area/core internal mechanisms go Pull requests that update Go code labels Aug 25, 2023
numRandom = len(uidList)
}

sg.uidMatrix[i].Uids = uidList[:numRandom]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uids in sg.uidMatrix[i].Uids are not sorted any more. I presume algo.MergeSorted(sg.uidMatrix) requires that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core internal mechanisms area/querylang Issues related to the query language specification and implementation. go Pull requests that update Go code
Development

Successfully merging this pull request may close these issues.

None yet

3 participants