core

package
v0.0.0-...-3633c1a Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2021 License: Apache-2.0 Imports: 56 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"
	// 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"
	// 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"
	// TypeUpdate is the type of Update.
	TypeUpdate = "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"
	// TypeWindow is the type of Window.
	TypeWindow = "Window"
)
View Source
const (
	// TiDBMergeJoin is hint enforce merge join.
	TiDBMergeJoin = "tidb_smj"
	// TiDBIndexNestedLoopJoin is hint enforce index nested loop join.
	TiDBIndexNestedLoopJoin = "tidb_inlj"
	// TiDBHashJoin is hint enforce hash join.
	TiDBHashJoin = "tidb_hj"
)
View Source
const (
	// ErrExprInSelect  is in select fields for the error of ErrFieldNotInGroupBy
	ErrExprInSelect = "SELECT list"
	// ErrExprInOrderBy  is in order by items for the error of ErrFieldNotInGroupBy
	ErrExprInOrderBy = "ORDER BY"
)

Variables

View Source
var (

	// PreparedPlanCacheCapacity stores the global config "prepared-plan-cache-capacity".
	PreparedPlanCacheCapacity uint
	// PreparedPlanCacheMemoryGuardRatio stores the global config "prepared-plan-cache-memory-guard-ratio".
	PreparedPlanCacheMemoryGuardRatio float64
	// PreparedPlanCacheMaxMemory stores the max memory size defined in the global config "performance-max-memory".
	PreparedPlanCacheMaxMemory atomic2.Uint64
)
View Source
var (
	ErrUnsupportedType             = terror.ClassOptimizer.New(codeUnsupportedType, "Unsupported type %T")
	ErrAnalyzeMissIndex            = terror.ClassOptimizer.New(codeAnalyzeMissIndex, "Index '%s' in field list does not exist in table '%s'")
	ErrCartesianProductUnsupported = terror.ClassOptimizer.New(codeUnsupported, "Cartesian product is unsupported")
	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")
	ErrTablenameNotAllowedHere     = terror.ClassOptimizer.New(codeTablenameNotAllowedHere, "Table '%s' from one of the %ss cannot be used in %s")

	ErrNotSupportedYet                 = terror.ClassOptimizer.New(codeNotSupportedYet, mysql.MySQLErrName[mysql.ErrNotSupportedYet])
	ErrWrongUsage                      = terror.ClassOptimizer.New(codeWrongUsage, mysql.MySQLErrName[mysql.ErrWrongUsage])
	ErrAmbiguous                       = terror.ClassOptimizer.New(codeAmbiguous, mysql.MySQLErrName[mysql.ErrNonUniq])
	ErrUnknown                         = terror.ClassOptimizer.New(codeUnknown, mysql.MySQLErrName[mysql.ErrUnknown])
	ErrUnknownColumn                   = terror.ClassOptimizer.New(codeUnknownColumn, mysql.MySQLErrName[mysql.ErrBadField])
	ErrUnknownTable                    = terror.ClassOptimizer.New(codeUnknownTable, mysql.MySQLErrName[mysql.ErrUnknownTable])
	ErrWrongArguments                  = terror.ClassOptimizer.New(codeWrongArguments, mysql.MySQLErrName[mysql.ErrWrongArguments])
	ErrWrongNumberOfColumnsInSelect    = terror.ClassOptimizer.New(codeWrongNumberOfColumnsInSelect, mysql.MySQLErrName[mysql.ErrWrongNumberOfColumnsInSelect])
	ErrBadGeneratedColumn              = terror.ClassOptimizer.New(codeBadGeneratedColumn, mysql.MySQLErrName[mysql.ErrBadGeneratedColumn])
	ErrFieldNotInGroupBy               = terror.ClassOptimizer.New(codeFieldNotInGroupBy, mysql.MySQLErrName[mysql.ErrFieldNotInGroupBy])
	ErrBadTable                        = terror.ClassOptimizer.New(codeBadTable, mysql.MySQLErrName[mysql.ErrBadTable])
	ErrKeyDoesNotExist                 = terror.ClassOptimizer.New(codeKeyDoesNotExist, mysql.MySQLErrName[mysql.ErrKeyDoesNotExist])
	ErrOperandColumns                  = terror.ClassOptimizer.New(codeOperandColumns, mysql.MySQLErrName[mysql.ErrOperandColumns])
	ErrInvalidWildCard                 = terror.ClassOptimizer.New(codeInvalidWildCard, "Wildcard fields without any table name appears in wrong place")
	ErrInvalidGroupFuncUse             = terror.ClassOptimizer.New(codeInvalidGroupFuncUse, mysql.MySQLErrName[mysql.ErrInvalidGroupFuncUse])
	ErrIllegalReference                = terror.ClassOptimizer.New(codeIllegalReference, mysql.MySQLErrName[mysql.ErrIllegalReference])
	ErrNoDB                            = terror.ClassOptimizer.New(codeNoDB, mysql.MySQLErrName[mysql.ErrNoDB])
	ErrUnknownExplainFormat            = terror.ClassOptimizer.New(codeUnknownExplainFormat, mysql.MySQLErrName[mysql.ErrUnknownExplainFormat])
	ErrWrongGroupField                 = terror.ClassOptimizer.New(codeWrongGroupField, mysql.MySQLErrName[mysql.ErrWrongGroupField])
	ErrDupFieldName                    = terror.ClassOptimizer.New(codeDupFieldName, mysql.MySQLErrName[mysql.ErrDupFieldName])
	ErrNonUpdatableTable               = terror.ClassOptimizer.New(codeNonUpdatableTable, mysql.MySQLErrName[mysql.ErrNonUpdatableTable])
	ErrInternal                        = terror.ClassOptimizer.New(codeInternal, mysql.MySQLErrName[mysql.ErrInternal])
	ErrMixOfGroupFuncAndFields         = terror.ClassOptimizer.New(codeMixOfGroupFuncAndFields, "In aggregated query without GROUP BY, expression #%d of SELECT list contains nonaggregated column '%s'; this is incompatible with sql_mode=only_full_group_by")
	ErrNonUniqTable                    = terror.ClassOptimizer.New(codeNonUniqTable, mysql.MySQLErrName[mysql.ErrNonuniqTable])
	ErrWrongValueCountOnRow            = terror.ClassOptimizer.New(mysql.ErrWrongValueCountOnRow, mysql.MySQLErrName[mysql.ErrWrongValueCountOnRow])
	ErrViewInvalid                     = terror.ClassOptimizer.New(mysql.ErrViewInvalid, mysql.MySQLErrName[mysql.ErrViewInvalid])
	ErrPrivilegeCheckFail              = terror.ClassOptimizer.New(codePrivilegeCheckFail, "privilege check fail")
	ErrWindowInvalidWindowFuncUse      = terror.ClassOptimizer.New(codeWindowInvalidWindowFuncUse, mysql.MySQLErrName[mysql.ErrWindowInvalidWindowFuncUse])
	ErrWindowInvalidWindowFuncAliasUse = terror.ClassOptimizer.New(codeWindowInvalidWindowFuncAliasUse, mysql.MySQLErrName[mysql.ErrWindowInvalidWindowFuncAliasUse])
	ErrWindowNoSuchWindow              = terror.ClassOptimizer.New(codeWindowNoSuchWindow, mysql.MySQLErrName[mysql.ErrWindowNoSuchWindow])
	ErrWindowCircularityInWindowGraph  = terror.ClassOptimizer.New(codeWindowCircularityInWindowGraph, mysql.MySQLErrName[mysql.ErrWindowCircularityInWindowGraph])
	ErrWindowNoChildPartitioning       = terror.ClassOptimizer.New(codeWindowNoChildPartitioning, mysql.MySQLErrName[mysql.ErrWindowNoChildPartitioning])
	ErrWindowNoInherentFrame           = terror.ClassOptimizer.New(codeWindowNoInherentFrame, mysql.MySQLErrName[mysql.ErrWindowNoInherentFrame])
	ErrWindowNoRedefineOrderBy         = terror.ClassOptimizer.New(codeWindowNoRedefineOrderBy, mysql.MySQLErrName[mysql.ErrWindowNoRedefineOrderBy])
	ErrWindowDuplicateName             = terror.ClassOptimizer.New(codeWindowDuplicateName, mysql.MySQLErrName[mysql.ErrWindowDuplicateName])
	ErrPartitionClauseOnNonpartitioned = terror.ClassOptimizer.New(codePartitionClauseOnNonpartitioned, mysql.MySQLErrName[mysql.ErrPartitionClauseOnNonpartitioned])

	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])
	ErrWindowFrameStartIllegal      = terror.ClassOptimizer.New(codeWindowFrameStartIllegal, mysql.MySQLErrName[mysql.ErrWindowFrameStartIllegal])
	ErrWindowFrameEndIllegal        = terror.ClassOptimizer.New(codeWindowFrameEndIllegal, mysql.MySQLErrName[mysql.ErrWindowFrameEndIllegal])
	ErrWindowFrameIllegal           = terror.ClassOptimizer.New(codeWindowFrameIllegal, mysql.MySQLErrName[mysql.ErrWindowFrameIllegal])
	ErrWindowRangeFrameOrderType    = terror.ClassOptimizer.New(codeWindowRangeFrameOrderType, mysql.MySQLErrName[mysql.ErrWindowRangeFrameOrderType])
	ErrWindowRangeFrameTemporalType = terror.ClassOptimizer.New(codeWindowRangeFrameTemporalType, mysql.MySQLErrName[mysql.ErrWindowRangeFrameTemporalType])
	ErrWindowRangeFrameNumericType  = terror.ClassOptimizer.New(codeWindowRangeFrameNumericType, mysql.MySQLErrName[mysql.ErrWindowRangeFrameNumericType])
	ErrWindowRangeBoundNotConstant  = terror.ClassOptimizer.New(codeWindowRangeBoundNotConstant, mysql.MySQLErrName[mysql.ErrWindowRangeBoundNotConstant])
	ErrWindowRowsIntervalUse        = terror.ClassOptimizer.New(codeWindowRowsIntervalUse, mysql.MySQLErrName[mysql.ErrWindowRowsIntervalUse])
	ErrWindowFunctionIgnoresFrame   = terror.ClassOptimizer.New(codeWindowFunctionIgnoresFrame, mysql.MySQLErrName[mysql.ErrWindowFunctionIgnoresFrame])
	ErrUnsupportedOnGeneratedColumn = terror.ClassOptimizer.New(codeUnsupportedOnGeneratedColumn, mysql.MySQLErrName[mysql.ErrUnsupportedOnGeneratedColumn])
	ErrNoSuchThread                 = terror.ClassOptimizer.New(mysql.ErrNoSuchThread, mysql.MySQLErrName[mysql.ErrNoSuchThread])
	// 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.

View Source
var AllowCartesianProduct = atomic.NewBool(true)

AllowCartesianProduct means whether tidb allows cartesian join without equal conditions.

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

EvalSubquery evaluates incorrelated subqueries once.

View Source
var OptimizeAstNode func(ctx sessionctx.Context, node ast.Node, is infoschema.InfoSchema) (Plan, error)

OptimizeAstNode optimizes the query to a physical plan directly.

Functions

func Cacheable

func Cacheable(node ast.Node) bool

Cacheable checks whether the input ast is cacheable.

func CheckPrivilege

func CheckPrivilege(activeRoles []*auth.RoleIdentity, pm privilege.Manager, vs []visitInfo) error

CheckPrivilege checks the privilege for a user.

func CheckTableLock

func CheckTableLock(ctx sessionctx.Context, is infoschema.InfoSchema, vs []visitInfo) error

CheckTableLock checks the table lock.

func CollectPlanStatsVersion

func CollectPlanStatsVersion(plan PhysicalPlan, statsInfos map[string]uint64) map[string]uint64

CollectPlanStatsVersion uses to collect the statistics version of the plan.

func GetStatsInfo

func GetStatsInfo(i interface{}) map[string]uint64

GetStatsInfo gets the statistics info from a physical plan tree.

func InPrepare

func InPrepare(p *preprocessor)

InPrepare is a PreprocessOpt that indicates preprocess is executing under prepare statement.

func InTxnRetry

func InTxnRetry(p *preprocessor)

InTxnRetry is a PreprocessOpt that indicates preprocess is executing under transaction retry.

func MockContext

func MockContext() sessionctx.Context

MockContext is only used for plan related tests.

func MockPartitionInfoSchema

func MockPartitionInfoSchema(definitions []model.PartitionDefinition) infoschema.InfoSchema

MockPartitionInfoSchema mocks an info schema for partition table.

func MockTable

func MockTable() *model.TableInfo

MockTable is only used for plan related tests.

func MockView

func MockView() *model.TableInfo

MockView is only used for plan related tests.

func NewPSTMTPlanCacheKey

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

NewPSTMTPlanCacheKey creates a new pstmtPlanCacheKey object.

func NewProjInjector

func NewProjInjector() *projInjector

NewProjInjector builds a projInjector.

func PreparedPlanCacheEnabled

func PreparedPlanCacheEnabled() bool

PreparedPlanCacheEnabled returns whether the prepared plan cache is enabled.

func Preprocess

func Preprocess(ctx sessionctx.Context, node ast.Node, is infoschema.InfoSchema, preprocessOpt ...PreprocessOpt) error

Preprocess resolves table names of the node, and checks some statements validation.

func SetPBColumnsDefaultValue

func SetPBColumnsDefaultValue(ctx sessionctx.Context, pbColumns []*tipb.ColumnInfo, columns []*model.ColumnInfo) error

SetPBColumnsDefaultValue sets the default values of tipb.ColumnInfos.

func SetPreparedPlanCache

func SetPreparedPlanCache(isEnabled bool)

SetPreparedPlanCache sets isEnabled to true, then prepared plan cache is enabled.

func SetPstmtIDSchemaVersion

func SetPstmtIDSchemaVersion(key kvcache.Key, pstmtID uint32, schemaVersion int64)

SetPstmtIDSchemaVersion implements PstmtCacheKeyMutator interface to change pstmtID and schemaVersion of cacheKey. so we can reuse Key instead of new every time.

func SupportStreaming

func SupportStreaming(p PhysicalPlan) bool

SupportStreaming returns true if a pushed down operation supports using coprocessor streaming API. Note that this function handle pushed down physical plan only! It's called in constructDAGReq. Some plans are difficult (if possible) to implement streaming, and some are pointless to do so. TODO: Support more kinds of physical plan.

func ToString

func ToString(p Plan) string

ToString explains a Plan, returns description string.

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
	MaxNumBuckets uint64
	// contains filtered or unexported fields
}

Analyze represents an analyze plan

func (*Analyze) ResolveIndices

func (p *Analyze) ResolveIndices() (err error)

func (*Analyze) Schema

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

Schema implements the Plan.Schema interface.

func (*Analyze) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type AnalyzeColumnsTask

type AnalyzeColumnsTask struct {
	PKInfo   *model.ColumnInfo
	ColsInfo []*model.ColumnInfo
	TblInfo  *model.TableInfo
	// contains filtered or unexported fields
}

AnalyzeColumnsTask is used for analyze columns.

type AnalyzeIndexTask

type AnalyzeIndexTask struct {
	IndexInfo *model.IndexInfo
	TblInfo   *model.TableInfo
	// contains filtered or unexported fields
}

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 CancelDDLJobs

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

CancelDDLJobs represents a cancel DDL jobs plan.

func (*CancelDDLJobs) ResolveIndices

func (p *CancelDDLJobs) ResolveIndices() (err error)

func (*CancelDDLJobs) Schema

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

Schema implements the Plan.Schema interface.

func (*CancelDDLJobs) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type Change

type Change struct {
	*ast.ChangeStmt
	// contains filtered or unexported fields
}

Change represents a change plan.

func (*Change) ResolveIndices

func (p *Change) ResolveIndices() (err error)

func (*Change) Schema

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

Schema implements the Plan.Schema interface.

func (*Change) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type CheckIndex

type CheckIndex struct {
	IndexLookUpReader *PhysicalIndexLookUpReader
	DBName            string
	IdxName           string
	// contains filtered or unexported fields
}

CheckIndex is used for checking index data, built from the 'admin check index' statement.

func (*CheckIndex) ResolveIndices

func (p *CheckIndex) ResolveIndices() (err error)

func (*CheckIndex) Schema

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

Schema implements the Plan.Schema interface.

func (*CheckIndex) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type CheckIndexRange

type CheckIndexRange struct {
	Table     *ast.TableName
	IndexName string

	HandleRanges []ast.HandleRange
	// contains filtered or unexported fields
}

CheckIndexRange is used for checking index data, output the index values that handle within begin and end.

func (*CheckIndexRange) ResolveIndices

func (p *CheckIndexRange) ResolveIndices() (err error)

func (*CheckIndexRange) Schema

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

Schema implements the Plan.Schema interface.

func (*CheckIndexRange) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type CheckTable

type CheckTable struct {
	Tables []*ast.TableName

	GenExprs map[model.TableColumnID]expression.Expression
	// contains filtered or unexported fields
}

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

func (*CheckTable) ResolveIndices

func (p *CheckTable) ResolveIndices() (err error)

func (*CheckTable) Schema

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

Schema implements the Plan.Schema interface.

func (*CheckTable) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type ChecksumTable

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

ChecksumTable is used for calculating table checksum, built from the `admin checksum table` statement.

func (*ChecksumTable) ResolveIndices

func (p *ChecksumTable) ResolveIndices() (err error)

func (*ChecksumTable) Schema

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

Schema implements the Plan.Schema interface.

func (*ChecksumTable) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type CleanupIndex

type CleanupIndex struct {
	Table     *ast.TableName
	IndexName string
	// contains filtered or unexported fields
}

CleanupIndex is used to delete dangling index data.

func (*CleanupIndex) ResolveIndices

func (p *CleanupIndex) ResolveIndices() (err error)

func (*CleanupIndex) Schema

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

Schema implements the Plan.Schema interface.

func (*CleanupIndex) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type ColWithCmpFuncManager

type ColWithCmpFuncManager struct {
	OpType []string
	// contains filtered or unexported fields
}

ColWithCmpFuncManager is used in index join to handle the column with compare functions(>=, >, <, <=). It stores the compare functions and build ranges in execution phase.

func (*ColWithCmpFuncManager) BuildRangesByRow

func (cwc *ColWithCmpFuncManager) BuildRangesByRow(ctx sessionctx.Context, row chunk.Row) ([]*ranger.Range, error)

BuildRangesByRow will build range of the given row. It will eval each function's arg then call BuildRange.

func (*ColWithCmpFuncManager) CompareRow

func (cwc *ColWithCmpFuncManager) CompareRow(lhs, rhs chunk.Row) int

CompareRow compares the rows for deduplicate.

func (*ColWithCmpFuncManager) String

func (cwc *ColWithCmpFuncManager) String() string

String implements Stringer interface.

type DDL

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

DDL represents a DDL statement plan.

func (*DDL) ResolveIndices

func (p *DDL) ResolveIndices() (err error)

func (*DDL) Schema

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

Schema implements the Plan.Schema interface.

func (*DDL) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type DataSource

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

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

DataSource represents a tableScan without condition push down.

func (*DataSource) DeriveStats

func (ds *DataSource) DeriveStats(childStats []*property.StatsInfo) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (DataSource) Init

func (ds DataSource) Init(ctx sessionctx.Context) *DataSource

Init initializes DataSource.

func (*DataSource) PredicatePushDown

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*DataSource) PruneColumns

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

PruneColumns implements LogicalPlan interface.

func (*DataSource) Schema

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

Schema implements the Plan.Schema interface.

func (*DataSource) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

func (*DataSource) TableInfo

func (ds *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) ResolveIndices

func (p *Deallocate) ResolveIndices() (err error)

func (*Deallocate) Schema

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

Schema implements the Plan.Schema interface.

func (*Deallocate) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type Delete

type Delete struct {
	Tables       []*ast.TableName
	IsMultiTable bool

	SelectPlan PhysicalPlan
	// contains filtered or unexported fields
}

Delete represents a delete plan.

func (Delete) Init

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

Init initializes Delete.

func (*Delete) ResolveIndices

func (p *Delete) ResolveIndices() (err error)

func (*Delete) Schema

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

Schema implements the Plan.Schema interface.

func (*Delete) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type ErrExprLoc

type ErrExprLoc struct {
	Offset int
	Loc    string
}

ErrExprLoc is for generate the ErrFieldNotInGroupBy error info

type Execute

type Execute struct {
	Name          string
	UsingVars     []expression.Expression
	PrepareParams []types.Datum
	ExecID        uint32
	Stmt          ast.StmtNode
	Plan          Plan
	// contains filtered or unexported fields
}

Execute represents prepare plan.

func (*Execute) OptimizePreparedPlan

func (e *Execute) OptimizePreparedPlan(ctx sessionctx.Context, is infoschema.InfoSchema) error

OptimizePreparedPlan optimizes the prepared statement.

func (*Execute) ResolveIndices

func (p *Execute) ResolveIndices() (err error)

func (*Execute) Schema

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

Schema implements the Plan.Schema interface.

func (*Execute) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type Explain

type Explain struct {
	StmtPlan Plan
	Rows     [][]string

	Format   string
	Analyze  bool
	ExecStmt ast.StmtNode
	ExecPlan Plan
	// contains filtered or unexported fields
}

Explain represents a explain plan.

func (*Explain) RenderResult

func (e *Explain) RenderResult() error

RenderResult renders the explain result as specified format.

func (*Explain) ResolveIndices

func (p *Explain) ResolveIndices() (err error)

func (*Explain) Schema

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

Schema implements the Plan.Schema interface.

func (*Explain) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type FrameBound

type FrameBound struct {
	Type      ast.BoundType
	UnBounded bool
	Num       uint64
	// CalcFuncs is used for range framed windows.
	// We will build the date_add or date_sub functions for frames like `INTERVAL '2:30' MINUTE_SECOND FOLLOWING`,
	// and plus or minus for frames like `1 preceding`.
	CalcFuncs []expression.Expression
	// CmpFuncs is used to decide whether one row is included in the current frame.
	CmpFuncs []expression.CompareFunc
}

FrameBound is the boundary of a frame.

type Insert

type Insert struct {
	Table table.Table

	Columns []*ast.ColumnName
	Lists   [][]expression.Expression
	SetList []*expression.Assignment

	OnDuplicate        []*expression.Assignment
	Schema4OnDuplicate *expression.Schema

	IsReplace bool

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

	GenCols InsertGeneratedColumns

	SelectPlan PhysicalPlan
	// contains filtered or unexported fields
}

Insert represents an insert plan.

func (Insert) Init

func (p Insert) Init(ctx sessionctx.Context) *Insert

Init initializes Insert.

func (*Insert) ResolveIndices

func (p *Insert) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*Insert) Schema

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

Schema implements the Plan.Schema interface.

func (*Insert) SetSchema

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

SetSchema implements the Plan.SetSchema 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) IsOuterJoin

func (tp JoinType) IsOuterJoin() bool

IsOuterJoin returns if this joiner is a outer joiner

func (JoinType) String

func (tp JoinType) String() string

type LoadData

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

	GenCols InsertGeneratedColumns
	// contains filtered or unexported fields
}

LoadData represents a loaddata plan.

func (*LoadData) ResolveIndices

func (p *LoadData) ResolveIndices() (err error)

func (*LoadData) Schema

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

Schema implements the Plan.Schema interface.

func (*LoadData) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type LoadStats

type LoadStats struct {
	Path string
	// contains filtered or unexported fields
}

LoadStats represents a load stats plan.

func (*LoadStats) ResolveIndices

func (p *LoadStats) ResolveIndices() (err error)

func (*LoadStats) Schema

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

Schema implements the Plan.Schema interface.

func (*LoadStats) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type LogicalAggregation

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

LogicalAggregation represents an aggregate plan.

func (*LogicalAggregation) DeriveStats

func (la *LogicalAggregation) DeriveStats(childStats []*property.StatsInfo) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (LogicalAggregation) Init

Init initializes LogicalAggregation.

func (*LogicalAggregation) PredicatePushDown

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalAggregation) PruneColumns

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

PruneColumns implements LogicalPlan interface.

func (*LogicalAggregation) Schema

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

Schema implements the Plan.Schema interface.

func (*LogicalAggregation) SetSchema

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

SetSchema implements the 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) DeriveStats

func (la *LogicalApply) DeriveStats(childStats []*property.StatsInfo) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (LogicalApply) Init

Init initializes LogicalApply.

func (*LogicalApply) PruneColumns

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

PruneColumns implements LogicalPlan interface.

func (*LogicalApply) Schema

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

Schema implements the Plan.Schema interface.

func (*LogicalApply) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type LogicalJoin

type LogicalJoin struct {
	JoinType JoinType

	StraightJoin bool

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

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

	// DefaultValues is only used for left/right outer join, which is values the inner row's should be when the outer table
	// doesn't match any inner table's row.
	// That it's nil just means the default values is a slice of NULL.
	// Currently, only `aggregation push down` phase will set this.
	DefaultValues []types.Datum
	// contains filtered or unexported fields
}

LogicalJoin is the logical join plan.

func (*LogicalJoin) DeriveStats

func (p *LogicalJoin) DeriveStats(childStats []*property.StatsInfo) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface. If the type of join is SemiJoin, the selectivity of it will be same as selection's. If the type of join is LeftOuterSemiJoin, it will not add or remove any row. The last column is a boolean value, whose Cardinality should be two. If the type of join is inner/outer join, the output of join(s, t) should be N(s) * N(t) / (V(s.key) * V(t.key)) * Min(s.key, t.key). N(s) stands for the number of rows in relation s. V(s.key) means the Cardinality of join key in s. This is a quite simple strategy: We assume every bucket of relation which will participate join has the same number of rows, and apply cross join for every matched bucket.

func (LogicalJoin) Init

Init initializes LogicalJoin.

func (*LogicalJoin) PredicatePushDown

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalJoin) PruneColumns

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

PruneColumns implements LogicalPlan interface.

func (*LogicalJoin) Schema

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

Schema implements the Plan.Schema interface.

func (*LogicalJoin) SetSchema

func (s *LogicalJoin) 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 (p *LogicalLimit) Children() []LogicalPlan

Children implements LogicalPlan Children interface.

func (*LogicalLimit) DeriveStats

func (p *LogicalLimit) DeriveStats(childStats []*property.StatsInfo) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (LogicalLimit) Init

Init initializes LogicalLimit.

func (*LogicalLimit) MaxOneRow

func (p *LogicalLimit) MaxOneRow() bool

func (*LogicalLimit) PredicatePushDown

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalLimit) PruneColumns

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

PruneColumns implements LogicalPlan interface.

func (*LogicalLimit) Schema

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

Schema implements Plan Schema interface.

func (*LogicalLimit) SetChildren

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

SetChildren implements LogicalPlan SetChildren interface.

type LogicalLock

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

LogicalLock represents a select lock plan.

func (*LogicalLock) Children

func (p *LogicalLock) Children() []LogicalPlan

Children implements LogicalPlan Children interface.

func (*LogicalLock) DeriveStats

func (p *LogicalLock) DeriveStats(childStats []*property.StatsInfo) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (LogicalLock) Init

Init initializes LogicalLock.

func (*LogicalLock) MaxOneRow

func (p *LogicalLock) MaxOneRow() bool

func (*LogicalLock) PredicatePushDown

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

PredicatePushDown implements LogicalPlan interface.

func (*LogicalLock) PruneColumns

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

PruneColumns implements LogicalPlan interface.

func (*LogicalLock) Schema

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

Schema implements Plan Schema interface.

func (*LogicalLock) SetChildren

func (p *LogicalLock) SetChildren(children ...LogicalPlan)

SetChildren implements LogicalPlan SetChildren interface.

type LogicalMaxOneRow

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

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

func (*LogicalMaxOneRow) Children

func (p *LogicalMaxOneRow) Children() []LogicalPlan

Children implements LogicalPlan Children interface.

func (*LogicalMaxOneRow) DeriveStats

func (p *LogicalMaxOneRow) DeriveStats(childStats []*property.StatsInfo) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (LogicalMaxOneRow) Init

Init initializes LogicalMaxOneRow.

func (*LogicalMaxOneRow) MaxOneRow

func (p *LogicalMaxOneRow) MaxOneRow() bool

func (*LogicalMaxOneRow) PredicatePushDown

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalMaxOneRow) PruneColumns

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

PruneColumns implements LogicalPlan interface.

func (*LogicalMaxOneRow) Schema

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

Schema implements Plan Schema interface.

func (*LogicalMaxOneRow) SetChildren

func (p *LogicalMaxOneRow) SetChildren(children ...LogicalPlan)

SetChildren implements LogicalPlan SetChildren 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)

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

	// DeriveStats derives statistic info for current plan node given child stats.
	DeriveStats(childStats []*property.StatsInfo) (*property.StatsInfo, error)

	// MaxOneRow means whether this operator only returns max one row.
	MaxOneRow() bool

	// Get all the children.
	Children() []LogicalPlan

	// SetChildren sets the children for the plan.
	SetChildren(...LogicalPlan)
	// 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 LogicalProjection

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

LogicalProjection represents a select fields plan.

func (*LogicalProjection) DeriveStats

func (p *LogicalProjection) DeriveStats(childStats []*property.StatsInfo) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (LogicalProjection) Init

Init initializes LogicalProjection.

func (*LogicalProjection) PredicatePushDown

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalProjection) PruneColumns

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

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

func (*LogicalProjection) Schema

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

Schema implements the Plan.Schema interface.

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 (p *LogicalSelection) Children() []LogicalPlan

Children implements LogicalPlan Children interface.

func (*LogicalSelection) DeriveStats

func (p *LogicalSelection) DeriveStats(childStats []*property.StatsInfo) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (LogicalSelection) Init

Init initializes LogicalSelection.

func (*LogicalSelection) MaxOneRow

func (p *LogicalSelection) MaxOneRow() bool

func (*LogicalSelection) PredicatePushDown

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalSelection) PruneColumns

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

PruneColumns implements LogicalPlan interface.

func (*LogicalSelection) Schema

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

Schema implements Plan Schema interface.

func (*LogicalSelection) SetChildren

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

SetChildren implements LogicalPlan SetChildren interface.

type LogicalSort

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

LogicalSort stands for the order by plan.

func (*LogicalSort) Children

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

Children implements LogicalPlan Children interface.

func (*LogicalSort) DeriveStats

func (p *LogicalSort) DeriveStats(childStats []*property.StatsInfo) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (LogicalSort) Init

func (ls LogicalSort) Init(ctx sessionctx.Context) *LogicalSort

Init initializes LogicalSort.

func (*LogicalSort) MaxOneRow

func (p *LogicalSort) MaxOneRow() bool

func (*LogicalSort) PredicatePushDown

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

PredicatePushDown implements LogicalPlan interface.

func (*LogicalSort) PruneColumns

func (ls *LogicalSort) PruneColumns(parentUsedCols []*expression.Column) error

PruneColumns implements LogicalPlan interface.

func (*LogicalSort) Schema

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

Schema implements Plan Schema interface.

func (*LogicalSort) SetChildren

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

SetChildren implements LogicalPlan SetChildren interface.

type LogicalTableDual

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

LogicalTableDual represents a dual table plan.

func (*LogicalTableDual) DeriveStats

func (p *LogicalTableDual) DeriveStats(childStats []*property.StatsInfo) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (LogicalTableDual) Init

Init initializes LogicalTableDual.

func (*LogicalTableDual) PredicatePushDown

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalTableDual) PruneColumns

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

PruneColumns implements LogicalPlan interface.

func (*LogicalTableDual) Schema

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

Schema implements the Plan.Schema interface.

func (*LogicalTableDual) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type LogicalTopN

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

LogicalTopN represents a top-n plan.

func (*LogicalTopN) Children

func (p *LogicalTopN) Children() []LogicalPlan

Children implements LogicalPlan Children interface.

func (*LogicalTopN) DeriveStats

func (lt *LogicalTopN) DeriveStats(childStats []*property.StatsInfo) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (LogicalTopN) Init

func (lt LogicalTopN) Init(ctx sessionctx.Context) *LogicalTopN

Init initializes LogicalTopN.

func (*LogicalTopN) MaxOneRow

func (p *LogicalTopN) MaxOneRow() bool

func (*LogicalTopN) PredicatePushDown

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

PredicatePushDown implements LogicalPlan interface.

func (*LogicalTopN) PruneColumns

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

PruneColumns implements LogicalPlan interface.

func (*LogicalTopN) Schema

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

Schema implements Plan Schema interface.

func (*LogicalTopN) SetChildren

func (p *LogicalTopN) SetChildren(children ...LogicalPlan)

SetChildren implements LogicalPlan SetChildren interface.

type LogicalUnionAll

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

LogicalUnionAll represents LogicalUnionAll plan.

func (*LogicalUnionAll) DeriveStats

func (p *LogicalUnionAll) DeriveStats(childStats []*property.StatsInfo) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (LogicalUnionAll) Init

Init initializes LogicalUnionAll.

func (*LogicalUnionAll) PredicatePushDown

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalUnionAll) PruneColumns

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

PruneColumns implements LogicalPlan interface.

func (*LogicalUnionAll) Schema

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

Schema implements the Plan.Schema interface.

func (*LogicalUnionAll) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type LogicalUnionScan

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

LogicalUnionScan is only used in non read-only txn.

func (*LogicalUnionScan) Children

func (p *LogicalUnionScan) Children() []LogicalPlan

Children implements LogicalPlan Children interface.

func (*LogicalUnionScan) DeriveStats

func (p *LogicalUnionScan) DeriveStats(childStats []*property.StatsInfo) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (LogicalUnionScan) Init

Init initializes LogicalUnionScan.

func (*LogicalUnionScan) MaxOneRow

func (p *LogicalUnionScan) MaxOneRow() bool

func (*LogicalUnionScan) PredicatePushDown

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalUnionScan) PruneColumns

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

PruneColumns implements LogicalPlan interface.

func (*LogicalUnionScan) Schema

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

Schema implements Plan Schema interface.

func (*LogicalUnionScan) SetChildren

func (p *LogicalUnionScan) SetChildren(children ...LogicalPlan)

SetChildren implements LogicalPlan SetChildren interface.

type LogicalWindow

type LogicalWindow struct {
	WindowFuncDescs []*aggregation.WindowFuncDesc
	PartitionBy     []property.Item
	OrderBy         []property.Item
	Frame           *WindowFrame
	// contains filtered or unexported fields
}

LogicalWindow represents a logical window function plan.

func (*LogicalWindow) DeriveStats

func (p *LogicalWindow) DeriveStats(childStats []*property.StatsInfo) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (*LogicalWindow) GetWindowResultColumns

func (p *LogicalWindow) GetWindowResultColumns() []*expression.Column

GetWindowResultColumns returns the columns storing the result of the window function.

func (LogicalWindow) Init

Init initializes LogicalWindow.

func (*LogicalWindow) PredicatePushDown

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalWindow) PruneColumns

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

PruneColumns implements LogicalPlan interface.

func (*LogicalWindow) Schema

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

Schema implements the Plan.Schema interface.

func (*LogicalWindow) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type NominalSort

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

NominalSort asks sort properties for its child. It is a fake operator that will not appear in final physical operator tree.

func (*NominalSort) Children

func (p *NominalSort) Children() []PhysicalPlan

Children implements PhysicalPlan Children interface.

func (*NominalSort) ExplainInfo

func (p *NominalSort) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (*NominalSort) GetChildReqProps

func (p *NominalSort) GetChildReqProps(idx int) *property.PhysicalProperty

func (NominalSort) Init

Init initializes NominalSort.

func (*NominalSort) ResolveIndices

func (p *NominalSort) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*NominalSort) Schema

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

Schema implements Plan Schema interface.

func (*NominalSort) SetChildren

func (p *NominalSort) SetChildren(children ...PhysicalPlan)

SetChildren implements PhysicalPlan SetChildren interface.

func (*NominalSort) StatsCount

func (p *NominalSort) StatsCount() float64

func (*NominalSort) ToPB

func (p *NominalSort) ToPB(_ sessionctx.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 PhysicalApply

type PhysicalApply struct {
	PhysicalHashJoin

	OuterSchema []*expression.CorrelatedColumn
	// contains filtered or unexported fields
}

PhysicalApply represents apply plan, only used for subquery.

func (PhysicalApply) Init

Init initializes PhysicalApply.

func (*PhysicalApply) ResolveIndices

func (p *PhysicalApply) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalApply) Schema

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

Schema implements the Plan.Schema interface.

func (*PhysicalApply) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type PhysicalHashAgg

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

PhysicalHashAgg is hash operator of aggregate.

func (*PhysicalHashAgg) ExplainInfo

func (p *PhysicalHashAgg) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalHashAgg) Init

func (base PhysicalHashAgg) Init(ctx sessionctx.Context, stats *property.StatsInfo) *basePhysicalAgg

Init initializes basePhysicalAgg.

func (*PhysicalHashAgg) ResolveIndices

func (p *PhysicalHashAgg) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalHashAgg) ToPB

func (p *PhysicalHashAgg) ToPB(ctx sessionctx.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
	// InnerChildIdx indicates which child is to build the hash table.
	// For inner join, the smaller one will be chosen.
	// For outer join or semi join, it's exactly the inner one.
	InnerChildIdx int
	Concurrency   uint

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

PhysicalHashJoin represents hash join for inner/ outer join.

func (*PhysicalHashJoin) ExplainInfo

func (p *PhysicalHashJoin) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalHashJoin) Init

Init initializes PhysicalHashJoin.

func (*PhysicalHashJoin) ResolveIndices

func (p *PhysicalHashJoin) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalHashJoin) Schema

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

Schema implements the Plan.Schema interface.

func (*PhysicalHashJoin) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type PhysicalIndexJoin

type PhysicalIndexJoin struct {
	JoinType        JoinType
	OuterJoinKeys   []*expression.Column
	InnerJoinKeys   []*expression.Column
	LeftConditions  expression.CNFExprs
	RightConditions expression.CNFExprs
	OtherConditions expression.CNFExprs
	OuterIndex      int

	DefaultValues []types.Datum

	// Ranges stores the IndexRanges when the inner plan is index scan.
	Ranges []*ranger.Range
	// KeyOff2IdxOff maps the offsets in join key to the offsets in the index.
	KeyOff2IdxOff []int
	// CompareFilters stores the filters for last column if those filters need to be evaluated during execution.
	// e.g. select * from t where t.a = t1.a and t.b > t1.b and t.b < t1.b+10
	//      If there's index(t.a, t.b). All the filters can be used to construct index range but t.b > t1.b and t.b < t1.b=10
	//      need to be evaluated after we fetch the data of t1.
	// This struct stores them and evaluate them to ranges.
	CompareFilters *ColWithCmpFuncManager
	// contains filtered or unexported fields
}

PhysicalIndexJoin represents the plan of index look up join.

func (*PhysicalIndexJoin) ExplainInfo

func (p *PhysicalIndexJoin) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalIndexJoin) Init

Init initializes PhysicalIndexJoin.

func (*PhysicalIndexJoin) ResolveIndices

func (p *PhysicalIndexJoin) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalIndexJoin) Schema

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

Schema implements the Plan.Schema interface.

func (*PhysicalIndexJoin) SetSchema

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

SetSchema implements the Plan.SetSchema 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
	// contains filtered or unexported fields
}

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

func (*PhysicalIndexLookUpReader) ExplainInfo

func (p *PhysicalIndexLookUpReader) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalIndexLookUpReader) Init

Init initializes PhysicalIndexLookUpReader.

func (*PhysicalIndexLookUpReader) ResolveIndices

func (p *PhysicalIndexLookUpReader) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalIndexLookUpReader) Schema

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

Schema implements the Plan.Schema interface.

func (*PhysicalIndexLookUpReader) SetSchema

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

SetSchema implements the Plan.SetSchema 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
	// contains filtered or unexported fields
}

PhysicalIndexReader is the index reader in tidb.

func (*PhysicalIndexReader) ExplainInfo

func (p *PhysicalIndexReader) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalIndexReader) Init

Init initializes PhysicalIndexReader.

func (*PhysicalIndexReader) ResolveIndices

func (p *PhysicalIndexReader) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalIndexReader) Schema

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

Schema implements the Plan.Schema interface.

func (*PhysicalIndexReader) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type PhysicalIndexScan

type PhysicalIndexScan struct {

	// AccessCondition is used to calculate range.
	AccessCondition []expression.Expression

	Table      *model.TableInfo
	Index      *model.IndexInfo
	IdxCols    []*expression.Column
	IdxColLens []int
	Ranges     []*ranger.Range
	Columns    []*model.ColumnInfo
	DBName     model.CIStr
	Desc       bool
	KeepOrder  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

	// Hist is the histogram when the query was issued.
	// It is used for query feedback.
	Hist *statistics.Histogram
	// contains filtered or unexported fields
}

PhysicalIndexScan represents an index scan plan.

func (*PhysicalIndexScan) ExplainInfo

func (p *PhysicalIndexScan) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalIndexScan) Init

Init initializes PhysicalIndexScan.

func (*PhysicalIndexScan) IsPartition

func (p *PhysicalIndexScan) IsPartition() (bool, int64)

IsPartition returns true and partition ID if it works on a partition.

func (*PhysicalIndexScan) IsPointGetByUniqueKey

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

IsPointGetByUniqueKey checks whether is a point get by unique key.

func (*PhysicalIndexScan) ResolveIndices

func (p *PhysicalIndexScan) ResolveIndices() (err error)

func (*PhysicalIndexScan) Schema

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

Schema implements the Plan.Schema interface.

func (*PhysicalIndexScan) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

func (*PhysicalIndexScan) ToPB

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

ToPB implements PhysicalPlan ToPB interface.

type PhysicalLimit

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

PhysicalLimit is the physical operator of Limit.

func (*PhysicalLimit) Children

func (p *PhysicalLimit) Children() []PhysicalPlan

Children implements PhysicalPlan Children interface.

func (*PhysicalLimit) ExplainInfo

func (p *PhysicalLimit) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (*PhysicalLimit) GetChildReqProps

func (p *PhysicalLimit) GetChildReqProps(idx int) *property.PhysicalProperty

func (PhysicalLimit) Init

Init initializes PhysicalLimit.

func (*PhysicalLimit) ResolveIndices

func (p *PhysicalLimit) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalLimit) Schema

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

Schema implements Plan Schema interface.

func (*PhysicalLimit) SetChildren

func (p *PhysicalLimit) SetChildren(children ...PhysicalPlan)

SetChildren implements PhysicalPlan SetChildren interface.

func (*PhysicalLimit) StatsCount

func (p *PhysicalLimit) StatsCount() float64

func (*PhysicalLimit) ToPB

func (p *PhysicalLimit) ToPB(ctx sessionctx.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalLock

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

PhysicalLock is the physical operator of lock, which is used for `select ... for update` clause.

func (*PhysicalLock) Children

func (p *PhysicalLock) Children() []PhysicalPlan

Children implements PhysicalPlan Children interface.

func (*PhysicalLock) ExplainInfo

func (p *PhysicalLock) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (*PhysicalLock) GetChildReqProps

func (p *PhysicalLock) GetChildReqProps(idx int) *property.PhysicalProperty

func (PhysicalLock) Init

Init initializes PhysicalLock.

func (*PhysicalLock) ResolveIndices

func (p *PhysicalLock) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalLock) Schema

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

Schema implements Plan Schema interface.

func (*PhysicalLock) SetChildren

func (p *PhysicalLock) SetChildren(children ...PhysicalPlan)

SetChildren implements PhysicalPlan SetChildren interface.

func (*PhysicalLock) StatsCount

func (p *PhysicalLock) StatsCount() float64

func (*PhysicalLock) ToPB

func (p *PhysicalLock) ToPB(_ sessionctx.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalMaxOneRow

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

PhysicalMaxOneRow is the physical operator of maxOneRow.

func (*PhysicalMaxOneRow) Children

func (p *PhysicalMaxOneRow) Children() []PhysicalPlan

Children implements PhysicalPlan Children interface.

func (*PhysicalMaxOneRow) ExplainInfo

func (p *PhysicalMaxOneRow) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (*PhysicalMaxOneRow) GetChildReqProps

func (p *PhysicalMaxOneRow) GetChildReqProps(idx int) *property.PhysicalProperty

func (PhysicalMaxOneRow) Init

Init initializes PhysicalMaxOneRow.

func (*PhysicalMaxOneRow) ResolveIndices

func (p *PhysicalMaxOneRow) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalMaxOneRow) Schema

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

Schema implements Plan Schema interface.

func (*PhysicalMaxOneRow) SetChildren

func (p *PhysicalMaxOneRow) SetChildren(children ...PhysicalPlan)

SetChildren implements PhysicalPlan SetChildren interface.

func (*PhysicalMaxOneRow) StatsCount

func (p *PhysicalMaxOneRow) StatsCount() float64

func (*PhysicalMaxOneRow) ToPB

func (p *PhysicalMaxOneRow) ToPB(_ sessionctx.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalMemTable

type PhysicalMemTable struct {
	DBName      model.CIStr
	Table       *model.TableInfo
	Columns     []*model.ColumnInfo
	TableAsName *model.CIStr
	// contains filtered or unexported fields
}

PhysicalMemTable reads memory table.

func (PhysicalMemTable) Init

Init initializes PhysicalMemTable.

func (*PhysicalMemTable) ResolveIndices

func (p *PhysicalMemTable) ResolveIndices() (err error)

func (*PhysicalMemTable) Schema

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

Schema implements the Plan.Schema interface.

func (*PhysicalMemTable) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type PhysicalMergeJoin

type PhysicalMergeJoin struct {
	JoinType JoinType

	CompareFuncs    []expression.CompareFunc
	LeftConditions  []expression.Expression
	RightConditions []expression.Expression
	OtherConditions []expression.Expression

	DefaultValues []types.Datum

	LeftKeys  []*expression.Column
	RightKeys []*expression.Column
	// contains filtered or unexported fields
}

PhysicalMergeJoin represents merge join for inner/ outer join.

func (*PhysicalMergeJoin) ExplainInfo

func (p *PhysicalMergeJoin) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalMergeJoin) Init

Init initializes PhysicalMergeJoin.

func (*PhysicalMergeJoin) ResolveIndices

func (p *PhysicalMergeJoin) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalMergeJoin) Schema

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

Schema implements the Plan.Schema interface.

func (*PhysicalMergeJoin) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type PhysicalPlan

type PhysicalPlan interface {
	Plan

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

	// ExplainInfo returns operator information to be explained.
	ExplainInfo() string

	// getChildReqProps gets the required property by child index.
	GetChildReqProps(idx int) *property.PhysicalProperty

	// StatsCount returns the count of property.StatsInfo for this plan.
	StatsCount() float64

	// Get all the children.
	Children() []PhysicalPlan

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

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

PhysicalPlan is a tree of the physical operators.

func DoOptimize

func DoOptimize(flag uint64, logic LogicalPlan) (PhysicalPlan, error)

DoOptimize optimizes a logical plan to a physical plan.

type PhysicalProjection

type PhysicalProjection struct {
	Exprs                []expression.Expression
	CalculateNoDelay     bool
	AvoidColumnEvaluator bool
	// contains filtered or unexported fields
}

PhysicalProjection is the physical operator of projection.

func (*PhysicalProjection) ExplainInfo

func (p *PhysicalProjection) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalProjection) Init

Init initializes PhysicalProjection.

func (*PhysicalProjection) ResolveIndices

func (p *PhysicalProjection) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalProjection) Schema

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

Schema implements the Plan.Schema interface.

func (*PhysicalProjection) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type PhysicalSelection

type PhysicalSelection struct {
	Conditions []expression.Expression
	// contains filtered or unexported fields
}

PhysicalSelection represents a filter.

func (*PhysicalSelection) Children

func (p *PhysicalSelection) Children() []PhysicalPlan

Children implements PhysicalPlan Children interface.

func (*PhysicalSelection) ExplainInfo

func (p *PhysicalSelection) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (*PhysicalSelection) GetChildReqProps

func (p *PhysicalSelection) GetChildReqProps(idx int) *property.PhysicalProperty

func (PhysicalSelection) Init

Init initializes PhysicalSelection.

func (*PhysicalSelection) ResolveIndices

func (p *PhysicalSelection) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalSelection) Schema

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

Schema implements Plan Schema interface.

func (*PhysicalSelection) SetChildren

func (p *PhysicalSelection) SetChildren(children ...PhysicalPlan)

SetChildren implements PhysicalPlan SetChildren interface.

func (*PhysicalSelection) StatsCount

func (p *PhysicalSelection) StatsCount() float64

func (*PhysicalSelection) ToPB

func (p *PhysicalSelection) ToPB(ctx sessionctx.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalSort

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

PhysicalSort is the physical operator of sort, which implements a memory sort.

func (*PhysicalSort) Children

func (p *PhysicalSort) Children() []PhysicalPlan

Children implements PhysicalPlan Children interface.

func (*PhysicalSort) ExplainInfo

func (p *PhysicalSort) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (*PhysicalSort) GetChildReqProps

func (p *PhysicalSort) GetChildReqProps(idx int) *property.PhysicalProperty

func (*PhysicalSort) GetCost

func (p *PhysicalSort) GetCost(count float64) float64

GetCost computes the cost of in memory sort.

func (PhysicalSort) Init

Init initializes PhysicalSort.

func (*PhysicalSort) ResolveIndices

func (p *PhysicalSort) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalSort) Schema

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

Schema implements Plan Schema interface.

func (*PhysicalSort) SetChildren

func (p *PhysicalSort) SetChildren(children ...PhysicalPlan)

SetChildren implements PhysicalPlan SetChildren interface.

func (*PhysicalSort) StatsCount

func (p *PhysicalSort) StatsCount() float64

func (*PhysicalSort) ToPB

func (p *PhysicalSort) ToPB(_ sessionctx.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalStreamAgg

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

PhysicalStreamAgg is stream operator of aggregate.

func (*PhysicalStreamAgg) ExplainInfo

func (p *PhysicalStreamAgg) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalStreamAgg) Init

func (base PhysicalStreamAgg) Init(ctx sessionctx.Context, stats *property.StatsInfo) *basePhysicalAgg

Init initializes basePhysicalAgg.

func (*PhysicalStreamAgg) ResolveIndices

func (p *PhysicalStreamAgg) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalStreamAgg) ToPB

func (p *PhysicalStreamAgg) ToPB(ctx sessionctx.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalTableDual

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

PhysicalTableDual is the physical operator of dual.

func (*PhysicalTableDual) ExplainInfo

func (p *PhysicalTableDual) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalTableDual) Init

Init initializes PhysicalTableDual.

func (*PhysicalTableDual) ResolveIndices

func (p *PhysicalTableDual) ResolveIndices() (err error)

func (*PhysicalTableDual) Schema

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

Schema implements the Plan.Schema interface.

func (*PhysicalTableDual) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type PhysicalTableReader

type PhysicalTableReader struct {

	// TablePlans flats the tablePlan to construct executor pb.
	TablePlans []PhysicalPlan
	// contains filtered or unexported fields
}

PhysicalTableReader is the table reader in tidb.

func (*PhysicalTableReader) ExplainInfo

func (p *PhysicalTableReader) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalTableReader) Init

Init initializes PhysicalTableReader.

func (*PhysicalTableReader) ResolveIndices

func (p *PhysicalTableReader) ResolveIndices() error

ResolveIndices implements Plan interface.

func (*PhysicalTableReader) Schema

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

Schema implements the Plan.Schema interface.

func (*PhysicalTableReader) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type PhysicalTableScan

type PhysicalTableScan struct {

	// AccessCondition is used to calculate range.
	AccessCondition []expression.Expression

	Table   *model.TableInfo
	Columns []*model.ColumnInfo
	DBName  model.CIStr
	Desc    bool
	Ranges  []*ranger.Range

	TableAsName *model.CIStr

	// KeepOrder is true, if sort data by scanning pkcol,
	KeepOrder bool

	// Hist is the histogram when the query was issued.
	// It is used for query feedback.
	Hist *statistics.Histogram
	// contains filtered or unexported fields
}

PhysicalTableScan represents a table scan plan.

func (*PhysicalTableScan) ExplainInfo

func (p *PhysicalTableScan) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalTableScan) Init

Init initializes PhysicalTableScan.

func (*PhysicalTableScan) IsPartition

func (ts *PhysicalTableScan) IsPartition() (bool, int64)

IsPartition returns true and partition ID if it's actually a partition.

func (*PhysicalTableScan) ResolveIndices

func (p *PhysicalTableScan) ResolveIndices() (err error)

func (*PhysicalTableScan) Schema

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

Schema implements the Plan.Schema interface.

func (*PhysicalTableScan) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

func (*PhysicalTableScan) ToPB

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

ToPB implements PhysicalPlan ToPB interface.

type PhysicalTopN

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

PhysicalTopN is the physical operator of topN.

func (*PhysicalTopN) Children

func (p *PhysicalTopN) Children() []PhysicalPlan

Children implements PhysicalPlan Children interface.

func (*PhysicalTopN) ExplainInfo

func (p *PhysicalTopN) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (*PhysicalTopN) GetChildReqProps

func (p *PhysicalTopN) GetChildReqProps(idx int) *property.PhysicalProperty

func (PhysicalTopN) Init

Init initializes PhysicalTopN.

func (*PhysicalTopN) ResolveIndices

func (p *PhysicalTopN) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalTopN) Schema

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

Schema implements Plan Schema interface.

func (*PhysicalTopN) SetChildren

func (p *PhysicalTopN) SetChildren(children ...PhysicalPlan)

SetChildren implements PhysicalPlan SetChildren interface.

func (*PhysicalTopN) StatsCount

func (p *PhysicalTopN) StatsCount() float64

func (*PhysicalTopN) ToPB

func (p *PhysicalTopN) ToPB(ctx sessionctx.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalUnionAll

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

PhysicalUnionAll is the physical operator of UnionAll.

func (PhysicalUnionAll) Init

Init initializes PhysicalUnionAll.

func (*PhysicalUnionAll) ResolveIndices

func (p *PhysicalUnionAll) ResolveIndices() (err error)

func (*PhysicalUnionAll) Schema

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

Schema implements the Plan.Schema interface.

func (*PhysicalUnionAll) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type PhysicalUnionScan

type PhysicalUnionScan struct {
	Conditions []expression.Expression
	// contains filtered or unexported fields
}

PhysicalUnionScan represents a union scan operator.

func (*PhysicalUnionScan) Children

func (p *PhysicalUnionScan) Children() []PhysicalPlan

Children implements PhysicalPlan Children interface.

func (*PhysicalUnionScan) ExplainInfo

func (p *PhysicalUnionScan) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (*PhysicalUnionScan) GetChildReqProps

func (p *PhysicalUnionScan) GetChildReqProps(idx int) *property.PhysicalProperty

func (PhysicalUnionScan) Init

Init initializes PhysicalUnionScan.

func (*PhysicalUnionScan) ResolveIndices

func (p *PhysicalUnionScan) ResolveIndices() (err error)

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 ...PhysicalPlan)

SetChildren implements PhysicalPlan SetChildren interface.

func (*PhysicalUnionScan) StatsCount

func (p *PhysicalUnionScan) StatsCount() float64

func (*PhysicalUnionScan) ToPB

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

ToPB implements PhysicalPlan ToPB interface.

type PhysicalWindow

type PhysicalWindow struct {
	WindowFuncDescs []*aggregation.WindowFuncDesc
	PartitionBy     []property.Item
	OrderBy         []property.Item
	Frame           *WindowFrame
	// contains filtered or unexported fields
}

PhysicalWindow is the physical operator of window function.

func (*PhysicalWindow) ExplainInfo

func (p *PhysicalWindow) ExplainInfo() string

ExplainInfo implements PhysicalPlan interface.

func (PhysicalWindow) Init

Init initializes PhysicalWindow.

func (*PhysicalWindow) ResolveIndices

func (p *PhysicalWindow) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalWindow) Schema

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

Schema implements the Plan.Schema interface.

func (*PhysicalWindow) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type Plan

type Plan interface {
	// Get the schema.
	Schema() *expression.Schema
	// Get the ID.
	ID() int
	// Get the ID in explain statement
	ExplainID() fmt.Stringer
	// 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 sessionctx.Context, node ast.Node, is infoschema.InfoSchema) (Plan, error)

BuildLogicalPlan used to build logical plan from ast.Node.

func TryFastPlan

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

TryFastPlan tries to use the PointGetPlan for the query.

type PlanBuilder

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

PlanBuilder builds Plan from an ast.Node. It just builds the ast node straightforwardly.

func NewPlanBuilder

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

NewPlanBuilder creates a new PlanBuilder.

func (*PlanBuilder) Build

func (b *PlanBuilder) Build(node ast.Node) (Plan, error)

Build builds the ast node to a Plan.

func (*PlanBuilder) BuildDataSourceFromView

func (b *PlanBuilder) BuildDataSourceFromView(dbName model.CIStr, tableInfo *model.TableInfo) (LogicalPlan, error)

BuildDataSourceFromView is used to build LogicalPlan from view

func (*PlanBuilder) GetDBTableInfo

func (b *PlanBuilder) GetDBTableInfo() []stmtctx.TableEntry

GetDBTableInfo gets the accessed dbs and tables info.

func (*PlanBuilder) GetOptFlag

func (b *PlanBuilder) GetOptFlag() uint64

GetOptFlag gets the optFlag of the PlanBuilder.

func (*PlanBuilder) GetVisitInfo

func (b *PlanBuilder) GetVisitInfo() []visitInfo

GetVisitInfo gets the visitInfo of the PlanBuilder.

func (*PlanBuilder) TableHints

func (b *PlanBuilder) TableHints() *tableHintInfo

TableHints returns the *tableHintInfo of PlanBuilder.

type PointGetPlan

type PointGetPlan struct {
	TblInfo          *model.TableInfo
	IndexInfo        *model.IndexInfo
	Handle           int64
	HandleParam      *driver.ParamMarkerExpr
	UnsignedHandle   bool
	IndexValues      []types.Datum
	IndexValueParams []*driver.ParamMarkerExpr

	IsTableDual bool
	Lock        bool
	IsForUpdate bool
	// contains filtered or unexported fields
}

PointGetPlan is a fast plan for simple point get. When we detect that the statement has a unique equal access condition, this plan is used. This plan is much faster to build and to execute because it avoid the optimization and coprocessor cost.

func (*PointGetPlan) Children

func (p *PointGetPlan) Children() []PhysicalPlan

Children gets all the children.

func (*PointGetPlan) ExplainID

func (p *PointGetPlan) ExplainID() fmt.Stringer

func (*PointGetPlan) ExplainInfo

func (p *PointGetPlan) ExplainInfo() string

ExplainInfo returns operator information to be explained.

func (*PointGetPlan) GetChildReqProps

func (p *PointGetPlan) GetChildReqProps(idx int) *property.PhysicalProperty

GetChildReqProps gets the required property by child index.

func (*PointGetPlan) ID

func (p *PointGetPlan) ID() int

ID implements Plan ID interface.

func (*PointGetPlan) ResolveIndices

func (p *PointGetPlan) ResolveIndices() error

ResolveIndices resolves the indices for columns. After doing this, the columns can evaluate the rows by their indices.

func (*PointGetPlan) Schema

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

Schema implements the Plan interface.

func (*PointGetPlan) SetChildren

func (p *PointGetPlan) SetChildren(...PhysicalPlan)

SetChildren sets the children for the plan.

func (*PointGetPlan) StatsCount

func (p *PointGetPlan) StatsCount() float64

StatsCount will return the the RowCount of property.StatsInfo for this plan.

func (*PointGetPlan) ToPB

func (p *PointGetPlan) ToPB(ctx sessionctx.Context) (*tipb.Executor, error)

ToPB converts physical plan to tipb executor.

type Prepare

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

Prepare represents prepare plan.

func (*Prepare) ResolveIndices

func (p *Prepare) ResolveIndices() (err error)

func (*Prepare) Schema

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

Schema implements the Plan.Schema interface.

func (*Prepare) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type PreprocessOpt

type PreprocessOpt func(*preprocessor)

PreprocessOpt presents optional parameters to `Preprocess` method.

type RecoverIndex

type RecoverIndex struct {
	Table     *ast.TableName
	IndexName string
	// contains filtered or unexported fields
}

RecoverIndex is used for backfilling corrupted index data.

func (*RecoverIndex) ResolveIndices

func (p *RecoverIndex) ResolveIndices() (err error)

func (*RecoverIndex) Schema

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

Schema implements the Plan.Schema interface.

func (*RecoverIndex) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type ReloadExprPushdownBlacklist

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

ReloadExprPushdownBlacklist reloads the data from expr_pushdown_blacklist table.

func (*ReloadExprPushdownBlacklist) ResolveIndices

func (p *ReloadExprPushdownBlacklist) ResolveIndices() (err error)

func (*ReloadExprPushdownBlacklist) Schema

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

Schema implements the Plan.Schema interface.

func (*ReloadExprPushdownBlacklist) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type SQLBindOpType

type SQLBindOpType int

SQLBindOpType repreents the SQL bind type

const (
	// OpSQLBindCreate represents the operation to create a SQL bind.
	OpSQLBindCreate SQLBindOpType = iota
	// OpSQLBindDrop represents the operation to drop a SQL bind.
	OpSQLBindDrop
)

type SQLBindPlan

type SQLBindPlan struct {
	SQLBindOp    SQLBindOpType
	NormdOrigSQL string
	BindSQL      string
	IsGlobal     bool
	BindStmt     ast.StmtNode
	Charset      string
	Collation    string
	// contains filtered or unexported fields
}

SQLBindPlan represents a plan for SQL bind.

func (*SQLBindPlan) ResolveIndices

func (p *SQLBindPlan) ResolveIndices() (err error)

func (*SQLBindPlan) Schema

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

Schema implements the Plan.Schema interface.

func (*SQLBindPlan) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type Set

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

Set represents a plan for set stmt.

func (*Set) ResolveIndices

func (p *Set) ResolveIndices() (err error)

func (*Set) Schema

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

Schema implements the Plan.Schema interface.

func (*Set) SetSchema

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

SetSchema implements the 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.
	Roles       []*auth.RoleIdentity // Used for show grants.
	IfNotExists bool                 // Used for `show create database if not exists`

	Conditions []expression.Expression

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

Show represents a show plan.

func (Show) Init

func (p Show) Init(ctx sessionctx.Context) *Show

Init initializes Show.

func (*Show) ResolveIndices

func (p *Show) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*Show) Schema

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

Schema implements the Plan.Schema interface.

func (*Show) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type ShowDDL

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

ShowDDL is for showing DDL information.

func (*ShowDDL) ResolveIndices

func (p *ShowDDL) ResolveIndices() (err error)

func (*ShowDDL) Schema

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

Schema implements the Plan.Schema interface.

func (*ShowDDL) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type ShowDDLJobQueries

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

ShowDDLJobQueries is for showing DDL job queries sql.

func (*ShowDDLJobQueries) ResolveIndices

func (p *ShowDDLJobQueries) ResolveIndices() (err error)

func (*ShowDDLJobQueries) Schema

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

Schema implements the Plan.Schema interface.

func (*ShowDDLJobQueries) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type ShowDDLJobs

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

ShowDDLJobs is for showing DDL job list.

func (*ShowDDLJobs) ResolveIndices

func (p *ShowDDLJobs) ResolveIndices() (err error)

func (*ShowDDLJobs) Schema

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

Schema implements the Plan.Schema interface.

func (*ShowDDLJobs) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type ShowNextRowID

type ShowNextRowID struct {
	TableName *ast.TableName
	// contains filtered or unexported fields
}

ShowNextRowID is for showing the next global row ID.

func (*ShowNextRowID) ResolveIndices

func (p *ShowNextRowID) ResolveIndices() (err error)

func (*ShowNextRowID) Schema

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

Schema implements the Plan.Schema interface.

func (*ShowNextRowID) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type ShowSlow

type ShowSlow struct {
	*ast.ShowSlow
	// contains filtered or unexported fields
}

ShowSlow is for showing slow queries.

func (*ShowSlow) ResolveIndices

func (p *ShowSlow) ResolveIndices() (err error)

func (*ShowSlow) Schema

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

Schema implements the Plan.Schema interface.

func (*ShowSlow) SetSchema

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

SetSchema implements the 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) ResolveIndices

func (p *Simple) ResolveIndices() (err error)

func (*Simple) Schema

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

Schema implements the Plan.Schema interface.

func (*Simple) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type SplitRegion

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

SplitRegion represents a split regions plan.

func (*SplitRegion) ResolveIndices

func (p *SplitRegion) ResolveIndices() (err error)

func (*SplitRegion) Schema

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

Schema implements the Plan.Schema interface.

func (*SplitRegion) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type Trace

type Trace struct {
	StmtNode ast.StmtNode
	Format   string
	// contains filtered or unexported fields
}

Trace represents a trace plan.

func (*Trace) ResolveIndices

func (p *Trace) ResolveIndices() (err error)

func (*Trace) Schema

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

Schema implements the Plan.Schema interface.

func (*Trace) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type Update

type Update struct {
	OrderedList []*expression.Assignment

	SelectPlan PhysicalPlan
	// contains filtered or unexported fields
}

Update represents Update plan.

func (Update) Init

func (p Update) Init(ctx sessionctx.Context) *Update

Init initializes Update.

func (*Update) ResolveIndices

func (p *Update) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*Update) Schema

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

Schema implements the Plan.Schema interface.

func (*Update) SetSchema

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

SetSchema implements the Plan.SetSchema interface.

type WindowFrame

type WindowFrame struct {
	Type  ast.FrameType
	Start *FrameBound
	End   *FrameBound
}

WindowFrame represents a window function frame.

type WindowFuncExtractor

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

WindowFuncExtractor visits Expr tree. It converts ColunmNameExpr to WindowFuncExpr and collects WindowFuncExpr.

func (*WindowFuncExtractor) Enter

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

Enter implements Visitor interface.

func (*WindowFuncExtractor) Leave

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

Leave implements Visitor interface.

Jump to

Keyboard shortcuts

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