UID variables, cascade, and pagination with first

To reproduce: seed Dgraph (version 21.03.2) with the following data (from tutorial 2):

{
  "set":[
    {
      "name": "Michael",
      "age": 40,
      "follows": {
        "name": "Pawan",
        "age": 28,
        "follows":{
          "name": "Leyla",
          "age": 31
        }
      }
    }
  ]
}

In the first block of this query, we will select all nodes with a name, limiting the results to one node and storing the UID in the variable u. Then, the second query block will print the details for this node, accessing it by UID:

{
  var(func: has(name), first:1) {
    u as uid
  }
  results(func: uid(u)) {
    name
    age
  }
}

As expected, the query returns a single result.

Now, compare the results if @cascade is added to the first query block. I expect the same result:

{
  var(func: has(name), first:1) @cascade {
    u as uid
  }
  results(func: uid(u)) {
    name
    age
  }
}

However, now all three records are returned; it appears that pagination has not been applied when @cascade was used. In Dgraph 20.07.3, the expected behaviour (one record returned) is observed, so this looks to me like a regression.

2 Likes

Believe these are related for context. Fix a problem, create a problem…