func (v *SystemVar) Type() sql.Type {
	if sysVar, _, ok := sql.SystemVariables.GetGlobal(v.Name); ok {
		return sysVar.Type
	}
	return sql.Null
}
Type implements the sql.Expression interface.
package expression
import (
	"fmt"
	"github.com/dolthub/go-mysql-server/sql"
)
type SystemVar struct {
	Name  string
	Scope sql.SystemVariableScope
}
func NewSystemVar(name string, scope sql.SystemVariableScope) *SystemVar {
	return &SystemVar{name, scope}
}
func (v *SystemVar) Children() []sql.Expression { return nil }
func (v *SystemVar) Eval(ctx *sql.Context, _ sql.Row) (interface{}, error) {
	switch v.Scope {
	case sql.SystemVariableScope_Session:
		val, err := ctx.GetSessionVariable(ctx, v.Name)
		if err != nil {
			return nil, err
		}
		return val, nil
	case sql.SystemVariableScope_Global:
		_, val, ok := sql.SystemVariables.GetGlobal(v.Name)
		if !ok {
			return nil, sql.ErrUnknownSystemVariable.New(v.Name)
		}
		return val, nil
	default:  
		return nil, fmt.Errorf("unknown scope `%v` on system variable `%s`", v.Scope, v.Name)
	}
}