Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AggregationFunction ¶
type AggregationFunction interface { // Update during executing. Update(row []types.Datum, groupKey []byte, ctx context.Context) error // GetGroupResult will be called when all data have been processed. GetGroupResult(groupKey []byte) types.Datum // GetArgs stands for getting all arguments. GetArgs() []Expression // GetName gets the aggregation function name. GetName() string // SetArgs set argument by index. SetArgs(idx int, expr Expression) // Clear collects the mapper's memory. Clear() }
AggregationFunction stands for aggregate functions.
func NewAggFunction ¶
func NewAggFunction(funcType string, funcArgs []Expression, distinct bool) AggregationFunction
NewAggFunction creates a new AggregationFunction.
type Column ¶
type Column struct { FromID string ColName model.CIStr DBName model.CIStr TblName model.CIStr RetType *types.FieldType // Position means the position of this column that appears in the select fields. // e.g. SELECT name as id , 1 - id as id , 1 + name as id, name as id from src having id = 1; // There are four ids in the same schema, so you can't identify the column through the FromID and ColName. Position int // IsAggOrSubq means if this column is referenced to a Aggregation column or a Subquery column. // If so, this column's name will be the plain sql text. IsAggOrSubq bool // only used during execution Index int // contains filtered or unexported fields }
Column represents a column.
func (*Column) DeepCopy ¶
func (col *Column) DeepCopy() Expression
DeepCopy implements Expression interface.
func (*Column) Equal ¶
func (col *Column) Equal(expr Expression) bool
Equal checks if two columns are equal
type Constant ¶
Constant stands for a constant value.
func (*Constant) DeepCopy ¶
func (c *Constant) DeepCopy() Expression
DeepCopy implements Expression interface.
type Expression ¶
type Expression interface { // Eval evaluates an expression through a row. Eval(row []types.Datum, ctx context.Context) (types.Datum, error) // Get the expression return type. GetType() *types.FieldType // DeepCopy copies an expression totally. DeepCopy() Expression // ToString converts an expression into a string. ToString() string }
Expression represents all scalar expression in SQL.
func ComposeCNFCondition ¶
func ComposeCNFCondition(conditions []Expression) Expression
ComposeCNFCondition composes CNF items into a balance deep CNF tree, which benefits a lot for pb decoder/encoder.
func ScalarFuncs2Exprs ¶
func ScalarFuncs2Exprs(funcs []*ScalarFunction) []Expression
ScalarFuncs2Exprs converts []*ScalarFunction to []Expression.
func Schema2Exprs ¶
func Schema2Exprs(schema Schema) []Expression
Schema2Exprs converts []*Column to []Expression.
type ScalarFunction ¶
type ScalarFunction struct { Args []Expression FuncName model.CIStr // TODO: Implement type inference here, now we use ast's return type temporarily. RetType *types.FieldType Function evaluator.BuiltinFunc }
ScalarFunction is the function that returns a value.
func NewFunction ¶
func NewFunction(funcName string, retType *types.FieldType, args ...Expression) (*ScalarFunction, error)
NewFunction creates a new scalar function.
func (*ScalarFunction) DeepCopy ¶
func (sf *ScalarFunction) DeepCopy() Expression
DeepCopy implements Expression interface.
func (*ScalarFunction) GetType ¶
func (sf *ScalarFunction) GetType() *types.FieldType
GetType implements Expression interface.
func (*ScalarFunction) ToString ¶
func (sf *ScalarFunction) ToString() string
ToString implements Expression interface.
type Schema ¶
type Schema []*Column
Schema stands for the row schema get from input.
func (Schema) FindColumn ¶
func (s Schema) FindColumn(astCol *ast.ColumnName) (*Column, error)
FindColumn finds an Column from schema for a ast.ColumnName. It compares the db/table/column names. If there are more than one result, it will raise ambiguous error.
func (Schema) InitIndices ¶
func (s Schema) InitIndices()
InitIndices sets indices for columns in schema.
func (Schema) RetrieveColumn ¶
RetrieveColumn retrieves column in expression from the columns in schema.