func (c *Crc32) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
	arg, err := c.EvalChild(ctx, row)
	if err != nil {
		return nil, err
	}
	if arg == nil {
		return nil, nil
	}
	var bytes []byte
	switch val := arg.(type) {
	case string:
		bytes = []byte(val)
	case int8, int16, int32, int64, int:
		val, err := sql.Int64.Convert(arg)
		if err != nil {
			return nil, err
		}
		bytes = []byte(strconv.FormatInt(val.(int64), 10))
	case uint8, uint16, uint32, uint64, uint:
		val, err := sql.Uint64.Convert(arg)
		if err != nil {
			return nil, err
		}
		bytes = []byte(strconv.FormatUint(val.(uint64), 10))
	case float32:
		s := floatToString(float64(val))
		bytes = []byte(s)
	case float64:
		s := floatToString(val)
		bytes = []byte(s)
	case bool:
		if val {
			bytes = []byte{1}
		} else {
			bytes = []byte{0}
		}
	default:
		return nil, ErrInvalidArgument.New("crc32", fmt.Sprint(arg))
	}
	return crc32.ChecksumIEEE(bytes), nil
}
Eval implements sql.Expression
package function
import (
	"fmt"
	"hash/crc32"
	"math"
	"math/rand"
	"regexp"
	"strconv"
	"strings"
	"time"
	"github.com/shopspring/decimal"
	"github.com/dolthub/go-mysql-server/sql"
)
type Rand struct {
	Child sql.Expression
}
var _ sql.Expression = (*Rand)(nil)
var _ sql.NonDeterministicExpression = (*Rand)(nil)
var _ sql.FunctionExpression = (*Rand)(nil)
func NewRand(exprs ...sql.Expression) (sql.Expression, error) {
	if len(exprs) > 1 {
		return nil, sql.ErrInvalidArgumentNumber.New("rand", "0 or 1", len(exprs))
	}
	if len(exprs) > 0 {
		return &Rand{Child: exprs[0]}, nil
	}
	return &Rand{}, nil
}
func (r *Rand) FunctionName() string {
	return "rand"
}
func (r *Rand) Type() sql.Type {
	return sql.Float64
}
func (r *Rand) IsNonDeterministic() bool {
	return r.Child == nil
}
func (r *Rand) IsNullable() bool {
	return false
}
func (r *Rand) Resolved() bool {
	return r.Child == nil || r.Child.Resolved()
}
func (r *Rand) String() string {
	if r.Child != nil {
		return fmt.Sprintf("RAND(%s)", r.Child)
	}
	return fmt.Sprintf("RAND()")
}
func (r *Rand) WithChildren(children ...sql.Expression) (sql.Expression, error) {
	if len(children) > 1 {
		return nil, sql.ErrInvalidChildrenNumber.New(r, len(children), 1)
	}
	if len(children) == 0 {
		return r, nil
	}
	return NewRand(children[0])
}
func (r *Rand) Children() []sql.Expression {
	if r.Child == nil {
		return nil
	}
	return []sql.Expression{r.Child}
}
func (r *Rand) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
	if r.Child == nil {
		return rand.Float64(), nil
	}
	e, err := r.Child.Eval(ctx, row)
	if err != nil {
		return nil, err
	}
	var seed int64
	if sql.IsNumber(r.Child.Type()) {
		e, err = sql.Int64.Convert(e)
		if err == nil {
			seed = e.(int64)
		}
	}
	return rand.New(rand.NewSource(seed)).Float64(), nil
}
type Sin struct {
	*UnaryFunc
}
var _ sql.FunctionExpression = (*Sin)(nil)
func NewSin(arg sql.Expression) sql.Expression {
	return &Sin{NewUnaryFunc(arg, "SIN", sql.Float64)}
}
func (s *Sin) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
	val, err := s.EvalChild(ctx, row)
	if err != nil {
		return nil, err
	}
	if val == nil {
		return nil, nil
	}
	n, err := sql.Float64.Convert(val)
	if err != nil {
		return nil, err
	}
	return math.Sin(n.(float64)), nil
}
func (s *Sin) WithChildren(children ...sql.Expression) (sql.Expression, error) {
	if len(children) != 1 {
		return nil, sql.ErrInvalidChildrenNumber.New(s, len(children), 1)
	}
	return NewSin(children[0]), nil
}
type Cos struct {
	*UnaryFunc
}
var _ sql.FunctionExpression = (*Cos)(nil)
func NewCos(arg sql.Expression) sql.Expression {
	return &Cos{NewUnaryFunc(arg, "COS", sql.Float64)}
}
func (s *Cos) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
	val, err := s.EvalChild(ctx, row)
	if err != nil {
		return nil, err
	}
	if val == nil {
		return nil, nil
	}
	n, err := sql.Float64.Convert(val)
	if err != nil {
		return nil, err
	}
	return math.Cos(n.(float64)), nil
}
func (c *Cos) WithChildren(children ...sql.Expression) (sql.Expression, error) {
	if len(children) != 1 {
		return nil, sql.ErrInvalidChildrenNumber.New(c, len(children), 1)
	}
	return NewCos(children[0]), nil
}
type Tan struct {
	*UnaryFunc
}
var _ sql.FunctionExpression = (*Tan)(nil)
func NewTan(arg sql.Expression) sql.Expression {
	return &Tan{NewUnaryFunc(arg, "TAN", sql.Float64)}
}
func (t *Tan) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
	val, err := t.EvalChild(ctx, row)
	if err != nil {
		return nil, err
	}
	if val == nil {
		return nil, nil
	}
	n, err := sql.Float64.Convert(val)
	if err != nil {
		return nil, err
	}
	return math.Tan(n.(float64)), nil
}
func (t *Tan) WithChildren(children ...sql.Expression) (sql.Expression, error) {
	if len(children) != 1 {
		return nil, sql.ErrInvalidChildrenNumber.New(t, len(children), 1)
	}
	return NewTan(children[0]), nil
}
type Asin struct {
	*UnaryFunc
}
var _ sql.FunctionExpression = (*Asin)(nil)
func NewAsin(arg sql.Expression) sql.Expression {
	return &Asin{NewUnaryFunc(arg, "ASIN", sql.Float64)}
}
func (a *Asin) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
	val, err := a.EvalChild(ctx, row)
	if err != nil {
		return nil, err
	}
	if val == nil {
		return nil, nil
	}
	n, err := sql.Float64.Convert(val)
	if err != nil {
		return nil, err
	}
	return math.Asin(n.(float64)), nil
}
func (a *Asin) WithChildren(children ...sql.Expression) (sql.Expression, error) {
	if len(children) != 1 {
		return nil, sql.ErrInvalidChildrenNumber.New(a, len(children), 1)
	}
	return NewAsin(children[0]), nil
}
type Acos struct {
	*UnaryFunc
}
var _ sql.FunctionExpression = (*Acos)(nil)
func NewAcos(arg sql.Expression) sql.Expression {
	return &Acos{NewUnaryFunc(arg, "ACOS", sql.Float64)}
}
func (a *Acos) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
	val, err := a.EvalChild(ctx, row)
	if err != nil {
		return nil, err
	}
	if val == nil {
		return nil, nil
	}
	n, err := sql.Float64.Convert(val)
	if err != nil {
		return nil, err
	}
	return math.Acos(n.(float64)), nil
}
func (a *Acos) WithChildren(children ...sql.Expression) (sql.Expression, error) {
	if len(children) != 1 {
		return nil, sql.ErrInvalidChildrenNumber.New(a, len(children), 1)
	}
	return NewAcos(children[0]), nil
}
type Atan struct {
	*UnaryFunc
}
var _ sql.FunctionExpression = (*Atan)(nil)
func NewAtan(arg sql.Expression) sql.Expression {
	return &Atan{NewUnaryFunc(arg, "ATAN", sql.Float64)}
}
func (a *Atan) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
	val, err := a.EvalChild(ctx, row)
	if err != nil {
		return nil, err
	}
	if val == nil {
		return nil, nil
	}
	n, err := sql.Float64.Convert(val)
	if err != nil {
		return nil, err
	}
	return math.Atan(n.(float64)), nil
}
func (a *Atan) WithChildren(children ...sql.Expression) (sql.Expression, error) {
	if len(children) != 1 {
		return nil, sql.ErrInvalidChildrenNumber.New(a, len(children), 1)
	}
	return NewAtan(children[0]), nil
}
type Cot struct {
	*UnaryFunc
}
var _ sql.FunctionExpression = (*Cot)(nil)
func NewCot(arg sql.Expression) sql.Expression {
	return &Cot{NewUnaryFunc(arg, "COT", sql.Float64)}
}
func (c *Cot) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
	val, err := c.EvalChild(ctx, row)
	if err != nil {
		return nil, err
	}
	if val == nil {
		return nil, nil
	}
	n, err := sql.Float64.Convert(val)
	if err != nil {
		return nil, err
	}
	return 1.0 / math.Tan(n.(float64)), nil
}
func (c *Cot) WithChildren(children ...sql.Expression) (sql.Expression, error) {
	if len(children) != 1 {
		return nil, sql.ErrInvalidChildrenNumber.New(c, len(children), 1)
	}
	return NewCot(children[0]), nil
}
type Degrees struct {
	*UnaryFunc
}
var _ sql.FunctionExpression = (*Degrees)(nil)
func NewDegrees(arg sql.Expression) sql.Expression {
	return &Degrees{NewUnaryFunc(arg, "DEGREES", sql.Float64)}
}
func (d *Degrees) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
	val, err := d.EvalChild(ctx, row)
	if err != nil {
		return nil, err
	}
	if val == nil {
		return nil, nil
	}
	n, err := sql.Float64.Convert(val)
	if err != nil {
		return nil, err
	}
	return (n.(float64) * 180.0) / math.Pi, nil
}
func (d *Degrees) WithChildren(children ...sql.Expression) (sql.Expression, error) {
	if len(children) != 1 {
		return nil, sql.ErrInvalidChildrenNumber.New(d, len(children), 1)
	}
	return NewDegrees(children[0]), nil
}
type Radians struct {
	*UnaryFunc
}
var _ sql.FunctionExpression = (*Radians)(nil)
func NewRadians(arg sql.Expression) sql.Expression {
	return &Radians{NewUnaryFunc(arg, "RADIANS", sql.Float64)}
}
func (r *Radians) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
	val, err := r.EvalChild(ctx, row)
	if err != nil {
		return nil, err
	}
	if val == nil {
		return nil, nil
	}
	n, err := sql.Float64.Convert(val)
	if err != nil {
		return nil, err
	}
	return (n.(float64) * math.Pi) / 180.0, nil
}
func (r *Radians) WithChildren(children ...sql.Expression) (sql.Expression, error) {
	if len(children) != 1 {
		return nil, sql.ErrInvalidChildrenNumber.New(r, len(children), 1)
	}
	return NewRadians(children[0]), nil
}
type Crc32 struct {
	*UnaryFunc
}
var _ sql.FunctionExpression = (*Crc32)(nil)
func NewCrc32(arg sql.Expression) sql.Expression {
	return &Crc32{NewUnaryFunc(arg, "CRC32", sql.Uint32)}
}