Skip to content

Commit

Permalink
fix(DQL): revert changes related to cascade pagination with sort (#7885)
Browse files Browse the repository at this point in the history
Fixes DGRAPH-3370.
This PR reverts the change related to `cascade with sort` which is currently causing panic on the master.

(cherry picked from commit 5ae487f)
  • Loading branch information
minhaj-shakeel committed Jun 4, 2021
1 parent 23a60d6 commit 26a2bc2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions query/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -2409,8 +2409,8 @@ func (sg *SubGraph) applyOrderAndPagination(ctx context.Context) error {
}
}

// if the @cascade directive is used then retrieve all the results.
if sg.Params.Count == 0 && len(sg.Params.Cascade.Fields) == 0 {
// Todo: fix offset for cascade queries.
if sg.Params.Count == 0 {
// Only retrieve up to 1000 results by default.
sg.Params.Count = 1000
}
Expand Down
13 changes: 13 additions & 0 deletions query/query0_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,19 @@ func TestCascadeWithPaginationAndOffsetZero(t *testing.T) {
require.JSONEq(t, `{"data":{"me":[{"name":"Rick Grimes","alive":true}]}}`, js)
}

func TestCascadeWithSort(t *testing.T) {
query := `
{
me(func: type(Person), first: 2, offset: 1, orderasc: name) @cascade{
name
alive
}
}
`
js := processQueryNoErr(t, query)
require.JSONEq(t, `{"data":{"me":[{"name": "Daryl Dixon","alive": false},{"name": "Rick Grimes","alive": true}]}}`, js)
}

func TestLevelBasedFacetVarAggSum(t *testing.T) {
query := `
{
Expand Down

0 comments on commit 26a2bc2

Please sign in to comment.