Skip to content

Commit

Permalink
feat: working on initial version of groupBy
Browse files Browse the repository at this point in the history
  • Loading branch information
Iván Corrales Solera committed Jan 12, 2019
1 parent 39f777c commit 39ecd4f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions internal/groupby/groupBy.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ func (op *GroupBy) Run() (reflect.Value, *errors.Error) {
return reflect.ValueOf(nil), errors.UserError(OpCode, result[1].Interface().(error))
}
}
valKey := reflect.ValueOf(output)
keyContent := output.MapIndex(valKey)
keyContent := output.MapIndex(output)
if keyContent.IsNil() {
output.SetMapIndex(valKey, reflect.ValueOf([]interface{}{val}))
output.SetMapIndex(output, reflect.ValueOf([]interface{}{val}))
} else {
output.SetMapIndex(valKey, reflect.AppendSlice(keyContent, val))
output.SetMapIndex(output, reflect.AppendSlice(keyContent, val))
}
}
return output, nil
Expand Down

0 comments on commit 39ecd4f

Please sign in to comment.