Skip to content

fix(query): handle pagination and offset for ordered cascade queries#9734

Draft
tomhollingworth wants to merge 2 commits into
dgraph-io:mainfrom
tomhollingworth:main
Draft

fix(query): handle pagination and offset for ordered cascade queries#9734
tomhollingworth wants to merge 2 commits into
dgraph-io:mainfrom
tomhollingworth:main

Conversation

@tomhollingworth

Copy link
Copy Markdown

Description

Implement missing first/offset pagination propagation from cascade directives to the parent query when ordering is applied and resolve an existing TODO comment. Effectively allowing @cascade and ordered queries to resolve for data sets with more than 1000 entries. The change also replaces hardcoded result limit of 1000 with a named constant.

Test cases were also added to prove out solution.

Background

GraphQL queries with @cascade and a order: { .. } only return the first 1000 results. This is due to the query Count being 0 - even if first: .... is set to something else, because the first / offset are moved into the query CascadeArgs and the deleted - effectively appearing as 0 and getting overridden to 1000.

Checklist

  • The PR title follows the
    Conventional Commits syntax, leading
    with fix:, feat:, chore:, ci:, etc.
  • [] Code compiles correctly and linting (via trunk) passes locally
  • Tests added for new functionality, or regression tests for bug fixes added as applicable

Replace hardcoded result limit of 1000 with a named constant.  Implement missing first/offset pagination propagation from cascade directives to the parent query when ordering is applied and resolve an existing TODO comment.

Add test cases to prove out solution.
…ips for better test scenarios

- Change shuffle-based string sorting data with deterministic pseudo-random integers for numeric sorting
- Introduce OrderedCascadeParent and OrderedCascadeChild types to validate order desc with cascading on parent-child edges
- Update schema definitions and test cases, removing unused deletion parameters
@tomhollingworth

Copy link
Copy Markdown
Author

I'm keeping this in draft until I've confirmed the additional test cases run successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant