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

Filter may override root query in v0.8.1 #1455

Closed
zhicwu opened this issue Sep 13, 2017 · 1 comment
Closed

Filter may override root query in v0.8.1 #1455

zhicwu opened this issue Sep 13, 2017 · 1 comment
Assignees
Labels
kind/bug Something is broken.
Milestone

Comments

@zhicwu
Copy link

zhicwu commented Sep 13, 2017

Steps to reproduce:

  • schema and test data
mutation {
  schema {
    test_key: string @index(exact) .
    test_value: string @index(exact) .
  }
  set {
    _:test_1 <test_key> "key1" .
    _:test_1 <test_value> "value1" .
    _:test_2 <test_key> "key2" .
    _:test_2 <test_value> "value2" .
  }
}
  • query
{
  v as var(func: eq(test_key, "key1")) @filter(eq(test_key, "key2"))
}
{
  q(func: uid(v)) {
    test_key
    test_value
  }
}
  • actual response - should be empty?
{
  "data": {
    "q": [
      {
        "_uid_": "0x11945",
        "test_key": "key2",
        "test_value": "value2"
      }
    ],
    "server_latency": {
      "processing": "310µs",
      "json": "104µs",
      "total": "604µs",
      "parsing": "184µs"
    }
  }
}
@pawanrawal pawanrawal self-assigned this Sep 13, 2017
@pawanrawal pawanrawal added the kind/bug Something is broken. label Sep 13, 2017
@pawanrawal pawanrawal added this to the v0.8.2 milestone Sep 13, 2017
@pawanrawal
Copy link
Contributor

Thanks for the report @zhicwu. Seems to be a bug with variable assignment as the below query gives the expected result.

{
  me(func: eq(test_key, "key1")) @filter(eq(test_key, "key2")) {
    test_key
    test_value
  }
}

I suspect variable is being assigned without applying the filters.

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

Successfully merging a pull request may close this issue.

3 participants