plan

package
v0.0.0-...-3056823 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2016 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeOneColumn           terror.ErrCode = 1
	CodeSameColumns         terror.ErrCode = 2
	CodeMultiWildCard       terror.ErrCode = 3
	CodeUnsupported         terror.ErrCode = 4
	CodeInvalidGroupFuncUse terror.ErrCode = 5
	CodeIllegalReference    terror.ErrCode = 6
)

Optimizer error codes.

View Source
const (
	// Sel is the type of Selection.
	Sel = "Selection"
	// Proj is the type of Projection.
	Proj = "Projection"
	// Agg is the type of Aggregation.
	Agg = "Aggregation"
	// Jn is the type of Join.
	Jn = "Join"
	// Un is the type of Union.
	Un = "Union"
	// Ts is the type of TableScan.
	Ts = "TableScan"
	// Idx is the type of IndexScan.
	Idx = "IndexScan"
	// Srt is the type of Sort.
	Srt = "Sort"
	// Lim is the type of Limit.
	Lim = "Limit"
	// App is the type of Apply.
	App = "Apply"
	// Dis is the type of Distinct.
	Dis = "Distinct"
	// Trm is the type of Trim.
	Trm = "Trim"
	// MOR is the type of MaxOneRow.
	MOR = "MaxOneRow"
	// Ext is the type of Exists.
	Ext = "Exists"
	// Dual is the type of TableDual.
	Dual = "TableDual"
	// Lock is the type of SelectLock.
	Lock = "SelectLock"
	// Load is the type of LoadData.
	Load = "LoadData"
	// Ins is the type of Insert
	Ins = "Insert"
	// Up is the type of Update.
	Up = "Update"
	// Del is the type of Delete.
	Del = "Delete"
)
View Source
const (
	CodeUnsupportedType terror.ErrCode = 1
	SystemInternalError terror.ErrCode = 2
)

Error codes.

Variables

View Source
var (
	ErrOneColumn           = terror.ClassOptimizer.New(CodeOneColumn, "Operand should contain 1 column(s)")
	ErrSameColumns         = terror.ClassOptimizer.New(CodeSameColumns, "Operands should contain same columns")
	ErrMultiWildCard       = terror.ClassOptimizer.New(CodeMultiWildCard, "wildcard field exist more than once")
	ErrUnSupported         = terror.ClassOptimizer.New(CodeUnsupported, "unsupported")
	ErrInvalidGroupFuncUse = terror.ClassOptimizer.New(CodeInvalidGroupFuncUse, "Invalid use of group function")
	ErrIllegalReference    = terror.ClassOptimizer.New(CodeIllegalReference, "Illegal reference")
)

Optimizer base errors.

View Source
var (
	ErrUnsupportedType      = terror.ClassOptimizerPlan.New(CodeUnsupportedType, "Unsupported type")
	SystemInternalErrorType = terror.ClassOptimizerPlan.New(SystemInternalError, "System internal error")
)

Error instances.

View Source
var EvalSubquery func(p PhysicalPlan, is infoschema.InfoSchema, ctx context.Context) ([]types.Datum, error)

EvalSubquery evaluates incorrelated subqueries once.

View Source
var JoinConcurrency = 5

JoinConcurrency means the number of goroutines that participate in joining.

Functions

func InferType

func InferType(node ast.Node) error

InferType infers result type for ast.ExprNode.

func InsertPlan

func InsertPlan(parent Plan, child Plan, insert Plan) error

InsertPlan means inserting plan between two plans.

func MockResolveName

func MockResolveName(node ast.Node, info infoschema.InfoSchema, defaultSchema string, ctx context.Context) error

MockResolveName only serves for test.

func PrepareStmt

func PrepareStmt(is infoschema.InfoSchema, ctx context.Context, node ast.Node) error

PrepareStmt prepares a raw statement parsed from parser. The statement must be prepared before it can be passed to optimize function. We pass InfoSchema instead of getting from Context in case it is changed after resolving name.

func Preprocess

func Preprocess(node ast.Node, info infoschema.InfoSchema, ctx context.Context) error

Preprocess does preprocess work for optimizer.

func RemovePlan

func RemovePlan(p Plan) error

RemovePlan means removing a plan.

func ResolveName

func ResolveName(node ast.Node, info infoschema.InfoSchema, ctx context.Context) error

ResolveName resolves table name and column name. It generates ResultFields for ResultSetNode and resolves ColumnNameExpr to a ResultField.

func ToString

func ToString(p Plan) string

ToString explains a Plan, returns description string.

func UnionColumns

func UnionColumns(leftExpr *expression.Column, rightExpr *expression.Column, multipleEqualities map[*expression.Column]*expression.Column)

UnionColumns uses union-find to build multiple equality predicates.

func Validate

func Validate(node ast.Node, inPrepare bool) error

Validate checkes whether the node is valid.

Types

type Aggregation

type Aggregation struct {
	AggFuncs     []expression.AggregationFunction
	GroupByItems []expression.Expression
	// contains filtered or unexported fields
}

Aggregation represents an aggregate plan.

func (*Aggregation) PredicatePushDown

func (p *Aggregation) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*Aggregation) PruneColumnsAndResolveIndices

func (p *Aggregation) PruneColumnsAndResolveIndices(parentUsedCols []*expression.Column) ([]*expression.Column, error)

PruneColumnsAndResolveIndices implements LogicalPlan PruneColumnsAndResolveIndices interface.

type AggregationType

type AggregationType int

AggregationType stands for the mode of aggregation plan.

const (
	// StreamedAgg supposes its input is sorted by group by key.
	StreamedAgg AggregationType = iota
	// FinalAgg supposes its input is partial results.
	FinalAgg
	// CompleteAgg supposes its input is original results.
	CompleteAgg
)

type Apply

type Apply struct {
	InnerPlan   LogicalPlan
	OuterSchema expression.Schema
	Checker     *ApplyConditionChecker
	// contains filtered or unexported fields
}

Apply gets one row from outer executor and gets one row from inner executor according to outer row.

func (*Apply) PredicatePushDown

func (p *Apply) PredicatePushDown(predicates []expression.Expression) (ret []expression.Expression, retPlan LogicalPlan, err error)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*Apply) PruneColumnsAndResolveIndices

func (p *Apply) PruneColumnsAndResolveIndices(parentUsedCols []*expression.Column) ([]*expression.Column, error)

PruneColumnsAndResolveIndices implements LogicalPlan PruneColumnsAndResolveIndices interface. e.g. For query select b.c, (select count(*) from a where a.id = b.id) from b. Its plan is Projection->Apply->TableScan. The schema of b is (a,b,c,id). When Pruning Apply, the parentUsedCols is (c, extra), outerSchema is (a,b,c,id). Then after pruning inner plan, the childOuterUsedCols schema in apply becomes (id). Now there're two columns in parentUsedCols, c is the column from Apply's child ---- TableScan, but extra isn't. So only c in parentUsedCols and id in outerSchema can be passed to TableScan.

type ApplyConditionChecker

type ApplyConditionChecker struct {
	Condition expression.Expression
	All       bool
}

ApplyConditionChecker checks whether all or any output of apply matches a condition.

type ByItems

type ByItems struct {
	Expr expression.Expression
	Desc bool
}

ByItems wraps a "by" item.

type CheckTable

type CheckTable struct {
	Tables []*ast.TableName
	// contains filtered or unexported fields
}

CheckTable is for checking table data.

func (*CheckTable) AddChild

func (p *CheckTable) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*CheckTable) AddParent

func (p *CheckTable) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*CheckTable) Fields

func (p *CheckTable) Fields() []*ast.ResultField

Fields implements Plan Fields interface.

func (*CheckTable) GetChildByIndex

func (p *CheckTable) GetChildByIndex(index int) (parent Plan)

GetChildByIndex implements Plan GetChildByIndex interface.

func (*CheckTable) GetChildren

func (p *CheckTable) GetChildren() []Plan

GetChildren implements Plan GetChildren interface.

func (*CheckTable) GetID

func (p *CheckTable) GetID() string

GetID implements Plan GetID interface.

func (*CheckTable) GetParentByIndex

func (p *CheckTable) GetParentByIndex(index int) (parent Plan)

GetParentByIndex implements Plan GetParentByIndex interface.

func (*CheckTable) GetParents

func (p *CheckTable) GetParents() []Plan

GetParents implements Plan GetParents interface.

func (*CheckTable) GetSchema

func (p *CheckTable) GetSchema() expression.Schema

GetSchema implements Plan GetSchema interface.

func (*CheckTable) IsCorrelated

func (p *CheckTable) IsCorrelated() bool

IsCorrelated implements Plan IsCorrelated interface.

func (*CheckTable) MarshalJSON

func (p *CheckTable) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*CheckTable) ReplaceChild

func (p *CheckTable) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (*CheckTable) ReplaceParent

func (p *CheckTable) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*CheckTable) SetChildren

func (p *CheckTable) SetChildren(children ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*CheckTable) SetFields

func (p *CheckTable) SetFields(fields []*ast.ResultField)

SetFields implements Plan SetFields interface.

func (*CheckTable) SetParents

func (p *CheckTable) SetParents(pars ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*CheckTable) SetSchema

func (p *CheckTable) SetSchema(schema expression.Schema)

SetSchema implements Plan SetSchema interface.

type DDL

type DDL struct {
	Statement ast.DDLNode
	// contains filtered or unexported fields
}

DDL represents a DDL statement plan.

func (*DDL) AddChild

func (p *DDL) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*DDL) AddParent

func (p *DDL) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*DDL) Fields

func (p *DDL) Fields() []*ast.ResultField

Fields implements Plan Fields interface.

func (*DDL) GetChildByIndex

func (p *DDL) GetChildByIndex(index int) (parent Plan)

GetChildByIndex implements Plan GetChildByIndex interface.

func (*DDL) GetChildren

func (p *DDL) GetChildren() []Plan

GetChildren implements Plan GetChildren interface.

func (*DDL) GetID

func (p *DDL) GetID() string

GetID implements Plan GetID interface.

func (*DDL) GetParentByIndex

func (p *DDL) GetParentByIndex(index int) (parent Plan)

GetParentByIndex implements Plan GetParentByIndex interface.

func (*DDL) GetParents

func (p *DDL) GetParents() []Plan

GetParents implements Plan GetParents interface.

func (*DDL) GetSchema

func (p *DDL) GetSchema() expression.Schema

GetSchema implements Plan GetSchema interface.

func (*DDL) IsCorrelated

func (p *DDL) IsCorrelated() bool

IsCorrelated implements Plan IsCorrelated interface.

func (*DDL) MarshalJSON

func (p *DDL) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*DDL) ReplaceChild

func (p *DDL) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (*DDL) ReplaceParent

func (p *DDL) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*DDL) SetChildren

func (p *DDL) SetChildren(children ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*DDL) SetFields

func (p *DDL) SetFields(fields []*ast.ResultField)

SetFields implements Plan SetFields interface.

func (*DDL) SetParents

func (p *DDL) SetParents(pars ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*DDL) SetSchema

func (p *DDL) SetSchema(schema expression.Schema)

SetSchema implements Plan SetSchema interface.

type DataSource

type DataSource struct {
	Table   *model.TableInfo
	Columns []*model.ColumnInfo
	DBName  *model.CIStr
	Desc    bool

	TableAsName *model.CIStr

	LimitCount *int64
	// contains filtered or unexported fields
}

DataSource represents a tablescan without condition push down.

func (*DataSource) PredicatePushDown

func (p *DataSource) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*DataSource) PruneColumnsAndResolveIndices

func (p *DataSource) PruneColumnsAndResolveIndices(parentUsedCols []*expression.Column) ([]*expression.Column, error)

PruneColumnsAndResolveIndices implements LogicalPlan PruneColumnsAndResolveIndices interface.

type Deallocate

type Deallocate struct {
	Name string
	// contains filtered or unexported fields
}

Deallocate represents deallocate plan.

func (*Deallocate) AddChild

func (p *Deallocate) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*Deallocate) AddParent

func (p *Deallocate) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*Deallocate) Fields

func (p *Deallocate) Fields() []*ast.ResultField

Fields implements Plan Fields interface.

func (*Deallocate) GetChildByIndex

func (p *Deallocate) GetChildByIndex(index int) (parent Plan)

GetChildByIndex implements Plan GetChildByIndex interface.

func (*Deallocate) GetChildren

func (p *Deallocate) GetChildren() []Plan

GetChildren implements Plan GetChildren interface.

func (*Deallocate) GetID

func (p *Deallocate) GetID() string

GetID implements Plan GetID interface.

func (*Deallocate) GetParentByIndex

func (p *Deallocate) GetParentByIndex(index int) (parent Plan)

GetParentByIndex implements Plan GetParentByIndex interface.

func (*Deallocate) GetParents

func (p *Deallocate) GetParents() []Plan

GetParents implements Plan GetParents interface.

func (*Deallocate) GetSchema

func (p *Deallocate) GetSchema() expression.Schema

GetSchema implements Plan GetSchema interface.

func (*Deallocate) IsCorrelated

func (p *Deallocate) IsCorrelated() bool

IsCorrelated implements Plan IsCorrelated interface.

func (*Deallocate) MarshalJSON

func (p *Deallocate) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*Deallocate) ReplaceChild

func (p *Deallocate) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (*Deallocate) ReplaceParent

func (p *Deallocate) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*Deallocate) SetChildren

func (p *Deallocate) SetChildren(children ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*Deallocate) SetFields

func (p *Deallocate) SetFields(fields []*ast.ResultField)

SetFields implements Plan SetFields interface.

func (*Deallocate) SetParents

func (p *Deallocate) SetParents(pars ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*Deallocate) SetSchema

func (p *Deallocate) SetSchema(schema expression.Schema)

SetSchema implements Plan SetSchema interface.

type Delete

type Delete struct {
	Tables       []*ast.TableName
	IsMultiTable bool
	// contains filtered or unexported fields
}

Delete represents a delete plan.

func (*Delete) Copy

func (p *Delete) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*Delete) PredicatePushDown

func (p *Delete) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*Delete) PruneColumnsAndResolveIndices

func (p *Delete) PruneColumnsAndResolveIndices(parentUsedCols []*expression.Column) ([]*expression.Column, error)

PruneColumnsAndResolveIndices implements LogicalPlan PruneColumnsAndResolveIndices interface.

type Distinct

type Distinct struct {
	// contains filtered or unexported fields
}

Distinct represents Distinct plan.

func (*Distinct) Copy

func (p *Distinct) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*Distinct) PredicatePushDown

func (p *Distinct) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*Distinct) PruneColumnsAndResolveIndices

func (p *Distinct) PruneColumnsAndResolveIndices(parentUsedCols []*expression.Column) ([]*expression.Column, error)

PruneColumnsAndResolveIndices implements LogicalPlan PruneColumnsAndResolveIndices interface.

type Execute

type Execute struct {
	Name      string
	UsingVars []ast.ExprNode
	ID        uint32
	// contains filtered or unexported fields
}

Execute represents prepare plan.

func (*Execute) AddChild

func (p *Execute) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*Execute) AddParent

func (p *Execute) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*Execute) Fields

func (p *Execute) Fields() []*ast.ResultField

Fields implements Plan Fields interface.

func (*Execute) GetChildByIndex

func (p *Execute) GetChildByIndex(index int) (parent Plan)

GetChildByIndex implements Plan GetChildByIndex interface.

func (*Execute) GetChildren

func (p *Execute) GetChildren() []Plan

GetChildren implements Plan GetChildren interface.

func (*Execute) GetID

func (p *Execute) GetID() string

GetID implements Plan GetID interface.

func (*Execute) GetParentByIndex

func (p *Execute) GetParentByIndex(index int) (parent Plan)

GetParentByIndex implements Plan GetParentByIndex interface.

func (*Execute) GetParents

func (p *Execute) GetParents() []Plan

GetParents implements Plan GetParents interface.

func (*Execute) GetSchema

func (p *Execute) GetSchema() expression.Schema

GetSchema implements Plan GetSchema interface.

func (*Execute) IsCorrelated

func (p *Execute) IsCorrelated() bool

IsCorrelated implements Plan IsCorrelated interface.

func (*Execute) MarshalJSON

func (p *Execute) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*Execute) ReplaceChild

func (p *Execute) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (*Execute) ReplaceParent

func (p *Execute) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*Execute) SetChildren

func (p *Execute) SetChildren(children ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*Execute) SetFields

func (p *Execute) SetFields(fields []*ast.ResultField)

SetFields implements Plan SetFields interface.

func (*Execute) SetParents

func (p *Execute) SetParents(pars ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*Execute) SetSchema

func (p *Execute) SetSchema(schema expression.Schema)

SetSchema implements Plan SetSchema interface.

type Exists

type Exists struct {
	// contains filtered or unexported fields
}

Exists checks if a query returns result.

func (*Exists) Copy

func (p *Exists) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*Exists) PredicatePushDown

func (p *Exists) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*Exists) PruneColumnsAndResolveIndices

func (p *Exists) PruneColumnsAndResolveIndices(parentUsedCols []*expression.Column) ([]*expression.Column, error)

PruneColumnsAndResolveIndices implements LogicalPlan PruneColumnsAndResolveIndices interface.

type Explain

type Explain struct {
	StmtPlan Plan
	// contains filtered or unexported fields
}

Explain represents a explain plan.

func (*Explain) AddChild

func (p *Explain) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*Explain) AddParent

func (p *Explain) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*Explain) Fields

func (p *Explain) Fields() []*ast.ResultField

Fields implements Plan Fields interface.

func (*Explain) GetChildByIndex

func (p *Explain) GetChildByIndex(index int) (parent Plan)

GetChildByIndex implements Plan GetChildByIndex interface.

func (*Explain) GetChildren

func (p *Explain) GetChildren() []Plan

GetChildren implements Plan GetChildren interface.

func (*Explain) GetID

func (p *Explain) GetID() string

GetID implements Plan GetID interface.

func (*Explain) GetParentByIndex

func (p *Explain) GetParentByIndex(index int) (parent Plan)

GetParentByIndex implements Plan GetParentByIndex interface.

func (*Explain) GetParents

func (p *Explain) GetParents() []Plan

GetParents implements Plan GetParents interface.

func (*Explain) GetSchema

func (p *Explain) GetSchema() expression.Schema

GetSchema implements Plan GetSchema interface.

func (*Explain) IsCorrelated

func (p *Explain) IsCorrelated() bool

IsCorrelated implements Plan IsCorrelated interface.

func (*Explain) MarshalJSON

func (p *Explain) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*Explain) ReplaceChild

func (p *Explain) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (*Explain) ReplaceParent

func (p *Explain) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*Explain) SetChildren

func (p *Explain) SetChildren(children ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*Explain) SetFields

func (p *Explain) SetFields(fields []*ast.ResultField)

SetFields implements Plan SetFields interface.

func (*Explain) SetParents

func (p *Explain) SetParents(pars ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*Explain) SetSchema

func (p *Explain) SetSchema(schema expression.Schema)

SetSchema implements Plan SetSchema interface.

type Filter

type Filter struct {

	// Originally the WHERE or ON condition is parsed into a single expression,
	// but after we converted to CNF(Conjunctive normal form), it can be
	// split into a list of AND conditions.
	Conditions []ast.ExprNode
	// contains filtered or unexported fields
}

Filter represents a plan that filter GetChildByIndex(0)plan result.

func (*Filter) AddChild

func (p *Filter) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*Filter) AddParent

func (p *Filter) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*Filter) Fields

func (p *Filter) Fields() []*ast.ResultField

Fields implements Plan Fields interface.

func (*Filter) GetChildByIndex

func (p *Filter) GetChildByIndex(index int) (parent Plan)

GetChildByIndex implements Plan GetChildByIndex interface.

func (*Filter) GetChildren

func (p *Filter) GetChildren() []Plan

GetChildren implements Plan GetChildren interface.

func (*Filter) GetID

func (p *Filter) GetID() string

GetID implements Plan GetID interface.

func (*Filter) GetParentByIndex

func (p *Filter) GetParentByIndex(index int) (parent Plan)

GetParentByIndex implements Plan GetParentByIndex interface.

func (*Filter) GetParents

func (p *Filter) GetParents() []Plan

GetParents implements Plan GetParents interface.

func (*Filter) GetSchema

func (p *Filter) GetSchema() expression.Schema

GetSchema implements Plan GetSchema interface.

func (*Filter) IsCorrelated

func (p *Filter) IsCorrelated() bool

IsCorrelated implements Plan IsCorrelated interface.

func (*Filter) MarshalJSON

func (p *Filter) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*Filter) ReplaceChild

func (p *Filter) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (*Filter) ReplaceParent

func (p *Filter) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*Filter) SetChildren

func (p *Filter) SetChildren(children ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*Filter) SetFields

func (p *Filter) SetFields(fields []*ast.ResultField)

SetFields implements Plan SetFields interface.

func (*Filter) SetParents

func (p *Filter) SetParents(pars ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*Filter) SetSchema

func (p *Filter) SetSchema(schema expression.Schema)

SetSchema implements Plan SetSchema interface.

type IndexRange

type IndexRange struct {
	LowVal      []types.Datum
	LowExclude  bool
	HighVal     []types.Datum
	HighExclude bool
}

IndexRange represents an index range to be scanned.

func (*IndexRange) IsPoint

func (ir *IndexRange) IsPoint() bool

IsPoint returns if the index range is a point.

func (*IndexRange) String

func (ir *IndexRange) String() string

type Insert

type Insert struct {
	Table       *ast.TableRefsClause
	Columns     []*ast.ColumnName
	Lists       [][]ast.ExprNode
	Setlist     []*ast.Assignment
	OnDuplicate []*ast.Assignment

	IsReplace bool
	Priority  int
	Ignore    bool
	// contains filtered or unexported fields
}

Insert represents an insert plan.

func (*Insert) Copy

func (p *Insert) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*Insert) PredicatePushDown

func (p *Insert) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*Insert) PruneColumnsAndResolveIndices

func (p *Insert) PruneColumnsAndResolveIndices(_ []*expression.Column) ([]*expression.Column, error)

PruneColumnsAndResolveIndices implements LogicalPlan PruneColumnsAndResolveIndices interface.

type Join

type Join struct {
	JoinType JoinType

	EqualConditions []*expression.ScalarFunction
	LeftConditions  []expression.Expression
	RightConditions []expression.Expression
	OtherConditions []expression.Expression
	// contains filtered or unexported fields
}

Join is the logical join plan.

func (*Join) PredicatePushDown

func (p *Join) PredicatePushDown(predicates []expression.Expression) (ret []expression.Expression, retPlan LogicalPlan, err error)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*Join) PruneColumnsAndResolveIndices

func (p *Join) PruneColumnsAndResolveIndices(parentUsedCols []*expression.Column) ([]*expression.Column, error)

PruneColumnsAndResolveIndices implements LogicalPlan PruneColumnsAndResolveIndices interface.

type JoinType

type JoinType int

JoinType contains CrossJoin, InnerJoin, LeftOuterJoin, RightOuterJoin, FullOuterJoin, SemiJoin.

const (
	// InnerJoin means inner join.
	InnerJoin JoinType = iota
	// LeftOuterJoin means left join.
	LeftOuterJoin
	// RightOuterJoin means right join.
	RightOuterJoin
	// SemiJoin means if row a in table A matches some rows in B, just output a.
	SemiJoin
	// SemiJoinWithAux means if row a in table A matches some rows in B, output (a, true), otherwise, output (a, false).
	SemiJoinWithAux
)

type Limit

type Limit struct {
	Offset uint64
	Count  uint64
	// contains filtered or unexported fields
}

Limit represents offset and limit plan.

func (*Limit) Copy

func (p *Limit) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*Limit) MarshalJSON

func (p *Limit) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*Limit) PredicatePushDown

func (p *Limit) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*Limit) PruneColumnsAndResolveIndices

func (p *Limit) PruneColumnsAndResolveIndices(parentUsedCols []*expression.Column) ([]*expression.Column, error)

PruneColumnsAndResolveIndices implements LogicalPlan PruneColumnsAndResolveIndices interface.

type LoadData

type LoadData struct {
	IsLocal    bool
	Path       string
	Table      *ast.TableName
	FieldsInfo *ast.FieldsClause
	LinesInfo  *ast.LinesClause
	// contains filtered or unexported fields
}

LoadData represents a loaddata plan.

func (*LoadData) AddChild

func (p *LoadData) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*LoadData) AddParent

func (p *LoadData) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*LoadData) Fields

func (p *LoadData) Fields() []*ast.ResultField

Fields implements Plan Fields interface.

func (*LoadData) GetChildByIndex

func (p *LoadData) GetChildByIndex(index int) (parent Plan)

GetChildByIndex implements Plan GetChildByIndex interface.

func (*LoadData) GetChildren

func (p *LoadData) GetChildren() []Plan

GetChildren implements Plan GetChildren interface.

func (*LoadData) GetID

func (p *LoadData) GetID() string

GetID implements Plan GetID interface.

func (*LoadData) GetParentByIndex

func (p *LoadData) GetParentByIndex(index int) (parent Plan)

GetParentByIndex implements Plan GetParentByIndex interface.

func (*LoadData) GetParents

func (p *LoadData) GetParents() []Plan

GetParents implements Plan GetParents interface.

func (*LoadData) GetSchema

func (p *LoadData) GetSchema() expression.Schema

GetSchema implements Plan GetSchema interface.

func (*LoadData) IsCorrelated

func (p *LoadData) IsCorrelated() bool

IsCorrelated implements Plan IsCorrelated interface.

func (*LoadData) MarshalJSON

func (p *LoadData) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*LoadData) ReplaceChild

func (p *LoadData) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (*LoadData) ReplaceParent

func (p *LoadData) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*LoadData) SetChildren

func (p *LoadData) SetChildren(children ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*LoadData) SetFields

func (p *LoadData) SetFields(fields []*ast.ResultField)

SetFields implements Plan SetFields interface.

func (*LoadData) SetParents

func (p *LoadData) SetParents(pars ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*LoadData) SetSchema

func (p *LoadData) SetSchema(schema expression.Schema)

SetSchema implements Plan SetSchema interface.

type LogicalPlan

type LogicalPlan interface {
	Plan

	// PredicatePushDown pushes down the predicates in the where/on/having clauses as deeply as possible.
	// It will accept a predicate that is an expression slice, and return the expressions that can't be pushed.
	// Because it might change the root if the having clause exists, we need to return a plan that represents a new root.
	PredicatePushDown([]expression.Expression) ([]expression.Expression, LogicalPlan, error)

	// PruneColumnsAndResolveIndices prunes the unused columns and resolves the index for columns.
	// This function returns a column slice representing columns from the outer environment and an error.
	// We need to return the outer columns, because the Apply plan will prune the inner Planner and it will know
	// the exact number of columns referenced by the inner plan.
	PruneColumnsAndResolveIndices([]*expression.Column) ([]*expression.Column, error)
	// contains filtered or unexported methods
}

LogicalPlan is a tree of logical operators. We can do a lot of logical optimizations to it, like predicate pushdown and column pruning.

func EliminateProjection

func EliminateProjection(p LogicalPlan) LogicalPlan

EliminateProjection eliminates projection operator to avoid the cost of memory copy in the iterator of projection.

type MaxOneRow

type MaxOneRow struct {
	// contains filtered or unexported fields
}

MaxOneRow checks if a query returns no more than one row.

func (*MaxOneRow) Copy

func (p *MaxOneRow) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*MaxOneRow) PredicatePushDown

func (p *MaxOneRow) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*MaxOneRow) PruneColumnsAndResolveIndices

func (p *MaxOneRow) PruneColumnsAndResolveIndices(parentUsedCols []*expression.Column) ([]*expression.Column, error)

PruneColumnsAndResolveIndices implements LogicalPlan PruneColumnsAndResolveIndices interface.

type PhysicalAggregation

type PhysicalAggregation struct {
	HasGby       bool
	AggType      AggregationType
	AggFuncs     []expression.AggregationFunction
	GroupByItems []expression.Expression
	// contains filtered or unexported fields
}

PhysicalAggregation is Aggregation's physical plan.

func (*PhysicalAggregation) AddChild

func (p *PhysicalAggregation) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*PhysicalAggregation) AddParent

func (p *PhysicalAggregation) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*PhysicalAggregation) Copy

Copy implements the PhysicalPlan Copy interface.

func (*PhysicalAggregation) Fields

func (p *PhysicalAggregation) Fields() []*ast.ResultField

Fields implements Plan Fields interface.

func (*PhysicalAggregation) GetChildByIndex

func (p *PhysicalAggregation) GetChildByIndex(index int) (parent Plan)

GetChildByIndex implements Plan GetChildByIndex interface.

func (*PhysicalAggregation) GetChildren

func (p *PhysicalAggregation) GetChildren() []Plan

GetChildren implements Plan GetChildren interface.

func (*PhysicalAggregation) GetID

func (p *PhysicalAggregation) GetID() string

GetID implements Plan GetID interface.

func (*PhysicalAggregation) GetParentByIndex

func (p *PhysicalAggregation) GetParentByIndex(index int) (parent Plan)

GetParentByIndex implements Plan GetParentByIndex interface.

func (*PhysicalAggregation) GetParents

func (p *PhysicalAggregation) GetParents() []Plan

GetParents implements Plan GetParents interface.

func (*PhysicalAggregation) GetSchema

func (p *PhysicalAggregation) GetSchema() expression.Schema

GetSchema implements Plan GetSchema interface.

func (*PhysicalAggregation) IsCorrelated

func (p *PhysicalAggregation) IsCorrelated() bool

IsCorrelated implements Plan IsCorrelated interface.

func (*PhysicalAggregation) MarshalJSON

func (p *PhysicalAggregation) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*PhysicalAggregation) ReplaceChild

func (p *PhysicalAggregation) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (*PhysicalAggregation) ReplaceParent

func (p *PhysicalAggregation) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*PhysicalAggregation) SetChildren

func (p *PhysicalAggregation) SetChildren(children ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*PhysicalAggregation) SetFields

func (p *PhysicalAggregation) SetFields(fields []*ast.ResultField)

SetFields implements Plan SetFields interface.

func (*PhysicalAggregation) SetParents

func (p *PhysicalAggregation) SetParents(pars ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*PhysicalAggregation) SetSchema

func (p *PhysicalAggregation) SetSchema(schema expression.Schema)

SetSchema implements Plan SetSchema interface.

type PhysicalApply

type PhysicalApply struct {
	InnerPlan   PhysicalPlan
	OuterSchema expression.Schema
	Checker     *ApplyConditionChecker
	// contains filtered or unexported fields
}

PhysicalApply represents apply plan, only used for subquery.

func (*PhysicalApply) AddChild

func (p *PhysicalApply) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*PhysicalApply) AddParent

func (p *PhysicalApply) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*PhysicalApply) Copy

func (p *PhysicalApply) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*PhysicalApply) Fields

func (p *PhysicalApply) Fields() []*ast.ResultField

Fields implements Plan Fields interface.

func (*PhysicalApply) GetChildByIndex

func (p *PhysicalApply) GetChildByIndex(index int) (parent Plan)

GetChildByIndex implements Plan GetChildByIndex interface.

func (*PhysicalApply) GetChildren

func (p *PhysicalApply) GetChildren() []Plan

GetChildren implements Plan GetChildren interface.

func (*PhysicalApply) GetID

func (p *PhysicalApply) GetID() string

GetID implements Plan GetID interface.

func (*PhysicalApply) GetParentByIndex

func (p *PhysicalApply) GetParentByIndex(index int) (parent Plan)

GetParentByIndex implements Plan GetParentByIndex interface.

func (*PhysicalApply) GetParents

func (p *PhysicalApply) GetParents() []Plan

GetParents implements Plan GetParents interface.

func (*PhysicalApply) GetSchema

func (p *PhysicalApply) GetSchema() expression.Schema

GetSchema implements Plan GetSchema interface.

func (*PhysicalApply) IsCorrelated

func (p *PhysicalApply) IsCorrelated() bool

IsCorrelated implements Plan IsCorrelated interface.

func (*PhysicalApply) MarshalJSON

func (p *PhysicalApply) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*PhysicalApply) ReplaceChild

func (p *PhysicalApply) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (*PhysicalApply) ReplaceParent

func (p *PhysicalApply) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*PhysicalApply) SetChildren

func (p *PhysicalApply) SetChildren(children ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*PhysicalApply) SetFields

func (p *PhysicalApply) SetFields(fields []*ast.ResultField)

SetFields implements Plan SetFields interface.

func (*PhysicalApply) SetParents

func (p *PhysicalApply) SetParents(pars ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*PhysicalApply) SetSchema

func (p *PhysicalApply) SetSchema(schema expression.Schema)

SetSchema implements Plan SetSchema interface.

type PhysicalDummyScan

type PhysicalDummyScan struct {
	// contains filtered or unexported fields
}

PhysicalDummyScan is a dummy table that returns nothing.

func (*PhysicalDummyScan) AddChild

func (p *PhysicalDummyScan) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*PhysicalDummyScan) AddParent

func (p *PhysicalDummyScan) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*PhysicalDummyScan) Copy

func (p *PhysicalDummyScan) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*PhysicalDummyScan) Fields

func (p *PhysicalDummyScan) Fields() []*ast.ResultField

Fields implements Plan Fields interface.

func (*PhysicalDummyScan) GetChildByIndex

func (p *PhysicalDummyScan) GetChildByIndex(index int) (parent Plan)

GetChildByIndex implements Plan GetChildByIndex interface.

func (*PhysicalDummyScan) GetChildren

func (p *PhysicalDummyScan) GetChildren() []Plan

GetChildren implements Plan GetChildren interface.

func (*PhysicalDummyScan) GetID

func (p *PhysicalDummyScan) GetID() string

GetID implements Plan GetID interface.

func (*PhysicalDummyScan) GetParentByIndex

func (p *PhysicalDummyScan) GetParentByIndex(index int) (parent Plan)

GetParentByIndex implements Plan GetParentByIndex interface.

func (*PhysicalDummyScan) GetParents

func (p *PhysicalDummyScan) GetParents() []Plan

GetParents implements Plan GetParents interface.

func (*PhysicalDummyScan) GetSchema

func (p *PhysicalDummyScan) GetSchema() expression.Schema

GetSchema implements Plan GetSchema interface.

func (*PhysicalDummyScan) IsCorrelated

func (p *PhysicalDummyScan) IsCorrelated() bool

IsCorrelated implements Plan IsCorrelated interface.

func (*PhysicalDummyScan) MarshalJSON

func (p *PhysicalDummyScan) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*PhysicalDummyScan) ReplaceChild

func (p *PhysicalDummyScan) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (*PhysicalDummyScan) ReplaceParent

func (p *PhysicalDummyScan) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*PhysicalDummyScan) SetChildren

func (p *PhysicalDummyScan) SetChildren(children ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*PhysicalDummyScan) SetFields

func (p *PhysicalDummyScan) SetFields(fields []*ast.ResultField)

SetFields implements Plan SetFields interface.

func (*PhysicalDummyScan) SetParents

func (p *PhysicalDummyScan) SetParents(pars ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*PhysicalDummyScan) SetSchema

func (p *PhysicalDummyScan) SetSchema(schema expression.Schema)

SetSchema implements Plan SetSchema interface.

type PhysicalHashJoin

type PhysicalHashJoin struct {
	JoinType JoinType

	EqualConditions []*expression.ScalarFunction
	LeftConditions  []expression.Expression
	RightConditions []expression.Expression
	OtherConditions []expression.Expression
	SmallTable      int
	Concurrency     int
	// contains filtered or unexported fields
}

PhysicalHashJoin represents hash join for inner/ outer join.

func (*PhysicalHashJoin) AddChild

func (p *PhysicalHashJoin) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*PhysicalHashJoin) AddParent

func (p *PhysicalHashJoin) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*PhysicalHashJoin) Copy

func (p *PhysicalHashJoin) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*PhysicalHashJoin) Fields

func (p *PhysicalHashJoin) Fields() []*ast.ResultField

Fields implements Plan Fields interface.

func (*PhysicalHashJoin) GetChildByIndex

func (p *PhysicalHashJoin) GetChildByIndex(index int) (parent Plan)

GetChildByIndex implements Plan GetChildByIndex interface.

func (*PhysicalHashJoin) GetChildren

func (p *PhysicalHashJoin) GetChildren() []Plan

GetChildren implements Plan GetChildren interface.

func (*PhysicalHashJoin) GetID

func (p *PhysicalHashJoin) GetID() string

GetID implements Plan GetID interface.

func (*PhysicalHashJoin) GetParentByIndex

func (p *PhysicalHashJoin) GetParentByIndex(index int) (parent Plan)

GetParentByIndex implements Plan GetParentByIndex interface.

func (*PhysicalHashJoin) GetParents

func (p *PhysicalHashJoin) GetParents() []Plan

GetParents implements Plan GetParents interface.

func (*PhysicalHashJoin) GetSchema

func (p *PhysicalHashJoin) GetSchema() expression.Schema

GetSchema implements Plan GetSchema interface.

func (*PhysicalHashJoin) IsCorrelated

func (p *PhysicalHashJoin) IsCorrelated() bool

IsCorrelated implements Plan IsCorrelated interface.

func (*PhysicalHashJoin) MarshalJSON

func (p *PhysicalHashJoin) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*PhysicalHashJoin) ReplaceChild

func (p *PhysicalHashJoin) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (*PhysicalHashJoin) ReplaceParent

func (p *PhysicalHashJoin) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*PhysicalHashJoin) SetChildren

func (p *PhysicalHashJoin) SetChildren(children ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*PhysicalHashJoin) SetFields

func (p *PhysicalHashJoin) SetFields(fields []*ast.ResultField)

SetFields implements Plan SetFields interface.

func (*PhysicalHashJoin) SetParents

func (p *PhysicalHashJoin) SetParents(pars ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*PhysicalHashJoin) SetSchema

func (p *PhysicalHashJoin) SetSchema(schema expression.Schema)

SetSchema implements Plan SetSchema interface.

type PhysicalHashSemiJoin

type PhysicalHashSemiJoin struct {
	WithAux bool
	Anti    bool

	EqualConditions []*expression.ScalarFunction
	LeftConditions  []expression.Expression
	RightConditions []expression.Expression
	OtherConditions []expression.Expression
	// contains filtered or unexported fields
}

PhysicalHashSemiJoin represents hash join for semi join.

func (*PhysicalHashSemiJoin) AddChild

func (p *PhysicalHashSemiJoin) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*PhysicalHashSemiJoin) AddParent

func (p *PhysicalHashSemiJoin) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*PhysicalHashSemiJoin) Copy

Copy implements the PhysicalPlan Copy interface.

func (*PhysicalHashSemiJoin) Fields

func (p *PhysicalHashSemiJoin) Fields() []*ast.ResultField

Fields implements Plan Fields interface.

func (*PhysicalHashSemiJoin) GetChildByIndex

func (p *PhysicalHashSemiJoin) GetChildByIndex(index int) (parent Plan)

GetChildByIndex implements Plan GetChildByIndex interface.

func (*PhysicalHashSemiJoin) GetChildren

func (p *PhysicalHashSemiJoin) GetChildren() []Plan

GetChildren implements Plan GetChildren interface.

func (*PhysicalHashSemiJoin) GetID

func (p *PhysicalHashSemiJoin) GetID() string

GetID implements Plan GetID interface.

func (*PhysicalHashSemiJoin) GetParentByIndex

func (p *PhysicalHashSemiJoin) GetParentByIndex(index int) (parent Plan)

GetParentByIndex implements Plan GetParentByIndex interface.

func (*PhysicalHashSemiJoin) GetParents

func (p *PhysicalHashSemiJoin) GetParents() []Plan

GetParents implements Plan GetParents interface.

func (*PhysicalHashSemiJoin) GetSchema

func (p *PhysicalHashSemiJoin) GetSchema() expression.Schema

GetSchema implements Plan GetSchema interface.

func (*PhysicalHashSemiJoin) IsCorrelated

func (p *PhysicalHashSemiJoin) IsCorrelated() bool

IsCorrelated implements Plan IsCorrelated interface.

func (*PhysicalHashSemiJoin) MarshalJSON

func (p *PhysicalHashSemiJoin) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*PhysicalHashSemiJoin) ReplaceChild

func (p *PhysicalHashSemiJoin) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (*PhysicalHashSemiJoin) ReplaceParent

func (p *PhysicalHashSemiJoin) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*PhysicalHashSemiJoin) SetChildren

func (p *PhysicalHashSemiJoin) SetChildren(children ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*PhysicalHashSemiJoin) SetFields

func (p *PhysicalHashSemiJoin) SetFields(fields []*ast.ResultField)

SetFields implements Plan SetFields interface.

func (*PhysicalHashSemiJoin) SetParents

func (p *PhysicalHashSemiJoin) SetParents(pars ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*PhysicalHashSemiJoin) SetSchema

func (p *PhysicalHashSemiJoin) SetSchema(schema expression.Schema)

SetSchema implements Plan SetSchema interface.

type PhysicalIndexScan

type PhysicalIndexScan struct {
	Table      *model.TableInfo
	Index      *model.IndexInfo
	Ranges     []*IndexRange
	Columns    []*model.ColumnInfo
	DBName     *model.CIStr
	Desc       bool
	OutOfOrder bool
	// DoubleRead means if the index executor will read kv two times.
	// If the query requires the columns that don't belong to index, DoubleRead will be true.
	DoubleRead bool

	AccessCondition []expression.Expression

	TableAsName *model.CIStr
	// contains filtered or unexported fields
}

PhysicalIndexScan represents an index scan plan.

func (*PhysicalIndexScan) AddChild

func (p *PhysicalIndexScan) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*PhysicalIndexScan) AddParent

func (p *PhysicalIndexScan) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*PhysicalIndexScan) Copy

func (p *PhysicalIndexScan) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*PhysicalIndexScan) Fields

func (p *PhysicalIndexScan) Fields() []*ast.ResultField

Fields implements Plan Fields interface.

func (*PhysicalIndexScan) GetChildByIndex

func (p *PhysicalIndexScan) GetChildByIndex(index int) (parent Plan)

GetChildByIndex implements Plan GetChildByIndex interface.

func (*PhysicalIndexScan) GetChildren

func (p *PhysicalIndexScan) GetChildren() []Plan

GetChildren implements Plan GetChildren interface.

func (*PhysicalIndexScan) GetID

func (p *PhysicalIndexScan) GetID() string

GetID implements Plan GetID interface.

func (*PhysicalIndexScan) GetParentByIndex

func (p *PhysicalIndexScan) GetParentByIndex(index int) (parent Plan)

GetParentByIndex implements Plan GetParentByIndex interface.

func (*PhysicalIndexScan) GetParents

func (p *PhysicalIndexScan) GetParents() []Plan

GetParents implements Plan GetParents interface.

func (*PhysicalIndexScan) GetSchema

func (p *PhysicalIndexScan) GetSchema() expression.Schema

GetSchema implements Plan GetSchema interface.

func (*PhysicalIndexScan) IsCorrelated

func (p *PhysicalIndexScan) IsCorrelated() bool

IsCorrelated implements Plan IsCorrelated interface.

func (*PhysicalIndexScan) MarshalJSON

func (p *PhysicalIndexScan) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*PhysicalIndexScan) ReplaceChild

func (p *PhysicalIndexScan) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (*PhysicalIndexScan) ReplaceParent

func (p *PhysicalIndexScan) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*PhysicalIndexScan) SetChildren

func (p *PhysicalIndexScan) SetChildren(children ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*PhysicalIndexScan) SetFields

func (p *PhysicalIndexScan) SetFields(fields []*ast.ResultField)

SetFields implements Plan SetFields interface.

func (*PhysicalIndexScan) SetParents

func (p *PhysicalIndexScan) SetParents(pars ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*PhysicalIndexScan) SetSchema

func (p *PhysicalIndexScan) SetSchema(schema expression.Schema)

SetSchema implements Plan SetSchema interface.

type PhysicalPlan

type PhysicalPlan interface {
	json.Marshaler
	Plan

	// Copy copies the current plan.
	Copy() PhysicalPlan
	// contains filtered or unexported methods
}

PhysicalPlan is a tree of the physical operators.

type PhysicalTableScan

type PhysicalTableScan struct {
	Table   *model.TableInfo
	Columns []*model.ColumnInfo
	DBName  *model.CIStr
	Desc    bool
	Ranges  []TableRange

	AccessCondition []expression.Expression

	TableAsName *model.CIStr

	// If sort data by scanning pkcol, KeepOrder should be true.
	KeepOrder bool
	// contains filtered or unexported fields
}

PhysicalTableScan represents a table scan plan.

func (*PhysicalTableScan) AddChild

func (p *PhysicalTableScan) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*PhysicalTableScan) AddParent

func (p *PhysicalTableScan) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*PhysicalTableScan) Copy

func (p *PhysicalTableScan) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*PhysicalTableScan) Fields

func (p *PhysicalTableScan) Fields() []*ast.ResultField

Fields implements Plan Fields interface.

func (*PhysicalTableScan) GetChildByIndex

func (p *PhysicalTableScan) GetChildByIndex(index int) (parent Plan)

GetChildByIndex implements Plan GetChildByIndex interface.

func (*PhysicalTableScan) GetChildren

func (p *PhysicalTableScan) GetChildren() []Plan

GetChildren implements Plan GetChildren interface.

func (*PhysicalTableScan) GetID

func (p *PhysicalTableScan) GetID() string

GetID implements Plan GetID interface.

func (*PhysicalTableScan) GetParentByIndex

func (p *PhysicalTableScan) GetParentByIndex(index int) (parent Plan)

GetParentByIndex implements Plan GetParentByIndex interface.

func (*PhysicalTableScan) GetParents

func (p *PhysicalTableScan) GetParents() []Plan

GetParents implements Plan GetParents interface.

func (*PhysicalTableScan) GetSchema

func (p *PhysicalTableScan) GetSchema() expression.Schema

GetSchema implements Plan GetSchema interface.

func (*PhysicalTableScan) IsCorrelated

func (p *PhysicalTableScan) IsCorrelated() bool

IsCorrelated implements Plan IsCorrelated interface.

func (*PhysicalTableScan) MarshalJSON

func (p *PhysicalTableScan) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*PhysicalTableScan) ReplaceChild

func (p *PhysicalTableScan) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (*PhysicalTableScan) ReplaceParent

func (p *PhysicalTableScan) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*PhysicalTableScan) SetChildren

func (p *PhysicalTableScan) SetChildren(children ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*PhysicalTableScan) SetFields

func (p *PhysicalTableScan) SetFields(fields []*ast.ResultField)

SetFields implements Plan SetFields interface.

func (*PhysicalTableScan) SetParents

func (p *PhysicalTableScan) SetParents(pars ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*PhysicalTableScan) SetSchema

func (p *PhysicalTableScan) SetSchema(schema expression.Schema)

SetSchema implements Plan SetSchema interface.

type PhysicalUnionScan

type PhysicalUnionScan struct {
	Condition expression.Expression
	// contains filtered or unexported fields
}

PhysicalUnionScan represents a union scan operator.

func (*PhysicalUnionScan) AddChild

func (p *PhysicalUnionScan) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*PhysicalUnionScan) AddParent

func (p *PhysicalUnionScan) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*PhysicalUnionScan) Copy

func (p *PhysicalUnionScan) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*PhysicalUnionScan) Fields

func (p *PhysicalUnionScan) Fields() []*ast.ResultField

Fields implements Plan Fields interface.

func (*PhysicalUnionScan) GetChildByIndex

func (p *PhysicalUnionScan) GetChildByIndex(index int) (parent Plan)

GetChildByIndex implements Plan GetChildByIndex interface.

func (*PhysicalUnionScan) GetChildren

func (p *PhysicalUnionScan) GetChildren() []Plan

GetChildren implements Plan GetChildren interface.

func (*PhysicalUnionScan) GetID

func (p *PhysicalUnionScan) GetID() string

GetID implements Plan GetID interface.

func (*PhysicalUnionScan) GetParentByIndex

func (p *PhysicalUnionScan) GetParentByIndex(index int) (parent Plan)

GetParentByIndex implements Plan GetParentByIndex interface.

func (*PhysicalUnionScan) GetParents

func (p *PhysicalUnionScan) GetParents() []Plan

GetParents implements Plan GetParents interface.

func (*PhysicalUnionScan) GetSchema

func (p *PhysicalUnionScan) GetSchema() expression.Schema

GetSchema implements Plan GetSchema interface.

func (*PhysicalUnionScan) IsCorrelated

func (p *PhysicalUnionScan) IsCorrelated() bool

IsCorrelated implements Plan IsCorrelated interface.

func (*PhysicalUnionScan) MarshalJSON

func (p *PhysicalUnionScan) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*PhysicalUnionScan) ReplaceChild

func (p *PhysicalUnionScan) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (*PhysicalUnionScan) ReplaceParent

func (p *PhysicalUnionScan) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*PhysicalUnionScan) SetChildren

func (p *PhysicalUnionScan) SetChildren(children ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*PhysicalUnionScan) SetFields

func (p *PhysicalUnionScan) SetFields(fields []*ast.ResultField)

SetFields implements Plan SetFields interface.

func (*PhysicalUnionScan) SetParents

func (p *PhysicalUnionScan) SetParents(pars ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*PhysicalUnionScan) SetSchema

func (p *PhysicalUnionScan) SetSchema(schema expression.Schema)

SetSchema implements Plan SetSchema interface.

type Plan

type Plan interface {
	// Fields returns the result fields of the plan.
	Fields() []*ast.ResultField
	// SetFields sets the results fields of the plan.
	SetFields(fields []*ast.ResultField)
	// AddParent means appending a parent for plan.
	AddParent(parent Plan)
	// AddChild means appending a child for plan.
	AddChild(children Plan)
	// ReplaceParent means replacing a parent with another one.
	ReplaceParent(parent, newPar Plan) error
	// ReplaceChild means replacing a child with another one.
	ReplaceChild(children, newChild Plan) error
	// Retrieve the parent by index.
	GetParentByIndex(index int) Plan
	// Retrieve the child by index.
	GetChildByIndex(index int) Plan
	// Get all the parents.
	GetParents() []Plan
	// Get all the children.
	GetChildren() []Plan
	// Set the schema.
	SetSchema(schema expression.Schema)
	// Get the schema.
	GetSchema() expression.Schema
	// Get the ID.
	GetID() string
	// Check whether this plan is correlated or not.
	IsCorrelated() bool
	// SetParents sets the parents for the plan.
	SetParents(...Plan)
	// SetParents sets the children for the plan.
	SetChildren(...Plan)
}

Plan is the description of an execution flow. It is created from ast.Node first, then optimized by the optimizer, finally used by the executor to create a Cursor which executes the statement.

func Optimize

func Optimize(ctx context.Context, node ast.Node, is infoschema.InfoSchema) (Plan, error)

Optimize does optimization and creates a Plan. The node must be prepared first.

type Prepare

type Prepare struct {
	Name    string
	SQLText string
	// contains filtered or unexported fields
}

Prepare represents prepare plan.

func (*Prepare) AddChild

func (p *Prepare) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*Prepare) AddParent

func (p *Prepare) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*Prepare) Fields

func (p *Prepare) Fields() []*ast.ResultField

Fields implements Plan Fields interface.

func (*Prepare) GetChildByIndex

func (p *Prepare) GetChildByIndex(index int) (parent Plan)

GetChildByIndex implements Plan GetChildByIndex interface.

func (*Prepare) GetChildren

func (p *Prepare) GetChildren() []Plan

GetChildren implements Plan GetChildren interface.

func (*Prepare) GetID

func (p *Prepare) GetID() string

GetID implements Plan GetID interface.

func (*Prepare) GetParentByIndex

func (p *Prepare) GetParentByIndex(index int) (parent Plan)

GetParentByIndex implements Plan GetParentByIndex interface.

func (*Prepare) GetParents

func (p *Prepare) GetParents() []Plan

GetParents implements Plan GetParents interface.

func (*Prepare) GetSchema

func (p *Prepare) GetSchema() expression.Schema

GetSchema implements Plan GetSchema interface.

func (*Prepare) IsCorrelated

func (p *Prepare) IsCorrelated() bool

IsCorrelated implements Plan IsCorrelated interface.

func (*Prepare) MarshalJSON

func (p *Prepare) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*Prepare) ReplaceChild

func (p *Prepare) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (*Prepare) ReplaceParent

func (p *Prepare) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*Prepare) SetChildren

func (p *Prepare) SetChildren(children ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*Prepare) SetFields

func (p *Prepare) SetFields(fields []*ast.ResultField)

SetFields implements Plan SetFields interface.

func (*Prepare) SetParents

func (p *Prepare) SetParents(pars ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*Prepare) SetSchema

func (p *Prepare) SetSchema(schema expression.Schema)

SetSchema implements Plan SetSchema interface.

type Projection

type Projection struct {
	Exprs []expression.Expression
	// contains filtered or unexported fields
}

Projection represents a select fields plan.

func (*Projection) Copy

func (p *Projection) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*Projection) MarshalJSON

func (p *Projection) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*Projection) PredicatePushDown

func (p *Projection) PredicatePushDown(predicates []expression.Expression) (ret []expression.Expression, retPlan LogicalPlan, err error)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*Projection) PruneColumnsAndResolveIndices

func (p *Projection) PruneColumnsAndResolveIndices(parentUsedCols []*expression.Column) ([]*expression.Column, error)

PruneColumnsAndResolveIndices implements LogicalPlan PruneColumnsAndResolveIndices interface.

type SelectLock

type SelectLock struct {
	Lock ast.SelectLockType
	// contains filtered or unexported fields
}

SelectLock represents a select lock plan.

func (*SelectLock) Copy

func (p *SelectLock) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*SelectLock) PredicatePushDown

func (p *SelectLock) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*SelectLock) PruneColumnsAndResolveIndices

func (p *SelectLock) PruneColumnsAndResolveIndices(parentUsedCols []*expression.Column) ([]*expression.Column, error)

PruneColumnsAndResolveIndices implements LogicalPlan PruneColumnsAndResolveIndices interface.

type Selection

type Selection struct {

	// Originally the WHERE or ON condition is parsed into a single expression,
	// but after we converted to CNF(Conjunctive normal form), it can be
	// split into a list of AND conditions.
	Conditions []expression.Expression
	// contains filtered or unexported fields
}

Selection means a filter.

func (*Selection) Copy

func (p *Selection) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*Selection) MarshalJSON

func (p *Selection) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*Selection) PredicatePushDown

func (p *Selection) PredicatePushDown(predicates []expression.Expression) (ret []expression.Expression, retP LogicalPlan, err error)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*Selection) PruneColumnsAndResolveIndices

func (p *Selection) PruneColumnsAndResolveIndices(parentUsedCols []*expression.Column) ([]*expression.Column, error)

PruneColumnsAndResolveIndices implements LogicalPlan PruneColumnsAndResolveIndices interface.

type Show

type Show struct {
	Tp     ast.ShowStmtType // Databases/Tables/Columns/....
	DBName string
	Table  *ast.TableName  // Used for showing columns.
	Column *ast.ColumnName // Used for `desc table column`.
	Flag   int             // Some flag parsed from sql, such as FULL.
	Full   bool
	User   string // Used for show grants.

	// Used by show variables
	GlobalScope bool
	// contains filtered or unexported fields
}

Show represents a show plan.

func (*Show) AddChild

func (p *Show) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*Show) AddParent

func (p *Show) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*Show) Fields

func (p *Show) Fields() []*ast.ResultField

Fields implements Plan Fields interface.

func (*Show) GetChildByIndex

func (p *Show) GetChildByIndex(index int) (parent Plan)

GetChildByIndex implements Plan GetChildByIndex interface.

func (*Show) GetChildren

func (p *Show) GetChildren() []Plan

GetChildren implements Plan GetChildren interface.

func (*Show) GetID

func (p *Show) GetID() string

GetID implements Plan GetID interface.

func (*Show) GetParentByIndex

func (p *Show) GetParentByIndex(index int) (parent Plan)

GetParentByIndex implements Plan GetParentByIndex interface.

func (*Show) GetParents

func (p *Show) GetParents() []Plan

GetParents implements Plan GetParents interface.

func (*Show) GetSchema

func (p *Show) GetSchema() expression.Schema

GetSchema implements Plan GetSchema interface.

func (*Show) IsCorrelated

func (p *Show) IsCorrelated() bool

IsCorrelated implements Plan IsCorrelated interface.

func (*Show) MarshalJSON

func (p *Show) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*Show) ReplaceChild

func (p *Show) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (*Show) ReplaceParent

func (p *Show) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*Show) SetChildren

func (p *Show) SetChildren(children ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*Show) SetFields

func (p *Show) SetFields(fields []*ast.ResultField)

SetFields implements Plan SetFields interface.

func (*Show) SetParents

func (p *Show) SetParents(pars ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*Show) SetSchema

func (p *Show) SetSchema(schema expression.Schema)

SetSchema implements Plan SetSchema interface.

type ShowDDL

type ShowDDL struct {
	// contains filtered or unexported fields
}

ShowDDL is for showing DDL information.

func (*ShowDDL) AddChild

func (p *ShowDDL) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*ShowDDL) AddParent

func (p *ShowDDL) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*ShowDDL) Fields

func (p *ShowDDL) Fields() []*ast.ResultField

Fields implements Plan Fields interface.

func (*ShowDDL) GetChildByIndex

func (p *ShowDDL) GetChildByIndex(index int) (parent Plan)

GetChildByIndex implements Plan GetChildByIndex interface.

func (*ShowDDL) GetChildren

func (p *ShowDDL) GetChildren() []Plan

GetChildren implements Plan GetChildren interface.

func (*ShowDDL) GetID

func (p *ShowDDL) GetID() string

GetID implements Plan GetID interface.

func (*ShowDDL) GetParentByIndex

func (p *ShowDDL) GetParentByIndex(index int) (parent Plan)

GetParentByIndex implements Plan GetParentByIndex interface.

func (*ShowDDL) GetParents

func (p *ShowDDL) GetParents() []Plan

GetParents implements Plan GetParents interface.

func (*ShowDDL) GetSchema

func (p *ShowDDL) GetSchema() expression.Schema

GetSchema implements Plan GetSchema interface.

func (*ShowDDL) IsCorrelated

func (p *ShowDDL) IsCorrelated() bool

IsCorrelated implements Plan IsCorrelated interface.

func (*ShowDDL) MarshalJSON

func (p *ShowDDL) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*ShowDDL) ReplaceChild

func (p *ShowDDL) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (*ShowDDL) ReplaceParent

func (p *ShowDDL) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*ShowDDL) SetChildren

func (p *ShowDDL) SetChildren(children ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*ShowDDL) SetFields

func (p *ShowDDL) SetFields(fields []*ast.ResultField)

SetFields implements Plan SetFields interface.

func (*ShowDDL) SetParents

func (p *ShowDDL) SetParents(pars ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*ShowDDL) SetSchema

func (p *ShowDDL) SetSchema(schema expression.Schema)

SetSchema implements Plan SetSchema interface.

type Simple

type Simple struct {
	Statement ast.StmtNode
	// contains filtered or unexported fields
}

Simple represents a simple statement plan which doesn't need any optimization.

func (*Simple) AddChild

func (p *Simple) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*Simple) AddParent

func (p *Simple) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*Simple) Fields

func (p *Simple) Fields() []*ast.ResultField

Fields implements Plan Fields interface.

func (*Simple) GetChildByIndex

func (p *Simple) GetChildByIndex(index int) (parent Plan)

GetChildByIndex implements Plan GetChildByIndex interface.

func (*Simple) GetChildren

func (p *Simple) GetChildren() []Plan

GetChildren implements Plan GetChildren interface.

func (*Simple) GetID

func (p *Simple) GetID() string

GetID implements Plan GetID interface.

func (*Simple) GetParentByIndex

func (p *Simple) GetParentByIndex(index int) (parent Plan)

GetParentByIndex implements Plan GetParentByIndex interface.

func (*Simple) GetParents

func (p *Simple) GetParents() []Plan

GetParents implements Plan GetParents interface.

func (*Simple) GetSchema

func (p *Simple) GetSchema() expression.Schema

GetSchema implements Plan GetSchema interface.

func (*Simple) IsCorrelated

func (p *Simple) IsCorrelated() bool

IsCorrelated implements Plan IsCorrelated interface.

func (*Simple) MarshalJSON

func (p *Simple) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*Simple) ReplaceChild

func (p *Simple) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (*Simple) ReplaceParent

func (p *Simple) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*Simple) SetChildren

func (p *Simple) SetChildren(children ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*Simple) SetFields

func (p *Simple) SetFields(fields []*ast.ResultField)

SetFields implements Plan SetFields interface.

func (*Simple) SetParents

func (p *Simple) SetParents(pars ...Plan)

RemoveAllParents implements Plan RemoveAllParents interface.

func (*Simple) SetSchema

func (p *Simple) SetSchema(schema expression.Schema)

SetSchema implements Plan SetSchema interface.

type Sort

type Sort struct {
	ByItems   []*ByItems
	ExecLimit *Limit
	// contains filtered or unexported fields
}

Sort stands for the order by plan.

func (*Sort) Copy

func (p *Sort) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*Sort) MarshalJSON

func (p *Sort) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (*Sort) PredicatePushDown

func (p *Sort) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*Sort) PruneColumnsAndResolveIndices

func (p *Sort) PruneColumnsAndResolveIndices(parentUsedCols []*expression.Column) ([]*expression.Column, error)

PruneColumnsAndResolveIndices implements LogicalPlan PruneColumnsAndResolveIndices interface.

type TableDual

type TableDual struct {
	// contains filtered or unexported fields
}

TableDual represents a dual table plan.

func (*TableDual) Copy

func (p *TableDual) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*TableDual) PredicatePushDown

func (p *TableDual) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*TableDual) PruneColumnsAndResolveIndices

func (p *TableDual) PruneColumnsAndResolveIndices(parentUsedCols []*expression.Column) ([]*expression.Column, error)

PruneColumnsAndResolveIndices implements LogicalPlan PruneColumnsAndResolveIndices interface.

type TableRange

type TableRange struct {
	LowVal  int64
	HighVal int64
}

TableRange represents a range of row handle.

type Trim

type Trim struct {
	// contains filtered or unexported fields
}

Trim trims child's rows.

func (*Trim) Copy

func (p *Trim) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*Trim) PredicatePushDown

func (p *Trim) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*Trim) PruneColumnsAndResolveIndices

func (p *Trim) PruneColumnsAndResolveIndices(parentUsedCols []*expression.Column) ([]*expression.Column, error)

PruneColumnsAndResolveIndices implements LogicalPlan PruneColumnsAndResolveIndices interface.

type Union

type Union struct {
	// contains filtered or unexported fields
}

Union represents Union plan.

func (*Union) Copy

func (p *Union) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*Union) PredicatePushDown

func (p *Union) PredicatePushDown(predicates []expression.Expression) (ret []expression.Expression, retPlan LogicalPlan, err error)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*Union) PruneColumnsAndResolveIndices

func (p *Union) PruneColumnsAndResolveIndices(parentUsedCols []*expression.Column) ([]*expression.Column, error)

PruneColumnsAndResolveIndices implements LogicalPlan PruneColumnsAndResolveIndices interface.

type Update

type Update struct {
	OrderedList []*expression.Assignment
	// contains filtered or unexported fields
}

Update represents Update plan.

func (*Update) Copy

func (p *Update) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*Update) PredicatePushDown

func (p *Update) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan, error)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*Update) PruneColumnsAndResolveIndices

func (p *Update) PruneColumnsAndResolveIndices(parentUsedCols []*expression.Column) ([]*expression.Column, error)

PruneColumnsAndResolveIndices implements LogicalPlan PruneColumnsAndResolveIndices interface. Update do not prune columns. Here we just do two things: 1. resolve indices for schema 2. reorder OrderedList

Directories

Path Synopsis
Package statistics is a generated protocol buffer package.
Package statistics is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL