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

A query with an offset and no limit is returning only one result #705

Closed
fredcarle opened this issue Aug 2, 2022 · 2 comments · Fixed by #706
Closed

A query with an offset and no limit is returning only one result #705

fredcarle opened this issue Aug 2, 2022 · 2 comments · Fixed by #706
Assignees
Labels
area/planner Related to the planner system bug Something isn't working
Milestone

Comments

@fredcarle
Copy link
Collaborator

A query of the form:

query {
  user(offset: 2) {
    age
	name
  }
}

is currently only returning one result even if the database contains multiple documents

@fredcarle fredcarle added bug Something isn't working area/planner Related to the planner system labels Aug 2, 2022
@fredcarle fredcarle added this to the DefraDB v0.3 milestone Aug 2, 2022
@fredcarle fredcarle self-assigned this Aug 2, 2022
@jsimnz
Copy link
Member

jsimnz commented Aug 2, 2022

Problem lies here:

if n.rowIndex-n.offset >= n.limit {

Can be solved with:

limit := int64(math.MaxInt64)
if n.Limit > 0 {
  limit = n.Limit
}

Basically, it assumes a limit of 0 by default. Changed to math.MaxUint64 by default

This is on HardLimitNode, also needs to be set on RenderLimitNode

@fredcarle
Copy link
Collaborator Author

Creating the PR as your posted this @jsimnz :)

fredcarle added a commit that referenced this issue Aug 2, 2022
… and offset (#706)

Relevant issue(s)
Resolves #705

Description
This PR solves a situation where setting an offset to the query without setting a limit would yield a single result.
shahzadlone pushed a commit to shahzadlone/defradb that referenced this issue Feb 23, 2024
… and offset (sourcenetwork#706)

Relevant issue(s)
Resolves sourcenetwork#705

Description
This PR solves a situation where setting an offset to the query without setting a limit would yield a single result.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/planner Related to the planner system bug Something isn't working
Projects
None yet
2 participants