Documentation ¶
Index ¶
- Variables
- func CanExprsPushDown(sc *stmtctx.StatementContext, exprs []Expression) bool
- func CanImplicitEvalInt(expr Expression) bool
- func CanImplicitEvalReal(expr Expression) bool
- func CheckArgsNotMultiColumnRow(args ...Expression) error
- func CheckIllegalMixCollation(funcName string, args []Expression, evalType types.EvalType) error
- func CompareDecimal(sctx sessionctx.Context, lhsArg, rhsArg Expression, lhsRow, rhsRow chunk.Row) (int64, bool, error)
- func CompareDuration(sctx sessionctx.Context, lhsArg, rhsArg Expression, lhsRow, rhsRow chunk.Row) (int64, bool, error)
- func CompareInt(sctx sessionctx.Context, lhsArg, rhsArg Expression, lhsRow, rhsRow chunk.Row) (int64, bool, error)
- func CompareJSON(sctx sessionctx.Context, lhsArg, rhsArg Expression, lhsRow, rhsRow chunk.Row) (int64, bool, error)
- func CompareReal(sctx sessionctx.Context, lhsArg, rhsArg Expression, lhsRow, rhsRow chunk.Row) (int64, bool, error)
- func CompareStringWithCollationInfo(sctx sessionctx.Context, lhsArg, rhsArg Expression, lhsRow, rhsRow chunk.Row, ...) (int64, bool, error)
- func CompareTime(sctx sessionctx.Context, lhsArg, rhsArg Expression, lhsRow, rhsRow chunk.Row) (int64, bool, error)
- func ConstructPositionExpr(p *driver.ParamMarkerExpr) *ast.PositionExpr
- func ContainMutableConst(ctx sessionctx.Context, exprs []Expression) bool
- func Contains(exprs []Expression, e Expression) bool
- func DeriveCollationFromExprs(ctx sessionctx.Context, exprs ...Expression) (dstCharset, dstCollation string)
- func DisableParseJSONFlag4Expr(expr Expression)
- func EvalBool(ctx sessionctx.Context, exprList CNFExprs, row chunk.Row) (bool, bool, error)
- func ExprFromSchema(expr Expression, schema *Schema) bool
- func ExtractColumnSet(exprs []Expression) *intsets.Sparse
- func FindFieldName(names types.NameSlice, astCol *ast.ColumnName) (int, error)
- func GetAccurateCmpType(lhs, rhs Expression) types.EvalType
- func GetIntFromConstant(ctx sessionctx.Context, value Expression) (int, bool, error)
- func GetRowLen(e Expression) int
- func GetStringFromConstant(ctx sessionctx.Context, value Expression) (string, bool, error)
- func GetUsedList(usedCols []*Column, schema *Schema) []bool
- func HandleOverflowOnSelection(sc *stmtctx.StatementContext, val int64, err error) (int64, error)
- func HasAssignSetVarFunc(expr Expression) bool
- func HasGetSetVarFunc(expr Expression) bool
- func InferType4ControlFuncs(lexp, rexp Expression) *types.FieldType
- func IsBinaryLiteral(expr Expression) bool
- func IsEQCondFromIn(expr Expression) bool
- func IsMutableEffectsExpr(expr Expression) bool
- func IsRuntimeConstExpr(expr Expression) bool
- func PosFromPositionExpr(ctx sessionctx.Context, v *ast.PositionExpr) (int, bool, error)
- func PropConstOverOuterJoin(ctx sessionctx.Context, joinConds, filterConds []Expression, ...) ([]Expression, []Expression)
- func PushDownExprs(sc *stmtctx.StatementContext, exprs []Expression) (pushed []Expression, remained []Expression)
- func Quote(str string) string
- func ResolveType4Between(args [3]Expression) types.EvalType
- func SetBinFlagOrBinStr(argTp *types.FieldType, resTp *types.FieldType)
- type Assignment
- type CNFExprs
- type Coercibility
- type CollationInfo
- type Column
- func ColInfo2Col(cols []*Column, col *model.ColumnInfo) *Column
- func ExtractColumns(expr Expression) []*Column
- func ExtractColumnsFromExpressions(result []*Column, exprs []Expression, filter func(*Column) bool) []*Column
- func FindPrefixOfIndex(cols []*Column, idxColIDs []int64) []*Column
- func IndexInfo2Cols(colInfos []*model.ColumnInfo, cols []*Column, index *model.IndexInfo) ([]*Column, []int)
- func IndexInfo2PrefixCols(colInfos []*model.ColumnInfo, cols []*Column, index *model.IndexInfo) ([]*Column, []int)
- func SortColumns(cols []*Column) []*Column
- func (c *Column) CharsetAndCollation(ctx sessionctx.Context) (string, string)
- func (col *Column) Clone() Expression
- func (col *Column) Coercibility() Coercibility
- func (col *Column) ConstItem(_ *stmtctx.StatementContext) bool
- func (col *Column) Decorrelate(_ *Schema) Expression
- func (col *Column) Equal(_ sessionctx.Context, expr Expression) bool
- func (col *Column) Eval(row chunk.Row) (types.Datum, error)
- func (col *Column) EvalDecimal(ctx sessionctx.Context, row chunk.Row) (*types.MyDecimal, bool, error)
- func (col *Column) EvalDuration(ctx sessionctx.Context, row chunk.Row) (types.Duration, bool, error)
- func (col *Column) EvalInt(ctx sessionctx.Context, row chunk.Row) (int64, bool, error)
- func (col *Column) EvalJSON(ctx sessionctx.Context, row chunk.Row) (json.BinaryJSON, bool, error)
- func (col *Column) EvalReal(ctx sessionctx.Context, row chunk.Row) (float64, bool, error)
- func (col *Column) EvalString(ctx sessionctx.Context, row chunk.Row) (string, bool, error)
- func (col *Column) EvalTime(ctx sessionctx.Context, row chunk.Row) (types.Time, bool, error)
- func (col *Column) EvalVirtualColumn(row chunk.Row) (types.Datum, error)
- func (col *Column) GetType() *types.FieldType
- func (c *Column) HasCoercibility() bool
- func (col *Column) HashCode(_ *stmtctx.StatementContext) []byte
- func (col *Column) IsCorrelated() bool
- func (col *Column) MarshalJSON() ([]byte, error)
- func (col *Column) ResolveIndices(schema *Schema) (Expression, error)
- func (col *Column) ReverseEval(sc *stmtctx.StatementContext, res types.Datum, rType types.RoundingType) (val types.Datum, err error)
- func (c *Column) SetCharsetAndCollation(chs, coll string)
- func (c *Column) SetCoercibility(val Coercibility)
- func (col *Column) String() string
- func (col *Column) SupportReverseEval() bool
- func (col *Column) ToInfo() *model.ColumnInfo
- func (col *Column) VecEvalDecimal(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (col *Column) VecEvalDuration(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (col *Column) VecEvalInt(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (col *Column) VecEvalJSON(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (col *Column) VecEvalReal(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (col *Column) VecEvalString(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (col *Column) VecEvalTime(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (col *Column) Vectorized() bool
- type CompareFunc
- type Constant
- func (c *Constant) CharsetAndCollation(ctx sessionctx.Context) (string, string)
- func (c *Constant) Clone() Expression
- func (c *Constant) Coercibility() Coercibility
- func (c *Constant) ConstItem(sc *stmtctx.StatementContext) bool
- func (c *Constant) Decorrelate(_ *Schema) Expression
- func (c *Constant) Equal(ctx sessionctx.Context, b Expression) bool
- func (c *Constant) Eval(row chunk.Row) (types.Datum, error)
- func (c *Constant) EvalDecimal(ctx sessionctx.Context, row chunk.Row) (*types.MyDecimal, bool, error)
- func (c *Constant) EvalDuration(ctx sessionctx.Context, row chunk.Row) (val types.Duration, isNull bool, err error)
- func (c *Constant) EvalInt(ctx sessionctx.Context, row chunk.Row) (int64, bool, error)
- func (c *Constant) EvalJSON(ctx sessionctx.Context, row chunk.Row) (json.BinaryJSON, bool, error)
- func (c *Constant) EvalReal(ctx sessionctx.Context, row chunk.Row) (float64, bool, error)
- func (c *Constant) EvalString(ctx sessionctx.Context, row chunk.Row) (string, bool, error)
- func (c *Constant) EvalTime(ctx sessionctx.Context, row chunk.Row) (val types.Time, isNull bool, err error)
- func (c *Constant) GetType() *types.FieldType
- func (c *Constant) HasCoercibility() bool
- func (c *Constant) HashCode(sc *stmtctx.StatementContext) []byte
- func (c *Constant) IsCorrelated() bool
- func (c *Constant) MarshalJSON() ([]byte, error)
- func (c *Constant) ResolveIndices(_ *Schema) (Expression, error)
- func (c *Constant) ReverseEval(sc *stmtctx.StatementContext, res types.Datum, rType types.RoundingType) (val types.Datum, err error)
- func (c *Constant) SetCharsetAndCollation(chs, coll string)
- func (c *Constant) SetCoercibility(val Coercibility)
- func (c *Constant) String() string
- func (c *Constant) SupportReverseEval() bool
- func (c *Constant) VecEvalDecimal(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (c *Constant) VecEvalDuration(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (c *Constant) VecEvalInt(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (c *Constant) VecEvalJSON(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (c *Constant) VecEvalReal(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (c *Constant) VecEvalString(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (c *Constant) VecEvalTime(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (c *Constant) Vectorized() bool
- type CorrelatedColumn
- func (c *CorrelatedColumn) CharsetAndCollation(ctx sessionctx.Context) (string, string)
- func (col *CorrelatedColumn) Clone() Expression
- func (col *CorrelatedColumn) ConstItem(_ *stmtctx.StatementContext) bool
- func (col *CorrelatedColumn) Decorrelate(schema *Schema) Expression
- func (col *CorrelatedColumn) Equal(ctx sessionctx.Context, expr Expression) bool
- func (col *CorrelatedColumn) Eval(row chunk.Row) (types.Datum, error)
- func (col *CorrelatedColumn) EvalDecimal(ctx sessionctx.Context, row chunk.Row) (*types.MyDecimal, bool, error)
- func (col *CorrelatedColumn) EvalDuration(ctx sessionctx.Context, row chunk.Row) (types.Duration, bool, error)
- func (col *CorrelatedColumn) EvalInt(ctx sessionctx.Context, row chunk.Row) (int64, bool, error)
- func (col *CorrelatedColumn) EvalJSON(ctx sessionctx.Context, row chunk.Row) (json.BinaryJSON, bool, error)
- func (col *CorrelatedColumn) EvalReal(ctx sessionctx.Context, row chunk.Row) (float64, bool, error)
- func (col *CorrelatedColumn) EvalString(ctx sessionctx.Context, row chunk.Row) (string, bool, error)
- func (col *CorrelatedColumn) EvalTime(ctx sessionctx.Context, row chunk.Row) (types.Time, bool, error)
- func (c *CorrelatedColumn) HasCoercibility() bool
- func (col *CorrelatedColumn) IsCorrelated() bool
- func (col *CorrelatedColumn) ResolveIndices(_ *Schema) (Expression, error)
- func (c *CorrelatedColumn) SetCharsetAndCollation(chs, coll string)
- func (c *CorrelatedColumn) SetCoercibility(val Coercibility)
- func (col *CorrelatedColumn) VecEvalDecimal(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (col *CorrelatedColumn) VecEvalDuration(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (col *CorrelatedColumn) VecEvalInt(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (col *CorrelatedColumn) VecEvalJSON(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (col *CorrelatedColumn) VecEvalReal(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (col *CorrelatedColumn) VecEvalString(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (col *CorrelatedColumn) VecEvalTime(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- type Expression
- func BuildCastFunction(ctx sessionctx.Context, expr Expression, tp *types.FieldType) (res Expression)
- func BuildCastFunction4Union(ctx sessionctx.Context, expr Expression, tp *types.FieldType) (res Expression)
- func BuildNotNullExpr(ctx sessionctx.Context, expr Expression) Expression
- func Column2Exprs(cols []*Column) []Expression
- func ColumnSubstitute(expr Expression, schema *Schema, newExprs []Expression) Expression
- func ColumnSubstituteImpl(expr Expression, schema *Schema, newExprs []Expression) (bool, Expression)
- func ComposeCNFCondition(ctx sessionctx.Context, conditions ...Expression) Expression
- func ComposeDNFCondition(ctx sessionctx.Context, conditions ...Expression) Expression
- func DeriveRelaxedFiltersFromDNF(expr Expression, schema *Schema) Expression
- func EvaluateExprWithNull(ctx sessionctx.Context, schema *Schema, expr Expression) Expression
- func ExtractFiltersFromDNFs(ctx sessionctx.Context, conditions []Expression) []Expression
- func Filter(result []Expression, input []Expression, filter func(Expression) bool) []Expression
- func FlattenCNFConditions(CNFCondition *ScalarFunction) []Expression
- func FlattenDNFConditions(DNFCondition *ScalarFunction) []Expression
- func FoldConstant(expr Expression) Expression
- func GetFuncArg(e Expression, idx int) Expression
- func NewFunction(ctx sessionctx.Context, funcName string, retType *types.FieldType, ...) (Expression, error)
- func NewFunctionBase(ctx sessionctx.Context, funcName string, retType *types.FieldType, ...) (Expression, error)
- func NewFunctionInternal(ctx sessionctx.Context, funcName string, retType *types.FieldType, ...) Expression
- func NewFunctionTryFold(ctx sessionctx.Context, funcName string, retType *types.FieldType, ...) (Expression, error)
- func ParamMarkerExpression(ctx sessionctx.Context, v *driver.ParamMarkerExpr) (Expression, error)
- func PopRowFirstArg(ctx sessionctx.Context, e Expression) (ret Expression, err error)
- func PropagateConstant(ctx sessionctx.Context, conditions []Expression) []Expression
- func PushDownNot(ctx sessionctx.Context, expr Expression) Expression
- func RemoveDupExprs(ctx sessionctx.Context, exprs []Expression) []Expression
- func ScalarFuncs2Exprs(funcs []*ScalarFunction) []Expression
- func SplitCNFItems(onExpr Expression) []Expression
- func SplitDNFItems(onExpr Expression) []Expression
- func TryPushCastIntoControlFunctionForHybridType(ctx sessionctx.Context, expr Expression, tp *types.FieldType) (res Expression)
- func WrapWithCastAsDecimal(ctx sessionctx.Context, expr Expression) Expression
- func WrapWithCastAsDuration(ctx sessionctx.Context, expr Expression) Expression
- func WrapWithCastAsInt(ctx sessionctx.Context, expr Expression) Expression
- func WrapWithCastAsJSON(ctx sessionctx.Context, expr Expression) Expression
- func WrapWithCastAsReal(ctx sessionctx.Context, expr Expression) Expression
- func WrapWithCastAsString(ctx sessionctx.Context, expr Expression) Expression
- func WrapWithCastAsTime(ctx sessionctx.Context, expr Expression, tp *types.FieldType) Expression
- type IntSet
- type KeyInfo
- type MysqlRng
- type ParamMarker
- type PropagateConstantSolver
- type ReverseExpr
- type ScalarFunction
- func (sf *ScalarFunction) CharsetAndCollation(ctx sessionctx.Context) (string, string)
- func (sf *ScalarFunction) Clone() Expression
- func (sf *ScalarFunction) Coercibility() Coercibility
- func (sf *ScalarFunction) ConstItem(sc *stmtctx.StatementContext) bool
- func (sf *ScalarFunction) Decorrelate(schema *Schema) Expression
- func (sf *ScalarFunction) Equal(ctx sessionctx.Context, e Expression) bool
- func (sf *ScalarFunction) Eval(row chunk.Row) (d types.Datum, err error)
- func (sf *ScalarFunction) EvalDecimal(ctx sessionctx.Context, row chunk.Row) (*types.MyDecimal, bool, error)
- func (sf *ScalarFunction) EvalDuration(ctx sessionctx.Context, row chunk.Row) (types.Duration, bool, error)
- func (sf *ScalarFunction) EvalInt(ctx sessionctx.Context, row chunk.Row) (int64, bool, error)
- func (sf *ScalarFunction) EvalJSON(ctx sessionctx.Context, row chunk.Row) (json.BinaryJSON, bool, error)
- func (sf *ScalarFunction) EvalReal(ctx sessionctx.Context, row chunk.Row) (float64, bool, error)
- func (sf *ScalarFunction) EvalString(ctx sessionctx.Context, row chunk.Row) (string, bool, error)
- func (sf *ScalarFunction) EvalTime(ctx sessionctx.Context, row chunk.Row) (types.Time, bool, error)
- func (sf *ScalarFunction) GetArgs() []Expression
- func (sf *ScalarFunction) GetCtx() sessionctx.Context
- func (sf *ScalarFunction) GetSingleColumn(reverse bool) (*Column, bool)
- func (sf *ScalarFunction) GetType() *types.FieldType
- func (sf *ScalarFunction) HasCoercibility() bool
- func (sf *ScalarFunction) HashCode(sc *stmtctx.StatementContext) []byte
- func (sf *ScalarFunction) IsCorrelated() bool
- func (sf *ScalarFunction) MarshalJSON() ([]byte, error)
- func (sf *ScalarFunction) ResolveIndices(schema *Schema) (Expression, error)
- func (sf *ScalarFunction) ReverseEval(sc *stmtctx.StatementContext, res types.Datum, rType types.RoundingType) (val types.Datum, err error)
- func (sf *ScalarFunction) SetCharsetAndCollation(chs, coll string)
- func (sf *ScalarFunction) SetCoercibility(val Coercibility)
- func (sf *ScalarFunction) String() string
- func (sf *ScalarFunction) SupportReverseEval() bool
- func (sf *ScalarFunction) VecEvalDecimal(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (sf *ScalarFunction) VecEvalDuration(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (sf *ScalarFunction) VecEvalInt(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (sf *ScalarFunction) VecEvalJSON(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (sf *ScalarFunction) VecEvalReal(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (sf *ScalarFunction) VecEvalString(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (sf *ScalarFunction) VecEvalTime(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
- func (sf *ScalarFunction) Vectorized() bool
- type Schema
- func (s *Schema) Append(col ...*Column)
- func (s *Schema) Clone() *Schema
- func (s *Schema) ColumnIndex(col *Column) int
- func (s *Schema) ColumnsByIndices(offsets []int) []*Column
- func (s *Schema) ColumnsIndices(cols []*Column) (ret []int)
- func (s *Schema) Contains(col *Column) bool
- func (s *Schema) ExtractColGroups(colGroups [][]*Column) ([][]int, []int)
- func (s *Schema) IsUnique(col *Column) bool
- func (s *Schema) IsUniqueKey(col *Column) bool
- func (s *Schema) Len() int
- func (s *Schema) RetrieveColumn(col *Column) *Column
- func (s *Schema) SetUniqueKeys(keys []KeyInfo)
- func (s *Schema) String() string
- type VarAssignment
- type VecExpr
Constants ¶
This section is empty.
Variables ¶
var ( // CollationStrictnessGroup group collation by strictness CollationStrictnessGroup = map[string]int{ "utf8_general_ci": 1, "utf8mb4_general_ci": 1, "utf8_unicode_ci": 2, "utf8mb4_unicode_ci": 2, charset.CollationASCII: 3, charset.CollationLatin1: 3, charset.CollationUTF8: 3, charset.CollationUTF8MB4: 3, charset.CollationBin: 4, } // CollationStrictness indicates the strictness of comparison of the collation. The unequal order in a weak collation also holds in a strict collation. // For example, if a != b in a weak collation(e.g. general_ci), then there must be a != b in a strict collation(e.g. _bin). // collation group id in value is stricter than collation group id in key CollationStrictness = map[int][]int{ 1: {3, 4}, 2: {3, 4}, 3: {4}, 4: {}, } )
var DeferredFunctions = map[string]struct{}{ ast.Now: {}, ast.RandomBytes: {}, ast.CurrentTimestamp: {}, ast.UTCTime: {}, ast.Curtime: {}, ast.CurrentTime: {}, ast.UTCTimestamp: {}, ast.UnixTimestamp: {}, ast.Curdate: {}, ast.CurrentDate: {}, ast.UTCDate: {}, }
DeferredFunctions stores functions which are foldable but should be deferred as well when plan cache is enabled. Note that, these functions must be foldable at first place, i.e, they are not in `unFoldableFunctions`.
var DisableFoldFunctions = map[string]struct{}{ ast.Benchmark: {}, }
DisableFoldFunctions stores functions which prevent child scope functions from being constant folded. Typically, these functions shall also exist in unFoldableFunctions, to stop from being folded when they themselves are in child scope of an outer function, and the outer function is recursively folding its children.
var MaxPropagateColsCnt = 100
MaxPropagateColsCnt means the max number of columns that can participate propagation.
var TryFoldFunctions = map[string]struct{}{ ast.If: {}, ast.Ifnull: {}, ast.Case: {}, ast.LogicAnd: {}, ast.LogicOr: {}, ast.Coalesce: {}, ast.Interval: {}, }
TryFoldFunctions stores functions which try to fold constant in child scope functions if without errors/warnings, otherwise, the child functions do not fold constant. Note: the function itself should fold constant.
Functions ¶
func CanExprsPushDown ¶
func CanExprsPushDown(sc *stmtctx.StatementContext, exprs []Expression) bool
CanExprsPushDown return true if all the expr in exprs can be pushed down
func CanImplicitEvalInt ¶
func CanImplicitEvalInt(expr Expression) bool
CanImplicitEvalInt represents the builtin functions that have an implicit path to evaluate as integer, regardless of the type that type inference decides it to be. This is a nasty way to match the weird behavior of MySQL functions like `dayname()` being implicitly evaluated as integer. See https://github.com/mysql/mysql-server/blob/ee4455a33b10f1b1886044322e4893f587b319ed/sql/item_timefunc.h#L423 for details.
func CanImplicitEvalReal ¶
func CanImplicitEvalReal(expr Expression) bool
CanImplicitEvalReal represents the builtin functions that have an implicit path to evaluate as real, regardless of the type that type inference decides it to be. This is a nasty way to match the weird behavior of MySQL functions like `dayname()` being implicitly evaluated as real. See https://github.com/mysql/mysql-server/blob/ee4455a33b10f1b1886044322e4893f587b319ed/sql/item_timefunc.h#L423 for details.
func CheckArgsNotMultiColumnRow ¶
func CheckArgsNotMultiColumnRow(args ...Expression) error
CheckArgsNotMultiColumnRow checks the args are not multi-column row.
func CheckIllegalMixCollation ¶
func CheckIllegalMixCollation(funcName string, args []Expression, evalType types.EvalType) error
CheckIllegalMixCollation checks illegal mix collation with expressions
func CompareDecimal ¶
func CompareDecimal(sctx sessionctx.Context, lhsArg, rhsArg Expression, lhsRow, rhsRow chunk.Row) (int64, bool, error)
CompareDecimal compares two decimals.
func CompareDuration ¶
func CompareDuration(sctx sessionctx.Context, lhsArg, rhsArg Expression, lhsRow, rhsRow chunk.Row) (int64, bool, error)
CompareDuration compares two durations.
func CompareInt ¶
func CompareInt(sctx sessionctx.Context, lhsArg, rhsArg Expression, lhsRow, rhsRow chunk.Row) (int64, bool, error)
CompareInt compares two integers.
func CompareJSON ¶
func CompareJSON(sctx sessionctx.Context, lhsArg, rhsArg Expression, lhsRow, rhsRow chunk.Row) (int64, bool, error)
CompareJSON compares two JSONs.
func CompareReal ¶
func CompareReal(sctx sessionctx.Context, lhsArg, rhsArg Expression, lhsRow, rhsRow chunk.Row) (int64, bool, error)
CompareReal compares two float-point values.
func CompareStringWithCollationInfo ¶
func CompareStringWithCollationInfo(sctx sessionctx.Context, lhsArg, rhsArg Expression, lhsRow, rhsRow chunk.Row, collation string) (int64, bool, error)
CompareStringWithCollationInfo compares two strings with the specified collation information.
func CompareTime ¶
func CompareTime(sctx sessionctx.Context, lhsArg, rhsArg Expression, lhsRow, rhsRow chunk.Row) (int64, bool, error)
CompareTime compares two datetime or timestamps.
func ConstructPositionExpr ¶
func ConstructPositionExpr(p *driver.ParamMarkerExpr) *ast.PositionExpr
ConstructPositionExpr constructs PositionExpr with the given ParamMarkerExpr.
func ContainMutableConst ¶
func ContainMutableConst(ctx sessionctx.Context, exprs []Expression) bool
ContainMutableConst checks if the expressions contain a lazy constant.
func Contains ¶
func Contains(exprs []Expression, e Expression) bool
Contains tests if `exprs` contains `e`.
func DeriveCollationFromExprs ¶
func DeriveCollationFromExprs(ctx sessionctx.Context, exprs ...Expression) (dstCharset, dstCollation string)
DeriveCollationFromExprs derives collation information from these expressions.
func DisableParseJSONFlag4Expr ¶
func DisableParseJSONFlag4Expr(expr Expression)
DisableParseJSONFlag4Expr disables ParseToJSONFlag for `expr` except Column. We should not *PARSE* a string as JSON under some scenarios. ParseToJSONFlag is 0 for JSON column yet(as well as JSON correlated column), so we can skip it. Moreover, Column.RetType refers to the infoschema, if we modify it, data race may happen if another goroutine read from the infoschema at the same time.
func EvalBool ¶
EvalBool evaluates expression list to a boolean value. The first returned value indicates bool result of the expression list, the second returned value indicates whether the result of the expression list is null, it can only be true when the first returned values is false.
func ExprFromSchema ¶
func ExprFromSchema(expr Expression, schema *Schema) bool
ExprFromSchema checks if all columns of this expression are from the same schema.
func ExtractColumnSet ¶
func ExtractColumnSet(exprs []Expression) *intsets.Sparse
ExtractColumnSet extracts the different values of `UniqueId` for columns in expressions.
func FindFieldName ¶
FindFieldName finds the column name from NameSlice.
func GetAccurateCmpType ¶
func GetAccurateCmpType(lhs, rhs Expression) types.EvalType
GetAccurateCmpType uses a more complex logic to decide the EvalType of the two args when compare with each other than getBaseCmpType does.
func GetIntFromConstant ¶
func GetIntFromConstant(ctx sessionctx.Context, value Expression) (int, bool, error)
GetIntFromConstant gets an interger value from the Constant expression.
func GetRowLen ¶
func GetRowLen(e Expression) int
GetRowLen gets the length if the func is row, returns 1 if not row.
func GetStringFromConstant ¶
func GetStringFromConstant(ctx sessionctx.Context, value Expression) (string, bool, error)
GetStringFromConstant gets a string value from the Constant expression.
func GetUsedList ¶
GetUsedList shows whether each column in schema is contained in usedCols.
func HandleOverflowOnSelection ¶
HandleOverflowOnSelection handles Overflow errors when evaluating selection filters. We should ignore overflow errors when evaluating selection conditions:
INSERT INTO t VALUES ("999999999999999999"); SELECT * FROM t WHERE v;
func HasAssignSetVarFunc ¶
func HasAssignSetVarFunc(expr Expression) bool
HasAssignSetVarFunc checks whether an expression contains SetVar function and assign a value
func HasGetSetVarFunc ¶
func HasGetSetVarFunc(expr Expression) bool
HasGetSetVarFunc checks whether an expression contains SetVar/GetVar function.
func InferType4ControlFuncs ¶
func InferType4ControlFuncs(lexp, rexp Expression) *types.FieldType
InferType4ControlFuncs infer result type for builtin IF, IFNULL, NULLIF, LEAD and LAG.
func IsBinaryLiteral ¶
func IsBinaryLiteral(expr Expression) bool
IsBinaryLiteral checks whether an expression is a binary literal
func IsEQCondFromIn ¶
func IsEQCondFromIn(expr Expression) bool
IsEQCondFromIn checks if an expression is equal condition converted from `[not] in (subq)`.
func IsMutableEffectsExpr ¶
func IsMutableEffectsExpr(expr Expression) bool
IsMutableEffectsExpr checks if expr contains function which is mutable or has side effects.
func IsRuntimeConstExpr ¶
func IsRuntimeConstExpr(expr Expression) bool
IsRuntimeConstExpr checks if a expr can be treated as a constant in **executor**.
func PosFromPositionExpr ¶
func PosFromPositionExpr(ctx sessionctx.Context, v *ast.PositionExpr) (int, bool, error)
PosFromPositionExpr generates a position value from PositionExpr.
func PropConstOverOuterJoin ¶
func PropConstOverOuterJoin(ctx sessionctx.Context, joinConds, filterConds []Expression, outerSchema, innerSchema *Schema, nullSensitive bool) ([]Expression, []Expression)
PropConstOverOuterJoin propagate constant equal and column equal conditions over outer join. First step is to extract `outerCol = const` from join conditions and filter conditions, and substitute `outerCol` in join conditions with `const`; Second step is to extract `outerCol = innerCol` from join conditions, and derive new join conditions based on this column equal condition and `outerCol` related expressions in join conditions and filter conditions;
func PushDownExprs ¶
func PushDownExprs(sc *stmtctx.StatementContext, exprs []Expression) (pushed []Expression, remained []Expression)
PushDownExprs split the input exprs into pushed and remained, pushed include all the exprs that can be pushed down
func Quote ¶
Quote produce a result that can be used as a properly escaped data value in an SQL statement.
func ResolveType4Between ¶
func ResolveType4Between(args [3]Expression) types.EvalType
ResolveType4Between resolves eval type for between expression.
Types ¶
type Assignment ¶
type Assignment struct { Col *Column // ColName indicates its original column name in table schema. It's used for outputting helping message when executing meets some errors. ColName model.CIStr Expr Expression }
Assignment represents a set assignment in Update, such as Update t set c1 = hex(12), c2 = c3 where c2 = 1
type Coercibility ¶
type Coercibility int
Coercibility values are used to check whether the collation of one item can be coerced to the collation of other. See https://dev.mysql.com/doc/refman/8.0/en/charset-collation-coercibility.html
const ( // CoercibilityExplicit is derived from an explicit COLLATE clause. CoercibilityExplicit Coercibility = 0 // CoercibilityNone is derived from the concatenation of two strings with different collations. CoercibilityNone Coercibility = 1 // CoercibilityImplicit is derived from a column or a stored routine parameter or local variable or cast() function. CoercibilityImplicit Coercibility = 2 // CoercibilitySysconst is derived from a “system constant” (the string returned by functions such as USER() or VERSION()). CoercibilitySysconst Coercibility = 3 // CoercibilityCoercible is derived from a literal. CoercibilityCoercible Coercibility = 4 // CoercibilityNumeric is derived from a numeric or temporal value. CoercibilityNumeric Coercibility = 5 // CoercibilityIgnorable is derived from NULL or an expression that is derived from NULL. CoercibilityIgnorable Coercibility = 6 )
type CollationInfo ¶
type CollationInfo interface { // HasCoercibility returns if the Coercibility value is initialized. HasCoercibility() bool // Coercibility returns the coercibility value which is used to check collations. Coercibility() Coercibility // SetCoercibility sets a specified coercibility for this expression. SetCoercibility(val Coercibility) // CharsetAndCollation ... CharsetAndCollation(ctx sessionctx.Context) (string, string) // SetCharsetAndCollation ... SetCharsetAndCollation(chs, coll string) }
CollationInfo contains all interfaces about dealing with collation.
type Column ¶
type Column struct { RetType *types.FieldType // ID is used to specify whether this column is ExtraHandleColumn or to access histogram. // We'll try to remove it in the future. ID int64 // UniqueID is the unique id of this column. UniqueID int64 // Index is used for execution, to tell the column's position in the given row. Index int // VirtualExpr is used to save expression for virtual column VirtualExpr Expression OrigName string IsHidden bool // IsPrefix indicates whether this column is a prefix column in index. // // for example: // pk(col1, col2), index(col1(10)), key: col1(10)_col1_col2 => index's col1 will be true // pk(col1(10), col2), index(col1), key: col1_col1(10)_col2 => pk's col1 will be true IsPrefix bool // InOperand indicates whether this column is the inner operand of column equal condition converted // from `[not] in (subq)`. InOperand bool // contains filtered or unexported fields }
Column represents a column.
func ColInfo2Col ¶
func ColInfo2Col(cols []*Column, col *model.ColumnInfo) *Column
ColInfo2Col finds the corresponding column of the ColumnInfo in a column slice.
func ExtractColumns ¶
func ExtractColumns(expr Expression) []*Column
ExtractColumns extracts all columns from an expression.
func ExtractColumnsFromExpressions ¶
func ExtractColumnsFromExpressions(result []*Column, exprs []Expression, filter func(*Column) bool) []*Column
ExtractColumnsFromExpressions is a more efficient version of ExtractColumns for batch operation. filter can be nil, or a function to filter the result column. It's often observed that the pattern of the caller like this:
cols := ExtractColumns(...)
for _, col := range cols { if xxx(col) {...} }
Provide an additional filter argument, this can be done in one step. To avoid allocation for cols that not need.
func FindPrefixOfIndex ¶
FindPrefixOfIndex will find columns in index by checking the unique id. So it will return at once no matching column is found.
func IndexInfo2Cols ¶
func IndexInfo2Cols(colInfos []*model.ColumnInfo, cols []*Column, index *model.IndexInfo) ([]*Column, []int)
IndexInfo2Cols gets the corresponding []*Column of the indexInfo's []*IndexColumn, together with a []int containing their lengths. If this index has three IndexColumn that the 1st and 3rd IndexColumn has corresponding *Column, the return value will be [col1, nil, col2].
func IndexInfo2PrefixCols ¶
func IndexInfo2PrefixCols(colInfos []*model.ColumnInfo, cols []*Column, index *model.IndexInfo) ([]*Column, []int)
IndexInfo2PrefixCols gets the corresponding []*Column of the indexInfo's []*IndexColumn, together with a []int containing their lengths. If this index has three IndexColumn that the 1st and 3rd IndexColumn has corresponding *Column, the return value will be only the 1st corresponding *Column and its length. TODO: Use a struct to represent {*Column, int}. And merge IndexInfo2PrefixCols and IndexInfo2Cols.
func SortColumns ¶
SortColumns sort columns based on UniqueID.
func (*Column) CharsetAndCollation ¶
func (c *Column) CharsetAndCollation(ctx sessionctx.Context) (string, string)
func (*Column) Coercibility ¶
func (col *Column) Coercibility() Coercibility
Coercibility returns the coercibility value which is used to check collations.
func (*Column) ConstItem ¶
func (col *Column) ConstItem(_ *stmtctx.StatementContext) bool
ConstItem implements Expression interface.
func (*Column) Decorrelate ¶
func (col *Column) Decorrelate(_ *Schema) Expression
Decorrelate implements Expression interface.
func (*Column) Equal ¶
func (col *Column) Equal(_ sessionctx.Context, expr Expression) bool
Equal implements Expression interface.
func (*Column) EvalDecimal ¶
func (col *Column) EvalDecimal(ctx sessionctx.Context, row chunk.Row) (*types.MyDecimal, bool, error)
EvalDecimal returns decimal representation of Column.
func (*Column) EvalDuration ¶
func (col *Column) EvalDuration(ctx sessionctx.Context, row chunk.Row) (types.Duration, bool, error)
EvalDuration returns Duration representation of Column.
func (*Column) EvalJSON ¶
func (col *Column) EvalJSON(ctx sessionctx.Context, row chunk.Row) (json.BinaryJSON, bool, error)
EvalJSON returns JSON representation of Column.
func (*Column) EvalString ¶
EvalString returns string representation of Column.
func (*Column) EvalVirtualColumn ¶
EvalVirtualColumn evals the virtual column
func (*Column) HasCoercibility ¶
func (c *Column) HasCoercibility() bool
func (*Column) HashCode ¶
func (col *Column) HashCode(_ *stmtctx.StatementContext) []byte
HashCode implements Expression interface.
func (*Column) IsCorrelated ¶
IsCorrelated implements Expression interface.
func (*Column) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface.
func (*Column) ResolveIndices ¶
func (col *Column) ResolveIndices(schema *Schema) (Expression, error)
ResolveIndices implements Expression interface.
func (*Column) ReverseEval ¶
func (col *Column) ReverseEval(sc *stmtctx.StatementContext, res types.Datum, rType types.RoundingType) (val types.Datum, err error)
ReverseEval evaluates the only one column value with given function result.
func (*Column) SetCharsetAndCollation ¶
func (c *Column) SetCharsetAndCollation(chs, coll string)
func (*Column) SetCoercibility ¶
func (c *Column) SetCoercibility(val Coercibility)
SetCoercibility implements CollationInfo SetCoercibility interface.
func (*Column) SupportReverseEval ¶
SupportReverseEval checks whether the builtinFunc support reverse evaluation.
func (*Column) ToInfo ¶
func (col *Column) ToInfo() *model.ColumnInfo
ToInfo converts the expression.Column to model.ColumnInfo for casting values, beware it doesn't fill all the fields of the model.ColumnInfo.
func (*Column) VecEvalDecimal ¶
func (col *Column) VecEvalDecimal(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalDecimal evaluates this expression in a vectorized manner.
func (*Column) VecEvalDuration ¶
func (col *Column) VecEvalDuration(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalDuration evaluates this expression in a vectorized manner.
func (*Column) VecEvalInt ¶
func (col *Column) VecEvalInt(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalInt evaluates this expression in a vectorized manner.
func (*Column) VecEvalJSON ¶
func (col *Column) VecEvalJSON(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalJSON evaluates this expression in a vectorized manner.
func (*Column) VecEvalReal ¶
func (col *Column) VecEvalReal(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalReal evaluates this expression in a vectorized manner.
func (*Column) VecEvalString ¶
func (col *Column) VecEvalString(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalString evaluates this expression in a vectorized manner.
func (*Column) VecEvalTime ¶
func (col *Column) VecEvalTime(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalTime evaluates this expression in a vectorized manner.
func (*Column) Vectorized ¶
Vectorized returns if this expression supports vectorized evaluation.
type CompareFunc ¶
type CompareFunc = func(sctx sessionctx.Context, lhsArg, rhsArg Expression, lhsRow, rhsRow chunk.Row) (int64, bool, error)
CompareFunc defines the compare function prototype.
type Constant ¶
type Constant struct { Value types.Datum RetType *types.FieldType // DeferredExpr holds deferred function in PlanCache cached plan. // it's only used to represent non-deterministic functions(see expression.DeferredFunctions) // in PlanCache cached plan, so let them can be evaluated until cached item be used. DeferredExpr Expression // ParamMarker holds param index inside sessionVars.PreparedParams. // It's only used to reference a user variable provided in the `EXECUTE` statement or `COM_EXECUTE` binary protocol. ParamMarker *ParamMarker // contains filtered or unexported fields }
Constant stands for a constant value.
func RefineComparedConstant ¶
func RefineComparedConstant(ctx sessionctx.Context, targetFieldType types.FieldType, con *Constant, op opcode.Op) (_ *Constant, isExceptional bool)
RefineComparedConstant changes a non-integer constant argument to its ceiling or floor result by the given op. isExceptional indicates whether the 'int column cmp const' might be true/false. If isExceptional is true, ExecptionalVal is returned. Or, CorrectVal is returned. CorrectVal: The computed result. If the constant can be converted to int without exception, return the val. Else return 'con'(the input). ExceptionalVal : It is used to get more information to check whether 'int column cmp const' is true/false
If the op == LT,LE,GT,GE and it gets an Overflow when converting, return inf/-inf. If the op == EQ,NullEQ and the constant can never be equal to the int column, return ‘con’(the input, a non-int constant).
func (*Constant) CharsetAndCollation ¶
func (c *Constant) CharsetAndCollation(ctx sessionctx.Context) (string, string)
func (*Constant) Clone ¶
func (c *Constant) Clone() Expression
Clone implements Expression interface.
func (*Constant) Coercibility ¶
func (c *Constant) Coercibility() Coercibility
Coercibility returns the coercibility value which is used to check collations.
func (*Constant) ConstItem ¶
func (c *Constant) ConstItem(sc *stmtctx.StatementContext) bool
ConstItem implements Expression interface.
func (*Constant) Decorrelate ¶
func (c *Constant) Decorrelate(_ *Schema) Expression
Decorrelate implements Expression interface.
func (*Constant) Equal ¶
func (c *Constant) Equal(ctx sessionctx.Context, b Expression) bool
Equal implements Expression interface.
func (*Constant) EvalDecimal ¶
func (c *Constant) EvalDecimal(ctx sessionctx.Context, row chunk.Row) (*types.MyDecimal, bool, error)
EvalDecimal returns decimal representation of Constant.
func (*Constant) EvalDuration ¶
func (c *Constant) EvalDuration(ctx sessionctx.Context, row chunk.Row) (val types.Duration, isNull bool, err error)
EvalDuration returns Duration representation of Constant.
func (*Constant) EvalJSON ¶
func (c *Constant) EvalJSON(ctx sessionctx.Context, row chunk.Row) (json.BinaryJSON, bool, error)
EvalJSON returns JSON representation of Constant.
func (*Constant) EvalString ¶
EvalString returns string representation of Constant.
func (*Constant) EvalTime ¶
func (c *Constant) EvalTime(ctx sessionctx.Context, row chunk.Row) (val types.Time, isNull bool, err error)
EvalTime returns DATE/DATETIME/TIMESTAMP representation of Constant.
func (*Constant) HasCoercibility ¶
func (c *Constant) HasCoercibility() bool
func (*Constant) HashCode ¶
func (c *Constant) HashCode(sc *stmtctx.StatementContext) []byte
HashCode implements Expression interface.
func (*Constant) IsCorrelated ¶
IsCorrelated implements Expression interface.
func (*Constant) MarshalJSON ¶
MarshalJSON implements json.Marshaler interface.
func (*Constant) ResolveIndices ¶
func (c *Constant) ResolveIndices(_ *Schema) (Expression, error)
ResolveIndices implements Expression interface.
func (*Constant) ReverseEval ¶
func (c *Constant) ReverseEval(sc *stmtctx.StatementContext, res types.Datum, rType types.RoundingType) (val types.Datum, err error)
ReverseEval evaluates the only one column value with given function result.
func (*Constant) SetCharsetAndCollation ¶
func (c *Constant) SetCharsetAndCollation(chs, coll string)
func (*Constant) SetCoercibility ¶
func (c *Constant) SetCoercibility(val Coercibility)
SetCoercibility implements CollationInfo SetCoercibility interface.
func (*Constant) SupportReverseEval ¶
SupportReverseEval checks whether the builtinFunc support reverse evaluation.
func (*Constant) VecEvalDecimal ¶
func (c *Constant) VecEvalDecimal(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalDecimal evaluates this expression in a vectorized manner.
func (*Constant) VecEvalDuration ¶
func (c *Constant) VecEvalDuration(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalDuration evaluates this expression in a vectorized manner.
func (*Constant) VecEvalInt ¶
func (c *Constant) VecEvalInt(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalInt evaluates this expression in a vectorized manner.
func (*Constant) VecEvalJSON ¶
func (c *Constant) VecEvalJSON(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalJSON evaluates this expression in a vectorized manner.
func (*Constant) VecEvalReal ¶
func (c *Constant) VecEvalReal(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalReal evaluates this expression in a vectorized manner.
func (*Constant) VecEvalString ¶
func (c *Constant) VecEvalString(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalString evaluates this expression in a vectorized manner.
func (*Constant) VecEvalTime ¶
func (c *Constant) VecEvalTime(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalTime evaluates this expression in a vectorized manner.
func (*Constant) Vectorized ¶
Vectorized returns if this expression supports vectorized evaluation.
type CorrelatedColumn ¶
type CorrelatedColumn struct {}
CorrelatedColumn stands for a column in a correlated sub query.
func ExtractCorColumns ¶
func ExtractCorColumns(expr Expression) (cols []*CorrelatedColumn)
ExtractCorColumns extracts correlated column from given expression.
func (*CorrelatedColumn) CharsetAndCollation ¶
func (c *CorrelatedColumn) CharsetAndCollation(ctx sessionctx.Context) (string, string)
func (*CorrelatedColumn) Clone ¶
func (col *CorrelatedColumn) Clone() Expression
Clone implements Expression interface.
func (*CorrelatedColumn) ConstItem ¶
func (col *CorrelatedColumn) ConstItem(_ *stmtctx.StatementContext) bool
ConstItem implements Expression interface.
func (*CorrelatedColumn) Decorrelate ¶
func (col *CorrelatedColumn) Decorrelate(schema *Schema) Expression
Decorrelate implements Expression interface.
func (*CorrelatedColumn) Equal ¶
func (col *CorrelatedColumn) Equal(ctx sessionctx.Context, expr Expression) bool
Equal implements Expression interface.
func (*CorrelatedColumn) EvalDecimal ¶
func (col *CorrelatedColumn) EvalDecimal(ctx sessionctx.Context, row chunk.Row) (*types.MyDecimal, bool, error)
EvalDecimal returns decimal representation of CorrelatedColumn.
func (*CorrelatedColumn) EvalDuration ¶
func (col *CorrelatedColumn) EvalDuration(ctx sessionctx.Context, row chunk.Row) (types.Duration, bool, error)
EvalDuration returns Duration representation of CorrelatedColumn.
func (*CorrelatedColumn) EvalInt ¶
func (col *CorrelatedColumn) EvalInt(ctx sessionctx.Context, row chunk.Row) (int64, bool, error)
EvalInt returns int representation of CorrelatedColumn.
func (*CorrelatedColumn) EvalJSON ¶
func (col *CorrelatedColumn) EvalJSON(ctx sessionctx.Context, row chunk.Row) (json.BinaryJSON, bool, error)
EvalJSON returns JSON representation of CorrelatedColumn.
func (*CorrelatedColumn) EvalReal ¶
func (col *CorrelatedColumn) EvalReal(ctx sessionctx.Context, row chunk.Row) (float64, bool, error)
EvalReal returns real representation of CorrelatedColumn.
func (*CorrelatedColumn) EvalString ¶
func (col *CorrelatedColumn) EvalString(ctx sessionctx.Context, row chunk.Row) (string, bool, error)
EvalString returns string representation of CorrelatedColumn.
func (*CorrelatedColumn) EvalTime ¶
func (col *CorrelatedColumn) EvalTime(ctx sessionctx.Context, row chunk.Row) (types.Time, bool, error)
EvalTime returns DATE/DATETIME/TIMESTAMP representation of CorrelatedColumn.
func (*CorrelatedColumn) HasCoercibility ¶
func (c *CorrelatedColumn) HasCoercibility() bool
func (*CorrelatedColumn) IsCorrelated ¶
func (col *CorrelatedColumn) IsCorrelated() bool
IsCorrelated implements Expression interface.
func (*CorrelatedColumn) ResolveIndices ¶
func (col *CorrelatedColumn) ResolveIndices(_ *Schema) (Expression, error)
ResolveIndices implements Expression interface.
func (*CorrelatedColumn) SetCharsetAndCollation ¶
func (c *CorrelatedColumn) SetCharsetAndCollation(chs, coll string)
func (*CorrelatedColumn) SetCoercibility ¶
func (c *CorrelatedColumn) SetCoercibility(val Coercibility)
SetCoercibility implements CollationInfo SetCoercibility interface.
func (*CorrelatedColumn) VecEvalDecimal ¶
func (col *CorrelatedColumn) VecEvalDecimal(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalDecimal evaluates this expression in a vectorized manner.
func (*CorrelatedColumn) VecEvalDuration ¶
func (col *CorrelatedColumn) VecEvalDuration(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalDuration evaluates this expression in a vectorized manner.
func (*CorrelatedColumn) VecEvalInt ¶
func (col *CorrelatedColumn) VecEvalInt(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalInt evaluates this expression in a vectorized manner.
func (*CorrelatedColumn) VecEvalJSON ¶
func (col *CorrelatedColumn) VecEvalJSON(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalJSON evaluates this expression in a vectorized manner.
func (*CorrelatedColumn) VecEvalReal ¶
func (col *CorrelatedColumn) VecEvalReal(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalReal evaluates this expression in a vectorized manner.
func (*CorrelatedColumn) VecEvalString ¶
func (col *CorrelatedColumn) VecEvalString(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalString evaluates this expression in a vectorized manner.
func (*CorrelatedColumn) VecEvalTime ¶
func (col *CorrelatedColumn) VecEvalTime(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalTime evaluates this expression in a vectorized manner.
type Expression ¶
type Expression interface { fmt.Stringer goJSON.Marshaler VecExpr ReverseExpr CollationInfo // Eval evaluates an expression through a row. Eval(row chunk.Row) (types.Datum, error) // EvalInt returns the int64 representation of expression. EvalInt(ctx sessionctx.Context, row chunk.Row) (val int64, isNull bool, err error) // EvalReal returns the float64 representation of expression. EvalReal(ctx sessionctx.Context, row chunk.Row) (val float64, isNull bool, err error) // EvalString returns the string representation of expression. EvalString(ctx sessionctx.Context, row chunk.Row) (val string, isNull bool, err error) // EvalDecimal returns the decimal representation of expression. EvalDecimal(ctx sessionctx.Context, row chunk.Row) (val *types.MyDecimal, isNull bool, err error) // EvalTime returns the DATE/DATETIME/TIMESTAMP representation of expression. EvalTime(ctx sessionctx.Context, row chunk.Row) (val types.Time, isNull bool, err error) // EvalDuration returns the duration representation of expression. EvalDuration(ctx sessionctx.Context, row chunk.Row) (val types.Duration, isNull bool, err error) // EvalJSON returns the JSON representation of expression. EvalJSON(ctx sessionctx.Context, row chunk.Row) (val json.BinaryJSON, isNull bool, err error) // GetType gets the type that the expression returns. GetType() *types.FieldType // Clone copies an expression totally. Clone() Expression // Equal checks whether two expressions are equal. Equal(ctx sessionctx.Context, e Expression) bool IsCorrelated() bool // ConstItem checks if this expression is constant item, regardless of query evaluation state. // An expression is constant item if it: // refers no tables. // refers no correlated column. // refers no subqueries that refers any tables. // refers no non-deterministic functions. // refers no statement parameters. // refers no param markers when prepare plan cache is enabled. ConstItem(sc *stmtctx.StatementContext) bool // Decorrelate try to decorrelate the expression by schema. Decorrelate(schema *Schema) Expression // ResolveIndices resolves indices by the given schema. It will copy the original expression and return the copied one. ResolveIndices(schema *Schema) (Expression, error) // HashCode creates the hashcode for expression which can be used to identify itself from other expression. // It generated as the following: // Constant: ConstantFlag+encoded value // Column: ColumnFlag+encoded value // ScalarFunction: SFFlag+encoded function name + encoded arg_1 + encoded arg_2 + ... HashCode(sc *stmtctx.StatementContext) []byte // contains filtered or unexported methods }
Expression represents all scalar expression in SQL.
func BuildCastFunction ¶
func BuildCastFunction(ctx sessionctx.Context, expr Expression, tp *types.FieldType) (res Expression)
BuildCastFunction builds a CAST ScalarFunction from the Expression.
func BuildCastFunction4Union ¶
func BuildCastFunction4Union(ctx sessionctx.Context, expr Expression, tp *types.FieldType) (res Expression)
BuildCastFunction4Union build a implicitly CAST ScalarFunction from the Union Expression.
func BuildNotNullExpr ¶
func BuildNotNullExpr(ctx sessionctx.Context, expr Expression) Expression
BuildNotNullExpr wraps up `not(isnull())` for given expression.
func Column2Exprs ¶
func Column2Exprs(cols []*Column) []Expression
Column2Exprs will transfer column slice to expression slice.
func ColumnSubstitute ¶
func ColumnSubstitute(expr Expression, schema *Schema, newExprs []Expression) Expression
ColumnSubstitute substitutes the columns in filter to expressions in select fields. e.g. select * from (select b as a from t) k where a < 10 => select * from (select b as a from t where b < 10) k.
func ColumnSubstituteImpl ¶
func ColumnSubstituteImpl(expr Expression, schema *Schema, newExprs []Expression) (bool, Expression)
ColumnSubstituteImpl tries to substitute column expr using newExprs, the newFunctionInternal is only called if its child is substituted
func ComposeCNFCondition ¶
func ComposeCNFCondition(ctx sessionctx.Context, conditions ...Expression) Expression
ComposeCNFCondition composes CNF items into a balance deep CNF tree, which benefits a lot for pb decoder/encoder.
func ComposeDNFCondition ¶
func ComposeDNFCondition(ctx sessionctx.Context, conditions ...Expression) Expression
ComposeDNFCondition composes DNF items into a balance deep DNF tree.
func DeriveRelaxedFiltersFromDNF ¶
func DeriveRelaxedFiltersFromDNF(expr Expression, schema *Schema) Expression
DeriveRelaxedFiltersFromDNF given a DNF expression, derive a relaxed DNF expression which only contains columns in specified schema; the derived expression is a superset of original expression, i.e, any tuple satisfying the original expression must satisfy the derived expression. Return nil when the derived expression is universal set. A running example is: for schema of t1, `(t1.a=1 and t2.a=1) or (t1.a=2 and t2.a=2)` would be derived as `t1.a=1 or t1.a=2`, while `t1.a=1 or t2.a=1` would get nil.
func EvaluateExprWithNull ¶
func EvaluateExprWithNull(ctx sessionctx.Context, schema *Schema, expr Expression) Expression
EvaluateExprWithNull sets columns in schema as null and calculate the final result of the scalar function. If the Expression is a non-constant value, it means the result is unknown.
func ExtractFiltersFromDNFs ¶
func ExtractFiltersFromDNFs(ctx sessionctx.Context, conditions []Expression) []Expression
ExtractFiltersFromDNFs checks whether the cond is DNF. If so, it will get the extracted part and the remained part. The original DNF will be replaced by the remained part or just be deleted if remained part is nil. And the extracted part will be appended to the end of the orignal slice.
func Filter ¶
func Filter(result []Expression, input []Expression, filter func(Expression) bool) []Expression
Filter the input expressions, append the results to result.
func FlattenCNFConditions ¶
func FlattenCNFConditions(CNFCondition *ScalarFunction) []Expression
FlattenCNFConditions extracts CNF expression's leaf item. e.g. and(and(a>1, a>2), and(a>3, a>4)), we'll get [a>1, a>2, a>3, a>4].
func FlattenDNFConditions ¶
func FlattenDNFConditions(DNFCondition *ScalarFunction) []Expression
FlattenDNFConditions extracts DNF expression's leaf item. e.g. or(or(a=1, a=2), or(a=3, a=4)), we'll get [a=1, a=2, a=3, a=4].
func FoldConstant ¶
func FoldConstant(expr Expression) Expression
FoldConstant does constant folding optimization on an expression excluding deferred ones.
func GetFuncArg ¶
func GetFuncArg(e Expression, idx int) Expression
GetFuncArg gets the argument of the function at idx.
func NewFunction ¶
func NewFunction(ctx sessionctx.Context, funcName string, retType *types.FieldType, args ...Expression) (Expression, error)
NewFunction creates a new scalar function or constant via a constant folding.
func NewFunctionBase ¶
func NewFunctionBase(ctx sessionctx.Context, funcName string, retType *types.FieldType, args ...Expression) (Expression, error)
NewFunctionBase creates a new scalar function with no constant folding.
func NewFunctionInternal ¶
func NewFunctionInternal(ctx sessionctx.Context, funcName string, retType *types.FieldType, args ...Expression) Expression
NewFunctionInternal is similar to NewFunction, but do not returns error, should only be used internally.
func NewFunctionTryFold ¶
func NewFunctionTryFold(ctx sessionctx.Context, funcName string, retType *types.FieldType, args ...Expression) (Expression, error)
NewFunctionTryFold creates a new scalar function with trying constant folding.
func ParamMarkerExpression ¶
func ParamMarkerExpression(ctx sessionctx.Context, v *driver.ParamMarkerExpr) (Expression, error)
ParamMarkerExpression generate a getparam function expression.
func PopRowFirstArg ¶
func PopRowFirstArg(ctx sessionctx.Context, e Expression) (ret Expression, err error)
PopRowFirstArg pops the first element and returns the rest of row. e.g. After this function (1, 2, 3) becomes (2, 3).
func PropagateConstant ¶
func PropagateConstant(ctx sessionctx.Context, conditions []Expression) []Expression
PropagateConstant propagate constant values of deterministic predicates in a condition.
func PushDownNot ¶
func PushDownNot(ctx sessionctx.Context, expr Expression) Expression
PushDownNot pushes the `not` function down to the expression's arguments.
func RemoveDupExprs ¶
func RemoveDupExprs(ctx sessionctx.Context, exprs []Expression) []Expression
RemoveDupExprs removes identical exprs. Not that if expr contains functions which are mutable or have side effects, we cannot remove it even if it has duplicates; if the plan is going to be cached, we cannot remove expressions containing `?` neither.
func ScalarFuncs2Exprs ¶
func ScalarFuncs2Exprs(funcs []*ScalarFunction) []Expression
ScalarFuncs2Exprs converts []*ScalarFunction to []Expression.
func SplitCNFItems ¶
func SplitCNFItems(onExpr Expression) []Expression
SplitCNFItems splits CNF items. CNF means conjunctive normal form, e.g. "a and b and c".
func SplitDNFItems ¶
func SplitDNFItems(onExpr Expression) []Expression
SplitDNFItems splits DNF items. DNF means disjunctive normal form, e.g. "a or b or c".
func TryPushCastIntoControlFunctionForHybridType ¶
func TryPushCastIntoControlFunctionForHybridType(ctx sessionctx.Context, expr Expression, tp *types.FieldType) (res Expression)
TryPushCastIntoControlFunctionForHybridType try to push cast into control function for Hybrid Type. If necessary, it will rebuild control function using changed args. When a hybrid type is the output of a control function, the result may be as a numeric type to subsequent calculation We should perform the `Cast` operation early to avoid using the wrong type for calculation For example, the condition `if(1, e, 'a') = 1`, `if` function will output `e` and compare with `1`. If the evaltype is ETString, it will get wrong result. So we can rewrite the condition to `IfInt(1, cast(e as int), cast('a' as int)) = 1` to get the correct result.
func WrapWithCastAsDecimal ¶
func WrapWithCastAsDecimal(ctx sessionctx.Context, expr Expression) Expression
WrapWithCastAsDecimal wraps `expr` with `cast` if the return type of expr is not type decimal, otherwise, returns `expr` directly.
func WrapWithCastAsDuration ¶
func WrapWithCastAsDuration(ctx sessionctx.Context, expr Expression) Expression
WrapWithCastAsDuration wraps `expr` with `cast` if the return type of expr is not type duration, otherwise, returns `expr` directly.
func WrapWithCastAsInt ¶
func WrapWithCastAsInt(ctx sessionctx.Context, expr Expression) Expression
WrapWithCastAsInt wraps `expr` with `cast` if the return type of expr is not type int, otherwise, returns `expr` directly.
func WrapWithCastAsJSON ¶
func WrapWithCastAsJSON(ctx sessionctx.Context, expr Expression) Expression
WrapWithCastAsJSON wraps `expr` with `cast` if the return type of expr is not type json, otherwise, returns `expr` directly.
func WrapWithCastAsReal ¶
func WrapWithCastAsReal(ctx sessionctx.Context, expr Expression) Expression
WrapWithCastAsReal wraps `expr` with `cast` if the return type of expr is not type real, otherwise, returns `expr` directly.
func WrapWithCastAsString ¶
func WrapWithCastAsString(ctx sessionctx.Context, expr Expression) Expression
WrapWithCastAsString wraps `expr` with `cast` if the return type of expr is not type string, otherwise, returns `expr` directly.
func WrapWithCastAsTime ¶
func WrapWithCastAsTime(ctx sessionctx.Context, expr Expression, tp *types.FieldType) Expression
WrapWithCastAsTime wraps `expr` with `cast` if the return type of expr is not same as type of the specified `tp` , otherwise, returns `expr` directly.
type IntSet ¶
type IntSet struct {
// contains filtered or unexported fields
}
IntSet is the int disjoint set.
type MysqlRng ¶
type MysqlRng struct {
// contains filtered or unexported fields
}
MysqlRng is random number generator and this implementation is ported from MySQL. See https://github.com/tikv/tikv/pull/6117#issuecomment-562489078.
func NewWithSeed ¶
NewWithSeed create a rng with random seed.
type ParamMarker ¶
type ParamMarker struct {
// contains filtered or unexported fields
}
ParamMarker indicates param provided by COM_STMT_EXECUTE.
func (*ParamMarker) GetUserVar ¶
func (d *ParamMarker) GetUserVar() types.Datum
GetUserVar returns the corresponding user variable presented in the `EXECUTE` statement or `COM_EXECUTE` command.
type PropagateConstantSolver ¶
type PropagateConstantSolver interface {
PropagateConstant(ctx sessionctx.Context, conditions []Expression) []Expression
}
PropagateConstantSolver is a constant propagate solver.
type ReverseExpr ¶
type ReverseExpr interface { // SupportReverseEval checks whether the builtinFunc support reverse evaluation. SupportReverseEval() bool // ReverseEval evaluates the only one column value with given function result. ReverseEval(sc *stmtctx.StatementContext, res types.Datum, rType types.RoundingType) (val types.Datum, err error) }
ReverseExpr contains all resersed evaluation methods.
type ScalarFunction ¶
type ScalarFunction struct { FuncName model.CIStr // RetType is the type that ScalarFunction returns. // TODO: Implement type inference here, now we use ast's return type temporarily. RetType *types.FieldType Function builtinFunc // contains filtered or unexported fields }
ScalarFunction is the function that returns a value.
func (*ScalarFunction) CharsetAndCollation ¶
func (sf *ScalarFunction) CharsetAndCollation(ctx sessionctx.Context) (string, string)
CharsetAndCollation ...
func (*ScalarFunction) Clone ¶
func (sf *ScalarFunction) Clone() Expression
Clone implements Expression interface.
func (*ScalarFunction) Coercibility ¶
func (sf *ScalarFunction) Coercibility() Coercibility
Coercibility returns the coercibility value which is used to check collations.
func (*ScalarFunction) ConstItem ¶
func (sf *ScalarFunction) ConstItem(sc *stmtctx.StatementContext) bool
ConstItem implements Expression interface.
func (*ScalarFunction) Decorrelate ¶
func (sf *ScalarFunction) Decorrelate(schema *Schema) Expression
Decorrelate implements Expression interface.
func (*ScalarFunction) Equal ¶
func (sf *ScalarFunction) Equal(ctx sessionctx.Context, e Expression) bool
Equal implements Expression interface.
func (*ScalarFunction) EvalDecimal ¶
func (sf *ScalarFunction) EvalDecimal(ctx sessionctx.Context, row chunk.Row) (*types.MyDecimal, bool, error)
EvalDecimal implements Expression interface.
func (*ScalarFunction) EvalDuration ¶
func (sf *ScalarFunction) EvalDuration(ctx sessionctx.Context, row chunk.Row) (types.Duration, bool, error)
EvalDuration implements Expression interface.
func (*ScalarFunction) EvalInt ¶
func (sf *ScalarFunction) EvalInt(ctx sessionctx.Context, row chunk.Row) (int64, bool, error)
EvalInt implements Expression interface.
func (*ScalarFunction) EvalJSON ¶
func (sf *ScalarFunction) EvalJSON(ctx sessionctx.Context, row chunk.Row) (json.BinaryJSON, bool, error)
EvalJSON implements Expression interface.
func (*ScalarFunction) EvalReal ¶
func (sf *ScalarFunction) EvalReal(ctx sessionctx.Context, row chunk.Row) (float64, bool, error)
EvalReal implements Expression interface.
func (*ScalarFunction) EvalString ¶
func (sf *ScalarFunction) EvalString(ctx sessionctx.Context, row chunk.Row) (string, bool, error)
EvalString implements Expression interface.
func (*ScalarFunction) EvalTime ¶
func (sf *ScalarFunction) EvalTime(ctx sessionctx.Context, row chunk.Row) (types.Time, bool, error)
EvalTime implements Expression interface.
func (*ScalarFunction) GetArgs ¶
func (sf *ScalarFunction) GetArgs() []Expression
GetArgs gets arguments of function.
func (*ScalarFunction) GetCtx ¶
func (sf *ScalarFunction) GetCtx() sessionctx.Context
GetCtx gets the context of function.
func (*ScalarFunction) GetSingleColumn ¶
func (sf *ScalarFunction) GetSingleColumn(reverse bool) (*Column, bool)
GetSingleColumn returns (Col, Desc) when the ScalarFunction is equivalent to (Col, Desc) when used as a sort key, otherwise returns (nil, false).
Can only handle: - ast.Plus - ast.Minus - ast.UnaryMinus
func (*ScalarFunction) GetType ¶
func (sf *ScalarFunction) GetType() *types.FieldType
GetType implements Expression interface.
func (*ScalarFunction) HasCoercibility ¶
func (sf *ScalarFunction) HasCoercibility() bool
HasCoercibility ...
func (*ScalarFunction) HashCode ¶
func (sf *ScalarFunction) HashCode(sc *stmtctx.StatementContext) []byte
HashCode implements Expression interface.
func (*ScalarFunction) IsCorrelated ¶
func (sf *ScalarFunction) IsCorrelated() bool
IsCorrelated implements Expression interface.
func (*ScalarFunction) MarshalJSON ¶
func (sf *ScalarFunction) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler interface.
func (*ScalarFunction) ResolveIndices ¶
func (sf *ScalarFunction) ResolveIndices(schema *Schema) (Expression, error)
ResolveIndices implements Expression interface.
func (*ScalarFunction) ReverseEval ¶
func (sf *ScalarFunction) ReverseEval(sc *stmtctx.StatementContext, res types.Datum, rType types.RoundingType) (val types.Datum, err error)
ReverseEval evaluates the only one column value with given function result.
func (*ScalarFunction) SetCharsetAndCollation ¶
func (sf *ScalarFunction) SetCharsetAndCollation(chs, coll string)
SetCharsetAndCollation ...
func (*ScalarFunction) SetCoercibility ¶
func (sf *ScalarFunction) SetCoercibility(val Coercibility)
SetCoercibility sets a specified coercibility for this expression.
func (*ScalarFunction) String ¶
func (sf *ScalarFunction) String() string
String implements fmt.Stringer interface.
func (*ScalarFunction) SupportReverseEval ¶
func (sf *ScalarFunction) SupportReverseEval() bool
SupportReverseEval returns if this expression supports reversed evaluation.
func (*ScalarFunction) VecEvalDecimal ¶
func (sf *ScalarFunction) VecEvalDecimal(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalDecimal evaluates this expression in a vectorized manner.
func (*ScalarFunction) VecEvalDuration ¶
func (sf *ScalarFunction) VecEvalDuration(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalDuration evaluates this expression in a vectorized manner.
func (*ScalarFunction) VecEvalInt ¶
func (sf *ScalarFunction) VecEvalInt(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalInt evaluates this expression in a vectorized manner.
func (*ScalarFunction) VecEvalJSON ¶
func (sf *ScalarFunction) VecEvalJSON(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalJSON evaluates this expression in a vectorized manner.
func (*ScalarFunction) VecEvalReal ¶
func (sf *ScalarFunction) VecEvalReal(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalReal evaluates this expression in a vectorized manner.
func (*ScalarFunction) VecEvalString ¶
func (sf *ScalarFunction) VecEvalString(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalString evaluates this expression in a vectorized manner.
func (*ScalarFunction) VecEvalTime ¶
func (sf *ScalarFunction) VecEvalTime(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error
VecEvalTime evaluates this expression in a vectorized manner.
func (*ScalarFunction) Vectorized ¶
func (sf *ScalarFunction) Vectorized() bool
Vectorized returns if this expression supports vectorized evaluation.
type Schema ¶
type Schema struct { Columns []*Column Keys []KeyInfo // UniqueKeys stores those unique indexes that allow null values, but Keys does not allow null values. // since equivalence conditions can filter out null values, in this case a unique index with null values can be a Key. UniqueKeys []KeyInfo }
Schema stands for the row schema and unique key information get from input.
func MergeSchema ¶
MergeSchema will merge two schema into one schema. We shouldn't need to consider unique keys. That will be processed in build_key_info.go.
func (*Schema) ColumnIndex ¶
ColumnIndex finds the index for a column.
func (*Schema) ColumnsByIndices ¶
ColumnsByIndices returns columns by multiple offsets. Callers should guarantee that all the offsets provided should be valid, which means offset should: 1. not smaller than 0, and 2. not exceed len(s.Columns)
func (*Schema) ColumnsIndices ¶
ColumnsIndices will return a slice which contains the position of each column in schema. If there is one column that doesn't match, nil will be returned.
func (*Schema) ExtractColGroups ¶
ExtractColGroups checks if column groups are from current schema, and returns offsets of those satisfied column groups.
func (*Schema) IsUnique ¶
IsUnique checks if this column is a unique key which may contain duplicate nulls .
func (*Schema) IsUniqueKey ¶
IsUniqueKey checks if this column is a unique key.
func (*Schema) RetrieveColumn ¶
RetrieveColumn retrieves column in expression from the columns in schema.
func (*Schema) SetUniqueKeys ¶
SetUniqueKeys will set the value of Schema.Keys.
type VarAssignment ¶
type VarAssignment struct { Name string Expr Expression IsDefault bool IsGlobal bool IsSystem bool ExtendValue *Constant }
VarAssignment represents a variable assignment in Set, such as set global a = 1.
type VecExpr ¶
type VecExpr interface { // Vectorized returns if this expression supports vectorized evaluation. Vectorized() bool // VecEvalInt evaluates this expression in a vectorized manner. VecEvalInt(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error // VecEvalReal evaluates this expression in a vectorized manner. VecEvalReal(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error // VecEvalString evaluates this expression in a vectorized manner. VecEvalString(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error // VecEvalDecimal evaluates this expression in a vectorized manner. VecEvalDecimal(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error // VecEvalTime evaluates this expression in a vectorized manner. VecEvalTime(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error // VecEvalDuration evaluates this expression in a vectorized manner. VecEvalDuration(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error // VecEvalJSON evaluates this expression in a vectorized manner. VecEvalJSON(ctx sessionctx.Context, input *chunk.Chunk, result *chunk.Column) error }
VecExpr contains all vectorized evaluation methods.
Source Files ¶
- builtin.go
- builtin_arithmetic.go
- builtin_arithmetic_vec.go
- builtin_cast.go
- builtin_cast_vec.go
- builtin_compare.go
- builtin_compare_vec.go
- builtin_compare_vec_generated.go
- builtin_control.go
- builtin_control_vec_generated.go
- builtin_json.go
- builtin_json_vec.go
- builtin_like.go
- builtin_like_vec.go
- builtin_math.go
- builtin_math_vec.go
- builtin_op.go
- builtin_op_vec.go
- builtin_other.go
- builtin_string.go
- builtin_string_vec.go
- builtin_string_vec_generated.go
- builtin_time.go
- builtin_time_vec.go
- builtin_time_vec_generated.go
- builtin_vectorized.go
- chunk_executor.go
- collation.go
- column.go
- constant.go
- constant_fold.go
- constant_propagation.go
- errors.go
- expression.go
- function_traits.go
- helper.go
- int_set.go
- rand.go
- scalar_function.go
- schema.go
- simple_rewriter.go
- util.go
- vectorized.go