NOTE: I’m using the GraphQL issue tag because I couldn’t find a DQL one
Report a DGraph Bug
What edition and version of Dgraph are you using?
Edition:
- SlashGraphQL
- Dgraph (community edition/Dgraph Cloud)
If you are using the community edition or enterprise edition of Dgraph, please list the version:
Dgraph Version
$ dgraph version
Dgraph version : v23.0.1
Dgraph codename : dgraph
Dgraph SHA-256 : 1d9145cf378b4e97b5f6cefd55069973c65c36f07b8e05a24b68b8ff5c5e74a4
Commit SHA-1 : 3de01e4
Commit timestamp : 2023-07-03 14:35:26 +0530
Branch : HEAD
Go version : go1.19.10
jemalloc enabled : true
Have you tried reproducing the issue with the latest release?
Yes
Steps to reproduce the issue (paste the query/schema if possible)
Schema
<endTime>: datetime @index(hour) .
<startTime>: datetime @index(hour) .
<state>: string @index(hash) .
type <ScheduleItem> {
endTime
startTime
state
}
Mutation
{
set {
<_:ScheduleItem1> <dgraph.type> "ScheduleItem" .
<_:ScheduleItem1> <endTime> "2023-07-28T12:00:00Z" .
<_:ScheduleItem1> <startTime> "2023-07-28T08:00:00Z" .
<_:ScheduleItem1> <state> "inactive" .
<_:ScheduleItem2> <dgraph.type> "ScheduleItem" .
<_:ScheduleItem2> <endTime> "2023-07-28T20:00:00Z" .
<_:ScheduleItem2> <startTime> "2023-07-28T16:00:00Z" .
<_:ScheduleItem2> <state> "inactive" .
}
}
Query
{
var(func: type(ScheduleItem), first: 1) @filter(eq(state, "active")) {
endTime as endTime
}
NextConsecutiveScheduleItem(func: type(ScheduleItem), first: 1) @filter(
eq(startTime, val(endTime))
and type(ScheduleItem)
and eq(state, "scheduled")
) {
uid
}
}
Expected behaviour and actual result.
Actual
The actual result is an error that a value was not provided.
{
"name": "t",
"url": "https://dgraph-alpha-ermine.001.001agents.com/query?timeout=20s",
"errors": [
{
"message": ": eq expects atleast 1 argument.",
"extensions": {
"code": "ErrorInvalidRequest"
}
}
]
}
Expected
I expect the query not to throw an error and instead use a null (or equivalent) value and return an empty result.
{
"data": {
"NextConsecutiveScheduleItem": []
},
}
Works if the first query block returns data
Mutation
upsert {
query {
u as var(func: type(ScheduleItem), first: 1) @filter(eq(state, "inactive"))
}
mutation {
set {
uid(u) <state> "active" .
}
}
}