Skip to content
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

Support recursive operator calls for $sum aggregation accumulator #3116

Merged
merged 18 commits into from
Jul 31, 2023
Prev Previous commit
Next Next commit
wip
  • Loading branch information
noisersup committed Jul 28, 2023
commit 42ff4215f6577f43b4ffea2207d18402d4f5f2f5
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ func newSum(accumulation *types.Document) (Accumulator, error) {
}

op, err := operators.NewOperator(expr)
if err == nil {
// TODO https://github.com/FerretDB/FerretDB/issues/3129
_, err = op.Process(nil)
}

if err != nil {
var opErr operators.OperatorError
if !errors.As(err, &opErr) {
Expand Down
7 changes: 0 additions & 7 deletions internal/handlers/common/aggregations/stages/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,6 @@ func newGroup(stage *types.Document) (aggregations.Stage, error) {
return nil, processOperatorError(err)
}

newIter := iterator.Values(iterator.ForSlice([]*types.Document{nil}))
defer newIter.Close()

if _, err = accumulator.Accumulate(newIter); err != nil {
return nil, processOperatorError(err)
}

groups = append(groups, groupBy{
outputField: field,
accumulate: accumulator.Accumulate,
Expand Down