Pagination param "after" does not work when using func: uid(v)

Moved from GitHub dgraph/5242

Posted by dkjii-g:

What version of Dgraph are you using?

v1.2.0

Have you tried reproducing the issue with the latest release?

Yes

What is the hardware spec (RAM, OS)?

4G, Linux

Steps to reproduce the issue (command/config used to run Dgraph).

Go to
https://dgraph.io/docs/query-language/#inequality
Try:

curl -H "Content-Type: application/graphql+-" localhost:8080/query -XPOST -d '
{
  var(func: has(name@en), first: 50) {
    test as uid
  }

  ss(func: uid(test), first: 2, after: 0x6) {
    uid
  }
}' | python -m json.tool | less

Response:

{
  "data": {
    "ss": [
      {
        "uid": "0x4"
      },
      {
        "uid": "0x6"
      }
    ]
  }
}

Expected behaviour and actual result.

Expected:
Returns uid > 0x6

MichelDiz commented :

Yeah, confirmed. It is a bug.

Tested in

Dgraph version   : v20.03.0
Dgraph SHA-256   : e0710c6112cb63a03648e3e49f220b563bab0e35db1fcfc3bbfe8f060384e96a
Commit SHA-1     : 147c8df9
Commit timestamp : 2020-03-30 17:28:31 -0700
Branch           : HEAD
Go version       : go1.14.1

Maybe the fix should be backported to v1.2.0.

Query used in my side

{
  actual_result(func: uid(test), first: 2, after: 0x1efe25) {
    uid
    objectName
  }
  Expected(func: has(objectName), first: 2, after: 0x1efe25) {
    uid
    objectName
  }
  varg(func: has(objectName), first: 50) {
    test as uid
    objectName
  }
}

Result

{
  "data": {
    "actual_result": [
      {
        "uid": "0x1efe21",
        "objectName": "Object 1"
      },
      {
        "uid": "0x1efe22",
        "objectName": "Object 2"
      }
    ],
    "Expected": [
      {
        "uid": "0x1efe26",
        "objectName": "Object 6"
      },
      {
        "uid": "0x1efe27",
        "objectName": "Object 7"
      }
    ],
    "varg": [
      {
        "uid": "0x1efe21",
        "objectName": "Object 1"
      },
      {
        "uid": "0x1efe22",
        "objectName": "Object 2"
      },
      {
        "uid": "0x1efe23",
        "objectName": "Object 3"
      },
      {
        "uid": "0x1efe24",
        "objectName": "Object 4"
      },
      {
        "uid": "0x1efe25",
        "objectName": "Object 5"
      },
      {
        "uid": "0x1efe26",
        "objectName": "Object 6"
      },
      {
        "uid": "0x1efe27",
        "objectName": "Object 7"
      }
    ]
  }
}

Dataset

{
      "set": [
        {
          "objectName": "Object 1"
        },
        {
          "objectName": "Object 2"
        },
        {
          "objectName": "Object 3"
        },
        {
          "objectName": "Object 4"
        },
        {
          "objectName": "Object 5"
        },
        {
          "objectName": "Object 6"
        },
        {
          "objectName": "Object 7"
        }
      ]
    }

Fixed by this PR: Pagination param "after" does not work when using func: uid(v) by antblood · Pull Request #6365 · dgraph-io/dgraph · GitHub