Desktop (please complete the following information):
if Containerization (please complete the following information):
Describe the bug
When using has(predicate) in queries we have strange results. After some debugging I found that many nodes without having the predicate were included in results.
The ones I have identified had the predicates removed.
This happens with dates, but I have not tested other predicate types.
To Reproduce
Steps to reproduce the behavior:
{
broken(func: has(obj.date_ended)) {
uid
obj.date_ended
}
}
returns
{
"uid": "0x5184"
},
{
"uid": "0x618c"
},
{
"uid": "0x6a65"
},
{
"uid": "0x9c37"
},
{
"uid": "0x9d28"
},
...
Expected behavior
not receiving nodes where predicates don't exist
Additional context
This is a fresh install of dgraph with all data added today using the dgo driver using api.NQuad
Duplicated of https://github.com/dgraph-io/dgraph/issues/2212
Should be fixed by 999a4e0c42b9a10c4111de52eb5703ad682a2bbe.
Is related to https://github.com/dgraph-io/dgraph/issues/2484
"This is a bug with has queries where empty PL's are not ignored." pawanrawal.
@slawo In this case, you are using @reverse?
It seems related but it happens in v1.0.8 so I did not bother linking this.
Also I have not tried this on other predicate types.
The issue is quite important as I use has() to filter data. In most cases on dates I'm able to use le(predicate, CURRENT_DATE) to get away with it but in some cases I need not has() and there I don't believe I can go around the issue.
The point is that it should have been fixed.
If you can make a sample mutation, the way you use it. Would help.
Mostly we need to know if you are using @reverse in your schema. At the level using "has".
We need to know why it's happening. Since we have a fix 999a4e0c42b9a10c4111de52eb5703ad682a2bbe .
However, in any case by your report its seem to be 80% chance of being duplicated.
We changed the way Posting List Deletions are happening, so maybe that's causing it. Needs investigation.
This should now be fixed. Can you test, @slawo ?
Hey @manishrjain I did a test with image: 'dgraph/dgraph:v1.0.9-rc1' and is working as expected.
{
"set": [
{
"obj.date_ended": "2018-08-14T11:56:46Z"
},
{
"obj.date_ended": "2018-08-14T11:56:46Z"
},
{
"obj.date_ended": "2018-08-14T11:56:46Z"
},
{
"obj.date_ended": "2018-08-14T11:56:46Z"
},
{
"obj.date_ended": "2018-08-14T11:56:46Z"
}
]
}
```js
{
delete {
<0x1>
<0x4>
<0x7>
<0x8>
<0x9>
}
}
And tried too
```JS
{
delete {
<0x1> * * .
<0x4> * * .
<0x7> * * .
<0x8> * * .
<0x9> * * .
}
}
Thanks, @MichelDiz !