Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with count and Aliases. #3814

Closed
MichelDiz opened this issue Aug 14, 2019 · 2 comments · Fixed by #3837
Closed

Bug with count and Aliases. #3814

MichelDiz opened this issue Aug 14, 2019 · 2 comments · Fixed by #3837
Assignees
Labels
area/parsing Issues related to the parser or lexer. kind/bug Something is broken. priority/P0 Critical issue that requires immediate attention.

Comments

@MichelDiz
Copy link
Contributor

If you suspect this could be a bug, follow the template.

  • What version of Dgraph are you using?
    Dgraph v1.1 RC 1

  • Have you tried reproducing the issue with latest release?
    yes

  • What is the hardware spec (RAM, OS)?
    Windows

  • Steps to reproduce the issue (command/config used to run Dgraph).
    Just run this query below.

curl localhost:8080/query -H "Content-Type: application/graphql+-" -XPOST -d '{
  nodeCount(func: has(<director.film>)) {
    nodeCount: count(uid)
    name@en
  }
}'

It happens with curl, in Ratel and so on.

  • Expected behaviour and actual result.

The predicate name in the right place instead of the "count" alias.

obs. Changing the positions we can have the desired result

{
  nodeCount(func: has(<director.film>)) {
    #nodeCount: count(uid)
    name@en
    nodeCount: count(uid)
  }
}
@MichelDiz MichelDiz added kind/bug Something is broken. area/parsing Issues related to the parser or lexer. labels Aug 15, 2019
@pawanrawal pawanrawal self-assigned this Aug 19, 2019
@pawanrawal pawanrawal added the priority/P0 Critical issue that requires immediate attention. label Aug 19, 2019
@pawanrawal
Copy link
Contributor

I was able to reproduce the issue and am looking into a fix now.

@pawanrawal
Copy link
Contributor

pawanrawal commented Aug 19, 2019

Here is a sample query and response which demonstrates the problem.

Query
---
{
  nodeCount(func: has(<director.film>), first: 10) {
    randomCount: count(uid)
    name@en
  }
}

Response
---
{
  "extensions": {
    "server_latency": {
      "parsing_ns": 7037,
      "processing_ns": 62411423,
      "encoding_ns": 142494
    },
    "txn": {
      "start_ts": 23369555
    }
  },
  "data": {
    "nodeCount": [
      {
        "randomCount": 10
      },
      {
        "randomCount": "Janis Cole"
      },
      {
        "randomCount": "Francisco Payó González"
      },
      {
        "randomCount": "Jim Powers"
      },
      {
        "randomCount": "Gulzar"
      },
      {
        "randomCount": "H.W. Poschauk"
      },
      {
        "randomCount": "Robert Cicchini"
      },
      {
        "randomCount": "Niki Karimi"
      },
      {
        "randomCount": "Leetal Platt"
      },
      {
        "randomCount": "Costas Sfikas"
      },
      {
        "randomCount": "Chris Chan Lee"
      }
    ]
  }
}

Notice how instead of the name, randomCount is returned as the key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/parsing Issues related to the parser or lexer. kind/bug Something is broken. priority/P0 Critical issue that requires immediate attention.
Development

Successfully merging a pull request may close this issue.

2 participants