func (f *firstBuffer) Eval(ctx *sql.Context) (interface{}, error) {
	return f.val, nil
}
Eval implements the AggregationBuffer interface.
package aggregation
import (
	"fmt"
	"github.com/dolthub/go-mysql-server/sql"
	"github.com/dolthub/go-mysql-server/sql/expression"
)
type First struct {
	expression.UnaryExpression
}
var _ sql.FunctionExpression = (*First)(nil)
var _ sql.Aggregation = (*First)(nil)
func NewFirst(e sql.Expression) *First {
	return &First{expression.UnaryExpression{Child: e}}
}
func (f *First) FunctionName() string {
	return "first"
}
func (f *First) Type() sql.Type {
	return f.Child.Type()
}
func (f *First) String() string {
	return fmt.Sprintf("FIRST(%s)", f.Child)
}
func (f *First) WithChildren(children ...sql.Expression) (sql.Expression, error) {
	if len(children) != 1 {
		return nil, sql.ErrInvalidChildrenNumber.New(f, len(children), 1)
	}
	return NewFirst(children[0]), nil
}
func (f *First) NewBuffer() (sql.AggregationBuffer, error) {
	bufferChild, err := expression.Clone(f.UnaryExpression.Child)
	if err != nil {
		return nil, err
	}
	return &firstBuffer{nil, bufferChild}, nil
}
func (f *First) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
	return nil, ErrEvalUnsupportedOnAggregation.New("First")
}
type firstBuffer struct {
	val  interface{}
	expr sql.Expression
}
func (f *firstBuffer) Update(ctx *sql.Context, row sql.Row) error {
	if f.val != nil {
		return nil
	}
	v, err := f.expr.Eval(ctx, row)
	if err != nil {
		return err
	}
	if v == nil {
		return nil
	}
	f.val = v
	return nil
}