-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
@normalize broken for >=v1.2.0 when using @facets #5241
Labels
area/facets
Issues related to face handling, querying, etc.
kind/bug
Something is broken.
status/accepted
We accept to investigate/work on it.
Comments
MichelDiz
added
area/facets
Issues related to face handling, querying, etc.
kind/bug
Something is broken.
labels
Apr 20, 2020
@ashish-goswami this is related to #4907 |
This was referenced Jun 19, 2020
ashish-goswami
added a commit
that referenced
this issue
Jul 9, 2020
Fixes: #5241 Fixes: DGRAPH-1670 This PR is related to #5690. It issues with facets response when facets are retrieved with @normalize directive. Below two cases are covered: Fixing facets response with uid/uid list predicates. Fixing facets response with scalard list predicates.
ashish-goswami
added a commit
that referenced
this issue
Jul 9, 2020
Fixes: #5241 Fixes: DGRAPH-1670 This PR fixes issue with facets when it is retrieved in a query containing @normalize directive. While forming @normalize response, we flatten a fastJsonNode and make its grand children, direct children of it. This should be valid in all of cases except when fastJsonNode is parent of facets nodes. For example consider below data: <0x1> <name> "Alice" . <0x1> <friend> "Bob" (from="college") . <0x1> <friend> "Roman" (from="school") . Also consider below query: q(func: uid(0x1)) @normalize { name: name friend: friends @facets } Expected response is: { "data": { "q": [ { "name": "Alice", "friends|from": { "0": "college", "1": "school" }, "friends": [ "Bob", "Roman" ] } ] } } But actual response is: { "data": { "q": [ { "0": "college", "1": "school", "friends": [ "Bob", "Roman" ], "name": "Alice" } ] } } Its happening because we are flattening facet parent node friends|from as well which have node "0" and "1" as children. We are solving it by having extra information in the node if it is a facets parent.
ashish-goswami
added a commit
that referenced
this issue
Jul 9, 2020
Fixes: #5241 Fixes: DGRAPH-1670 This PR fixes issue with facets when it is retrieved in a query containing @normalize directive. While forming @normalize response, we flatten a fastJsonNode and make its grand children, direct children of it. This should be valid in all of cases except when fastJsonNode is parent of facets nodes. For example consider below data: <0x1> <name> "Alice" . <0x1> <friend> "Bob" (from="college") . <0x1> <friend> "Roman" (from="school") . Also consider below query: q(func: uid(0x1)) @normalize { name: name friend: friends @facets } Expected response is: { "data": { "q": [ { "name": "Alice", "friends|from": { "0": "college", "1": "school" }, "friends": [ "Bob", "Roman" ] } ] } } But actual response is: { "data": { "q": [ { "0": "college", "1": "school", "friends": [ "Bob", "Roman" ], "name": "Alice" } ] } } Its happening because we are flattening facet parent node friends|from as well which have node "0" and "1" as children. We are solving it by having extra information in the node if it is a facets parent. (cherry picked from commit f4c28b8)
ashish-goswami
added a commit
that referenced
this issue
Jul 10, 2020
Fixes: #5241 Fixes: DGRAPH-1670 This PR fixes issue with facets when it is retrieved in a query containing @normalize directive. While forming @normalize response, we flatten a fastJsonNode and make its grand children, direct children of it. This should be valid in all of cases except when fastJsonNode is parent of facets nodes. For example consider below data: <0x1> <name> "Alice" . <0x1> <friend> "Bob" (from="college") . <0x1> <friend> "Roman" (from="school") . Also consider below query: q(func: uid(0x1)) @normalize { name: name friend: friends @facets } Expected response is: { "data": { "q": [ { "name": "Alice", "friends|from": { "0": "college", "1": "school" }, "friends": [ "Bob", "Roman" ] } ] } } But actual response is: { "data": { "q": [ { "0": "college", "1": "school", "friends": [ "Bob", "Roman" ], "name": "Alice" } ] } } Its happening because we are flattening facet parent node friends|from as well which have node "0" and "1" as children. We are solving it by having extra information in the node if it is a facets parent. (cherry picked from commit f4c28b8)
parasssh
pushed a commit
that referenced
this issue
Jul 10, 2020
Fixes: #5241 Fixes: DGRAPH-1670 This PR fixes issue with facets when it is retrieved in a query containing @normalize directive. While forming @normalize response, we flatten a fastJsonNode and make its grand children, direct children of it. This should be valid in all of cases except when fastJsonNode is parent of facets nodes. For example consider below data: <0x1> <name> "Alice" . <0x1> <friend> "Bob" (from="college") . <0x1> <friend> "Roman" (from="school") . Also consider below query: q(func: uid(0x1)) @normalize { name: name friend: friends @facets } Expected response is: { "data": { "q": [ { "name": "Alice", "friends|from": { "0": "college", "1": "school" }, "friends": [ "Bob", "Roman" ] } ] } } But actual response is: { "data": { "q": [ { "0": "college", "1": "school", "friends": [ "Bob", "Roman" ], "name": "Alice" } ] } } Its happening because we are flattening facet parent node friends|from as well which have node "0" and "1" as children. We are solving it by having extra information in the node if it is a facets parent. (cherry picked from commit f4c28b8)
arijitAD
pushed a commit
that referenced
this issue
Jul 14, 2020
Fixes: #5241 Fixes: DGRAPH-1670 This PR fixes issue with facets when it is retrieved in a query containing @normalize directive. While forming @normalize response, we flatten a fastJsonNode and make its grand children, direct children of it. This should be valid in all of cases except when fastJsonNode is parent of facets nodes. For example consider below data: <0x1> <name> "Alice" . <0x1> <friend> "Bob" (from="college") . <0x1> <friend> "Roman" (from="school") . Also consider below query: q(func: uid(0x1)) @normalize { name: name friend: friends @facets } Expected response is: { "data": { "q": [ { "name": "Alice", "friends|from": { "0": "college", "1": "school" }, "friends": [ "Bob", "Roman" ] } ] } } But actual response is: { "data": { "q": [ { "0": "college", "1": "school", "friends": [ "Bob", "Roman" ], "name": "Alice" } ] } } Its happening because we are flattening facet parent node friends|from as well which have node "0" and "1" as children. We are solving it by having extra information in the node if it is a facets parent.
dna2github
pushed a commit
to dna2fork/dgraph
that referenced
this issue
Jul 18, 2020
Fixes: dgraph-io#5241 Fixes: DGRAPH-1670 This PR fixes issue with facets when it is retrieved in a query containing @normalize directive. While forming @normalize response, we flatten a fastJsonNode and make its grand children, direct children of it. This should be valid in all of cases except when fastJsonNode is parent of facets nodes. For example consider below data: <0x1> <name> "Alice" . <0x1> <friend> "Bob" (from="college") . <0x1> <friend> "Roman" (from="school") . Also consider below query: q(func: uid(0x1)) @normalize { name: name friend: friends @facets } Expected response is: { "data": { "q": [ { "name": "Alice", "friends|from": { "0": "college", "1": "school" }, "friends": [ "Bob", "Roman" ] } ] } } But actual response is: { "data": { "q": [ { "0": "college", "1": "school", "friends": [ "Bob", "Roman" ], "name": "Alice" } ] } } Its happening because we are flattening facet parent node friends|from as well which have node "0" and "1" as children. We are solving it by having extra information in the node if it is a facets parent.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/facets
Issues related to face handling, querying, etc.
kind/bug
Something is broken.
status/accepted
We accept to investigate/work on it.
Description
@facets used to work when being normalized, but v1.2.0 introduced some nesting behavior, which gives a weird result when using @normalize with @facets
What version of Dgraph are you using?
v1.2.0
Have you tried reproducing the issue with the latest release?
Yes
What is the hardware spec (RAM, OS)?
4G, Linux
Steps to reproduce the issue (command/config used to run Dgraph).
Go to https://dgraph.io/docs/query-language/#facets-on-scalar-predicates
Try this query:
in the facets playground
Result:
Expected behaviour and actual result.
This is what used to happen on v1.1.1:
The text was updated successfully, but these errors were encountered: