Skip to content

Commit

Permalink
fixup! Add support for top level aggregates
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewSisley committed Jul 8, 2022
1 parent f462921 commit d402aa1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion query/graphql/planner/top.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
package planner

import (
"errors"

"github.com/sourcenetwork/defradb/core"
"github.com/sourcenetwork/defradb/query/graphql/mapper"
parserTypes "github.com/sourcenetwork/defradb/query/graphql/parser/types"
Expand Down Expand Up @@ -146,10 +148,13 @@ func (n *topLevelNode) Next() (bool, error) {
// This Next will always return a value, as it's source is this node!
// Even if it adds nothing to the current currentValue, it should still
// yield it unchanged.
_, err := child.Next()
hasChild, err := child.Next()
if err != nil {
return false, err
}
if !hasChild {
return false, errors.New("Expected child value, however none was yielded")
}

n.currentValue = child.Value()
}
Expand Down

0 comments on commit d402aa1

Please sign in to comment.