func (c *CountDistinct) IsNullable() bool {
	return false
}
IsNullable returns whether the return value can be null.
package aggregation
import (
	"fmt"
	"github.com/mitchellh/hashstructure"
	"github.com/src-d/go-mysql-server/sql"
	"github.com/src-d/go-mysql-server/sql/expression"
)
type Count struct {
	expression.UnaryExpression
}
func NewCount(e sql.Expression) *Count {
	return &Count{expression.UnaryExpression{Child: e}}
}
func (c *Count) NewBuffer() sql.Row {
	return sql.NewRow(int64(0))
}
func (c *Count) Type() sql.Type {
	return sql.Int64
}
func (c *Count) IsNullable() bool {
	return false
}
func (c *Count) Resolved() bool {
	if _, ok := c.Child.(*expression.Star); ok {
		return true
	}
	return c.Child.Resolved()
}
func (c *Count) String() string {
	return fmt.Sprintf("COUNT(%s)", c.Child)
}
func (c *Count) WithChildren(children ...sql.Expression) (sql.Expression, error) {
	if len(children) != 1 {
		return nil, sql.ErrInvalidChildrenNumber.New(c, len(children), 1)
	}
	return NewCount(children[0]), nil
}
func (c *Count) Update(ctx *sql.Context, buffer, row sql.Row) error {
	var inc bool
	if _, ok := c.Child.(*expression.Star); ok {
		inc = true
	} else {
		v, err := c.Child.Eval(ctx, row)
		if v != nil {
			inc = true
		}
		if err != nil {
			return err
		}
	}
	if inc {
		buffer[0] = buffer[0].(int64) + int64(1)
	}
	return nil
}
func (c *Count) Merge(ctx *sql.Context, buffer, partial sql.Row) error {
	buffer[0] = buffer[0].(int64) + partial[0].(int64)
	return nil
}
func (c *Count) Eval(ctx *sql.Context, buffer sql.Row) (interface{}, error) {
	count := buffer[0]
	return count, nil
}
type CountDistinct struct {
	expression.UnaryExpression
}
func NewCountDistinct(e sql.Expression) *CountDistinct {
	return &CountDistinct{expression.UnaryExpression{Child: e}}
}
func (c *CountDistinct) NewBuffer() sql.Row {
	return sql.NewRow(make(map[uint64]struct{}))
}
func (c *CountDistinct) Type() sql.Type {
	return sql.Int64
}