func (m *Sum) NewBuffer() (sql.AggregationBuffer, error) {
	bufferChild, err := expression.Clone(m.UnaryExpression.Child)
	if err != nil {
		return nil, err
	}
	return &sumBuffer{true, 0, bufferChild}, nil
}
NewBuffer creates a new buffer to compute the result.
package aggregation
import (
	"fmt"
	"github.com/dolthub/go-mysql-server/sql"
	"github.com/dolthub/go-mysql-server/sql/expression"
)
type Sum struct {
	expression.UnaryExpression
}
var _ sql.FunctionExpression = (*Sum)(nil)
var _ sql.Aggregation = (*Sum)(nil)
func NewSum(e sql.Expression) *Sum {
	return &Sum{expression.UnaryExpression{Child: e}}
}
func (m *Sum) FunctionName() string {
	return "sum"
}
func (m *Sum) Type() sql.Type {
	return sql.Float64
}
func (m *Sum) String() string {
	return fmt.Sprintf("SUM(%s)", m.Child)
}
func (m *Sum) WithChildren(children ...sql.Expression) (sql.Expression, error) {
	if len(children) != 1 {
		return nil, sql.ErrInvalidChildrenNumber.New(m, len(children), 1)
	}
	return NewSum(children[0]), nil
}