plan

package
v1.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2017 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TypeSel is the type of Selection.
	TypeSel = "Selection"
	// TypeSet is the type of Set.
	TypeSet = "Set"
	// TypeProj is the type of Projection.
	TypeProj = "Projection"
	// TypeAgg is the type of Aggregation.
	TypeAgg = "Aggregation"
	// TypeStreamAgg is the type of StreamAgg.
	TypeStreamAgg = "StreamAgg"
	// TypeHashAgg is the type of HashAgg.
	TypeHashAgg = "HashAgg"
	// TypeCache is the type of cache.
	TypeCache = "Cache"
	// TypeShow is the type of show.
	TypeShow = "Show"
	// TypeJoin is the type of Join.
	TypeJoin = "Join"
	// TypeUnion is the type of Union.
	TypeUnion = "Union"
	// TypeTableScan is the type of TableScan.
	TypeTableScan = "TableScan"
	// TypeMemTableScan is the type of TableScan.
	TypeMemTableScan = "MemTableScan"
	// TypeUnionScan is the type of UnionScan.
	TypeUnionScan = "UnionScan"
	// TypeIdxScan is the type of IndexScan.
	TypeIdxScan = "IndexScan"
	// TypeSort is the type of Sort.
	TypeSort = "Sort"
	// TypeTopN is the type of TopN.
	TypeTopN = "TopN"
	// TypeLimit is the type of Limit.
	TypeLimit = "Limit"
	// TypeHashSemiJoin is the type of hash semi join.
	TypeHashSemiJoin = "HashSemiJoin"
	// TypeHashLeftJoin is the type of left hash join.
	TypeHashLeftJoin = "HashLeftJoin"
	// TypeHashRightJoin is the type of right hash join.
	TypeHashRightJoin = "HashRightJoin"
	// TypeMergeJoin is the type of merge join.
	TypeMergeJoin = "MergeJoin"
	// TypeIndexJoin is the type of index look up join.
	TypeIndexJoin = "IndexJoin"
	// TypeApply is the type of Apply.
	TypeApply = "Apply"
	// TypeMaxOneRow is the type of MaxOneRow.
	TypeMaxOneRow = "MaxOneRow"
	// TypeExists is the type of Exists.
	TypeExists = "Exists"
	// TypeDual is the type of TableDual.
	TypeDual = "TableDual"
	// TypeLock is the type of SelectLock.
	TypeLock = "SelectLock"
	// TypeInsert is the type of Insert
	TypeInsert = "Insert"
	// TypeUpate is the type of Update.
	TypeUpate = "Update"
	// TypeDelete is the type of Delete.
	TypeDelete = "Delete"
	// TypeIndexLookUp is the type of IndexLookUp.
	TypeIndexLookUp = "IndexLookUp"
	// TypeTableReader is the type of TableReader.
	TypeTableReader = "TableReader"
	// TypeIndexReader is the type of IndexReader.
	TypeIndexReader = "IndexReader"
)
View Source
const (
	// TiDBMergeJoin is hint enforce merge join.
	TiDBMergeJoin = "tidb_smj"
	// TiDBIndexNestedLoopJoin is hint enforce index nested loop join.
	TiDBIndexNestedLoopJoin = "tidb_inlj"
)
View Source
const (
	CodeOperandColumns      terror.ErrCode = 1
	CodeInvalidWildCard     terror.ErrCode = 3
	CodeUnsupported         terror.ErrCode = 4
	CodeInvalidGroupFuncUse terror.ErrCode = 5
	CodeIllegalReference    terror.ErrCode = 6
	CodeStmtNotFound        terror.ErrCode = 7
	CodeWrongParamCount     terror.ErrCode = 8
	CodeSchemaChanged       terror.ErrCode = 9

	// MySQL error code.
	CodeNoDB                 terror.ErrCode = mysql.ErrNoDB
	CodeUnknownExplainFormat terror.ErrCode = mysql.ErrUnknownExplainFormat
)

Optimizer error codes.

View Source
const (
	CodeUnsupportedType    terror.ErrCode = 1
	SystemInternalError                   = 2
	CodeAlterAutoID                       = 3
	CodeAnalyzeMissIndex                  = 4
	CodeAmbiguous                         = 1052
	CodeUnknownColumn                     = mysql.ErrBadField
	CodeUnknownTable                      = mysql.ErrBadTable
	CodeWrongArguments                    = 1210
	CodeBadGeneratedColumn                = mysql.ErrBadGeneratedColumn
)

Error codes.

Variables

View Source
var (
	// PlanCacheEnabled stores the global config "plan-cache-enabled".
	PlanCacheEnabled bool
	// PlanCacheShards stores the global config "plan-cache-shards".
	PlanCacheShards int64
	// PlanCacheCapacity stores the global config "plan-cache-capacity".
	PlanCacheCapacity int64
	// GlobalPlanCache stores the global plan cache for every session in a tidb-server.
	GlobalPlanCache *kvcache.ShardedLRUCache

	// PreparedPlanCacheEnabled stores the global config "prepared-plan-cache-enabled".
	PreparedPlanCacheEnabled bool
	// PreparedPlanCacheCapacity stores the global config "prepared-plan-cache-capacity".
	PreparedPlanCacheCapacity int64
)
View Source
var (
	ErrOperandColumns              = terror.ClassOptimizer.New(CodeOperandColumns, "Operand should contain %d column(s)")
	ErrInvalidWildCard             = terror.ClassOptimizer.New(CodeInvalidWildCard, "Wildcard fields without any table name appears in wrong place")
	ErrCartesianProductUnsupported = terror.ClassOptimizer.New(CodeUnsupported, "Cartesian product is unsupported")
	ErrInvalidGroupFuncUse         = terror.ClassOptimizer.New(CodeInvalidGroupFuncUse, "Invalid use of group function")
	ErrIllegalReference            = terror.ClassOptimizer.New(CodeIllegalReference, "Illegal reference")
	ErrNoDB                        = terror.ClassOptimizer.New(CodeNoDB, "No database selected")
	ErrUnknownExplainFormat        = terror.ClassOptimizer.New(CodeUnknownExplainFormat, mysql.MySQLErrName[mysql.ErrUnknownExplainFormat])
	ErrStmtNotFound                = terror.ClassOptimizer.New(CodeStmtNotFound, "Prepared statement not found")
	ErrWrongParamCount             = terror.ClassOptimizer.New(CodeWrongParamCount, "Wrong parameter count")
	ErrSchemaChanged               = terror.ClassOptimizer.New(CodeSchemaChanged, "Schema has changed")
)

Optimizer base errors.

View Source
var (
	ErrUnsupportedType      = terror.ClassOptimizerPlan.New(CodeUnsupportedType, "Unsupported type")
	SystemInternalErrorType = terror.ClassOptimizerPlan.New(SystemInternalError, "System internal error")
	ErrUnknownColumn        = terror.ClassOptimizerPlan.New(CodeUnknownColumn, mysql.MySQLErrName[mysql.ErrBadField])
	ErrUnknownTable         = terror.ClassOptimizerPlan.New(CodeUnknownColumn, mysql.MySQLErrName[mysql.ErrBadTable])
	ErrWrongArguments       = terror.ClassOptimizerPlan.New(CodeWrongArguments, "Incorrect arguments to EXECUTE")
	ErrAmbiguous            = terror.ClassOptimizerPlan.New(CodeAmbiguous, "Column '%s' in field list is ambiguous")
	ErrAnalyzeMissIndex     = terror.ClassOptimizerPlan.New(CodeAnalyzeMissIndex, "Index '%s' in field list does not exist in table '%s'")
	ErrAlterAutoID          = terror.ClassAutoid.New(CodeAlterAutoID, "No support for setting auto_increment using alter_table")
	ErrBadGeneratedColumn   = terror.ClassOptimizerPlan.New(CodeBadGeneratedColumn, mysql.MySQLErrName[mysql.ErrBadGeneratedColumn])
)

Error instances.

View Source
var AllowCartesianProduct = true

AllowCartesianProduct means whether tidb allows cartesian join without equal conditions.

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 Cacheable

func Cacheable(node ast.Node) bool

Cacheable checks whether the input ast is cacheable.

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 NewPSTMTPlanCacheKey

func NewPSTMTPlanCacheKey(sessionVars *variable.SessionVars, pstmtID uint32, schemaVersion int64) kvcache.Key

NewPSTMTPlanCacheKey creates a new pstmtPlanCacheKey object.

func NewSQLCacheKey

func NewSQLCacheKey(sessionVars *variable.SessionVars, sql string, schemaVersion int64, readOnly bool) kvcache.Key

NewSQLCacheKey creates a new sqlCacheKey object.

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(ctx context.Context, node ast.Node, is infoschema.InfoSchema, inPrepare bool) error

Preprocess resolves names of the node, and checks whether the node is valid.

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 UseDAGPlanBuilder

func UseDAGPlanBuilder(ctx context.Context) bool

UseDAGPlanBuilder checks if we use new DAG planner.

Types

type AggregateFuncExtractor

type AggregateFuncExtractor struct {

	// AggFuncs is the collected AggregateFuncExprs.
	AggFuncs []*ast.AggregateFuncExpr
	// contains filtered or unexported fields
}

AggregateFuncExtractor visits Expr tree. It converts ColunmNameExpr to AggregateFuncExpr and collects AggregateFuncExpr.

func (*AggregateFuncExtractor) Enter

func (a *AggregateFuncExtractor) Enter(n ast.Node) (ast.Node, bool)

Enter implements Visitor interface.

func (*AggregateFuncExtractor) Leave

func (a *AggregateFuncExtractor) Leave(n ast.Node) (ast.Node, bool)

Leave implements Visitor 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
)

func (AggregationType) String

func (at AggregationType) String() string

String implements fmt.Stringer interface.

type Analyze

type Analyze struct {
	ColTasks []AnalyzeColumnsTask
	IdxTasks []AnalyzeIndexTask
	// contains filtered or unexported fields
}

Analyze represents an analyze plan

func (*Analyze) AddChild

func (p *Analyze) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*Analyze) AddParent

func (p *Analyze) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*Analyze) Allocator

func (p *Analyze) Allocator() *idAllocator

func (*Analyze) Children

func (p *Analyze) Children() []Plan

Children implements Plan Children interface.

func (*Analyze) ExplainID

func (p *Analyze) ExplainID() string

func (*Analyze) ID

func (p *Analyze) ID() int

ID implements Plan ID interface.

func (*Analyze) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (*Analyze) Parents

func (p *Analyze) Parents() []Plan

Parents implements Plan Parents interface.

func (*Analyze) PruneColumns

func (p *Analyze) PruneColumns(parentUsedCols []*expression.Column)

PruneColumns implements LogicalPlan interface. We should not prune columns for Analyze.

func (*Analyze) ReplaceChild

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

ReplaceChild means replace a child with another one.

func (*Analyze) ReplaceParent

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

ReplaceParent means replace a parent for another one.

func (*Analyze) ResolveIndices

func (p *Analyze) ResolveIndices()

ResolveIndices implements Plan interface.

func (*Analyze) Schema

func (p *Analyze) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (*Analyze) SetChildren

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

SetChildren implements Plan SetChildren interface.

func (*Analyze) SetParents

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

SetParents implements Plan SetParents interface.

func (*Analyze) SetSchema

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

SetSchema implements Plan SetSchema interface.

type AnalyzeColumnsTask

type AnalyzeColumnsTask struct {
	TableInfo *model.TableInfo
	PKInfo    *model.ColumnInfo
	ColsInfo  []*model.ColumnInfo
	PushDown  bool
}

AnalyzeColumnsTask is used for analyze columns.

type AnalyzeIndexTask

type AnalyzeIndexTask struct {
	TableInfo *model.TableInfo
	IndexInfo *model.IndexInfo
	PushDown  bool
}

AnalyzeIndexTask is used for analyze index.

type ByItems

type ByItems struct {
	Expr expression.Expression
	Desc bool
}

ByItems wraps a "by" item.

func (*ByItems) Clone

func (by *ByItems) Clone() *ByItems

Clone makes a copy of ByItems.

func (*ByItems) String

func (by *ByItems) String() string

String implements fmt.Stringer interface.

type Cache

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

Cache plan is a physical plan which stores the result of its child node.

func (Cache) AddChild

func (p Cache) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (Cache) AddParent

func (p Cache) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (Cache) Allocator

func (p Cache) Allocator() *idAllocator

func (Cache) Children

func (p Cache) Children() []Plan

Children implements Plan Children interface.

func (*Cache) Copy

func (p *Cache) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (Cache) ExplainID

func (p Cache) ExplainID() string

func (*Cache) ExplainInfo

func (bp *Cache) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (Cache) ID

func (p Cache) ID() int

ID implements Plan ID interface.

func (Cache) MarshalJSON

func (p Cache) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (Cache) Parents

func (p Cache) Parents() []Plan

Parents implements Plan Parents interface.

func (Cache) ReplaceChild

func (p Cache) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (Cache) ReplaceParent

func (p Cache) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (Cache) ResolveIndices

func (p Cache) ResolveIndices()

ResolveIndices implements Plan interface.

func (Cache) Schema

func (p Cache) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (Cache) SetChildren

func (p Cache) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (Cache) SetParents

func (p Cache) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (Cache) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*Cache) ToPB

func (p *Cache) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type CancelDDLJobs added in v1.0.1

type CancelDDLJobs struct {
	JobIDs []int64
	// contains filtered or unexported fields
}

CancelDDLJobs represents a cancel DDL jobs plan.

func (*CancelDDLJobs) AddChild added in v1.0.1

func (p *CancelDDLJobs) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*CancelDDLJobs) AddParent added in v1.0.1

func (p *CancelDDLJobs) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*CancelDDLJobs) Allocator added in v1.0.1

func (p *CancelDDLJobs) Allocator() *idAllocator

func (*CancelDDLJobs) Children added in v1.0.1

func (p *CancelDDLJobs) Children() []Plan

Children implements Plan Children interface.

func (*CancelDDLJobs) ExplainID added in v1.0.1

func (p *CancelDDLJobs) ExplainID() string

func (*CancelDDLJobs) ID added in v1.0.1

func (p *CancelDDLJobs) ID() int

ID implements Plan ID interface.

func (*CancelDDLJobs) MarshalJSON added in v1.0.1

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

MarshalJSON implements json.Marshaler interface.

func (*CancelDDLJobs) Parents added in v1.0.1

func (p *CancelDDLJobs) Parents() []Plan

Parents implements Plan Parents interface.

func (*CancelDDLJobs) ReplaceChild added in v1.0.1

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

ReplaceChild means replace a child with another one.

func (*CancelDDLJobs) ReplaceParent added in v1.0.1

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

ReplaceParent means replace a parent for another one.

func (*CancelDDLJobs) ResolveIndices added in v1.0.1

func (p *CancelDDLJobs) ResolveIndices()

ResolveIndices implements Plan interface.

func (*CancelDDLJobs) Schema added in v1.0.1

func (p *CancelDDLJobs) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (*CancelDDLJobs) SetChildren added in v1.0.1

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

SetChildren implements Plan SetChildren interface.

func (*CancelDDLJobs) SetParents added in v1.0.1

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

SetParents implements Plan SetParents interface.

func (*CancelDDLJobs) SetSchema added in v1.0.1

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

SetSchema implements Plan SetSchema interface.

type CheckTable

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

CheckTable is used for checking table data, built from the 'admin check table' statement.

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) Allocator

func (p *CheckTable) Allocator() *idAllocator

func (*CheckTable) Children

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

Children implements Plan Children interface.

func (*CheckTable) ExplainID

func (p *CheckTable) ExplainID() string

func (*CheckTable) ID

func (p *CheckTable) ID() int

ID implements Plan ID interface.

func (*CheckTable) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (*CheckTable) Parents

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

Parents implements Plan Parents 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) ResolveIndices

func (p *CheckTable) ResolveIndices()

ResolveIndices implements Plan interface.

func (*CheckTable) Schema

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

Schema implements Plan Schema interface.

func (*CheckTable) SetChildren

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

SetChildren implements Plan SetChildren interface.

func (*CheckTable) SetParents

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

SetParents implements Plan SetParents 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) Allocator

func (p *DDL) Allocator() *idAllocator

func (*DDL) Children

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

Children implements Plan Children interface.

func (*DDL) ExplainID

func (p *DDL) ExplainID() string

func (*DDL) ID

func (p *DDL) ID() int

ID implements Plan ID interface.

func (*DDL) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (*DDL) Parents

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

Parents implements Plan Parents 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) ResolveIndices

func (p *DDL) ResolveIndices()

ResolveIndices implements Plan interface.

func (*DDL) Schema

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

Schema implements Plan Schema interface.

func (*DDL) SetChildren

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

SetChildren implements Plan SetChildren interface.

func (*DDL) SetParents

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

SetParents implements Plan SetParents interface.

func (*DDL) SetSchema

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

SetSchema implements Plan SetSchema interface.

type DataSource

type DataSource struct {
	Columns []*model.ColumnInfo
	DBName  model.CIStr

	TableAsName *model.CIStr

	LimitCount *int64

	// NeedColHandle is used in execution phase.
	NeedColHandle bool
	// contains filtered or unexported fields
}

DataSource represents a tablescan without condition push down.

func (DataSource) AddChild

func (p DataSource) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (DataSource) AddParent

func (p DataSource) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (DataSource) Allocator

func (p DataSource) Allocator() *idAllocator

func (DataSource) Children

func (p DataSource) Children() []Plan

Children implements Plan Children interface.

func (DataSource) ExplainID

func (p DataSource) ExplainID() string

func (DataSource) ID

func (p DataSource) ID() int

ID implements Plan ID interface.

func (DataSource) MarshalJSON

func (p DataSource) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (DataSource) Parents

func (p DataSource) Parents() []Plan

Parents implements Plan Parents interface.

func (*DataSource) PredicatePushDown

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*DataSource) PruneColumns

func (p *DataSource) PruneColumns(parentUsedCols []*expression.Column)

PruneColumns implements LogicalPlan interface.

func (DataSource) ReplaceChild

func (p DataSource) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (DataSource) ReplaceParent

func (p DataSource) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (DataSource) ResolveIndices

func (p DataSource) ResolveIndices()

ResolveIndices implements Plan interface.

func (*DataSource) Schema

func (p *DataSource) Schema() *expression.Schema

Schema implements the plan interface.

func (DataSource) SetChildren

func (p DataSource) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (DataSource) SetParents

func (p DataSource) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (DataSource) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*DataSource) TableInfo

func (p *DataSource) TableInfo() *model.TableInfo

TableInfo returns the *TableInfo of data source.

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) Allocator

func (p *Deallocate) Allocator() *idAllocator

func (*Deallocate) Children

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

Children implements Plan Children interface.

func (*Deallocate) ExplainID

func (p *Deallocate) ExplainID() string

func (*Deallocate) ID

func (p *Deallocate) ID() int

ID implements Plan ID interface.

func (*Deallocate) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (*Deallocate) Parents

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

Parents implements Plan Parents 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) ResolveIndices

func (p *Deallocate) ResolveIndices()

ResolveIndices implements Plan interface.

func (*Deallocate) Schema

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

Schema implements Plan Schema interface.

func (*Deallocate) SetChildren

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

SetChildren implements Plan SetChildren interface.

func (*Deallocate) SetParents

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

SetParents implements Plan SetParents 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) AddChild

func (p Delete) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (Delete) AddParent

func (p Delete) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (Delete) Allocator

func (p Delete) Allocator() *idAllocator

func (Delete) Children

func (p Delete) Children() []Plan

Children implements Plan Children interface.

func (*Delete) Copy

func (p *Delete) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (Delete) ExplainID

func (p Delete) ExplainID() string

func (*Delete) ExplainInfo

func (bp *Delete) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (Delete) ID

func (p Delete) ID() int

ID implements Plan ID interface.

func (Delete) MarshalJSON

func (p Delete) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (Delete) Parents

func (p Delete) Parents() []Plan

Parents implements Plan Parents interface.

func (*Delete) PredicatePushDown

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

PredicatePushDown implements LogicalPlan interface.

func (*Delete) PruneColumns

func (p *Delete) PruneColumns(parentUsedCols []*expression.Column)

PruneColumns implements LogicalPlan interface.

func (Delete) ReplaceChild

func (p Delete) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (Delete) ReplaceParent

func (p Delete) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (Delete) ResolveIndices

func (p Delete) ResolveIndices()

ResolveIndices implements Plan interface.

func (Delete) Schema

func (p Delete) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (Delete) SetChildren

func (p Delete) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (Delete) SetParents

func (p Delete) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (Delete) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*Delete) ToPB

func (p *Delete) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type Execute

type Execute struct {
	Name      string
	UsingVars []expression.Expression
	ExecID    uint32
	Stmt      ast.StmtNode
	Plan      Plan
	// 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) Allocator

func (p *Execute) Allocator() *idAllocator

func (*Execute) Children

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

Children implements Plan Children interface.

func (*Execute) ExplainID

func (p *Execute) ExplainID() string

func (*Execute) ID

func (p *Execute) ID() int

ID implements Plan ID interface.

func (*Execute) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (*Execute) Parents

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

Parents implements Plan Parents 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) ResolveIndices

func (p *Execute) ResolveIndices()

ResolveIndices implements Plan interface.

func (*Execute) Schema

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

Schema implements Plan Schema interface.

func (*Execute) SetChildren

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

SetChildren implements Plan SetChildren interface.

func (*Execute) SetParents

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

SetParents implements Plan SetParents 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) AddChild

func (p Exists) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (Exists) AddParent

func (p Exists) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (Exists) Allocator

func (p Exists) Allocator() *idAllocator

func (Exists) Children

func (p Exists) Children() []Plan

Children implements Plan Children interface.

func (*Exists) Copy

func (p *Exists) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (Exists) ExplainID

func (p Exists) ExplainID() string

func (*Exists) ExplainInfo

func (bp *Exists) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (Exists) ID

func (p Exists) ID() int

ID implements Plan ID interface.

func (Exists) MarshalJSON

func (p Exists) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (Exists) Parents

func (p Exists) Parents() []Plan

Parents implements Plan Parents interface.

func (*Exists) PredicatePushDown

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

PredicatePushDown implements LogicalPlan interface.

func (*Exists) PruneColumns

func (p *Exists) PruneColumns(parentUsedCols []*expression.Column)

PruneColumns implements LogicalPlan interface.

func (Exists) ReplaceChild

func (p Exists) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (Exists) ReplaceParent

func (p Exists) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (Exists) ResolveIndices

func (p Exists) ResolveIndices()

ResolveIndices implements Plan interface.

func (Exists) Schema

func (p Exists) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (Exists) SetChildren

func (p Exists) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (Exists) SetParents

func (p Exists) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (Exists) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*Exists) ToPB

func (p *Exists) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type Explain

type Explain struct {
	StmtPlan Plan
	Rows     [][]types.Datum
	// 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) Allocator

func (p *Explain) Allocator() *idAllocator

func (*Explain) Children

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

Children implements Plan Children interface.

func (*Explain) ExplainID

func (p *Explain) ExplainID() string

func (*Explain) ID

func (p *Explain) ID() int

ID implements Plan ID interface.

func (*Explain) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (*Explain) Parents

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

Parents implements Plan Parents 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) ResolveIndices

func (p *Explain) ResolveIndices()

ResolveIndices implements Plan interface.

func (*Explain) Schema

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

Schema implements Plan Schema interface.

func (*Explain) SetChildren

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

SetChildren implements Plan SetChildren interface.

func (*Explain) SetParents

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

SetParents implements Plan SetParents interface.

func (*Explain) SetSchema

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

SetSchema implements Plan SetSchema interface.

type Insert

type Insert struct {
	Table table.Table

	Columns     []*ast.ColumnName
	Lists       [][]expression.Expression
	Setlist     []*expression.Assignment
	OnDuplicate []*expression.Assignment

	IsReplace bool
	Priority  mysql.PriorityEnum
	IgnoreErr bool

	// NeedFillDefaultValue is true when expr in value list reference other column.
	NeedFillDefaultValue bool

	GenCols InsertGeneratedColumns
	// contains filtered or unexported fields
}

Insert represents an insert plan.

func (Insert) AddChild

func (p Insert) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (Insert) AddParent

func (p Insert) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (Insert) Allocator

func (p Insert) Allocator() *idAllocator

func (Insert) Children

func (p Insert) Children() []Plan

Children implements Plan Children interface.

func (*Insert) Copy

func (p *Insert) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (Insert) ExplainID

func (p Insert) ExplainID() string

func (*Insert) ExplainInfo

func (bp *Insert) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (Insert) ID

func (p Insert) ID() int

ID implements Plan ID interface.

func (Insert) MarshalJSON

func (p Insert) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (Insert) Parents

func (p Insert) Parents() []Plan

Parents implements Plan Parents interface.

func (*Insert) PredicatePushDown

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

PredicatePushDown implements LogicalPlan interface.

func (*Insert) PruneColumns

func (p *Insert) PruneColumns(_ []*expression.Column)

PruneColumns implements LogicalPlan interface.

func (Insert) ReplaceChild

func (p Insert) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (Insert) ReplaceParent

func (p Insert) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*Insert) ResolveIndices

func (p *Insert) ResolveIndices()

ResolveIndices implements Plan interface.

func (Insert) Schema

func (p Insert) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (Insert) SetChildren

func (p Insert) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (Insert) SetParents

func (p Insert) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (Insert) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*Insert) ToPB

func (p *Insert) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type InsertGeneratedColumns

type InsertGeneratedColumns struct {
	Columns      []*ast.ColumnName
	Exprs        []expression.Expression
	OnDuplicates []*expression.Assignment
}

InsertGeneratedColumns is for completing generated columns in Insert. We resolve generation expressions in plan, and eval those in executor.

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
	// AntiSemiJoin means if row a in table A does not match any row in B, then output a.
	AntiSemiJoin
	// LeftOuterSemiJoin means if row a in table A matches some rows in B, output (a, true), otherwise, output (a, false).
	LeftOuterSemiJoin
	// AntiLeftOuterSemiJoin means if row a in table A matches some rows in B, output (a, false), otherwise, output (a, true).
	AntiLeftOuterSemiJoin
)

func (JoinType) String

func (tp JoinType) String() string

type Limit

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

Limit represents offset and limit plan.

func (Limit) AddChild

func (p Limit) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (Limit) AddParent

func (p Limit) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (Limit) Allocator

func (p Limit) Allocator() *idAllocator

func (Limit) Children

func (p Limit) Children() []Plan

Children implements Plan Children interface.

func (*Limit) Copy

func (p *Limit) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (Limit) ExplainID

func (p Limit) ExplainID() string

func (*Limit) ExplainInfo

func (p *Limit) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (Limit) ID

func (p Limit) ID() int

ID implements Plan ID interface.

func (*Limit) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (Limit) Parents

func (p Limit) Parents() []Plan

Parents implements Plan Parents interface.

func (*Limit) PredicatePushDown

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*Limit) PruneColumns

func (p *Limit) PruneColumns(parentUsedCols []*expression.Column)

PruneColumns implements LogicalPlan interface.

func (Limit) ReplaceChild

func (p Limit) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (Limit) ReplaceParent

func (p Limit) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (Limit) ResolveIndices

func (p Limit) ResolveIndices()

ResolveIndices implements Plan interface.

func (Limit) Schema

func (p Limit) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (Limit) SetChildren

func (p Limit) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (Limit) SetParents

func (p Limit) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (Limit) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*Limit) ToPB

func (p *Limit) ToPB(ctx context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type LoadData

type LoadData struct {
	IsLocal    bool
	Path       string
	Table      *ast.TableName
	Columns    []*ast.ColumnName
	FieldsInfo *ast.FieldsClause
	LinesInfo  *ast.LinesClause

	GenCols InsertGeneratedColumns
	// 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) Allocator

func (p *LoadData) Allocator() *idAllocator

func (*LoadData) Children

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

Children implements Plan Children interface.

func (*LoadData) ExplainID

func (p *LoadData) ExplainID() string

func (*LoadData) ID

func (p *LoadData) ID() int

ID implements Plan ID interface.

func (*LoadData) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (*LoadData) Parents

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

Parents implements Plan Parents 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) ResolveIndices

func (p *LoadData) ResolveIndices()

ResolveIndices implements Plan interface.

func (*LoadData) Schema

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

Schema implements Plan Schema interface.

func (*LoadData) SetChildren

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

SetChildren implements Plan SetChildren interface.

func (*LoadData) SetParents

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

SetParents implements Plan SetParents interface.

func (*LoadData) SetSchema

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

SetSchema implements Plan SetSchema interface.

type LogicalAggregation

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

LogicalAggregation represents an aggregate plan.

func (LogicalAggregation) AddChild

func (p LogicalAggregation) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (LogicalAggregation) AddParent

func (p LogicalAggregation) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (LogicalAggregation) Allocator

func (p LogicalAggregation) Allocator() *idAllocator

func (LogicalAggregation) Children

func (p LogicalAggregation) Children() []Plan

Children implements Plan Children interface.

func (LogicalAggregation) ExplainID

func (p LogicalAggregation) ExplainID() string

func (LogicalAggregation) ID

func (p LogicalAggregation) ID() int

ID implements Plan ID interface.

func (LogicalAggregation) MarshalJSON

func (p LogicalAggregation) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (LogicalAggregation) Parents

func (p LogicalAggregation) Parents() []Plan

Parents implements Plan Parents interface.

func (*LogicalAggregation) PredicatePushDown

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalAggregation) PruneColumns

func (p *LogicalAggregation) PruneColumns(parentUsedCols []*expression.Column)

PruneColumns implements LogicalPlan interface.

func (LogicalAggregation) ReplaceChild

func (p LogicalAggregation) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (LogicalAggregation) ReplaceParent

func (p LogicalAggregation) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*LogicalAggregation) ResolveIndices

func (p *LogicalAggregation) ResolveIndices()

ResolveIndices implements Plan interface.

func (LogicalAggregation) Schema

func (p LogicalAggregation) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (LogicalAggregation) SetChildren

func (p LogicalAggregation) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (LogicalAggregation) SetParents

func (p LogicalAggregation) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (LogicalAggregation) SetSchema

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

SetSchema implements Plan SetSchema interface.

type LogicalApply

type LogicalApply struct {
	LogicalJoin
	// contains filtered or unexported fields
}

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

func (LogicalApply) AddChild

func (p LogicalApply) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (LogicalApply) AddParent

func (p LogicalApply) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (LogicalApply) Allocator

func (p LogicalApply) Allocator() *idAllocator

func (LogicalApply) Children

func (p LogicalApply) Children() []Plan

Children implements Plan Children interface.

func (LogicalApply) ExplainID

func (p LogicalApply) ExplainID() string

func (LogicalApply) ID

func (p LogicalApply) ID() int

ID implements Plan ID interface.

func (LogicalApply) MarshalJSON

func (p LogicalApply) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (LogicalApply) Parents

func (p LogicalApply) Parents() []Plan

Parents implements Plan Parents interface.

func (*LogicalApply) PruneColumns

func (p *LogicalApply) PruneColumns(parentUsedCols []*expression.Column)

PruneColumns implements LogicalPlan interface.

func (LogicalApply) ReplaceChild

func (p LogicalApply) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (LogicalApply) ReplaceParent

func (p LogicalApply) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*LogicalApply) ResolveIndices

func (p *LogicalApply) ResolveIndices()

ResolveIndices implements Plan interface.

func (LogicalApply) Schema

func (p LogicalApply) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (LogicalApply) SetChildren

func (p LogicalApply) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (LogicalApply) SetParents

func (p LogicalApply) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (LogicalApply) SetSchema

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

SetSchema implements Plan SetSchema interface.

type LogicalJoin

type LogicalJoin struct {
	JoinType JoinType

	EqualConditions []*expression.ScalarFunction
	LeftConditions  expression.CNFExprs
	RightConditions expression.CNFExprs
	OtherConditions expression.CNFExprs

	LeftJoinKeys  []*expression.Column
	RightJoinKeys []*expression.Column

	// DefaultValues is only used for outer join, which stands for the default values when the outer table cannot find join partner
	// instead of null padding.
	DefaultValues []types.Datum
	// contains filtered or unexported fields
}

LogicalJoin is the logical join plan.

func (LogicalJoin) AddChild

func (p LogicalJoin) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (LogicalJoin) AddParent

func (p LogicalJoin) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (LogicalJoin) Allocator

func (p LogicalJoin) Allocator() *idAllocator

func (LogicalJoin) Children

func (p LogicalJoin) Children() []Plan

Children implements Plan Children interface.

func (LogicalJoin) ExplainID

func (p LogicalJoin) ExplainID() string

func (LogicalJoin) ID

func (p LogicalJoin) ID() int

ID implements Plan ID interface.

func (LogicalJoin) MarshalJSON

func (p LogicalJoin) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (LogicalJoin) Parents

func (p LogicalJoin) Parents() []Plan

Parents implements Plan Parents interface.

func (*LogicalJoin) PredicatePushDown

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalJoin) PruneColumns

func (p *LogicalJoin) PruneColumns(parentUsedCols []*expression.Column)

PruneColumns implements LogicalPlan interface.

func (LogicalJoin) ReplaceChild

func (p LogicalJoin) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (LogicalJoin) ReplaceParent

func (p LogicalJoin) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*LogicalJoin) ResolveIndices

func (p *LogicalJoin) ResolveIndices()

ResolveIndices implements Plan interface.

func (LogicalJoin) Schema

func (p LogicalJoin) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (LogicalJoin) SetChildren

func (p LogicalJoin) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (LogicalJoin) SetParents

func (p LogicalJoin) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (LogicalJoin) SetSchema

func (p LogicalJoin) 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)

	// PruneColumns prunes the unused columns.
	PruneColumns([]*expression.Column)
	// 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.

type MaxOneRow

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

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

func (MaxOneRow) AddChild

func (p MaxOneRow) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (MaxOneRow) AddParent

func (p MaxOneRow) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (MaxOneRow) Allocator

func (p MaxOneRow) Allocator() *idAllocator

func (MaxOneRow) Children

func (p MaxOneRow) Children() []Plan

Children implements Plan Children interface.

func (*MaxOneRow) Copy

func (p *MaxOneRow) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (MaxOneRow) ExplainID

func (p MaxOneRow) ExplainID() string

func (*MaxOneRow) ExplainInfo

func (bp *MaxOneRow) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (MaxOneRow) ID

func (p MaxOneRow) ID() int

ID implements Plan ID interface.

func (MaxOneRow) MarshalJSON

func (p MaxOneRow) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (MaxOneRow) Parents

func (p MaxOneRow) Parents() []Plan

Parents implements Plan Parents interface.

func (*MaxOneRow) PredicatePushDown

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*MaxOneRow) PruneColumns

func (p *MaxOneRow) PruneColumns(parentUsedCols []*expression.Column)

PruneColumns implements LogicalPlan interface.

func (MaxOneRow) ReplaceChild

func (p MaxOneRow) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (MaxOneRow) ReplaceParent

func (p MaxOneRow) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (MaxOneRow) ResolveIndices

func (p MaxOneRow) ResolveIndices()

ResolveIndices implements Plan interface.

func (MaxOneRow) Schema

func (p MaxOneRow) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (MaxOneRow) SetChildren

func (p MaxOneRow) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (MaxOneRow) SetParents

func (p MaxOneRow) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (MaxOneRow) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*MaxOneRow) ToPB

func (p *MaxOneRow) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PSTMTPlanCacheValue

type PSTMTPlanCacheValue struct {
	Plan Plan
}

PSTMTPlanCacheValue stores the cached Statement and StmtNode.

func NewPSTMTPlanCacheValue

func NewPSTMTPlanCacheValue(plan Plan) *PSTMTPlanCacheValue

NewPSTMTPlanCacheValue creates a SQLCacheValue.

type PhysicalAggregation

type PhysicalAggregation struct {
	HasGby       bool
	AggType      AggregationType
	AggFuncs     []aggregation.Aggregation
	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) Allocator

func (p PhysicalAggregation) Allocator() *idAllocator

func (PhysicalAggregation) Children

func (p PhysicalAggregation) Children() []Plan

Children implements Plan Children interface.

func (*PhysicalAggregation) Copy

Copy implements the PhysicalPlan Copy interface.

func (PhysicalAggregation) ExplainID

func (p PhysicalAggregation) ExplainID() string

func (*PhysicalAggregation) ExplainInfo

func (p *PhysicalAggregation) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalAggregation) ID

func (p PhysicalAggregation) ID() int

ID implements Plan ID interface.

func (*PhysicalAggregation) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (PhysicalAggregation) Parents

func (p PhysicalAggregation) Parents() []Plan

Parents implements Plan Parents 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) ResolveIndices

func (p *PhysicalAggregation) ResolveIndices()

ResolveIndices implements Plan interface.

func (PhysicalAggregation) Schema

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

Schema implements Plan Schema interface.

func (PhysicalAggregation) SetChildren

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

SetChildren implements Plan SetChildren interface.

func (PhysicalAggregation) SetParents

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

SetParents implements Plan SetParents interface.

func (PhysicalAggregation) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*PhysicalAggregation) ToPB

func (p *PhysicalAggregation) ToPB(ctx context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalApply

type PhysicalApply struct {
	PhysicalJoin PhysicalPlan
	OuterSchema  []*expression.CorrelatedColumn
	// 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) Allocator

func (p PhysicalApply) Allocator() *idAllocator

func (PhysicalApply) Children

func (p PhysicalApply) Children() []Plan

Children implements Plan Children interface.

func (*PhysicalApply) Copy

func (p *PhysicalApply) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (PhysicalApply) ExplainID

func (p PhysicalApply) ExplainID() string

func (*PhysicalApply) ExplainInfo

func (p *PhysicalApply) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalApply) ID

func (p PhysicalApply) ID() int

ID implements Plan ID interface.

func (*PhysicalApply) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (PhysicalApply) Parents

func (p PhysicalApply) Parents() []Plan

Parents implements Plan Parents 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) ResolveIndices

func (p *PhysicalApply) ResolveIndices()

ResolveIndices implements Plan interface.

func (PhysicalApply) Schema

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

Schema implements Plan Schema interface.

func (PhysicalApply) SetChildren

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

SetChildren implements Plan SetChildren interface.

func (PhysicalApply) SetParents

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

SetParents implements Plan SetParents interface.

func (PhysicalApply) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*PhysicalApply) ToPB

func (p *PhysicalApply) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalHashJoin

type PhysicalHashJoin struct {
	JoinType JoinType

	EqualConditions []*expression.ScalarFunction
	LeftConditions  []expression.Expression
	RightConditions []expression.Expression
	OtherConditions []expression.Expression
	SmallTable      int
	Concurrency     int

	DefaultValues []types.Datum
	// 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) Allocator

func (p PhysicalHashJoin) Allocator() *idAllocator

func (PhysicalHashJoin) Children

func (p PhysicalHashJoin) Children() []Plan

Children implements Plan Children interface.

func (*PhysicalHashJoin) Copy

func (p *PhysicalHashJoin) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (PhysicalHashJoin) ExplainID

func (p PhysicalHashJoin) ExplainID() string

func (*PhysicalHashJoin) ExplainInfo

func (p *PhysicalHashJoin) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalHashJoin) ID

func (p PhysicalHashJoin) ID() int

ID implements Plan ID interface.

func (*PhysicalHashJoin) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (PhysicalHashJoin) Parents

func (p PhysicalHashJoin) Parents() []Plan

Parents implements Plan Parents 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) ResolveIndices

func (p *PhysicalHashJoin) ResolveIndices()

ResolveIndices implements Plan interface.

func (PhysicalHashJoin) Schema

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

Schema implements Plan Schema interface.

func (PhysicalHashJoin) SetChildren

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

SetChildren implements Plan SetChildren interface.

func (PhysicalHashJoin) SetParents

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

SetParents implements Plan SetParents interface.

func (PhysicalHashJoin) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*PhysicalHashJoin) ToPB

func (p *PhysicalHashJoin) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB 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) Allocator

func (p PhysicalHashSemiJoin) Allocator() *idAllocator

func (PhysicalHashSemiJoin) Children

func (p PhysicalHashSemiJoin) Children() []Plan

Children implements Plan Children interface.

func (*PhysicalHashSemiJoin) Copy

Copy implements the PhysicalPlan Copy interface.

func (PhysicalHashSemiJoin) ExplainID

func (p PhysicalHashSemiJoin) ExplainID() string

func (*PhysicalHashSemiJoin) ExplainInfo

func (p *PhysicalHashSemiJoin) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalHashSemiJoin) ID

func (p PhysicalHashSemiJoin) ID() int

ID implements Plan ID interface.

func (*PhysicalHashSemiJoin) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (PhysicalHashSemiJoin) Parents

func (p PhysicalHashSemiJoin) Parents() []Plan

Parents implements Plan Parents 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) ResolveIndices

func (p *PhysicalHashSemiJoin) ResolveIndices()

ResolveIndices implements Plan interface.

func (PhysicalHashSemiJoin) Schema

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

Schema implements Plan Schema interface.

func (PhysicalHashSemiJoin) SetChildren

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

SetChildren implements Plan SetChildren interface.

func (PhysicalHashSemiJoin) SetParents

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

SetParents implements Plan SetParents interface.

func (PhysicalHashSemiJoin) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*PhysicalHashSemiJoin) ToPB

func (p *PhysicalHashSemiJoin) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalIndexJoin

type PhysicalIndexJoin struct {
	Outer           bool
	OuterJoinKeys   []*expression.Column
	InnerJoinKeys   []*expression.Column
	LeftConditions  expression.CNFExprs
	RightConditions expression.CNFExprs
	OtherConditions expression.CNFExprs

	KeepOrder bool

	DefaultValues []types.Datum
	// contains filtered or unexported fields
}

PhysicalIndexJoin represents the plan of index look up join.

func (PhysicalIndexJoin) AddChild

func (p PhysicalIndexJoin) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (PhysicalIndexJoin) AddParent

func (p PhysicalIndexJoin) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (PhysicalIndexJoin) Allocator

func (p PhysicalIndexJoin) Allocator() *idAllocator

func (PhysicalIndexJoin) Children

func (p PhysicalIndexJoin) Children() []Plan

Children implements Plan Children interface.

func (*PhysicalIndexJoin) Copy

func (p *PhysicalIndexJoin) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (PhysicalIndexJoin) ExplainID

func (p PhysicalIndexJoin) ExplainID() string

func (*PhysicalIndexJoin) ExplainInfo

func (p *PhysicalIndexJoin) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalIndexJoin) ID

func (p PhysicalIndexJoin) ID() int

ID implements Plan ID interface.

func (PhysicalIndexJoin) MarshalJSON

func (p PhysicalIndexJoin) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (PhysicalIndexJoin) Parents

func (p PhysicalIndexJoin) Parents() []Plan

Parents implements Plan Parents interface.

func (PhysicalIndexJoin) ReplaceChild

func (p PhysicalIndexJoin) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (PhysicalIndexJoin) ReplaceParent

func (p PhysicalIndexJoin) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*PhysicalIndexJoin) ResolveIndices

func (p *PhysicalIndexJoin) ResolveIndices()

ResolveIndices implements Plan interface.

func (PhysicalIndexJoin) Schema

func (p PhysicalIndexJoin) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (PhysicalIndexJoin) SetChildren

func (p PhysicalIndexJoin) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (PhysicalIndexJoin) SetParents

func (p PhysicalIndexJoin) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (PhysicalIndexJoin) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*PhysicalIndexJoin) ToPB

func (p *PhysicalIndexJoin) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalIndexLookUpReader

type PhysicalIndexLookUpReader struct {

	// IndexPlans flats the indexPlan to construct executor pb.
	IndexPlans []PhysicalPlan
	// TablePlans flats the tablePlan to construct executor pb.
	TablePlans []PhysicalPlan

	// NeedColHandle is used in execution phase.
	NeedColHandle bool
	// contains filtered or unexported fields
}

PhysicalIndexLookUpReader is the index look up reader in tidb. It's used in case of double reading.

func (PhysicalIndexLookUpReader) AddChild

func (p PhysicalIndexLookUpReader) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (PhysicalIndexLookUpReader) AddParent

func (p PhysicalIndexLookUpReader) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (PhysicalIndexLookUpReader) Allocator

func (p PhysicalIndexLookUpReader) Allocator() *idAllocator

func (PhysicalIndexLookUpReader) Children

func (p PhysicalIndexLookUpReader) Children() []Plan

Children implements Plan Children interface.

func (*PhysicalIndexLookUpReader) Copy

Copy implements the PhysicalPlan Copy interface.

func (PhysicalIndexLookUpReader) ExplainID

func (p PhysicalIndexLookUpReader) ExplainID() string

func (*PhysicalIndexLookUpReader) ExplainInfo

func (p *PhysicalIndexLookUpReader) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalIndexLookUpReader) ID

func (p PhysicalIndexLookUpReader) ID() int

ID implements Plan ID interface.

func (PhysicalIndexLookUpReader) MarshalJSON

func (p PhysicalIndexLookUpReader) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (PhysicalIndexLookUpReader) Parents

func (p PhysicalIndexLookUpReader) Parents() []Plan

Parents implements Plan Parents interface.

func (PhysicalIndexLookUpReader) ReplaceChild

func (p PhysicalIndexLookUpReader) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (PhysicalIndexLookUpReader) ReplaceParent

func (p PhysicalIndexLookUpReader) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*PhysicalIndexLookUpReader) ResolveIndices

func (p *PhysicalIndexLookUpReader) ResolveIndices()

ResolveIndices implements Plan interface.

func (PhysicalIndexLookUpReader) Schema

func (p PhysicalIndexLookUpReader) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (PhysicalIndexLookUpReader) SetChildren

func (p PhysicalIndexLookUpReader) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (PhysicalIndexLookUpReader) SetParents

func (p PhysicalIndexLookUpReader) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (PhysicalIndexLookUpReader) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*PhysicalIndexLookUpReader) ToPB

func (p *PhysicalIndexLookUpReader) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalIndexReader

type PhysicalIndexReader struct {

	// IndexPlans flats the indexPlan to construct executor pb.
	IndexPlans []PhysicalPlan

	// OutputColumns represents the columns that index reader should return.
	OutputColumns []*expression.Column

	// NeedColHandle is used in execution phase.
	NeedColHandle bool
	// contains filtered or unexported fields
}

PhysicalIndexReader is the index reader in tidb.

func (PhysicalIndexReader) AddChild

func (p PhysicalIndexReader) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (PhysicalIndexReader) AddParent

func (p PhysicalIndexReader) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (PhysicalIndexReader) Allocator

func (p PhysicalIndexReader) Allocator() *idAllocator

func (PhysicalIndexReader) Children

func (p PhysicalIndexReader) Children() []Plan

Children implements Plan Children interface.

func (*PhysicalIndexReader) Copy

Copy implements the PhysicalPlan Copy interface.

func (PhysicalIndexReader) ExplainID

func (p PhysicalIndexReader) ExplainID() string

func (*PhysicalIndexReader) ExplainInfo

func (p *PhysicalIndexReader) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalIndexReader) ID

func (p PhysicalIndexReader) ID() int

ID implements Plan ID interface.

func (PhysicalIndexReader) MarshalJSON

func (p PhysicalIndexReader) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (PhysicalIndexReader) Parents

func (p PhysicalIndexReader) Parents() []Plan

Parents implements Plan Parents interface.

func (PhysicalIndexReader) ReplaceChild

func (p PhysicalIndexReader) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (PhysicalIndexReader) ReplaceParent

func (p PhysicalIndexReader) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*PhysicalIndexReader) ResolveIndices

func (p *PhysicalIndexReader) ResolveIndices()

ResolveIndices implements Plan interface.

func (PhysicalIndexReader) Schema

func (p PhysicalIndexReader) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (PhysicalIndexReader) SetChildren

func (p PhysicalIndexReader) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (PhysicalIndexReader) SetParents

func (p PhysicalIndexReader) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (PhysicalIndexReader) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*PhysicalIndexReader) ToPB

func (p *PhysicalIndexReader) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalIndexScan

type PhysicalIndexScan struct {
	Table      *model.TableInfo
	Index      *model.IndexInfo
	Ranges     []*types.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

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

PhysicalIndexScan represents an index scan plan.

func (*PhysicalIndexScan) Copy

func (p *PhysicalIndexScan) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*PhysicalIndexScan) ExplainInfo

func (p *PhysicalIndexScan) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (*PhysicalIndexScan) IsPointGetByUniqueKey

func (p *PhysicalIndexScan) IsPointGetByUniqueKey(sc *variable.StatementContext) bool

IsPointGetByUniqueKey checks whether is a point get by unique key.

func (*PhysicalIndexScan) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (*PhysicalIndexScan) SourceSchema

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

SourceSchema returns the original schema of DataSource

func (*PhysicalIndexScan) ToPB

func (p *PhysicalIndexScan) ToPB(ctx context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalMemTable

type PhysicalMemTable struct {
	DBName      model.CIStr
	Table       *model.TableInfo
	Columns     []*model.ColumnInfo
	Ranges      []types.IntColumnRange
	TableAsName *model.CIStr

	// NeedColHandle is used in execution phase.
	NeedColHandle bool
	// contains filtered or unexported fields
}

PhysicalMemTable reads memory table.

func (PhysicalMemTable) AddChild

func (p PhysicalMemTable) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (PhysicalMemTable) AddParent

func (p PhysicalMemTable) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (PhysicalMemTable) Allocator

func (p PhysicalMemTable) Allocator() *idAllocator

func (PhysicalMemTable) Children

func (p PhysicalMemTable) Children() []Plan

Children implements Plan Children interface.

func (*PhysicalMemTable) Copy

func (p *PhysicalMemTable) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (PhysicalMemTable) ExplainID

func (p PhysicalMemTable) ExplainID() string

func (*PhysicalMemTable) ExplainInfo

func (bp *PhysicalMemTable) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalMemTable) ID

func (p PhysicalMemTable) ID() int

ID implements Plan ID interface.

func (*PhysicalMemTable) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (PhysicalMemTable) Parents

func (p PhysicalMemTable) Parents() []Plan

Parents implements Plan Parents interface.

func (PhysicalMemTable) ReplaceChild

func (p PhysicalMemTable) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (PhysicalMemTable) ReplaceParent

func (p PhysicalMemTable) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (PhysicalMemTable) ResolveIndices

func (p PhysicalMemTable) ResolveIndices()

ResolveIndices implements Plan interface.

func (PhysicalMemTable) Schema

func (p PhysicalMemTable) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (PhysicalMemTable) SetChildren

func (p PhysicalMemTable) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (PhysicalMemTable) SetParents

func (p PhysicalMemTable) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (PhysicalMemTable) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*PhysicalMemTable) ToPB

func (p *PhysicalMemTable) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalMergeJoin

type PhysicalMergeJoin struct {
	JoinType JoinType

	EqualConditions []*expression.ScalarFunction
	LeftConditions  []expression.Expression
	RightConditions []expression.Expression
	OtherConditions []expression.Expression

	DefaultValues []types.Datum
	Desc          bool
	// contains filtered or unexported fields
}

PhysicalMergeJoin represents merge join for inner/ outer join.

func (PhysicalMergeJoin) AddChild

func (p PhysicalMergeJoin) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (PhysicalMergeJoin) AddParent

func (p PhysicalMergeJoin) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (PhysicalMergeJoin) Allocator

func (p PhysicalMergeJoin) Allocator() *idAllocator

func (PhysicalMergeJoin) Children

func (p PhysicalMergeJoin) Children() []Plan

Children implements Plan Children interface.

func (*PhysicalMergeJoin) Copy

func (p *PhysicalMergeJoin) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (PhysicalMergeJoin) ExplainID

func (p PhysicalMergeJoin) ExplainID() string

func (*PhysicalMergeJoin) ExplainInfo

func (p *PhysicalMergeJoin) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalMergeJoin) ID

func (p PhysicalMergeJoin) ID() int

ID implements Plan ID interface.

func (*PhysicalMergeJoin) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (PhysicalMergeJoin) Parents

func (p PhysicalMergeJoin) Parents() []Plan

Parents implements Plan Parents interface.

func (PhysicalMergeJoin) ReplaceChild

func (p PhysicalMergeJoin) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (PhysicalMergeJoin) ReplaceParent

func (p PhysicalMergeJoin) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*PhysicalMergeJoin) ResolveIndices

func (p *PhysicalMergeJoin) ResolveIndices()

ResolveIndices implements Plan interface.

func (PhysicalMergeJoin) Schema

func (p PhysicalMergeJoin) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (PhysicalMergeJoin) SetChildren

func (p PhysicalMergeJoin) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (PhysicalMergeJoin) SetParents

func (p PhysicalMergeJoin) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (PhysicalMergeJoin) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*PhysicalMergeJoin) ToPB

func (p *PhysicalMergeJoin) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalPlan

type PhysicalPlan interface {
	json.Marshaler
	Plan

	// Copy copies the current plan.
	Copy() PhysicalPlan

	// ToPB converts physical plan to tipb executor.
	ToPB(ctx context.Context) (*tipb.Executor, error)

	// ExplainInfo returns operator information to be explained.
	ExplainInfo() string
	// contains filtered or unexported methods
}

PhysicalPlan is a tree of the physical operators.

type PhysicalTableReader

type PhysicalTableReader struct {

	// TablePlans flats the tablePlan to construct executor pb.
	TablePlans []PhysicalPlan

	// NeedColHandle is used in execution phase.
	NeedColHandle bool
	// contains filtered or unexported fields
}

PhysicalTableReader is the table reader in tidb.

func (PhysicalTableReader) AddChild

func (p PhysicalTableReader) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (PhysicalTableReader) AddParent

func (p PhysicalTableReader) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (PhysicalTableReader) Allocator

func (p PhysicalTableReader) Allocator() *idAllocator

func (PhysicalTableReader) Children

func (p PhysicalTableReader) Children() []Plan

Children implements Plan Children interface.

func (*PhysicalTableReader) Copy

Copy implements the PhysicalPlan Copy interface.

func (PhysicalTableReader) ExplainID

func (p PhysicalTableReader) ExplainID() string

func (*PhysicalTableReader) ExplainInfo

func (p *PhysicalTableReader) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalTableReader) ID

func (p PhysicalTableReader) ID() int

ID implements Plan ID interface.

func (PhysicalTableReader) MarshalJSON

func (p PhysicalTableReader) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (PhysicalTableReader) Parents

func (p PhysicalTableReader) Parents() []Plan

Parents implements Plan Parents interface.

func (PhysicalTableReader) ReplaceChild

func (p PhysicalTableReader) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (PhysicalTableReader) ReplaceParent

func (p PhysicalTableReader) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*PhysicalTableReader) ResolveIndices

func (p *PhysicalTableReader) ResolveIndices()

ResolveIndices implements Plan interface.

func (PhysicalTableReader) Schema

func (p PhysicalTableReader) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (PhysicalTableReader) SetChildren

func (p PhysicalTableReader) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (PhysicalTableReader) SetParents

func (p PhysicalTableReader) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (PhysicalTableReader) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*PhysicalTableReader) ToPB

func (p *PhysicalTableReader) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalTableScan

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

	TableAsName *model.CIStr

	// KeepOrder is true, if sort data by scanning pkcol,
	KeepOrder bool
	// contains filtered or unexported fields
}

PhysicalTableScan represents a table scan plan.

func (*PhysicalTableScan) Copy

func (p *PhysicalTableScan) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (*PhysicalTableScan) ExplainInfo

func (p *PhysicalTableScan) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (*PhysicalTableScan) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (*PhysicalTableScan) ToPB

func (p *PhysicalTableScan) ToPB(ctx context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalUnionScan

type PhysicalUnionScan struct {
	NeedColHandle bool
	Conditions    []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) Allocator

func (p PhysicalUnionScan) Allocator() *idAllocator

func (PhysicalUnionScan) Children

func (p PhysicalUnionScan) Children() []Plan

Children implements Plan Children interface.

func (*PhysicalUnionScan) Copy

func (p *PhysicalUnionScan) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (PhysicalUnionScan) ExplainID

func (p PhysicalUnionScan) ExplainID() string

func (*PhysicalUnionScan) ExplainInfo

func (p *PhysicalUnionScan) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalUnionScan) ID

func (p PhysicalUnionScan) ID() int

ID implements Plan ID interface.

func (PhysicalUnionScan) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (PhysicalUnionScan) Parents

func (p PhysicalUnionScan) Parents() []Plan

Parents implements Plan Parents 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) ResolveIndices

func (p *PhysicalUnionScan) ResolveIndices()

ResolveIndices implements Plan interface.

func (PhysicalUnionScan) Schema

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

Schema implements Plan Schema interface.

func (PhysicalUnionScan) SetChildren

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

SetChildren implements Plan SetChildren interface.

func (PhysicalUnionScan) SetParents

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

SetParents implements Plan SetParents interface.

func (PhysicalUnionScan) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*PhysicalUnionScan) ToPB

func (p *PhysicalUnionScan) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type Plan

type Plan interface {
	// 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
	// Get all the parents.
	Parents() []Plan
	// Get all the children.
	Children() []Plan
	// Set the schema.
	SetSchema(schema *expression.Schema)
	// Get the schema.
	Schema() *expression.Schema
	// Get the ID.
	ID() int
	// Get the ID in explain statement
	ExplainID() string
	// Get id allocator
	Allocator() *idAllocator
	// SetParents sets the parents for the plan.
	SetParents(...Plan)
	// SetChildren sets the children for the plan.
	SetChildren(...Plan)

	// ResolveIndices resolves the indices for columns. After doing this, the columns can evaluate the rows by their indices.
	ResolveIndices()
	// contains filtered or unexported methods
}

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 BuildLogicalPlan

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

BuildLogicalPlan is exported and only used for test.

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) Allocator

func (p *Prepare) Allocator() *idAllocator

func (*Prepare) Children

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

Children implements Plan Children interface.

func (*Prepare) ExplainID

func (p *Prepare) ExplainID() string

func (*Prepare) ID

func (p *Prepare) ID() int

ID implements Plan ID interface.

func (*Prepare) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (*Prepare) Parents

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

Parents implements Plan Parents 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) ResolveIndices

func (p *Prepare) ResolveIndices()

ResolveIndices implements Plan interface.

func (*Prepare) Schema

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

Schema implements Plan Schema interface.

func (*Prepare) SetChildren

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

SetChildren implements Plan SetChildren interface.

func (*Prepare) SetParents

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

SetParents implements Plan SetParents interface.

func (*Prepare) SetSchema

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

SetSchema implements Plan SetSchema interface.

type Prepared

type Prepared struct {
	Stmt          ast.StmtNode
	Params        []*ast.ParamMarkerExpr
	SchemaVersion int64
	UseCache      bool
}

Prepared represents a prepared statement.

type Projection

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

Projection represents a select fields plan.

func (Projection) AddChild

func (p Projection) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (Projection) AddParent

func (p Projection) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (Projection) Allocator

func (p Projection) Allocator() *idAllocator

func (Projection) Children

func (p Projection) Children() []Plan

Children implements Plan Children interface.

func (*Projection) Copy

func (p *Projection) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (Projection) ExplainID

func (p Projection) ExplainID() string

func (*Projection) ExplainInfo

func (p *Projection) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (Projection) ID

func (p Projection) ID() int

ID implements Plan ID interface.

func (*Projection) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (Projection) Parents

func (p Projection) Parents() []Plan

Parents implements Plan Parents 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) PruneColumns

func (p *Projection) PruneColumns(parentUsedCols []*expression.Column)

PruneColumns implements LogicalPlan interface. If any expression has SetVar functions, we do not prune it.

func (Projection) ReplaceChild

func (p Projection) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (Projection) ReplaceParent

func (p Projection) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*Projection) ResolveIndices

func (p *Projection) ResolveIndices()

ResolveIndices implements Plan interface.

func (Projection) Schema

func (p Projection) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (Projection) SetChildren

func (p Projection) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (Projection) SetParents

func (p Projection) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (Projection) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*Projection) ToPB

func (p *Projection) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type SQLCacheValue

type SQLCacheValue struct {
	StmtNode  ast.StmtNode
	Plan      Plan
	Expensive bool
}

SQLCacheValue stores the cached Statement and StmtNode.

func NewSQLCacheValue

func NewSQLCacheValue(ast ast.StmtNode, plan Plan, expensive bool) *SQLCacheValue

NewSQLCacheValue creates a SQLCacheValue.

type SelectLock

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

SelectLock represents a select lock plan.

func (SelectLock) AddChild

func (p SelectLock) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (SelectLock) AddParent

func (p SelectLock) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (SelectLock) Allocator

func (p SelectLock) Allocator() *idAllocator

func (SelectLock) Children

func (p SelectLock) Children() []Plan

Children implements Plan Children interface.

func (*SelectLock) Copy

func (p *SelectLock) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (SelectLock) ExplainID

func (p SelectLock) ExplainID() string

func (*SelectLock) ExplainInfo

func (p *SelectLock) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (SelectLock) ID

func (p SelectLock) ID() int

ID implements Plan ID interface.

func (SelectLock) MarshalJSON

func (p SelectLock) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (SelectLock) Parents

func (p SelectLock) Parents() []Plan

Parents implements Plan Parents interface.

func (*SelectLock) PredicatePushDown

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

PredicatePushDown implements LogicalPlan interface.

func (*SelectLock) PruneColumns

func (p *SelectLock) PruneColumns(parentUsedCols []*expression.Column)

PruneColumns implements LogicalPlan interface.

func (SelectLock) ReplaceChild

func (p SelectLock) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (SelectLock) ReplaceParent

func (p SelectLock) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (SelectLock) ResolveIndices

func (p SelectLock) ResolveIndices()

ResolveIndices implements Plan interface.

func (SelectLock) Schema

func (p SelectLock) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (SelectLock) SetChildren

func (p SelectLock) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (SelectLock) SetParents

func (p SelectLock) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (SelectLock) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*SelectLock) ToPB

func (p *SelectLock) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB 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

	// If ScanController is true, then the child of this selection is a scan,
	// which use pk or index. we will record the accessConditions, idxConditions,
	// and tblConditions to control the below plan.
	ScanController bool
	// contains filtered or unexported fields
}

Selection means a filter.

func (Selection) AddChild

func (p Selection) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (Selection) AddParent

func (p Selection) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (Selection) Allocator

func (p Selection) Allocator() *idAllocator

func (Selection) Children

func (p Selection) Children() []Plan

Children implements Plan Children interface.

func (*Selection) Copy

func (p *Selection) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (Selection) ExplainID

func (p Selection) ExplainID() string

func (*Selection) ExplainInfo

func (p *Selection) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (Selection) ID

func (p Selection) ID() int

ID implements Plan ID interface.

func (*Selection) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (Selection) Parents

func (p Selection) Parents() []Plan

Parents implements Plan Parents interface.

func (*Selection) PredicatePushDown

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*Selection) PruneColumns

func (p *Selection) PruneColumns(parentUsedCols []*expression.Column)

PruneColumns implements LogicalPlan interface.

func (Selection) ReplaceChild

func (p Selection) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (Selection) ReplaceParent

func (p Selection) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*Selection) ResolveIndices

func (p *Selection) ResolveIndices()

ResolveIndices implements Plan interface.

func (Selection) Schema

func (p Selection) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (Selection) SetChildren

func (p Selection) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (Selection) SetParents

func (p Selection) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (Selection) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*Selection) ToPB

func (p *Selection) ToPB(ctx context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type Set

type Set struct {
	VarAssigns []*expression.VarAssignment
	// contains filtered or unexported fields
}

Set represents a plan for set stmt.

func (*Set) AddChild

func (p *Set) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*Set) AddParent

func (p *Set) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*Set) Allocator

func (p *Set) Allocator() *idAllocator

func (*Set) Children

func (p *Set) Children() []Plan

Children implements Plan Children interface.

func (*Set) ExplainID

func (p *Set) ExplainID() string

func (*Set) ID

func (p *Set) ID() int

ID implements Plan ID interface.

func (*Set) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (*Set) Parents

func (p *Set) Parents() []Plan

Parents implements Plan Parents interface.

func (*Set) ReplaceChild

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

ReplaceChild means replace a child with another one.

func (*Set) ReplaceParent

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

ReplaceParent means replace a parent for another one.

func (*Set) ResolveIndices

func (p *Set) ResolveIndices()

ResolveIndices implements Plan interface.

func (*Set) Schema

func (p *Set) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (*Set) SetChildren

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

SetChildren implements Plan SetChildren interface.

func (*Set) SetParents

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

SetParents implements Plan SetParents interface.

func (*Set) SetSchema

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

SetSchema implements Plan SetSchema 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   *auth.UserIdentity // 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) Allocator

func (p Show) Allocator() *idAllocator

func (Show) Children

func (p Show) Children() []Plan

Children implements Plan Children interface.

func (*Show) Copy

func (p *Show) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (Show) ExplainID

func (p Show) ExplainID() string

func (*Show) ExplainInfo

func (bp *Show) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (Show) ID

func (p Show) ID() int

ID implements Plan ID interface.

func (Show) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (Show) Parents

func (p Show) Parents() []Plan

Parents implements Plan Parents interface.

func (*Show) PredicatePushDown

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

PredicatePushDown implements LogicalPlan interface.

func (*Show) PruneColumns

func (p *Show) PruneColumns(parentUsedCols []*expression.Column)

PruneColumns implements LogicalPlan 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) ResolveIndices

func (p Show) ResolveIndices()

ResolveIndices implements Plan interface.

func (Show) Schema

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

Schema implements Plan Schema interface.

func (Show) SetChildren

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

SetChildren implements Plan SetChildren interface.

func (Show) SetParents

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

SetParents implements Plan SetParents interface.

func (Show) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*Show) ToPB

func (p *Show) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB 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) Allocator

func (p *ShowDDL) Allocator() *idAllocator

func (*ShowDDL) Children

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

Children implements Plan Children interface.

func (*ShowDDL) ExplainID

func (p *ShowDDL) ExplainID() string

func (*ShowDDL) ID

func (p *ShowDDL) ID() int

ID implements Plan ID interface.

func (*ShowDDL) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (*ShowDDL) Parents

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

Parents implements Plan Parents 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) ResolveIndices

func (p *ShowDDL) ResolveIndices()

ResolveIndices implements Plan interface.

func (*ShowDDL) Schema

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

Schema implements Plan Schema interface.

func (*ShowDDL) SetChildren

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

SetChildren implements Plan SetChildren interface.

func (*ShowDDL) SetParents

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

SetParents implements Plan SetParents interface.

func (*ShowDDL) SetSchema

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

SetSchema implements Plan SetSchema interface.

type ShowDDLJobs

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

ShowDDLJobs is for showing DDL job list.

func (*ShowDDLJobs) AddChild

func (p *ShowDDLJobs) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (*ShowDDLJobs) AddParent

func (p *ShowDDLJobs) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (*ShowDDLJobs) Allocator

func (p *ShowDDLJobs) Allocator() *idAllocator

func (*ShowDDLJobs) Children

func (p *ShowDDLJobs) Children() []Plan

Children implements Plan Children interface.

func (*ShowDDLJobs) ExplainID

func (p *ShowDDLJobs) ExplainID() string

func (*ShowDDLJobs) ID

func (p *ShowDDLJobs) ID() int

ID implements Plan ID interface.

func (*ShowDDLJobs) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (*ShowDDLJobs) Parents

func (p *ShowDDLJobs) Parents() []Plan

Parents implements Plan Parents interface.

func (*ShowDDLJobs) ReplaceChild

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

ReplaceChild means replace a child with another one.

func (*ShowDDLJobs) ReplaceParent

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

ReplaceParent means replace a parent for another one.

func (*ShowDDLJobs) ResolveIndices

func (p *ShowDDLJobs) ResolveIndices()

ResolveIndices implements Plan interface.

func (*ShowDDLJobs) Schema

func (p *ShowDDLJobs) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (*ShowDDLJobs) SetChildren

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

SetChildren implements Plan SetChildren interface.

func (*ShowDDLJobs) SetParents

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

SetParents implements Plan SetParents interface.

func (*ShowDDLJobs) SetSchema

func (p *ShowDDLJobs) 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) Allocator

func (p *Simple) Allocator() *idAllocator

func (*Simple) Children

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

Children implements Plan Children interface.

func (*Simple) ExplainID

func (p *Simple) ExplainID() string

func (*Simple) ID

func (p *Simple) ID() int

ID implements Plan ID interface.

func (*Simple) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (*Simple) Parents

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

Parents implements Plan Parents 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) ResolveIndices

func (p *Simple) ResolveIndices()

ResolveIndices implements Plan interface.

func (*Simple) Schema

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

Schema implements Plan Schema interface.

func (*Simple) SetChildren

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

SetChildren implements Plan SetChildren interface.

func (*Simple) SetParents

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

SetParents implements Plan SetParents 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 // no longer be used by new plan
	// contains filtered or unexported fields
}

Sort stands for the order by plan.

func (Sort) AddChild

func (p Sort) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (Sort) AddParent

func (p Sort) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (Sort) Allocator

func (p Sort) Allocator() *idAllocator

func (Sort) Children

func (p Sort) Children() []Plan

Children implements Plan Children interface.

func (*Sort) Copy

func (p *Sort) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (Sort) ExplainID

func (p Sort) ExplainID() string

func (*Sort) ExplainInfo

func (p *Sort) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (Sort) ID

func (p Sort) ID() int

ID implements Plan ID interface.

func (*Sort) MarshalJSON

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

MarshalJSON implements json.Marshaler interface.

func (Sort) Parents

func (p Sort) Parents() []Plan

Parents implements Plan Parents interface.

func (*Sort) PredicatePushDown

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

PredicatePushDown implements LogicalPlan interface.

func (*Sort) PruneColumns

func (p *Sort) PruneColumns(parentUsedCols []*expression.Column)

PruneColumns implements LogicalPlan interface.

func (Sort) ReplaceChild

func (p Sort) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (Sort) ReplaceParent

func (p Sort) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*Sort) ResolveIndices

func (p *Sort) ResolveIndices()

ResolveIndices implements Plan interface.

func (Sort) Schema

func (p Sort) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (Sort) SetChildren

func (p Sort) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (Sort) SetParents

func (p Sort) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (Sort) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*Sort) ToPB

func (p *Sort) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type TableDual

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

TableDual represents a dual table plan.

func (TableDual) AddChild

func (p TableDual) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (TableDual) AddParent

func (p TableDual) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (TableDual) Allocator

func (p TableDual) Allocator() *idAllocator

func (TableDual) Children

func (p TableDual) Children() []Plan

Children implements Plan Children interface.

func (*TableDual) Copy

func (p *TableDual) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (TableDual) ExplainID

func (p TableDual) ExplainID() string

func (*TableDual) ExplainInfo

func (p *TableDual) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (TableDual) ID

func (p TableDual) ID() int

ID implements Plan ID interface.

func (TableDual) MarshalJSON

func (p TableDual) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (TableDual) Parents

func (p TableDual) Parents() []Plan

Parents implements Plan Parents interface.

func (*TableDual) PredicatePushDown

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*TableDual) PruneColumns

func (p *TableDual) PruneColumns(_ []*expression.Column)

PruneColumns implements LogicalPlan interface.

func (TableDual) ReplaceChild

func (p TableDual) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (TableDual) ReplaceParent

func (p TableDual) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (TableDual) ResolveIndices

func (p TableDual) ResolveIndices()

ResolveIndices implements Plan interface.

func (TableDual) Schema

func (p TableDual) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (TableDual) SetChildren

func (p TableDual) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (TableDual) SetParents

func (p TableDual) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (TableDual) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*TableDual) ToPB

func (p *TableDual) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type TopN

type TopN struct {
	ByItems []*ByItems
	Offset  uint64
	Count   uint64
	// contains filtered or unexported fields
}

TopN represents a top-n plan.

func (TopN) AddChild

func (p TopN) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (TopN) AddParent

func (p TopN) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (TopN) Allocator

func (p TopN) Allocator() *idAllocator

func (TopN) Children

func (p TopN) Children() []Plan

Children implements Plan Children interface.

func (*TopN) Copy

func (p *TopN) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (TopN) ExplainID

func (p TopN) ExplainID() string

func (*TopN) ExplainInfo

func (bp *TopN) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (TopN) ID

func (p TopN) ID() int

ID implements Plan ID interface.

func (TopN) MarshalJSON

func (p TopN) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (TopN) Parents

func (p TopN) Parents() []Plan

Parents implements Plan Parents interface.

func (*TopN) PredicatePushDown

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

PredicatePushDown implements LogicalPlan interface.

func (*TopN) PruneColumns

func (p *TopN) PruneColumns(parentUsedCols []*expression.Column)

PruneColumns implements LogicalPlan interface.

func (TopN) ReplaceChild

func (p TopN) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (TopN) ReplaceParent

func (p TopN) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*TopN) ResolveIndices

func (p *TopN) ResolveIndices()

ResolveIndices implements Plan interface.

func (TopN) Schema

func (p TopN) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (TopN) SetChildren

func (p TopN) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (TopN) SetParents

func (p TopN) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (TopN) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*TopN) ToPB

func (p *TopN) ToPB(ctx context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type Union

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

Union represents Union plan.

func (Union) AddChild

func (p Union) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (Union) AddParent

func (p Union) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (Union) Allocator

func (p Union) Allocator() *idAllocator

func (Union) Children

func (p Union) Children() []Plan

Children implements Plan Children interface.

func (*Union) Copy

func (p *Union) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (Union) ExplainID

func (p Union) ExplainID() string

func (*Union) ExplainInfo

func (bp *Union) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (Union) ID

func (p Union) ID() int

ID implements Plan ID interface.

func (Union) MarshalJSON

func (p Union) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (Union) Parents

func (p Union) Parents() []Plan

Parents implements Plan Parents 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) PruneColumns

func (p *Union) PruneColumns(parentUsedCols []*expression.Column)

PruneColumns implements LogicalPlan interface.

func (Union) ReplaceChild

func (p Union) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (Union) ReplaceParent

func (p Union) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (Union) ResolveIndices

func (p Union) ResolveIndices()

ResolveIndices implements Plan interface.

func (Union) Schema

func (p Union) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (Union) SetChildren

func (p Union) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (Union) SetParents

func (p Union) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (Union) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*Union) ToPB

func (p *Union) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type Update

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

Update represents Update plan.

func (Update) AddChild

func (p Update) AddChild(child Plan)

AddChild implements Plan AddChild interface.

func (Update) AddParent

func (p Update) AddParent(parent Plan)

AddParent implements Plan AddParent interface.

func (Update) Allocator

func (p Update) Allocator() *idAllocator

func (Update) Children

func (p Update) Children() []Plan

Children implements Plan Children interface.

func (*Update) Copy

func (p *Update) Copy() PhysicalPlan

Copy implements the PhysicalPlan Copy interface.

func (Update) ExplainID

func (p Update) ExplainID() string

func (*Update) ExplainInfo

func (bp *Update) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (Update) ID

func (p Update) ID() int

ID implements Plan ID interface.

func (Update) MarshalJSON

func (p Update) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface.

func (Update) Parents

func (p Update) Parents() []Plan

Parents implements Plan Parents interface.

func (*Update) PredicatePushDown

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

PredicatePushDown implements LogicalPlan interface.

func (*Update) PruneColumns

func (p *Update) PruneColumns(parentUsedCols []*expression.Column)

PruneColumns implements LogicalPlan interface.

func (Update) ReplaceChild

func (p Update) ReplaceChild(child, newChild Plan) error

ReplaceChild means replace a child with another one.

func (Update) ReplaceParent

func (p Update) ReplaceParent(parent, newPar Plan) error

ReplaceParent means replace a parent for another one.

func (*Update) ResolveIndices

func (p *Update) ResolveIndices()

ResolveIndices implements Plan interface.

func (Update) Schema

func (p Update) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (Update) SetChildren

func (p Update) SetChildren(children ...Plan)

SetChildren implements Plan SetChildren interface.

func (Update) SetParents

func (p Update) SetParents(pars ...Plan)

SetParents implements Plan SetParents interface.

func (Update) SetSchema

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

SetSchema implements Plan SetSchema interface.

func (*Update) ToPB

func (p *Update) ToPB(_ context.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

Jump to

Keyboard shortcuts

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