Documentation ¶
Index ¶
- Constants
- Variables
- func DetachCondsForTableRange(sctx sessionctx.Context, conds []expression.Expression, col *expression.Column) (accessContditions, otherConditions []expression.Expression)
- func ExtractAccessConditionsForColumn(conds []expression.Expression, colName model.CIStr) []expression.Expression
- type Range
- func BuildColumnRange(conds []expression.Expression, sc *stmtctx.StatementContext, ...) ([]*Range, error)
- func BuildTableRange(accessConditions []expression.Expression, sc *stmtctx.StatementContext, ...) ([]*Range, error)
- func DetachCondAndBuildRangeForIndex(sctx sessionctx.Context, conditions []expression.Expression, ...) ([]*Range, []expression.Expression, []expression.Expression, int, error)
- func DetachSimpleCondAndBuildRangeForIndex(sctx sessionctx.Context, conditions []expression.Expression, ...) (ranges []*Range, accessConds []expression.Expression, err error)
- func FullIntRange(isUnsigned bool) []*Range
- func FullRange() []*Range
- type RangeType
Constants ¶
Error codes.
Variables ¶
var (
ErrUnsupportedType = terror.ClassOptimizer.New(CodeUnsupportedType, "Unsupported type")
)
Error instances.
Functions ¶
func DetachCondsForTableRange ¶
func DetachCondsForTableRange(sctx sessionctx.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 ExtractAccessConditionsForColumn ¶
func ExtractAccessConditionsForColumn(conds []expression.Expression, colName model.CIStr) []expression.Expression
ExtractAccessConditionsForColumn detaches the access conditions used for range calculation.
Types ¶
type Range ¶
type Range struct { LowVal []types.Datum HighVal []types.Datum LowExclude bool // Low value is exclusive. HighExclude bool // High value is exclusive. }
Range represents a range generated in physical plan building phase.
func BuildColumnRange ¶
func BuildColumnRange(conds []expression.Expression, sc *stmtctx.StatementContext, tp *types.FieldType) ([]*Range, error)
BuildColumnRange builds the range for sampling histogram to calculate the row count.
func BuildTableRange ¶
func BuildTableRange(accessConditions []expression.Expression, sc *stmtctx.StatementContext, tp *types.FieldType) ([]*Range, error)
BuildTableRange will build range of pk for PhysicalTableScan
func DetachCondAndBuildRangeForIndex ¶
func DetachCondAndBuildRangeForIndex(sctx sessionctx.Context, conditions []expression.Expression, cols []*expression.Column, lengths []int) ([]*Range, []expression.Expression, []expression.Expression, int, error)
DetachCondAndBuildRangeForIndex will detach the index filters from table filters. If the top layer is DNF, we return a int slice which is eqAndInCount of every DNF item. Otherwise just one number is returned.
func DetachSimpleCondAndBuildRangeForIndex ¶
func DetachSimpleCondAndBuildRangeForIndex(sctx sessionctx.Context, conditions []expression.Expression, cols []*expression.Column, lengths []int) (ranges []*Range, accessConds []expression.Expression, err error)
DetachSimpleCondAndBuildRangeForIndex will detach the index filters from table filters. It will find the point query column firstly and then extract the range query column.
func FullIntRange ¶
FullIntRange is used for table range. Since table range cannot accept MaxValueDatum as the max value. So we need to set it to MaxInt64.
func (*Range) IsPoint ¶
func (ran *Range) IsPoint(sc *stmtctx.StatementContext) bool
IsPoint returns if the range is a point.