Moved from GitHub dgraph/4024
Posted by animesh2049:
What version of Dgraph are you using?
version: 5b20d411f7cb21fe575503e70f60ca48bb794bb1
Steps to reproduce the issue and expected behaviour and actual result.
Behavior of aggregators is not clear when used with @cascade
.
Data:
_:animesh <name> "Animesh" .
_:ashish <name> "Ashish" .
_:aman <name> "Aman" .
_:prashant <name> "Prashant" .
_:animesh <age> "24" .
_:ashish <age> "27" .
_:aman <age> "26" .
_:animesh <friend> _:ashish .
_:ashish <friend> _:aman .
_:aman <friend> _:prashant .
query:
{
var(func: has(name)) @cascade {
friend {
age_var as age
friend {
age
}
}
}
me() {
min(val(age_var))
}
}
Response:
{
"data": {
"me": [
{
"min(val(age))": 26
}
]
},
"extensions": {
"server_latency": {
"parsing_ns": 28933,
"processing_ns": 7890307,
"encoding_ns": 5757,
"assign_timestamp_ns": 652749
},
"txn": {
"start_ts": 154
}
}
}
age_var
should only contain those nodes, whose friend's
have age and friend's friend
have age
. Here root query will have uids of animesh, ashish, aman, prashant
,
animesh --(friend)----> ashish (name: "Ashish", age(aliased as age): 27) --(friend)--> aman (name: "Aman", age: 26)
ashish --(friend)--> aman (name: "Aman", age(aliased as age): 26) --(friend)--> prashant(name: "Prashant") # Prashant doesn't have age so this should be filtered out due to cascade
aman --(friend)--> prashant(name: "Prashant") # This should also be filtered
prashant # This should also be filtered
So age_var
should only have uid of ashish
and min(val(age))
should be 27, but we are getting 26 which is aman's age
.
Right now it seems @cascade
is being ignored.