You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: processor_group_by_value.go
    path of file: ./repos/benthos/internal/impl/pure
    
    the code of the file until where you have to start completion: package pure

import (
	"context"
	"fmt"

	"github.com/benthosdev/benthos/v4/internal/bloblang/field"
	"github.com/benthosdev/benthos/v4/internal/bundle"
	"github.com/benthosdev/benthos/v4/internal/component/interop"
	"github.com/benthosdev/benthos/v4/internal/component/processor"
	"github.com/benthosdev/benthos/v4/internal/log"
	"github.com/benthosdev/benthos/v4/internal/message"
	"github.com/benthosdev/benthos/v4/public/service"
)

const (
	gbvpFieldValue = "value"
)

func init() {
	err := service.RegisterBatchProcessor(
		"group_by_value", service.NewConfigSpec().
			C
    
func (g *groupByValueProc) ProcessBatch(ctx *processor.BatchProcContext, batch message.Batch) ([]message.Batch, error) {
	if batch.Len() == 0 {
		return nil, nil
	}

	groupKeys := []string{}
	groupMap := map[string]message.Batch{}

	_ = batch.Iter(func(i int, p *message.Part) error {
		v, err := g.value.String(i, batch)
		if err != nil {
			g.log.Error("Group value interpolation error: %v", err)
			err = fmt.Errorf("group value interpolation error: %w", err)
			ctx.OnError(err, i, p)
		}

		ctx.Span(i).LogKV("event", "grouped", "type", v)
		ctx.Span(i).SetTag("group", v)
		if group, exists := groupMap[v]; exists {
			groupMap[v] = append(group, p)
		} else {
			g.log.Trace("New group formed: %v\n", v)
			groupKeys = append(groupKeys, v)
			groupMap[v] = message.Batch{p}
		}
		return nil
	})

	msgs := []message.Batch{}
	for _, key := range groupKeys {
		msgs = append(msgs, groupMap[key])
	}
	if len(msgs) == 0 {
		return nil, nil
	}
	return msgs, nil
}