ronantakizawa/codereview-bench huggingface dataset:
Repository: pingcap/tidb
File: pkg/ddl/rollingback.go (Go)

Code before:
	constraintInfo.State = model.StatePublic
	if job.IsRollingback() {
		job.State = model.JobStateRollbackDone
	}
	ver, err = updateVersionAndTableInfoWithCheck(jobCtx, job, tblInfo, true)
	return ver, errors.Trace(err)
}

func rollbackModifySchemaReadOnly(jobCtx *jobContext, job *model.Job) (ver int64, err error) {
	dbInfo, err := jobCtx.metaMut.GetDatabase(job.SchemaID)
	if err != nil {
		return ver, errors.Trace(err)
	}
	args, err := model.GetModifySchemaArgs(job)
	if err != nil {
		job.State = model.JobStateCancelled
		return ver, errors.Trace(err)
	}
	dbInfo.ReadOnly = !args.ReadOnly
	if err = jobCtx.metaMut.UpdateDatabase(dbInfo); err != nil {
		job.State = model.JobStateCancelled
		return ver, errors.Trace(err)
	}
	if ver, err = updateSchemaVersion(jobCtx, job); err != nil {
		return ver, errors.Trace(err)
	}
	job.State = model.JobStateRollbackDone
	return ver, nil
}


Review comment (suggestion):
seems other similar method change to `job.State = model.JobStateRollingback`

Code after:
	constraintInfo.State = model.StatePublic
	if job.IsRollingback() {
		job.State = model.JobStateRollbackDone
	}
	ver, err = updateVersionAndTableInfoWithCheck(jobCtx, job, tblInfo, true)
	return ver, errors.Trace(err)
}

func rollbackModifySchemaReadOnly(jobCtx *jobContext, job *model.Job) (ver int64, err error) {
	dbInfo, err := jobCtx.metaMut.GetDatabase(job.SchemaID)
	if err != nil {
		return ver, errors.Trace(err)
	}
	args, err := model.GetModifySchemaArgs(job)
	if err != nil {
		job.State = model.JobStateCancelled
		return ver, errors.Trace(err)
	}
	dbInfo.ReadOnly = !args.ReadOnly
	if err = jobCtx.metaMut.UpdateDatabase(dbInfo); err != nil {
		return ver, errors.Trace(err)
	}
	if ver, err = updateSchemaVersion(jobCtx, job); err != nil {
		return ver, errors.Trace(err)
	}
	job.State = model.JobStateRollbackDone
	job.SchemaState = model.StateNone
	return ver, nil
}
Repository: pingcap/tidb
File: pkg/ddl/rollingback.go (Go)

Code before:
		return ver, dbterror.ErrCancelledDDLJob
	}

	// Only alter check constraints ENFORCED can get here.
	constraintInfo.Enforced = !enforced
	constraintInfo.State = model.StatePublic
	if job.IsRollingback() {
		job.State = model.JobStateRollbackDone
	}
	ver, err = updateVersionAndTableInfoWithCheck(jobCtx, job, tblInfo, true)
	return ver, errors.Trace(err)
}

func rollbackModifySchemaReadOnly(jobCtx *jobContext, job *model.Job) (ver int64, err error) {
	dbInfo, err := jobCtx.metaMut.GetDatabase(job.SchemaID)
	if err != nil {
		return ver, errors.Trace(err)
	}
	args, err := model.GetModifySchemaArgs(job)
	if err != nil {
		job.State = model.JobStateCancelled
		return ver, errors.Trace(err)
	}
	dbInfo.ReadOnly = !args.ReadOnly
	if err = jobCtx.metaMut.UpdateDatabase(dbInfo); err != nil {
		job.State = model.JobStateCancelled
		return ver, errors.Trace(err)
	}
	if ver, err = updateSchemaVersion(jobCtx, job); err != nil {
		return ver, errors.Trace(err)
	}
	job.State = model.JobStateRollbackDone
	return ver, nil
}


Review comment (suggestion):
is this necessary, seems not all error will set the state, such as `rollingbackAddColumn`

Code after:
		return ver, dbterror.ErrCancelledDDLJob
	}

	// Only alter check constraints ENFORCED can get here.
	constraintInfo.Enforced = !enforced
	constraintInfo.State = model.StatePublic
	if job.IsRollingback() {
		job.State = model.JobStateRollbackDone
	}
	ver, err = updateVersionAndTableInfoWithCheck(jobCtx, job, tblInfo, true)
	return ver, errors.Trace(err)
}

func rollbackModifySchemaReadOnly(jobCtx *jobContext, job *model.Job) (ver int64, err error) {
	dbInfo, err := jobCtx.metaMut.GetDatabase(job.SchemaID)
	if err != nil {
		return ver, errors.Trace(err)
	}
	args, err := model.GetModifySchemaArgs(job)
	if err != nil {
		job.State = model.JobStateCancelled
		return ver, errors.Trace(err)
	}
	dbInfo.ReadOnly = !args.ReadOnly
	if err = jobCtx.metaMut.UpdateDatabase(dbInfo); err != nil {
		return ver, errors.Trace(err)
	}
	if ver, err = updateSchemaVersion(jobCtx, job); err != nil {
		return ver, errors.Trace(err)
	}
	job.State = model.JobStateRollbackDone
	job.SchemaState = model.StateNone
	return ver, nil
}
Repository: pingcap/tidb
File: pkg/ddl/rollingback.go (Go)

Code before:
	constraintInfo.State = model.StatePublic
	if job.IsRollingback() {
		job.State = model.JobStateRollbackDone
	}
	ver, err = updateVersionAndTableInfoWithCheck(jobCtx, job, tblInfo, true)
	return ver, errors.Trace(err)
}

func rollbackModifySchemaReadOnly(jobCtx *jobContext, job *model.Job) (ver int64, err error) {
	dbInfo, err := jobCtx.metaMut.GetDatabase(job.SchemaID)
	if err != nil {
		return ver, errors.Trace(err)
	}
	args, err := model.GetModifySchemaArgs(job)
	if err != nil {
		job.State = model.JobStateCancelled
		return ver, errors.Trace(err)
	}
	dbInfo.ReadOnly = !args.ReadOnly
	if err = jobCtx.metaMut.UpdateDatabase(dbInfo); err != nil {
		return ver, errors.Trace(err)
	}
	if ver, err = updateSchemaVersion(jobCtx, job); err != nil {
		return ver, errors.Trace(err)
	}
	job.State = model.JobStateRollingback
	return ver, nil
}


Review comment (suggestion):
```suggestion
	job.State = model.JobStateRollbackDone
	job.SchemaState = model.StateNone
```
Maybe we can update state here directly.

Code after:
	constraintInfo.State = model.StatePublic
	if job.IsRollingback() {
		job.State = model.JobStateRollbackDone
	}
	ver, err = updateVersionAndTableInfoWithCheck(jobCtx, job, tblInfo, true)
	return ver, errors.Trace(err)
}

func rollbackModifySchemaReadOnly(jobCtx *jobContext, job *model.Job) (ver int64, err error) {
	dbInfo, err := jobCtx.metaMut.GetDatabase(job.SchemaID)
	if err != nil {
		return ver, errors.Trace(err)
	}
	args, err := model.GetModifySchemaArgs(job)
	if err != nil {
		job.State = model.JobStateCancelled
		return ver, errors.Trace(err)
	}
	dbInfo.ReadOnly = !args.ReadOnly
	if err = jobCtx.metaMut.UpdateDatabase(dbInfo); err != nil {
		return ver, errors.Trace(err)
	}
	if ver, err = updateSchemaVersion(jobCtx, job); err != nil {
		return ver, errors.Trace(err)
	}
	job.State = model.JobStateRollbackDone
	job.SchemaState = model.StateNone
	return ver, nil
}
Repository: pingcap/tidb
File: pkg/store/mockstore/unistore/tikv/dbreader/db_reader.go (Go)

Code before:
	}
	skipValue := proc.SkipValue()
	iter := r.GetIter()
	var cnt int
	var err error
	for iter.Seek(startKey); iter.Valid(); iter.Next() {
		item := iter.Item()
		key := item.Key()
		if exceedEndKey(key, endKey) {
			break
		}
		err = r.CheckWriteItemForRcCheckTSRead(startTS, item)
		if err != nil {
			return errors.Trace(err)
		}
		if item.IsEmpty() {
			continue
		}
		var val []byte
		if !skipValue {
			val, err = item.Value()
			if err != nil {
				return errors.Trace(err)
			}
		}
		err = proc.Process(key, val)
		if err != nil {
			if err == ErrScanBreak {
				break
			}
			return errors.Trace(err)
		}
		cnt++
		if cnt >= limit {
			break
		}
	}
	return nil
}

// GetKeyByStartTs gets a key with the start ts.
func (r *DBReader) GetKeyByStartTs(startKey, endKey []byte, startTs uint64) ([]byte, error) {
	iter := r.GetIter()
	iter.SetAllVersions(true)
	for iter.Seek(startKey); iter.Valid(); iter.Next() {
		curItem := iter.Item()
		curKey := curItem.Key()
		if len(endKey) != 0 && bytes.Compare(curKey, endKey) >= 0 {
			break
		}
		meta := mvcc.DBUserMeta(curItem.UserMeta())

Review comment (suggestion):
The real change is just this line ... passing commit ts 
All other changes are interface change related.

Code after:
	}
	skipValue := proc.SkipValue()
	iter := r.GetIter()
	var cnt int
	var err error
	for iter.Seek(startKey); iter.Valid(); iter.Next() {
		item := iter.Item()
		key := item.Key()
		if exceedEndKey(key, endKey) {
			break
		}
		err = r.CheckWriteItemForRcCheckTSRead(startTS, item)
		if err != nil {
			return errors.Trace(err)
		}
		if item.IsEmpty() {
			continue
		}
		var val []byte
		if !skipValue {
			val, err = item.Value()
			if err != nil {
				return errors.Trace(err)
			}
		}
		err = proc.Process(key, val, item.Version())
		if err != nil {
			if err == ErrScanBreak {
				break
			}
			return errors.Trace(err)
		}
		cnt++
		if cnt >= limit {
			break
		}
	}
	return nil
}

// GetKeyByStartTs gets a key with the start ts.
func (r *DBReader) GetKeyByStartTs(startKey, endKey []byte, startTs uint64) ([]byte, error) {
	iter := r.GetIter()
	iter.SetAllVersions(true)
	for iter.Seek(startKey); iter.Valid(); iter.Next() {
		curItem := iter.Item()
		curKey := curItem.Key()
		if len(endKey) != 0 && bytes.Compare(curKey, endKey) >= 0 {
			break
		}
		meta := mvcc.DBUserMeta(curItem.UserMeta())
Repository: pingcap/tidb
File: pkg/disttask/framework/metering/metering.go (Go)

Code before:
}

// WriteMeterData writes the metering data.
func (m *Meter) WriteMeterData(ctx context.Context, ts int64, uuid string, items []map[string]any) error {
	failpoint.InjectCall("forceTSAtMinuteBoundary", &ts)
	meteringData := &common.MeteringData{
		SelfID:    uuid,
		Timestamp: ts,
		Category:  category,
		Data:      items,
	}
	flushCtx, cancel := context.WithTimeout(ctx, writeTimeout)
	defer cancel()

	return m.writer.Write(flushCtx, meteringData)
}

// Close closes the metering writer.
func (m *Meter) Close() error {
	if m.writer != nil {
		err := m.writer.Close()
		if err != nil {
			m.logger.Warn("failed to close metering writer", zap.Error(err))
		}
		return err
	}
	return nil
}


Review comment (suggestion):
The `retryLoop` function exits immediately when the context is cancelled without attempting a final retry of pending data. This differs from the `flushLoop` which makes a best-effort attempt to flush final data after shutdown (line 361). Consider adding a final `retryWrite` call after the context is cancelled to maximize data delivery during graceful shutdown, similar to how `flushLoop` handles shutdown.

Code after:
	}
	return items
}

// StartFlushLoop creates a flush loop.
func (m *Meter) StartFlushLoop(ctx context.Context) {
	m.wg.RunWithLog(func() {
		m.flushLoop(ctx)
	})
	m.wg.RunWithLog(func() {
		m.retryLoop(ctx)
	})
	m.wg.Wait()
}

func (m *Meter) retryLoop(ctx context.Context) {
	for {
		select {
		case <-ctx.Done():
			return
		case <-time.After(retryInterval):
		}

		m.retryWrite(ctx)
	}
}

func (m *Meter) retryWrite(ctx context.Context) {
	data := m.pendingRetryData.getDataClone()
	if len(data) == 0 {
		return
	}

	var (
		firstErr   error
		needRemove = make([]*writeFailData, 0, len(data))
	)
	for ts, wd := range data {
		err := m.WriteMeterData(ctx, ts, m.uuid, wd.items)
		if err == nil {
			m.logger.Info("succeed to write metering data after retry",
				zap.Int64("timestamp", ts), zap.Int("retry-count", wd.retryCnt),
				zap.Any("data", wd.items))
			needRemove = append(needRemove, wd)
			continue
		}

		if ctx.Err() != nil {
			break
		}
		if firstErr == nil {
Repository: pingcap/tidb
File: pkg/lightning/backend/local/local.go (Go)

Code before:
			Start: startKey,
			End:   endKey,
		},
	}

	for _, store := range stores {
		if store.StatusAddress == "" || engine.IsTiFlash(store) {
			continue
		}
		importCli, err := local.importClientFactory.create(subctx, store.Id)
		if err != nil {
			tidblogutil.Logger(subctx).Warn("create import client failed", zap.Error(err), zap.String("store", store.StatusAddress))
			continue
		}
		clients = append(clients, importCli)
		storeAddrs = append(storeAddrs, store.StatusAddress)
	}

	addTableSplitRange := func() {
		var (
			firstErr      error
			mu            sync.Mutex
			successStores = make([]string, 0, len(clients))
			failedStores  = make([]string, 0, len(clients))
		)
		var wg sync.WaitGroup
		wg.Add(len(clients))
		for i, c := range clients {
			go func(i int, c sst.ImportSSTClient) {
				defer wg.Done()
				failpoint.InjectCall("AddPartitionRangeForTable")
				_, err := c.AddForcePartitionRange(subctx, addReq)
				mu.Lock()
				defer mu.Unlock()
				if err == nil {
					successStores = append(successStores, storeAddrs[i])
				} else {
					failedStores = append(failedStores, storeAddrs[i])
					if firstErr == nil {
						firstErr = err
					}
				}
			}(i, c)
		}
		wg.Wait()
		tidblogutil.Logger(subctx).Info("call AddForcePartitionRange",
			zap.Strings("success stores", successStores),
			zap.Strings("failed stores", failedStores),
			zap.Error(firstErr),
		)
	}

Review comment (suggestion):
better to use some struct from `pkg/util/wait_group_wrapper.go` to avoid panic

Code after:
			Start: startKey,
			End:   endKey,
		},
	}

	for _, store := range stores {
		if store.StatusAddress == "" || engine.IsTiFlash(store) {
			continue
		}
		importCli, err := local.importClientFactory.create(subctx, store.Id)
		if err != nil {
			tidblogutil.Logger(subctx).Warn("create import client failed", zap.Error(err), zap.String("store", store.StatusAddress))
			continue
		}
		clients = append(clients, importCli)
		storeAddrs = append(storeAddrs, store.StatusAddress)
	}

	addTableSplitRange := func() {
		var (
			firstErr      error
			mu            sync.Mutex
			successStores = make([]string, 0, len(clients))
			failedStores  = make([]string, 0, len(clients))
		)
		concurrency := int(local.WorkerConcurrency.Load())
		if concurrency <= 0 {
			concurrency = 1
		}
		eg, _ := util.NewErrorGroupWithRecoverWithCtx(subctx)
		eg.SetLimit(concurrency)
		for i, c := range clients {
			client, addr := c, storeAddrs[i]
			eg.Go(func() error {
				failpoint.InjectCall("AddPartitionRangeForTable")
				_, err := client.AddForcePartitionRange(subctx, addReq)
				mu.Lock()
				defer mu.Unlock()
				if err == nil {
					successStores = append(successStores, addr)
				} else {
					failedStores = append(failedStores, addr)
					if firstErr == nil {
						firstErr = err
					}
				}
				return nil
			})
		}
		_ = eg.Wait()
		tidblogutil.Logger(subctx).Info("call AddForcePartitionRange",
Repository: pingcap/tidb
File: pkg/executor/cluster_table_test.go (Go)

Code before:
	"compress/gzip"
	"context"
	"fmt"
	"net"
	"os"
	"strconv"
	"strings"
	"testing"
	"time"

	"github.com/pingcap/tidb/pkg/config"
	"github.com/pingcap/tidb/pkg/domain"
	"github.com/pingcap/tidb/pkg/expression"
	"github.com/pingcap/tidb/pkg/parser"
	"github.com/pingcap/tidb/pkg/parser/auth"
	"github.com/pingcap/tidb/pkg/parser/mysql"
	"github.com/pingcap/tidb/pkg/server"
	"github.com/pingcap/tidb/pkg/session/sessmgr"
	"github.com/pingcap/tidb/pkg/testkit"
	"github.com/pingcap/tidb/pkg/testkit/testfailpoint"
	"github.com/stretchr/testify/require"
	"google.golang.org/grpc"
)

func createRPCServer(t *testing.T, dom *domain.Domain) *grpc.Server {
	restoreCfg := config.RestoreFunc()
	t.Cleanup(restoreCfg)

	sm := &testkit.MockSessionManager{}
	sm.PS = append(sm.PS, &sessmgr.ProcessInfo{
		ID:      1,
		User:    "root",
		Host:    "127.0.0.1",
		Command: mysql.ComQuery,
	})

	lis, err := net.Listen("tcp", "127.0.0.1:0")
	require.NoError(t, err)
	host, port, err := net.SplitHostPort(lis.Addr().String())
	require.NoError(t, err)
	portNum, err := strconv.Atoi(port)
	require.NoError(t, err)

	srv := server.NewRPCServer(config.GetGlobalConfig(), dom, sm)
	go func() {
		err = srv.Serve(lis)
		require.NoError(t, err)
	}()

	config.UpdateGlobal(func(conf *config.Config) {
		conf.Status.StatusPort = uint(portNum)

Review comment (suggestion):
```suggestion
	restoreCfgFn := config.RestoreFunc()
```

Code after:
	"compress/gzip"
	"context"
	"fmt"
	"net"
	"os"
	"strconv"
	"strings"
	"testing"
	"time"

	"github.com/pingcap/tidb/pkg/config"
	"github.com/pingcap/tidb/pkg/domain"
	"github.com/pingcap/tidb/pkg/expression"
	"github.com/pingcap/tidb/pkg/parser"
	"github.com/pingcap/tidb/pkg/parser/auth"
	"github.com/pingcap/tidb/pkg/parser/mysql"
	"github.com/pingcap/tidb/pkg/server"
	"github.com/pingcap/tidb/pkg/session/sessmgr"
	"github.com/pingcap/tidb/pkg/testkit"
	"github.com/stretchr/testify/require"
	"google.golang.org/grpc"
)

func createRPCServer(t *testing.T, dom *domain.Domain) *grpc.Server {
	t.Cleanup(config.RestoreFunc())

	sm := &testkit.MockSessionManager{}
	sm.PS = append(sm.PS, &sessmgr.ProcessInfo{
		ID:      1,
		User:    "root",
		Host:    "127.0.0.1",
		Command: mysql.ComQuery,
	})

	lis, err := net.Listen("tcp", "127.0.0.1:0")
	require.NoError(t, err)
	host, port, err := net.SplitHostPort(lis.Addr().String())
	require.NoError(t, err)
	portNum, err := strconv.Atoi(port)
	require.NoError(t, err)

	srv := server.NewRPCServer(config.GetGlobalConfig(), dom, sm)
	go func() {
		err = srv.Serve(lis)
		require.NoError(t, err)
	}()

	config.UpdateGlobal(func(conf *config.Config) {
		conf.Status.StatusPort = uint(portNum)
		conf.AdvertiseAddress = host
	})
Repository: pingcap/tidb
File: pkg/util/rowcodec/decoder.go (Go)

Code before:
		return d, errors.Errorf("unknown type %d", col.Ft.GetType())
	}
	return d, nil
}

// ChunkDecoder decodes the row to chunk.Chunk.
type ChunkDecoder struct {
	decoder
	defDatum func(i int, chk *chunk.Chunk) error
}

// NewChunkDecoder creates a NewChunkDecoder.
func NewChunkDecoder(columns []ColInfo, handleColIDs []int64, defDatum func(i int, chk *chunk.Chunk) error, loc *time.Location) *ChunkDecoder {
	return &ChunkDecoder{
		decoder: decoder{
			columns:      columns,
			handleColIDs: handleColIDs,
			loc:          loc,
		},
		defDatum: defDatum,
	}
}

// DecodeToChunk decodes a row to chunk.
func (decoder *ChunkDecoder) DecodeToChunk(rowData []byte, handle kv.Handle, chk *chunk.Chunk) error {
	err := decoder.fromBytes(rowData)
	if err != nil {
		return err
	}

	for colIdx := range decoder.columns {
		col := &decoder.columns[colIdx]
		// fill the virtual column value after row calculation
		if col.VirtualGenCol {
			chk.AppendNull(colIdx)
			continue
		}
		if col.ID == model.ExtraRowChecksumID {
			chk.AppendNull(colIdx)
			continue
		}

		idx, isNil, notFound := decoder.row.findColID(col.ID)
		if !notFound && !isNil {
			colData := decoder.getData(idx)
			err := decoder.decodeColToChunk(colIdx, col, colData, chk)
			if err != nil {
				return err
			}
			continue
		}

Review comment (suggestion):
DecodeToChunk now is now only used by unistore's coprocessor. The other code can set commitTS to 0 if commiTS is not required

Code after:
	default:
		return d, errors.Errorf("unknown type %d", col.Ft.GetType())
	}
	return d, nil
}

// ChunkDecoder decodes the row to chunk.Chunk.
type ChunkDecoder struct {
	decoder
	defDatum func(i int, chk *chunk.Chunk) error
}

// NewChunkDecoder creates a NewChunkDecoder.
func NewChunkDecoder(columns []ColInfo, handleColIDs []int64, defDatum func(i int, chk *chunk.Chunk) error, loc *time.Location) *ChunkDecoder {
	return &ChunkDecoder{
		decoder: decoder{
			columns:      columns,
			handleColIDs: handleColIDs,
			loc:          loc,
		},
		defDatum: defDatum,
	}
}

// DecodeToChunk decodes a row to chunk.
func (decoder *ChunkDecoder) DecodeToChunk(rowData []byte, commitTS uint64, handle kv.Handle, chk *chunk.Chunk) error {
	err := decoder.fromBytes(rowData)
	if err != nil {
		return err
	}

	for colIdx := range decoder.columns {
		col := &decoder.columns[colIdx]
		if col.ID == model.ExtraCommitTSID {
			intest.Assert(commitTS > 0, "commitTS should be valid if ExtraCommitTSID exists")
			if commitTS > 0 {
				chk.AppendUint64(colIdx, commitTS)
			} else {
				chk.AppendNull(colIdx)
			}
			continue
		}
		// fill the virtual column value after row calculation
		if col.VirtualGenCol {
			chk.AppendNull(colIdx)
			continue
		}
		if col.ID == model.ExtraRowChecksumID {
			chk.AppendNull(colIdx)
			continue
		}
Repository: pingcap/tidb
File: pkg/expression/builtin_miscellaneous_vec.go (Go)

Code before:
	return true
}

func (b *builtinUUIDSig) vecEvalString(ctx EvalContext, input *chunk.Chunk, result *chunk.Column) error {
	n := input.NumRows()
	result.ReserveString(n)
	var id uuid.UUID
	var err error
	for range n {
		id, err = uuid.NewUUID()
		if err != nil {
			return err
		}
		result.AppendString(id.String())
	}
	return nil
}

func (b *builtinNameConstDurationSig) vectorized() bool {
	return true
}

func (b *builtinNameConstDurationSig) vecEvalDuration(ctx EvalContext, input *chunk.Chunk, result *chunk.Column) error {
	return b.args[1].VecEvalDuration(ctx, input, result)
}

func (b *builtinDurationAnyValueSig) vectorized() bool {
	return true
}

func (b *builtinDurationAnyValueSig) vecEvalDuration(ctx EvalContext, input *chunk.Chunk, result *chunk.Column) error {
	return b.args[0].VecEvalDuration(ctx, input, result)
}

func (b *builtinIntAnyValueSig) vectorized() bool {
	return true
}

func (b *builtinIntAnyValueSig) vecEvalInt(ctx EvalContext, input *chunk.Chunk, result *chunk.Column) error {
	return b.args[0].VecEvalInt(ctx, input, result)
}

func (b *builtinIsIPv4CompatSig) vectorized() bool {
	return true
}

func (b *builtinIsIPv4CompatSig) vecEvalInt(ctx EvalContext, input *chunk.Chunk, result *chunk.Column) error {
	n := input.NumRows()
	buf, err := b.bufAllocator.get()
	if err != nil {
		return err

Review comment (suggestion):
it looks to me that the result of `uuid` function is fixed length? If yes, then we can do more precise space reservation. (ReserveString assume that each row has 8 bytes).

Code after:
func (b *builtinUUIDSig) vectorized() bool {
	return true
}

func (b *builtinUUIDSig) vecEvalString(ctx EvalContext, input *chunk.Chunk, result *chunk.Column) error {
	n := input.NumRows()
	result.ReserveString(n)
	var id uuid.UUID
	var err error
	for range n {
		id, err = uuid.NewUUID()
		if err != nil {
			return err
		}
		result.AppendString(id.String())
	}
	return nil
}

func (b *builtinUUIDv4Sig) vectorized() bool {
	return true
}

func (b *builtinUUIDv4Sig) vecEvalString(ctx EvalContext, input *chunk.Chunk, result *chunk.Column) error {
	n := input.NumRows()
	result.ReserveString(n)
	var id uuid.UUID
	var err error
	for range n {
		id, err = uuid.NewRandom()
		if err != nil {
			return err
		}
		result.AppendString(id.String())
	}
	return nil
}

func (b *builtinUUIDv7Sig) vectorized() bool {
	return true
}

func (b *builtinUUIDv7Sig) vecEvalString(ctx EvalContext, input *chunk.Chunk, result *chunk.Column) error {
	n := input.NumRows()
	result.ReserveString(n)
	var id uuid.UUID
	var err error
	for range n {
		id, err = uuid.NewV7()
		if err != nil {
			return err