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

Math >= seems to behave like > #2362

Closed
cajus opened this issue Apr 26, 2018 · 1 comment
Closed

Math >= seems to behave like > #2362

cajus opened this issue Apr 26, 2018 · 1 comment
Assignees
Labels
kind/bug Something is broken.

Comments

@cajus
Copy link

cajus commented Apr 26, 2018

  • What version of Dgraph are you using?
    Docker image of v1.0.5

  • Have you tried reproducing the issue with latest release?
    It's the latest release. Not tested with git HEAD.

  • What is the hardware spec (RAM, OS)?
    Running in a local minikube on Fedora. I don't think that RAM matters in the current setup as there are only a couple of entries in the test DB.

  • Steps to reproduce the issue (command/config used to run Dgraph).
    dgraph server --my=$(hostname -f):7080 --lru_mb 1024 --zero dgraph-zero-0.dgraph-zero.default.svc.cluster.local:5080

  • Expected behaviour and actual result.

The schema:

    container: uid @reverse .
    user: uid .
    device: uid .

The contents:

    _:root <name> "/" .
    _:root <container> _:c .

    _:c <name> "Foobar" .

The non @normalize query:

{
  q(func: eq(name, "/")) {
    containerCount as count(container)
    userCount as count(user)
    deviceCount as count(device)
    hasChildren: math(containerCount + userCount + deviceCount >= 1)
  }
}

The result (stripped):

 "q": [
      {
        "count(container)": 1,
        "count(user)": 0,
        "count(device)": 0,
        "hasChildren": false
      }
    ]

As the containerCount is 1 and the others are 0, I'd expect hasChildren to be true in case of the given query. Please correct me if this expectation is wrong for some reason I don't understand yet :-)

Using math(containerCount + userCount + deviceCount > 0) results in true - which is expected.

@pawanrawal pawanrawal added investigate Requires further investigation kind/bug Something is broken. and removed investigate Requires further investigation labels Apr 29, 2018
@pawanrawal
Copy link
Contributor

PR: #2365

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something is broken.
Development

No branches or pull requests

3 participants