-
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
Query variable for query block not recognised after upgrading to 1.1.0 #4038
Comments
For now, there is a way around this (I just noticed that you are already using it*). If you execute the query below in https://play.dgraph.io/?latest you gonna have the expected result. This happens cuz the This approach below has no performance losses or any other issues. {
count as var(func:type(Actor))
actorCount(func:uid(count)) {
total: count(uid)
}
q(func:uid(count)) @filter(eq(name@en, "Michael")) {
expand(_all_)
}
} {
"data": {
"actorCount": [
{
"total": 478908
}
],
"q": [
{
"name@en": "Michael"
},
{
"name@en": "Michael"
},
{
"name@en": "Michael",
"name@ko": "마이클",
"name@ro": "Michael"
},
{
"name@en": "Michael",
"name@hi": "माइकल"
},
{
"name@en": "Michael"
},
{
"name@en": "Michael"
},
{
"name@en": "Michael",
"name@fr": "Michael",
"name@ja": "まいける"
},
{
"name@en": "Michael"
}
]
},
"extensions": {
"server_latency": {
"parsing_ns": 9302,
"processing_ns": 68891161,
"encoding_ns": 73507892
},
"txn": {
"start_ts": 1366718
}
}
} |
Thanks for the quick response. I'm waiting for the fix. Do you plan to do have it ready until 1.1.1 already? |
No plans, it has 23 hours :P - but it's Cheers. |
I still am looking into this, seems like we do not allow query alias along with alias for |
I tried the following query -
It should fail with parsing errors saying that we have defined more variables than in use. But it runs successfully. Trying to figure out what is the right design here, whether we support something like this. |
In order to clarify the example, let's change the name of the variable to avoid confusion with the {
people as personCount(func:type(Person)) {
total: count(uid)
}
allPerson(func:uid(people)) {
name
}
} This should return {
"data": {
"personCount": {
"total": 3,
},
"allPerson": [
{
"name": "Michael"
},
{
"name": "Catalina"
},
{
"name": "Sarah"
}
]
},
"extensions": { ... }
} This doesn't currently work, because the variable On the other hand, if we comment out the {
people as personCount(func:type(Person)) {
# total: count(uid)
}
allPerson(func:uid(people)) {
name
}
} Copy Text to Clipboard
{
"data": {
"personCount": [],
"allPerson": [
{
"name": "Michael"
},
{
"name": "Catalina"
},
{
"name": "Sarah"
}
]
},
"extensions": { ... }
} Not sure whether having multiple aliases to |
The root cause for this issue is the line here https://github.com/dgraph-io/dgraph/blob/master/gql/parser.go#L2848 The multiple aliases to This regression was introduced in the PR #2947 |
Hey @mangalaman93, do you have any updates on this issue? |
I was working on another issue. I will work on a solution for this issue today. I already have a plan in mind to fix it. |
I am still trying to figure out a clean fix for the issue. The current implementation is restrictive in some ways, including this bug and requires a more thorough investigation of the issue. I have understood the root cause of the issue and should have a fix soon. |
What version of Dgraph are you using?
1.1.0 and master
Have you tried reproducing the issue with the latest release?
Yes.
What is the hardware spec (RAM, OS)?
MacBook Pro 15, Mac OS Mojave
Steps to reproduce the issue (command/config used to run Dgraph).
Load the schema and data from tutorial in a clean database (http://tour.dgraph.io/intro/3/ and http://tour.dgraph.io/intro/3/) and execute following query:
Produces following error:
In comparison following query works fine.
and produces that result:
Expected behaviour and actual result.
The variable should be recognised and the query successfully executed. In Version 1.0.16 this still worked.
The text was updated successfully, but these errors were encountered: