Documentation ¶
Index ¶
- Constants
- Variables
- func DetachCondsForTableRange(ctx context.Context, conds []expression.Expression, col *expression.Column) (accessContditions, otherConditions []expression.Expression)
- func DetachIndexConditions(conditions []expression.Expression, cols []*expression.Column, lengths []int) (accessConds []expression.Expression, filterConds []expression.Expression)
- func ExtractAccessConditions(conds []expression.Expression, rangeType RangeType, cols []*expression.Column, ...) []expression.Expression
- type IntColumnRange
- type NewRange
- func BuildColumnRange(conds []expression.Expression, sc *stmtctx.StatementContext, ...) ([]*NewRange, error)
- func BuildIndexRange(sc *stmtctx.StatementContext, cols []*expression.Column, lengths []int, ...) ([]*NewRange, error)
- func BuildTableRange(accessConditions []expression.Expression, sc *stmtctx.StatementContext, ...) ([]*NewRange, error)
- func FullIntNewRange(isUnsigned bool) []*NewRange
- func FullNewRange() []*NewRange
- type RangeType
Constants ¶
const (
CodeUnsupportedType terror.ErrCode = 1
)
Error codes.
Variables ¶
var (
ErrUnsupportedType = terror.ClassOptimizerPlan.New(CodeUnsupportedType, "Unsupported type")
)
Error instances.
Functions ¶
func DetachCondsForTableRange ¶
func DetachCondsForTableRange(ctx context.Context, conds []expression.Expression, col *expression.Column) (accessContditions, otherConditions []expression.Expression)
DetachCondsForTableRange detaches the conditions used for range calculation form other useless conditions for calculating the table range.
func DetachIndexConditions ¶
func DetachIndexConditions(conditions []expression.Expression, cols []*expression.Column, lengths []int) (accessConds []expression.Expression, filterConds []expression.Expression)
DetachIndexConditions will detach the index filters from table filters. It will first find the point query column and then extract the range query column.
func ExtractAccessConditions ¶
func ExtractAccessConditions(conds []expression.Expression, rangeType RangeType, cols []*expression.Column, lengths []int) []expression.Expression
ExtractAccessConditions detaches the access conditions used for range calculation.
Types ¶
type IntColumnRange ¶
IntColumnRange represents a range for a integer column, both low and high are inclusive.
func FullIntRange ¶
func FullIntRange() []IntColumnRange
FullIntRange is (-∞, +∞) for IntColumnRange.
func (*IntColumnRange) IsPoint ¶
func (tr *IntColumnRange) IsPoint() bool
IsPoint returns if the table range is a point.
func (IntColumnRange) String ¶
func (tr IntColumnRange) String() string
type NewRange ¶
type NewRange struct { LowVal []types.Datum HighVal []types.Datum LowExclude bool // Low value is exclusive. HighExclude bool // High value is exclusive. }
NewRange represents a range generated in physical plan building phase.
func BuildColumnRange ¶
func BuildColumnRange(conds []expression.Expression, sc *stmtctx.StatementContext, tp *types.FieldType) ([]*NewRange, error)
BuildColumnRange builds the range for sampling histogram to calculate the row count.
func BuildIndexRange ¶
func BuildIndexRange(sc *stmtctx.StatementContext, cols []*expression.Column, lengths []int, accessCondition []expression.Expression) ([]*NewRange, error)
BuildIndexRange builds the range for index.
func BuildTableRange ¶
func BuildTableRange(accessConditions []expression.Expression, sc *stmtctx.StatementContext, tp *types.FieldType) ([]*NewRange, error)
BuildTableRange will build range of pk for PhysicalTableScan
func FullIntNewRange ¶
FullIntNewRange is used for table range. Since table range cannot accept MaxValueDatum as the max value. So we need to set it to MaxInt64.
func (*NewRange) IsPoint ¶
func (ran *NewRange) IsPoint(sc *stmtctx.StatementContext) bool
IsPoint returns if the range is a point.
func (*NewRange) PrefixEqualLen ¶
func (ran *NewRange) PrefixEqualLen(sc *stmtctx.StatementContext) (int, error)
PrefixEqualLen tells you how long the prefix of the range is a point. e.g. If this range is (1 2 3, 1 2 +inf), then the return value is 2.