planner

package
v0.0.0-...-3903214 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedType                 = terror.ClassOptimizer.New(mysql.ErrUnsupportedType, mysql.MySQLErrName[mysql.ErrUnsupportedType])
	ErrAnalyzeMissIndex                = terror.ClassOptimizer.New(mysql.ErrAnalyzeMissIndex, mysql.MySQLErrName[mysql.ErrAnalyzeMissIndex])
	ErrWrongParamCount                 = terror.ClassOptimizer.New(mysql.ErrWrongParamCount, mysql.MySQLErrName[mysql.ErrWrongParamCount])
	ErrSchemaChanged                   = terror.ClassOptimizer.New(mysql.ErrSchemaChanged, mysql.MySQLErrName[mysql.ErrSchemaChanged])
	ErrTablenameNotAllowedHere         = terror.ClassOptimizer.New(mysql.ErrTablenameNotAllowedHere, mysql.MySQLErrName[mysql.ErrTablenameNotAllowedHere])
	ErrNotSupportedYet                 = terror.ClassOptimizer.New(mysql.ErrNotSupportedYet, mysql.MySQLErrName[mysql.ErrNotSupportedYet])
	ErrWrongUsage                      = terror.ClassOptimizer.New(mysql.ErrWrongUsage, mysql.MySQLErrName[mysql.ErrWrongUsage])
	ErrUnknown                         = terror.ClassOptimizer.New(mysql.ErrUnknown, mysql.MySQLErrName[mysql.ErrUnknown])
	ErrUnknownTable                    = terror.ClassOptimizer.New(mysql.ErrUnknownTable, mysql.MySQLErrName[mysql.ErrUnknownTable])
	ErrNoSuchTable                     = terror.ClassOptimizer.New(mysql.ErrNoSuchTable, mysql.MySQLErrName[mysql.ErrNoSuchTable])
	ErrWrongArguments                  = terror.ClassOptimizer.New(mysql.ErrWrongArguments, mysql.MySQLErrName[mysql.ErrWrongArguments])
	ErrWrongNumberOfColumnsInSelect    = terror.ClassOptimizer.New(mysql.ErrWrongNumberOfColumnsInSelect, mysql.MySQLErrName[mysql.ErrWrongNumberOfColumnsInSelect])
	ErrBadGeneratedColumn              = terror.ClassOptimizer.New(mysql.ErrBadGeneratedColumn, mysql.MySQLErrName[mysql.ErrBadGeneratedColumn])
	ErrFieldNotInGroupBy               = terror.ClassOptimizer.New(mysql.ErrFieldNotInGroupBy, mysql.MySQLErrName[mysql.ErrFieldNotInGroupBy])
	ErrBadTable                        = terror.ClassOptimizer.New(mysql.ErrBadTable, mysql.MySQLErrName[mysql.ErrBadTable])
	ErrKeyDoesNotExist                 = terror.ClassOptimizer.New(mysql.ErrKeyDoesNotExist, mysql.MySQLErrName[mysql.ErrKeyDoesNotExist])
	ErrOperandColumns                  = terror.ClassOptimizer.New(mysql.ErrOperandColumns, mysql.MySQLErrName[mysql.ErrOperandColumns])
	ErrInvalidGroupFuncUse             = terror.ClassOptimizer.New(mysql.ErrInvalidGroupFuncUse, mysql.MySQLErrName[mysql.ErrInvalidGroupFuncUse])
	ErrIllegalReference                = terror.ClassOptimizer.New(mysql.ErrIllegalReference, mysql.MySQLErrName[mysql.ErrIllegalReference])
	ErrNoDB                            = terror.ClassOptimizer.New(mysql.ErrNoDB, mysql.MySQLErrName[mysql.ErrNoDB])
	ErrUnknownExplainFormat            = terror.ClassOptimizer.New(mysql.ErrUnknownExplainFormat, mysql.MySQLErrName[mysql.ErrUnknownExplainFormat])
	ErrWrongGroupField                 = terror.ClassOptimizer.New(mysql.ErrWrongGroupField, mysql.MySQLErrName[mysql.ErrWrongGroupField])
	ErrDupFieldName                    = terror.ClassOptimizer.New(mysql.ErrDupFieldName, mysql.MySQLErrName[mysql.ErrDupFieldName])
	ErrNonUpdatableTable               = terror.ClassOptimizer.New(mysql.ErrNonUpdatableTable, mysql.MySQLErrName[mysql.ErrNonUpdatableTable])
	ErrInternal                        = terror.ClassOptimizer.New(mysql.ErrInternal, mysql.MySQLErrName[mysql.ErrInternal])
	ErrNonUniqTable                    = terror.ClassOptimizer.New(mysql.ErrNonuniqTable, mysql.MySQLErrName[mysql.ErrNonuniqTable])
	ErrWindowInvalidWindowFuncUse      = terror.ClassOptimizer.New(mysql.ErrWindowInvalidWindowFuncUse, mysql.MySQLErrName[mysql.ErrWindowInvalidWindowFuncUse])
	ErrWindowInvalidWindowFuncAliasUse = terror.ClassOptimizer.New(mysql.ErrWindowInvalidWindowFuncAliasUse, mysql.MySQLErrName[mysql.ErrWindowInvalidWindowFuncAliasUse])
	ErrWindowNoSuchWindow              = terror.ClassOptimizer.New(mysql.ErrWindowNoSuchWindow, mysql.MySQLErrName[mysql.ErrWindowNoSuchWindow])
	ErrWindowCircularityInWindowGraph  = terror.ClassOptimizer.New(mysql.ErrWindowCircularityInWindowGraph, mysql.MySQLErrName[mysql.ErrWindowCircularityInWindowGraph])
	ErrWindowNoChildPartitioning       = terror.ClassOptimizer.New(mysql.ErrWindowNoChildPartitioning, mysql.MySQLErrName[mysql.ErrWindowNoChildPartitioning])
	ErrWindowNoInherentFrame           = terror.ClassOptimizer.New(mysql.ErrWindowNoInherentFrame, mysql.MySQLErrName[mysql.ErrWindowNoInherentFrame])
	ErrWindowNoRedefineOrderBy         = terror.ClassOptimizer.New(mysql.ErrWindowNoRedefineOrderBy, mysql.MySQLErrName[mysql.ErrWindowNoRedefineOrderBy])
	ErrWindowDuplicateName             = terror.ClassOptimizer.New(mysql.ErrWindowDuplicateName, mysql.MySQLErrName[mysql.ErrWindowDuplicateName])
	ErrPartitionClauseOnNonpartitioned = terror.ClassOptimizer.New(mysql.ErrPartitionClauseOnNonpartitioned, mysql.MySQLErrName[mysql.ErrPartitionClauseOnNonpartitioned])
	ErrWindowFrameStartIllegal         = terror.ClassOptimizer.New(mysql.ErrWindowFrameStartIllegal, mysql.MySQLErrName[mysql.ErrWindowFrameStartIllegal])
	ErrWindowFrameEndIllegal           = terror.ClassOptimizer.New(mysql.ErrWindowFrameEndIllegal, mysql.MySQLErrName[mysql.ErrWindowFrameEndIllegal])
	ErrWindowFrameIllegal              = terror.ClassOptimizer.New(mysql.ErrWindowFrameIllegal, mysql.MySQLErrName[mysql.ErrWindowFrameIllegal])
	ErrWindowRangeFrameOrderType       = terror.ClassOptimizer.New(mysql.ErrWindowRangeFrameOrderType, mysql.MySQLErrName[mysql.ErrWindowRangeFrameOrderType])
	ErrWindowRangeFrameTemporalType    = terror.ClassOptimizer.New(mysql.ErrWindowRangeFrameTemporalType, mysql.MySQLErrName[mysql.ErrWindowRangeFrameTemporalType])
	ErrWindowRangeFrameNumericType     = terror.ClassOptimizer.New(mysql.ErrWindowRangeFrameNumericType, mysql.MySQLErrName[mysql.ErrWindowRangeFrameNumericType])
	ErrWindowRangeBoundNotConstant     = terror.ClassOptimizer.New(mysql.ErrWindowRangeBoundNotConstant, mysql.MySQLErrName[mysql.ErrWindowRangeBoundNotConstant])
	ErrWindowRowsIntervalUse           = terror.ClassOptimizer.New(mysql.ErrWindowRowsIntervalUse, mysql.MySQLErrName[mysql.ErrWindowRowsIntervalUse])
	ErrWindowFunctionIgnoresFrame      = terror.ClassOptimizer.New(mysql.ErrWindowFunctionIgnoresFrame, mysql.MySQLErrName[mysql.ErrWindowFunctionIgnoresFrame])
	ErrUnsupportedOnGeneratedColumn    = terror.ClassOptimizer.New(mysql.ErrUnsupportedOnGeneratedColumn, mysql.MySQLErrName[mysql.ErrUnsupportedOnGeneratedColumn])
	ErrPrivilegeCheckFail              = terror.ClassOptimizer.New(mysql.ErrPrivilegeCheckFail, mysql.MySQLErrName[mysql.ErrPrivilegeCheckFail])
	ErrInvalidWildCard                 = terror.ClassOptimizer.New(mysql.ErrInvalidWildCard, mysql.MySQLErrName[mysql.ErrInvalidWildCard])
	ErrMixOfGroupFuncAndFields         = terror.ClassOptimizer.New(mysql.ErrMixOfGroupFuncAndFieldsIncompatible, mysql.MySQLErrName[mysql.ErrMixOfGroupFuncAndFieldsIncompatible])

	ErrDBaccessDenied              = terror.ClassOptimizer.New(mysql.ErrDBaccessDenied, mysql.MySQLErrName[mysql.ErrDBaccessDenied])
	ErrTableaccessDenied           = terror.ClassOptimizer.New(mysql.ErrTableaccessDenied, mysql.MySQLErrName[mysql.ErrTableaccessDenied])
	ErrSpecificAccessDenied        = terror.ClassOptimizer.New(mysql.ErrSpecificAccessDenied, mysql.MySQLErrName[mysql.ErrSpecificAccessDenied])
	ErrViewNoExplain               = terror.ClassOptimizer.New(mysql.ErrViewNoExplain, mysql.MySQLErrName[mysql.ErrViewNoExplain])
	ErrWrongValueCountOnRow        = terror.ClassOptimizer.New(mysql.ErrWrongValueCountOnRow, mysql.MySQLErrName[mysql.ErrWrongValueCountOnRow])
	ErrViewInvalid                 = terror.ClassOptimizer.New(mysql.ErrViewInvalid, mysql.MySQLErrName[mysql.ErrViewInvalid])
	ErrNoSuchThread                = terror.ClassOptimizer.New(mysql.ErrNoSuchThread, mysql.MySQLErrName[mysql.ErrNoSuchThread])
	ErrUnknownColumn               = terror.ClassOptimizer.New(mysql.ErrBadField, mysql.MySQLErrName[mysql.ErrBadField])
	ErrCartesianProductUnsupported = terror.ClassOptimizer.New(mysql.ErrCartesianProductUnsupported, mysql.MySQLErrName[mysql.ErrCartesianProductUnsupported])
	ErrStmtNotFound                = terror.ClassOptimizer.New(mysql.ErrPreparedStmtNotFound, mysql.MySQLErrName[mysql.ErrPreparedStmtNotFound])
	ErrAmbiguous                   = terror.ClassOptimizer.New(mysql.ErrNonUniq, mysql.MySQLErrName[mysql.ErrNonUniq])
	// Since we cannot know if user loggined with a password, use message of ErrAccessDeniedNoPassword instead
	ErrAccessDenied = terror.ClassOptimizer.New(mysql.ErrAccessDenied, mysql.MySQLErrName[mysql.ErrAccessDeniedNoPassword])
)

error definitions.

Functions

This section is empty.

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 BatchPointGetPlan

type BatchPointGetPlan struct {
	Table       table.Table
	IndexMeta   *model.IndexMeta
	IndexValues [][]types.Datum

	Delete bool
	// contains filtered or unexported fields
}

func (BatchPointGetPlan) Init

func (*BatchPointGetPlan) OutputNames

func (s *BatchPointGetPlan) OutputNames() types.NameSlice

OutputNames returns the outputting names of each column.

func (*BatchPointGetPlan) Schema

func (s *BatchPointGetPlan) Schema() *expression.Schema

Schema implements the Plan.Schema interface.

func (*BatchPointGetPlan) SetOutputNames

func (s *BatchPointGetPlan) SetOutputNames(names types.NameSlice)

func (*BatchPointGetPlan) SetSchema

func (s *BatchPointGetPlan) SetSchema(schema *expression.Schema)

SetSchema implements the Plan.SetSchema interface.

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

func (by *ByItems) Equal(ctx sctx.Context, other *ByItems) bool

Equal checks whether two ByItems are equal.

type DDL

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

func (*DDL) OutputNames

func (s *DDL) OutputNames() types.NameSlice

OutputNames returns the outputting names of each column.

func (*DDL) Schema

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

Schema implements the Plan.Schema interface.

func (*DDL) SetOutputNames

func (s *DDL) SetOutputNames(names types.NameSlice)

func (*DDL) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type DataSource

type DataSource struct {
	Columns []*model.ColumnMeta

	DBName      parser_model.CIStr
	TableAsName *parser_model.CIStr

	TblCols []*expression.Column

	IdxVals []types.Datum
	Index   *model.IndexMeta

	PkVals []types.Datum
	Limit  uint64

	SimpleScanPlan *SimpleScanPlan
	// contains filtered or unexported fields
}

DataSource represents a tableScan without condition push down.

func (DataSource) Init

func (d DataSource) Init(ctx sctx.Context) *DataSource

func (*DataSource) OutputNames

func (s *DataSource) OutputNames() types.NameSlice

func (*DataSource) PruneColumns

func (d *DataSource) PruneColumns(usedColumns []*expression.Column) ([]*expression.Column, error)

func (*DataSource) PushFilterDown

func (d *DataSource) PushFilterDown(exprs []expression.Expression) []expression.Expression

func (*DataSource) PushFilterDown2

func (d *DataSource) PushFilterDown2(exprs []expression.Expression) []expression.Expression

func (*DataSource) PushLimitDown

func (d *DataSource) PushLimitDown(limit uint64)

func (*DataSource) Schema

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

Schema implements the Plan.Schema interface.

func (*DataSource) SetOutputNames

func (s *DataSource) SetOutputNames(names types.NameSlice)

func (*DataSource) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

func (*DataSource) Table

func (d *DataSource) Table() table.Table

type Delete

type Delete struct {
	Table              table.Table
	SelectionPlan      Plan
	SimplePointGetPlan Plan
	// contains filtered or unexported fields
}

func (Delete) Init

func (p Delete) Init(ctx sctx.Context) *Delete

func (*Delete) OutputNames

func (s *Delete) OutputNames() types.NameSlice

OutputNames returns the outputting names of each column.

func (*Delete) Schema

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

Schema implements the Plan.Schema interface.

func (*Delete) SetOutputNames

func (s *Delete) SetOutputNames(names types.NameSlice)

func (*Delete) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type Insert

type Insert struct {
	Table table.Table

	Columns   []*ast.ColumnName
	Lists     [][]expression.Expression
	DefaultCF bool
	// contains filtered or unexported fields
}

func (Insert) Init

func (i Insert) Init(ctx sctx.Context) *Insert

func (*Insert) OutputNames

func (s *Insert) OutputNames() types.NameSlice

OutputNames returns the outputting names of each column.

func (*Insert) Schema

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

Schema implements the Plan.Schema interface.

func (*Insert) SetOutputNames

func (s *Insert) SetOutputNames(names types.NameSlice)

func (*Insert) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type LogicalAggregation

type LogicalAggregation struct {
	AggFuncs []*aggregation.AggFuncDesc
	Table    table.Table
	// contains filtered or unexported fields
}

func (*LogicalAggregation) GetUsedCols

func (la *LogicalAggregation) GetUsedCols() (usedCols []*expression.Column)

GetUsedCols extracts all of the Columns used by agg including GroupByItems and AggFuncs.

func (LogicalAggregation) Init

func (*LogicalAggregation) OutputNames

func (s *LogicalAggregation) OutputNames() types.NameSlice

func (*LogicalAggregation) PushLimitDown

func (p *LogicalAggregation) PushLimitDown(limit uint64)

func (*LogicalAggregation) Schema

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

Schema implements the Plan.Schema interface.

func (*LogicalAggregation) SetOutputNames

func (s *LogicalAggregation) SetOutputNames(names types.NameSlice)

func (*LogicalAggregation) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type LogicalLimit

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

LogicalLimit represents offset and limit plan.

func (*LogicalLimit) Children

func (blp *LogicalLimit) Children() []LogicalPlan

func (LogicalLimit) Init

func (p LogicalLimit) Init(ctx sctx.Context) *LogicalLimit

Init initializes LogicalLimit.

func (*LogicalLimit) OutputNames

func (p *LogicalLimit) OutputNames() types.NameSlice

func (*LogicalLimit) PruneColumns

func (blp *LogicalLimit) PruneColumns(usedColumns []*expression.Column) ([]*expression.Column, error)

func (*LogicalLimit) PushFilterDown

func (blp *LogicalLimit) PushFilterDown(exprs []expression.Expression) []expression.Expression

func (*LogicalLimit) PushLimitDown

func (blp *LogicalLimit) PushLimitDown(limit uint64)

func (*LogicalLimit) Schema

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

func (*LogicalLimit) SetChild

func (blp *LogicalLimit) SetChild(i int, child LogicalPlan)

func (*LogicalLimit) SetChildren

func (blp *LogicalLimit) SetChildren(children ...LogicalPlan)

type LogicalPlan

type LogicalPlan interface {
	Plan
	// Get all the children.
	Children() []LogicalPlan

	// SetChildren sets the children for the plan.
	SetChildren(...LogicalPlan)

	// SetChild sets the ith child for the plan.
	SetChild(i int, child LogicalPlan)

	// PruneColumns prunes the unused columns.
	PruneColumns([]*expression.Column) ([]*expression.Column, error)

	// Push the expression in where clause to datasource to use index.
	// Only selection need to implement this now.
	PushFilterDown([]expression.Expression) []expression.Expression

	PushLimitDown(uint64)
}

type LogicalProjection

type LogicalProjection struct {
	Exprs []expression.Expression

	// key -> col index in proj schema
	// value -> col index in row fetched(table scan schema)
	ColIndexMap map[int]int
	// contains filtered or unexported fields
}

func (LogicalProjection) Init

func (*LogicalProjection) OutputNames

func (s *LogicalProjection) OutputNames() types.NameSlice

func (*LogicalProjection) PruneColumns

func (p *LogicalProjection) PruneColumns(usedColumns []*expression.Column) ([]*expression.Column, error)

func (*LogicalProjection) Schema

func (s *LogicalProjection) Schema() *expression.Schema

Schema implements the Plan.Schema interface.

func (*LogicalProjection) SetOutputNames

func (s *LogicalProjection) SetOutputNames(names types.NameSlice)

func (*LogicalProjection) SetSchema

func (s *LogicalProjection) SetSchema(schema *expression.Schema)

SetSchema implements the Plan.SetSchema interface.

type LogicalSelection

type LogicalSelection struct {

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

LogicalSelection represents a where or having predicate.

func (*LogicalSelection) Children

func (blp *LogicalSelection) Children() []LogicalPlan

func (LogicalSelection) Init

Init initializes LogicalSelection.

func (*LogicalSelection) OutputNames

func (p *LogicalSelection) OutputNames() types.NameSlice

func (*LogicalSelection) PruneColumns

func (p *LogicalSelection) PruneColumns(usedColumns []*expression.Column) ([]*expression.Column, error)

TODO: Should prune columns based on cols related in where condition.

func (*LogicalSelection) PushFilterDown

func (p *LogicalSelection) PushFilterDown(exprs []expression.Expression) []expression.Expression

func (*LogicalSelection) PushLimitDown

func (blp *LogicalSelection) PushLimitDown(limit uint64)

func (*LogicalSelection) Schema

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

func (*LogicalSelection) SetChild

func (blp *LogicalSelection) SetChild(i int, child LogicalPlan)

func (*LogicalSelection) SetChildren

func (blp *LogicalSelection) SetChildren(children ...LogicalPlan)

type LogicalShow

type LogicalShow struct {
	ShowContents
	// contains filtered or unexported fields
}

LogicalShow represents a show plan.

func (LogicalShow) Init

func (p LogicalShow) Init(ctx sctx.Context) *LogicalShow

Init initializes LogicalSelection.

func (*LogicalShow) OutputNames

func (s *LogicalShow) OutputNames() types.NameSlice

func (*LogicalShow) Schema

func (s *LogicalShow) Schema() *expression.Schema

Schema implements the Plan.Schema interface.

func (*LogicalShow) SetOutputNames

func (s *LogicalShow) SetOutputNames(names types.NameSlice)

func (*LogicalShow) SetSchema

func (s *LogicalShow) SetSchema(schema *expression.Schema)

SetSchema implements the Plan.SetSchema interface.

type LogicalSort

type LogicalSort struct {
	ByItems []*ByItems
	// contains filtered or unexported fields
}

func (*LogicalSort) Children

func (blp *LogicalSort) Children() []LogicalPlan

func (LogicalSort) Init

func (p LogicalSort) Init(ctx sctx.Context) *LogicalSort

func (*LogicalSort) OutputNames

func (p *LogicalSort) OutputNames() types.NameSlice

func (*LogicalSort) PruneColumns

func (blp *LogicalSort) PruneColumns(usedColumns []*expression.Column) ([]*expression.Column, error)

func (*LogicalSort) PushFilterDown

func (blp *LogicalSort) PushFilterDown(exprs []expression.Expression) []expression.Expression

func (*LogicalSort) PushLimitDown

func (p *LogicalSort) PushLimitDown(limit uint64)

Sort can not push limit down unless the by item has an index. Ignore the situation for now.

func (*LogicalSort) Schema

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

func (*LogicalSort) SetChild

func (blp *LogicalSort) SetChild(i int, child LogicalPlan)

func (*LogicalSort) SetChildren

func (blp *LogicalSort) SetChildren(children ...LogicalPlan)

type LogicalTableDual

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

LogicalTableDual represents a dual table plan.

func (LogicalTableDual) Init

Init initializes LogicalTableDual.

func (*LogicalTableDual) OutputNames

func (s *LogicalTableDual) OutputNames() types.NameSlice

func (*LogicalTableDual) Schema

func (s *LogicalTableDual) Schema() *expression.Schema

Schema implements the Plan.Schema interface.

func (*LogicalTableDual) SetOutputNames

func (s *LogicalTableDual) SetOutputNames(names types.NameSlice)

func (*LogicalTableDual) SetSchema

func (s *LogicalTableDual) SetSchema(schema *expression.Schema)

SetSchema implements the Plan.SetSchema interface.

type LogicalUpdate

type LogicalUpdate struct {
	Table table.Table

	ColValues  map[int64]types.Datum
	DataSource Plan
	// contains filtered or unexported fields
}

func (*LogicalUpdate) Children

func (blp *LogicalUpdate) Children() []LogicalPlan

func (LogicalUpdate) Init

func (p LogicalUpdate) Init(ctx sctx.Context) *LogicalUpdate

func (*LogicalUpdate) PruneColumns

func (blp *LogicalUpdate) PruneColumns(usedColumns []*expression.Column) ([]*expression.Column, error)

func (*LogicalUpdate) PushFilterDown

func (blp *LogicalUpdate) PushFilterDown(exprs []expression.Expression) []expression.Expression

func (*LogicalUpdate) PushLimitDown

func (blp *LogicalUpdate) PushLimitDown(limit uint64)

func (*LogicalUpdate) SetChild

func (blp *LogicalUpdate) SetChild(i int, child LogicalPlan)

func (*LogicalUpdate) SetChildren

func (blp *LogicalUpdate) SetChildren(children ...LogicalPlan)

type PhysicalPlan

type PhysicalPlan interface {
	Plan
	// Get all the children.
	Children() []PhysicalPlan

	// SetChildren sets the children for the plan.
	SetChildren(...PhysicalPlan)

	// SetChild sets the ith child for the plan.
	SetChild(i int, child PhysicalPlan)
}

type Plan

type Plan interface {
	Schema() *expression.Schema
	Type() string
	// OutputNames returns the outputting names of each column.
	OutputNames() types.NameSlice

	// SetOutputNames sets the outputting name by the given slice.
	SetOutputNames(names types.NameSlice)
	ExplainID() fmt.Stringer
}

func TryFastPlan

func TryFastPlan(ctx sctx.Context, node ast.Node) Plan

type PlanBuilder

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

func NewPlanBuilder

func NewPlanBuilder(ctx sctx.Context, is infoschema.InfoSchema) *PlanBuilder

func (*PlanBuilder) Build

func (pb *PlanBuilder) Build(ctx context.Context, node ast.Node) (Plan, error)

type Set

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

func (*Set) OutputNames

func (s *Set) OutputNames() types.NameSlice

OutputNames returns the outputting names of each column.

func (*Set) Schema

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

Schema implements the Plan.Schema interface.

func (*Set) SetOutputNames

func (s *Set) SetOutputNames(names types.NameSlice)

func (*Set) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type ShowContents

type ShowContents struct {
	Tp        ast.ShowStmtType // Databases/Tables/Columns/....
	DBName    string
	Table     *ast.TableName  // Used for showing columns.
	Column    *ast.ColumnName // Used for `desc table column`.
	IndexName parser_model.CIStr
}

ShowContents stores the contents for the `SHOW` statement.

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

func (s *Simple) OutputNames() types.NameSlice

OutputNames returns the outputting names of each column.

func (*Simple) Schema

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

Schema implements the Plan.Schema interface.

func (*Simple) SetOutputNames

func (s *Simple) SetOutputNames(names types.NameSlice)

func (*Simple) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type SimpleScanPlan

type SimpleScanPlan struct {
	Table     table.Table
	IndexMeta *model.IndexMeta

	Lower []*util.Bound
	Upper []*util.Bound

	Limit int64
	// contains filtered or unexported fields
}

func (SimpleScanPlan) Init

func (p SimpleScanPlan) Init(ctx sctx.Context, schema *expression.Schema, names []*types.FieldName) *SimpleScanPlan

func (*SimpleScanPlan) OutputNames

func (s *SimpleScanPlan) OutputNames() types.NameSlice

OutputNames returns the outputting names of each column.

func (*SimpleScanPlan) Schema

func (s *SimpleScanPlan) Schema() *expression.Schema

Schema implements the Plan.Schema interface.

func (*SimpleScanPlan) SetOutputNames

func (s *SimpleScanPlan) SetOutputNames(names types.NameSlice)

func (*SimpleScanPlan) SetSchema

func (s *SimpleScanPlan) SetSchema(schema *expression.Schema)

SetSchema implements the Plan.SetSchema interface.

type SplitRegion

type SplitRegion struct {
	IndexMeta  *model.IndexMeta
	TableMeta  *model.TableMeta
	Lower      []types.Datum
	Upper      []types.Datum
	ValueLists [][]types.Datum
	Num        int
	// contains filtered or unexported fields
}

func (*SplitRegion) OutputNames

func (s *SplitRegion) OutputNames() types.NameSlice

OutputNames returns the outputting names of each column.

func (*SplitRegion) Schema

func (s *SplitRegion) Schema() *expression.Schema

Schema implements the Plan.Schema interface.

func (*SplitRegion) SetOutputNames

func (s *SplitRegion) SetOutputNames(names types.NameSlice)

func (*SplitRegion) SetSchema

func (s *SplitRegion) SetSchema(schema *expression.Schema)

SetSchema implements the Plan.SetSchema interface.

Jump to

Keyboard shortcuts

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