# Sorting with @cascade returns empty results

**URL:** <https://discuss.dgraph.io/t/sorting-with-cascade-returns-empty-results/14841>\
**Category:** GraphQL\
**Tags:** status:accepted\
**Created:** [July 6, 2021, 1:07pm UTC](https://discuss.dgraph.io/t/sorting-with-cascade-returns-empty-results/14841 "2021-07-06T13:07:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![SamJBentley](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/samjbentley/32/6550_2.png) [@SamJBentley](https://discuss.dgraph.io/u/SamJBentley)\
**Post date:** [July 6, 2021, 1:07pm UTC](https://discuss.dgraph.io/t/sorting-with-cascade-returns-empty-results/14841/1 "2021-07-06T13:07:15Z")

</div>

## A paginated query with `order` and `@cascade` returns no results even though there are no nulls

I have simple query that I can run with pagination, filtering, sorting and `@cascade`, which returns data when `order` is not specified. When I run I run the same query with `order` it returns no results. **Note that I do not have any null values**

## What I did

This query (with `order` commented out), works. When `order` is not commented out, it returns empty data

```auto
query {
  slides: queryClinicalStudy(
    offset: 0
    first: 10
    filter: { hasStudyName: { gt: "" } }
    # order: { asc: hasStudyName }
  ) @cascade {
    hasStudyName
  }
}

```

Here is a truncated schema

```auto
interface Process {
   # Nothing interesting here
}
type ClinicalStudy implements Process {
   hasStudyName: String @search(by: [exact]) @dgraph(pred: "ClinicalStudy.hasStudyName")
}

```

Removing the @cascde works, but I don’t understand why, since we have no null values. We are using @cascade for more complicated queries and filtering. For simplicity, I have not shown it in this query

## Dgraph metadata

> **dgraph version**
>
> v21.03.0

---

<div class="post-metadata">

**Author:** ![SamJBentley](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/samjbentley/32/6550_2.png) [@SamJBentley](https://discuss.dgraph.io/u/SamJBentley)\
**Post date:** [July 7, 2021, 2:41pm UTC](https://discuss.dgraph.io/t/sorting-with-cascade-returns-empty-results/14841/2 "2021-07-07T14:41:52Z")

</div>

I should also note that we do have empty strings in `hasStudyName`, which may affect this.

For clarity, the empty strings are “” and not null

---

<div class="post-metadata">

**Author:** ![SamJBentley](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/samjbentley/32/6550_2.png) [@SamJBentley](https://discuss.dgraph.io/u/SamJBentley)\
**Post date:** [July 12, 2021, 10:04am UTC](https://discuss.dgraph.io/t/sorting-with-cascade-returns-empty-results/14841/3 "2021-07-12T10:04:42Z")

</div>

@MichelDiz, thanks for tagging this. Is this something you are looking in to? Thanks

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [July 12, 2021, 2:27pm UTC](https://discuss.dgraph.io/t/sorting-with-cascade-returns-empty-results/14841/4 "2021-07-12T14:27:35Z")

</div>

Hi, nope, I’ve just accepted it so an engineer can take a look.

Cheers.

---

<div class="post-metadata">

**Author:** ![SamJBentley](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/samjbentley/32/6550_2.png) [@SamJBentley](https://discuss.dgraph.io/u/SamJBentley)\
**Post date:** [July 30, 2021, 12:39pm UTC](https://discuss.dgraph.io/t/sorting-with-cascade-returns-empty-results/14841/5 "2021-07-30T12:39:35Z")

</div>

Hi @MichelDiz Just wondering if you’ve scheduled the time in for a developer to look into this. It is causing a prod bug for us and it would be great if someone could investigate, or provide me with an expected time.

Thanks

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [July 30, 2021, 1:54pm UTC](https://discuss.dgraph.io/t/sorting-with-cascade-returns-empty-results/14841/7 "2021-07-30T13:54:01Z")

</div>

Would be possible to share a sample of your data and the exact/similar query? So we can reproduce and tell what is happening.

Cheers.

---

<div class="post-metadata">

**Author:** ![SamJBentley](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/samjbentley/32/6550_2.png) [@SamJBentley](https://discuss.dgraph.io/u/SamJBentley)\
**Post date:** [July 30, 2021, 2:27pm UTC](https://discuss.dgraph.io/t/sorting-with-cascade-returns-empty-results/14841/8 "2021-07-30T14:27:14Z")

</div>

It’s ok, we just upgraded to v21.03.1 (from v21.03.0) and it is now working
