-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
area/querylangIssues related to the query language specification and implementation.Issues related to the query language specification and implementation.area/querylang/groupbyIssues related to the @groupby directive.Issues related to the @groupby directive.kind/enhancementSomething could be better.Something could be better.priority/P2Somehow important but would not block a release.Somehow important but would not block a release.status/acceptedWe accept to investigate/work on it.We accept to investigate/work on it.
Milestone
Description
It would be great to be able to group by nested fields.
For example, when data is structured like that:
mutation {
schema {
name: string @index(hash) .
geoPoint: geo .
}
set {
_:company1 <name> "Company A" .
_:company1 <pickupFrom> _:company1_pickup_from .
_:company1 <deliverTo> _:company1_deliver_to .
_:company1_pickup_from <geoPoint> "{'type':'Point','coordinates':[0.0,0.0]}" .
_:company1_deliver_to <geoPoint> "{'type':'Point','coordinates':[10.0,11.0]}" .
_:company2 <name> "Company A" .
_:company2 <pickupFrom> _:company2_pickup_from .
_:company2 <deliverTo> _:company2_deliver_to .
_:company2_pickup_from <geoPoint> "{'type':'Point','coordinates':[0.0,0.0]}" .
_:company2_deliver_to <geoPoint> "{'type':'Point','coordinates':[10.0,11.0]}" .
_:company3 <name> "Company A" .
_:company3 <pickupFrom> _:company3_pickup_from .
_:company3 <deliverTo> _:company3_deliver_to .
_:company3_pickup_from <geoPoint> "{'type':'Point','coordinates':[0.0,0.0]}" .
_:company3_deliver_to <geoPoint> "{'type':'Point','coordinates':[13.0,14.0]}" .
}
}
Query might be something like that:
{
q(func: eq(name, "Company A")) @groupby(<pickupFrom>.<geoPoint>, <deliverTo>.<geoPoint>) {
count(_uid_)
}
}
Expected result something like that:
[
{
pickupFrom: {'type':'Point','coordinates':[0.0,0.0]},
deliverTo: {'type':'Point','coordinates':[10.0,11.0]},
count: 2
},
{
pickupFrom: {'type':'Point','coordinates':[0.0,0.0]},
deliverTo: {'type':'Point','coordinates':[13.0,14.0]},
count: 1
}
]
Metadata
Metadata
Assignees
Labels
area/querylangIssues related to the query language specification and implementation.Issues related to the query language specification and implementation.area/querylang/groupbyIssues related to the @groupby directive.Issues related to the @groupby directive.kind/enhancementSomething could be better.Something could be better.priority/P2Somehow important but would not block a release.Somehow important but would not block a release.status/acceptedWe accept to investigate/work on it.We accept to investigate/work on it.