executor

package
v0.0.0-...-503c688 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 197 Imported by: 0

Documentation

Index

Constants

View Source
const LoadDataVarKey loadDataVarKeyType = 0

LoadDataVarKey is a variable key for load data.

View Source
const LoadStatsVarKey loadStatsVarKeyType = 0

LoadStatsVarKey is a variable key for load statistic.

View Source
const LockStatsVarKey lockStatsVarKeyType = 0

LockStatsVarKey is a variable key for lock statistic.

View Source
const PlanReplayerDumpVarKey planReplayerDumpKeyType = 1

PlanReplayerDumpVarKey is a variable key for plan replayer dump.

View Source
const PlanReplayerLoadVarKey planReplayerLoadKeyType = 0

PlanReplayerLoadVarKey is a variable key for plan replayer load.

View Source
const UnlockStatsVarKey unlockStatsVarKeyType = 0

UnlockStatsVarKey is a variable key for unlock statistic.

Variables

View Source
var (
	// RandSeed is the seed for randing package.
	// It's public for test.
	RandSeed = int64(1)

	// MaxRegionSampleSize is the max sample size for one region when analyze v1 collects samples from table.
	// It's public for test.
	MaxRegionSampleSize = int64(1000)
)
View Source
var (

	// GlobalMemoryUsageTracker is the ancestor of all the Executors' memory tracker and GlobalMemory Tracker
	GlobalMemoryUsageTracker *memory.Tracker
	// GlobalDiskUsageTracker is the ancestor of all the Executors' disk tracker
	GlobalDiskUsageTracker *disk.Tracker
	// GlobalAnalyzeMemoryTracker is the ancestor of all the Analyze jobs' memory tracker and child of global Tracker
	GlobalAnalyzeMemoryTracker *memory.Tracker
)
View Source
var CloseSession func(ctx sessionctx.Context)

CloseSession will be assigned by session package.

View Source
var CreateSession func(ctx sessionctx.Context) (sessionctx.Context, error)

CreateSession will be assigned by session package.

View Source
var ErrSavepointNotSupportedWithBinlog = errors.New("SAVEPOINT is not supported when binlog is enabled")

ErrSavepointNotSupportedWithBinlog export for testing.

View Source
var LookupTableTaskChannelSize int32 = 50

LookupTableTaskChannelSize represents the channel size of the index double read taskChan.

View Source
var ParseSlowLogBatchSize = 64

ParseSlowLogBatchSize is the batch size of slow-log lines for a worker to parse, exported for testing.

View Source
var QueryReplacer = strings.NewReplacer("\r", " ", "\n", " ", "\t", " ")

QueryReplacer replaces new line and tab for grep result including query string.

View Source
var ShardCount = 320

ShardCount controls the shard maps within the concurrent map

View Source
var TableStatsCacheExpiry = 3 * time.Second

TableStatsCacheExpiry is the expiry time for table stats cache.

View Source
var TestSetConfigHTTPHandlerKey stringutil.StringerStr = "TestSetConfigHTTPHandlerKey"

TestSetConfigHTTPHandlerKey is used as the key to store 'TestSetConfigDoRequestFunc' in the context.

View Source
var TestSetConfigServerInfoKey stringutil.StringerStr = "TestSetConfigServerInfoKey"

TestSetConfigServerInfoKey is used as the key to store 'TestSetConfigServerInfoFunc' in the context.

View Source
var TestShowClusterConfigKey stringutil.StringerStr = "TestShowClusterConfigKey"

TestShowClusterConfigKey is the key used to store TestShowClusterConfigFunc.

Functions

func AddNewAnalyzeJob

func AddNewAnalyzeJob(ctx sessionctx.Context, job *statistics.AnalyzeJob)

AddNewAnalyzeJob records the new analyze job.

func ConstructResultOfShowCreateDatabase

func ConstructResultOfShowCreateDatabase(ctx sessionctx.Context, dbInfo *model.DBInfo, ifNotExists bool, buf *bytes.Buffer) (err error)

ConstructResultOfShowCreateDatabase constructs the result for show create database.

func ConstructResultOfShowCreatePlacementPolicy

func ConstructResultOfShowCreatePlacementPolicy(policyInfo *model.PolicyInfo) string

ConstructResultOfShowCreatePlacementPolicy constructs the result for show create placement policy.

func ConstructResultOfShowCreateSequence

func ConstructResultOfShowCreateSequence(ctx sessionctx.Context, tableInfo *model.TableInfo, buf *bytes.Buffer)

ConstructResultOfShowCreateSequence constructs the result for show create sequence.

func ConstructResultOfShowCreateTable

func ConstructResultOfShowCreateTable(ctx sessionctx.Context, tableInfo *model.TableInfo, allocators autoid.Allocators, buf *bytes.Buffer) (err error)

ConstructResultOfShowCreateTable constructs the result for show create table.

func ConvertConfigItem2JSON

func ConvertConfigItem2JSON(ctx sessionctx.Context, key string, val expression.Expression) (body string, err error)

ConvertConfigItem2JSON converts the config item specified by key and val to json. For example:

set config x key="val" ==> {"key":"val"}
set config x key=233 ==> {"key":233}

func CountStmtNode

func CountStmtNode(stmtNode ast.StmtNode, inRestrictedSQL bool)

CountStmtNode records the number of statements with the same type.

func DecodeRowValToChunk

func DecodeRowValToChunk(sctx sessionctx.Context, schema *expression.Schema, tblInfo *model.TableInfo,
	handle kv.Handle, rowVal []byte, chk *chunk.Chunk, rd *rowcodec.ChunkDecoder) error

DecodeRowValToChunk decodes row value into chunk checking row format used.

func DumpRealOutfile

func DumpRealOutfile(realBuf, lineBuf []byte, v float64, tp *types.FieldType) ([]byte, []byte)

DumpRealOutfile dumps a real number to lineBuf.

func EncodeUniqueIndexKey

func EncodeUniqueIndexKey(ctx sessionctx.Context, tblInfo *model.TableInfo, idxInfo *model.IndexInfo, idxVals []types.Datum, tID int64) (_ []byte, err error)

EncodeUniqueIndexKey encodes a unique index key.

func EncodeUniqueIndexValuesForKey

func EncodeUniqueIndexValuesForKey(ctx sessionctx.Context, tblInfo *model.TableInfo, idxInfo *model.IndexInfo, idxVals []types.Datum) (_ []byte, err error)

EncodeUniqueIndexValuesForKey encodes unique index values for a key.

func FinishAnalyzeJob

func FinishAnalyzeJob(sctx sessionctx.Context, job *statistics.AnalyzeJob, analyzeErr error)

FinishAnalyzeJob updates the state of the analyze job to finished/failed according to `meetError` and sets the end time.

func FinishAnalyzeMergeJob

func FinishAnalyzeMergeJob(sctx sessionctx.Context, job *statistics.AnalyzeJob, analyzeErr error)

FinishAnalyzeMergeJob finishes analyze merge job

func FormatSQL

func FormatSQL(sql string) stringutil.StringerFunc

FormatSQL is used to format the original SQL, e.g. truncating long SQL, appending prepared arguments.

func GenCascadeDeleteAST

func GenCascadeDeleteAST(schema, table, idx model.CIStr, cols []*model.ColumnInfo, fkValues [][]types.Datum) *ast.DeleteStmt

GenCascadeDeleteAST uses to generate cascade delete ast, export for test.

func GenCascadeSetNullAST

func GenCascadeSetNullAST(schema, table, idx model.CIStr, cols []*model.ColumnInfo, fkValues [][]types.Datum) *ast.UpdateStmt

GenCascadeSetNullAST uses to generate foreign key `SET NULL` ast, export for test.

func GenCascadeUpdateAST

func GenCascadeUpdateAST(schema, table, idx model.CIStr, cols []*model.ColumnInfo, couple *UpdatedValuesCouple) *ast.UpdateStmt

GenCascadeUpdateAST uses to generate cascade update ast, export for test.

func GetDropOrTruncateTableInfoFromJobs

func GetDropOrTruncateTableInfoFromJobs(jobs []*model.Job, gcSafePoint uint64, dom *domain.Domain, fn func(*model.Job, *model.TableInfo) (bool, error)) (bool, error)

GetDropOrTruncateTableInfoFromJobs gets the dropped/truncated table information from DDL jobs, it will use the `start_ts` of DDL job as snapshot to get the dropped/truncated table information.

func GetEncodedPlan

func GetEncodedPlan(stmtCtx *stmtctx.StatementContext, genHint bool) (encodedPlan, hintStr string)

GetEncodedPlan returned same as getEncodedPlan

func GetLackHandles

func GetLackHandles(expectedHandles []kv.Handle, obtainedHandlesMap *kv.HandleMap) []kv.Handle

GetLackHandles gets the handles in expectedHandles but not in obtainedHandlesMap.

func GetResourceGroupController

func GetResourceGroupController() *rmclient.ResourceGroupsController

GetResourceGroupController returns the ResourceGroupsController.

func GetResultRowsCount

func GetResultRowsCount(stmtCtx *stmtctx.StatementContext, p plannercore.Plan) int64

GetResultRowsCount gets the count of the statement result rows.

func IsFastPlan

func IsFastPlan(p plannercore.Plan) bool

IsFastPlan exports for testing.

func JoinerType

func JoinerType(j joiner) plannercore.JoinType

JoinerType returns the join type of a Joiner.

func LoadExprPushdownBlacklist

func LoadExprPushdownBlacklist(sctx sessionctx.Context) (err error)

LoadExprPushdownBlacklist loads the latest data from table mysql.expr_pushdown_blacklist.

func LoadOptRuleBlacklist

func LoadOptRuleBlacklist(ctx context.Context, sctx sessionctx.Context) (err error)

LoadOptRuleBlacklist loads the latest data from table mysql.opt_rule_blacklist.

func LockKeys

func LockKeys(ctx context.Context, sctx sessionctx.Context, lockWaitTime int64, keys ...kv.Key) error

LockKeys locks the keys for pessimistic transaction.

func MockNewCacheTableSnapShot

func MockNewCacheTableSnapShot(snapshot kv.Snapshot, memBuffer kv.MemBuffer) *cacheTableSnapshot

MockNewCacheTableSnapShot only serves for test.

func NewAnalyzeResultsNotifyWaitGroupWrapper

func NewAnalyzeResultsNotifyWaitGroupWrapper(notify chan *statistics.AnalyzeResults) *analyzeResultsNotifyWaitGroupWrapper

NewAnalyzeResultsNotifyWaitGroupWrapper is to create analyzeResultsNotifyWaitGroupWrapper

func NewProfileBuilder

func NewProfileBuilder(sctx sessionctx.Context, start, end time.Time, tp string) (*profileBuilder, error)

NewProfileBuilder returns a new profileBuilder.

func NewRowDecoder

func NewRowDecoder(ctx sessionctx.Context, schema *expression.Schema, tbl *model.TableInfo) *rowcodec.ChunkDecoder

NewRowDecoder creates a chunk decoder for new row format row value decode.

func Next

func Next(ctx context.Context, e Executor, req *chunk.Chunk) error

Next is a wrapper function on e.Next(), it handles some common codes.

func ParseTime

func ParseTime(s string) (time.Time, error)

ParseTime exports for testing.

func ResetContextOfStmt

func ResetContextOfStmt(ctx sessionctx.Context, s ast.StmtNode) (err error)

ResetContextOfStmt resets the StmtContext and session variables. Before every execution, we must clear statement context.

func ResetDeleteStmtCtx

func ResetDeleteStmtCtx(sc *stmtctx.StatementContext, stmt *ast.DeleteStmt, vars *variable.SessionVars)

ResetDeleteStmtCtx resets statement context for DeleteStmt.

func ResetUpdateStmtCtx

func ResetUpdateStmtCtx(sc *stmtctx.StatementContext, stmt *ast.UpdateStmt, vars *variable.SessionVars)

ResetUpdateStmtCtx resets statement context for UpdateStmt.

func SetFromString

func SetFromString(value string) []string

SetFromString constructs a slice of strings from a comma separated string. It is assumed that there is no duplicated entry. You could use addToSet to maintain this property. It is exported for tests. I HOPE YOU KNOW WHAT YOU ARE DOING.

func SetResourceGroupController

func SetResourceGroupController(rc *rmclient.ResourceGroupsController)

SetResourceGroupController set a inited ResourceGroupsController for calibrate usage.

func StartAnalyzeJob

func StartAnalyzeJob(sctx sessionctx.Context, job *statistics.AnalyzeJob)

StartAnalyzeJob marks the state of the analyze job as running and sets the start time.

func UpdateAnalyzeJob

func UpdateAnalyzeJob(sctx sessionctx.Context, job *statistics.AnalyzeJob, rowCount int64)

UpdateAnalyzeJob updates count of the processed rows when increment reaches a threshold.

Types

type AccountLockTelemetryInfo

type AccountLockTelemetryInfo struct {
	// The number of CREATE/ALTER USER statements that lock the user
	LockUser int64
	// The number of CREATE/ALTER USER statements that unlock the user
	UnlockUser int64
	// The number of CREATE/ALTER USER statements
	CreateOrAlterUser int64
}

AccountLockTelemetryInfo records account lock/unlock information during execution

type AdminPluginsExec

type AdminPluginsExec struct {
	Action  core.AdminPluginsAction
	Plugins []string
	// contains filtered or unexported fields
}

AdminPluginsExec indicates AdminPlugins executor.

func (*AdminPluginsExec) Close

func (e *AdminPluginsExec) Close() error

Close closes all executors and release all resources.

func (*AdminPluginsExec) Next

func (e *AdminPluginsExec) Next(ctx context.Context, _ *chunk.Chunk) error

Next implements the Executor Next interface.

func (*AdminPluginsExec) Open

func (e *AdminPluginsExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*AdminPluginsExec) Schema

func (e *AdminPluginsExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type AdminResetTelemetryIDExec

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

AdminResetTelemetryIDExec is an executor for ADMIN RESET TELEMETRY_ID.

func (*AdminResetTelemetryIDExec) Close

func (e *AdminResetTelemetryIDExec) Close() error

Close closes all executors and release all resources.

func (*AdminResetTelemetryIDExec) Next

Next implements the Executor Next interface.

func (*AdminResetTelemetryIDExec) Open

func (e *AdminResetTelemetryIDExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*AdminResetTelemetryIDExec) Schema

func (e *AdminResetTelemetryIDExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type AdminShowTelemetryExec

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

AdminShowTelemetryExec is an executor for ADMIN SHOW TELEMETRY.

func (*AdminShowTelemetryExec) Close

func (e *AdminShowTelemetryExec) Close() error

Close closes all executors and release all resources.

func (*AdminShowTelemetryExec) Next

Next implements the Executor Next interface.

func (*AdminShowTelemetryExec) Open

func (e *AdminShowTelemetryExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*AdminShowTelemetryExec) Schema

func (e *AdminShowTelemetryExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type AfFinalResult

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

AfFinalResult indicates aggregation functions final result.

type AggSpillDiskAction

type AggSpillDiskAction struct {
	memory.BaseOOMAction
	// contains filtered or unexported fields
}

AggSpillDiskAction implements memory.ActionOnExceed for unparalleled HashAgg. If the memory quota of a query is exceeded, AggSpillDiskAction.Action is triggered.

func (*AggSpillDiskAction) Action

func (a *AggSpillDiskAction) Action(t *memory.Tracker)

Action set HashAggExec spill mode.

func (*AggSpillDiskAction) GetPriority

func (*AggSpillDiskAction) GetPriority() int64

GetPriority get the priority of the Action

type AggWorkerInfo

type AggWorkerInfo struct {
	Concurrency int
	WallTime    int64
}

AggWorkerInfo contains the agg worker information.

type AggWorkerStat

type AggWorkerStat struct {
	TaskNum    int64
	WaitTime   int64
	ExecTime   int64
	WorkerTime int64
}

AggWorkerStat record the AggWorker runtime stat

func (*AggWorkerStat) Clone

func (w *AggWorkerStat) Clone() *AggWorkerStat

Clone implements the RuntimeStats interface.

type AnalyzeColumnsExec

type AnalyzeColumnsExec struct {
	core.AnalyzeInfo
	// contains filtered or unexported fields
}

AnalyzeColumnsExec represents Analyze columns push down executor.

type AnalyzeColumnsExecV1

type AnalyzeColumnsExecV1 struct {
	*AnalyzeColumnsExec
}

AnalyzeColumnsExecV1 is used to maintain v1 analyze process

type AnalyzeColumnsExecV2

type AnalyzeColumnsExecV2 struct {
	*AnalyzeColumnsExec
}

AnalyzeColumnsExecV2 is used to maintain v2 analyze process

type AnalyzeExec

type AnalyzeExec struct {
	OptionsMap map[int64]core.V2AnalyzeOptions
	// contains filtered or unexported fields
}

AnalyzeExec represents Analyze executor.

func (*AnalyzeExec) Close

func (e *AnalyzeExec) Close() error

Close closes all executors and release all resources.

func (*AnalyzeExec) Next

func (e *AnalyzeExec) Next(ctx context.Context, _ *chunk.Chunk) error

Next implements the Executor Next interface.

func (*AnalyzeExec) Open

func (e *AnalyzeExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*AnalyzeExec) Schema

func (e *AnalyzeExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type AnalyzeFastExec

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

AnalyzeFastExec represents Fast Analyze executor.

type AnalyzeIndexExec

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

AnalyzeIndexExec represents analyze index push down executor.

type AnalyzeTestFastExec

type AnalyzeTestFastExec struct {
	AnalyzeFastExec
	Ctx         sessionctx.Context
	TableID     statistics.AnalyzeTableID
	HandleCols  core.HandleCols
	ColsInfo    []*model.ColumnInfo
	IdxsInfo    []*model.IndexInfo
	Concurrency int
	Collectors  []*statistics.SampleCollector
	TblInfo     *model.TableInfo
	Opts        map[ast.AnalyzeOptionType]uint64
	Snapshot    uint64
}

AnalyzeTestFastExec is for fast sample in unit test.

func (*AnalyzeTestFastExec) TestFastSample

func (e *AnalyzeTestFastExec) TestFastSample() error

TestFastSample only test the fast sample in unit test.

type BRIEExec

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

BRIEExec represents an executor for BRIE statements (BACKUP, RESTORE, etc)

func (*BRIEExec) Close

func (e *BRIEExec) Close() error

Close closes all executors and release all resources.

func (*BRIEExec) Next

func (e *BRIEExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*BRIEExec) Open

func (e *BRIEExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*BRIEExec) Schema

func (e *BRIEExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type BatchPointGetExec

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

BatchPointGetExec executes a bunch of point select queries.

func (*BatchPointGetExec) Close

func (e *BatchPointGetExec) Close() error

Close implements the Executor interface.

func (*BatchPointGetExec) Next

func (e *BatchPointGetExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor interface.

func (*BatchPointGetExec) Open

Open implements the Executor interface.

func (*BatchPointGetExec) Schema

func (e *BatchPointGetExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type CTEExec

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

CTEExec implements CTE. Following diagram describes how CTEExec works.

`iterInTbl` is shared by `CTEExec` and `CTETableReaderExec`. `CTETableReaderExec` reads data from `iterInTbl`, and its output will be stored `iterOutTbl` by `CTEExec`.

When an iteration ends, `CTEExec` will move all data from `iterOutTbl` into `iterInTbl`, which will be the input for new iteration. At the end of each iteration, data in `iterOutTbl` will also be added into `resTbl`. `resTbl` stores data of all iteration.

                                  +----------+
                    write         |iterOutTbl|
      CTEExec ------------------->|          |
         |                        +----+-----+
   -------------                       | write
   |           |                       v
other op     other op             +----------+
(seed)       (recursive)          |  resTbl  |
                 ^                |          |
                 |                +----------+
           CTETableReaderExec
                  ^
                  |  read         +----------+
                  +---------------+iterInTbl |
                                  |          |
                                  +----------+

func (*CTEExec) Close

func (e *CTEExec) Close() (err error)

Close implements the Executor interface.

func (*CTEExec) Next

func (e *CTEExec) Next(ctx context.Context, req *chunk.Chunk) (err error)

Next implements the Executor interface.

func (*CTEExec) Open

func (e *CTEExec) Open(ctx context.Context) (err error)

Open implements the Executor interface.

func (*CTEExec) Schema

func (e *CTEExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type CTEStorages

type CTEStorages struct {
	ResTbl    cteutil.Storage
	IterInTbl cteutil.Storage
}

CTEStorages stores resTbl and iterInTbl for CTEExec. There will be a map[CTEStorageID]*CTEStorages in StmtCtx, which will store all CTEStorages to make all shared CTEs use same the CTEStorages.

type CTETableReaderExec

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

CTETableReaderExec scans data in iterInTbl, which is filled by corresponding CTEExec.

func (*CTETableReaderExec) Close

func (e *CTETableReaderExec) Close() (err error)

Close implements the Executor interface.

func (*CTETableReaderExec) Next

func (e *CTETableReaderExec) Next(ctx context.Context, req *chunk.Chunk) (err error)

Next implements the Executor interface.

func (*CTETableReaderExec) Open

func (e *CTETableReaderExec) Open(ctx context.Context) error

Open implements the Executor interface.

func (*CTETableReaderExec) Schema

func (e *CTETableReaderExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type CancelDDLJobsExec

type CancelDDLJobsExec struct {
	*CommandDDLJobsExec
}

CancelDDLJobsExec represents a cancel DDL jobs executor.

func (CancelDDLJobsExec) Close

func (e CancelDDLJobsExec) Close() error

Close closes all executors and release all resources.

func (CancelDDLJobsExec) Schema

func (e CancelDDLJobsExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type ChangeExec

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

ChangeExec represents a change executor.

func (*ChangeExec) Close

func (e *ChangeExec) Close() error

Close closes all executors and release all resources.

func (*ChangeExec) Next

func (e *ChangeExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*ChangeExec) Open

func (e *ChangeExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*ChangeExec) Schema

func (e *ChangeExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type CheckIndexRangeExec

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

CheckIndexRangeExec outputs the index values which has handle between begin and end.

func (*CheckIndexRangeExec) Close

func (e *CheckIndexRangeExec) Close() error

Close implements the Executor Close interface.

func (*CheckIndexRangeExec) Next

func (e *CheckIndexRangeExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*CheckIndexRangeExec) Open

Open implements the Executor Open interface.

func (*CheckIndexRangeExec) Schema

func (e *CheckIndexRangeExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type CheckTableExec

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

CheckTableExec represents a check table executor. It is built from the "admin check table" statement, and it checks if the index matches the records in the table.

func (*CheckTableExec) Close

func (e *CheckTableExec) Close() error

Close implements the Executor Close interface.

func (*CheckTableExec) Next

func (e *CheckTableExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*CheckTableExec) Open

func (e *CheckTableExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*CheckTableExec) Schema

func (e *CheckTableExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type ChecksumTableExec

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

ChecksumTableExec represents ChecksumTable executor.

func (*ChecksumTableExec) Close

func (e *ChecksumTableExec) Close() error

Close closes all executors and release all resources.

func (*ChecksumTableExec) Next

func (e *ChecksumTableExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*ChecksumTableExec) Open

func (e *ChecksumTableExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*ChecksumTableExec) Schema

func (e *ChecksumTableExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type CleanupIndexExec

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

CleanupIndexExec represents a cleanup index executor. It is built from "admin cleanup index" statement, is used to delete dangling index data.

func (*CleanupIndexExec) Close

func (e *CleanupIndexExec) Close() error

Close implements the Executor Close interface.

func (*CleanupIndexExec) Next

func (e *CleanupIndexExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*CleanupIndexExec) Open

func (e *CleanupIndexExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*CleanupIndexExec) Schema

func (e *CleanupIndexExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type Closeable

type Closeable interface {
	// Close closes the object.
	Close() error
}

Closeable is a interface for closeable structures.

type CommandDDLJobsExec

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

CommandDDLJobsExec is the general struct for Cancel/Pause/Resume commands on DDL jobs. These command currently by admin have the very similar struct and operations, it should be a better idea to have them in the same struct.

func (*CommandDDLJobsExec) Close

func (e *CommandDDLJobsExec) Close() error

Close closes all executors and release all resources.

func (*CommandDDLJobsExec) Next

func (e *CommandDDLJobsExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface for Cancel/Pause/Resume

func (*CommandDDLJobsExec) Open

func (e *CommandDDLJobsExec) Open(ctx context.Context) error

Open implements the Executor for all Cancel/Pause/Resume command on DDL jobs just with different processes. And, it should not be called directly by the Executor.

func (*CommandDDLJobsExec) Schema

func (e *CommandDDLJobsExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type CompactTableTiFlashExec

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

CompactTableTiFlashExec represents an executor for "ALTER TABLE [NAME] COMPACT TIFLASH REPLICA" statement.

func (*CompactTableTiFlashExec) Close

func (e *CompactTableTiFlashExec) Close() error

Close closes all executors and release all resources.

func (*CompactTableTiFlashExec) Next

Next implements the Executor Next interface.

func (*CompactTableTiFlashExec) Open

func (e *CompactTableTiFlashExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*CompactTableTiFlashExec) Schema

func (e *CompactTableTiFlashExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type Compiler

type Compiler struct {
	Ctx sessionctx.Context
}

Compiler compiles an ast.StmtNode to a physical plan.

func (*Compiler) Compile

func (c *Compiler) Compile(ctx context.Context, stmtNode ast.StmtNode) (_ *ExecStmt, err error)

Compile compiles an ast.StmtNode to a physical plan.

type CoprocessorDAGHandler

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

CoprocessorDAGHandler uses to handle cop dag request.

func NewCoprocessorDAGHandler

func NewCoprocessorDAGHandler(sctx sessionctx.Context) *CoprocessorDAGHandler

NewCoprocessorDAGHandler creates a new CoprocessorDAGHandler.

func (*CoprocessorDAGHandler) HandleRequest

HandleRequest handles the coprocessor request.

func (*CoprocessorDAGHandler) HandleStreamRequest

HandleStreamRequest handles the coprocessor stream request.

type DDLExec

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

DDLExec represents a DDL executor. It grabs a DDL instance from Domain, calling the DDL methods to do the work.

func (*DDLExec) Close

func (e *DDLExec) Close() error

Close closes all executors and release all resources.

func (*DDLExec) Next

func (e *DDLExec) Next(ctx context.Context, req *chunk.Chunk) (err error)

Next implements the Executor Next interface.

func (*DDLExec) Open

func (e *DDLExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*DDLExec) Schema

func (e *DDLExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type DDLJobRetriever

type DDLJobRetriever struct {
	TZLoc *time.Location
	// contains filtered or unexported fields
}

DDLJobRetriever retrieve the DDLJobs. nolint:structcheck

type DDLJobsReaderExec

type DDLJobsReaderExec struct {
	DDLJobRetriever
	// contains filtered or unexported fields
}

DDLJobsReaderExec executes DDLJobs information retrieving.

func (*DDLJobsReaderExec) Close

func (e *DDLJobsReaderExec) Close() error

Close implements the Executor Close interface.

func (*DDLJobsReaderExec) Next

func (e *DDLJobsReaderExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*DDLJobsReaderExec) Open

func (e *DDLJobsReaderExec) Open(ctx context.Context) error

Open implements the Executor Next interface.

func (*DDLJobsReaderExec) Schema

func (e *DDLJobsReaderExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type DeallocateExec

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

DeallocateExec represent a DEALLOCATE executor.

func (*DeallocateExec) Close

func (e *DeallocateExec) Close() error

Close closes all executors and release all resources.

func (*DeallocateExec) Next

func (e *DeallocateExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*DeallocateExec) Open

func (e *DeallocateExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*DeallocateExec) Schema

func (e *DeallocateExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type DeleteExec

type DeleteExec struct {
	IsMultiTable bool
	// contains filtered or unexported fields
}

DeleteExec represents a delete executor. See https://dev.mysql.com/doc/refman/5.7/en/delete.html

func (*DeleteExec) Close

func (e *DeleteExec) Close() error

Close implements the Executor Close interface.

func (*DeleteExec) GetFKCascades

func (e *DeleteExec) GetFKCascades() []*FKCascadeExec

GetFKCascades implements WithForeignKeyTrigger interface.

func (*DeleteExec) GetFKChecks

func (e *DeleteExec) GetFKChecks() []*FKCheckExec

GetFKChecks implements WithForeignKeyTrigger interface.

func (*DeleteExec) HasFKCascades

func (e *DeleteExec) HasFKCascades() bool

HasFKCascades implements WithForeignKeyTrigger interface.

func (*DeleteExec) Next

func (e *DeleteExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*DeleteExec) Open

func (e *DeleteExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*DeleteExec) Schema

func (e *DeleteExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type ExecStmt

type ExecStmt struct {
	// GoCtx stores parent go context.Context for a stmt.
	GoCtx context.Context
	// InfoSchema stores a reference to the schema information.
	InfoSchema infoschema.InfoSchema
	// Plan stores a reference to the final physical plan.
	Plan plannercore.Plan
	// Text represents the origin query text.
	Text string

	StmtNode ast.StmtNode

	Ctx sessionctx.Context

	// LowerPriority represents whether to lower the execution priority of a query.
	LowerPriority bool

	// OutputNames will be set if using cached plan
	OutputNames []*types.FieldName
	PsStmt      *plannercore.PlanCacheStmt
	Ti          *TelemetryInfo
	// contains filtered or unexported fields
}

ExecStmt implements the sqlexec.Statement interface, it builds a planner.Plan to an sqlexec.Statement.

func (*ExecStmt) CloseRecordSet

func (a *ExecStmt) CloseRecordSet(txnStartTS uint64, lastErr error)

CloseRecordSet will finish the execution of current statement and do some record work

func (*ExecStmt) Exec

func (a *ExecStmt) Exec(ctx context.Context) (_ sqlexec.RecordSet, err error)

Exec builds an Executor from a plan. If the Executor doesn't return result, like the INSERT, UPDATE statements, it executes in this function. If the Executor returns result, execution is done after this function returns, in the returned sqlexec.RecordSet Next method.

func (*ExecStmt) FinishExecuteStmt

func (a *ExecStmt) FinishExecuteStmt(txnTS uint64, err error, hasMoreResults bool)

FinishExecuteStmt is used to record some information after `ExecStmt` execution finished: 1. record slow log if needed. 2. record summary statement. 3. record execute duration metric. 4. update the `PrevStmt` in session variable. 5. reset `DurationParse` in session variable.

func (*ExecStmt) GetStmtNode

func (a *ExecStmt) GetStmtNode() ast.StmtNode

GetStmtNode returns the stmtNode inside Statement

func (*ExecStmt) GetTextToLog

func (a *ExecStmt) GetTextToLog(keepHint bool) string

GetTextToLog return the query text to log.

func (*ExecStmt) IsPrepared

func (a *ExecStmt) IsPrepared() bool

IsPrepared returns true if stmt is a prepare statement.

func (*ExecStmt) IsReadOnly

func (a *ExecStmt) IsReadOnly(vars *variable.SessionVars) bool

IsReadOnly returns true if a statement is read only. If current StmtNode is an ExecuteStmt, we can get its prepared stmt, then using ast.IsReadOnly function to determine a statement is read only or not.

func (*ExecStmt) LogSlowQuery

func (a *ExecStmt) LogSlowQuery(txnTS uint64, succ bool, hasMoreResults bool)

LogSlowQuery is used to print the slow query in the log files.

func (*ExecStmt) OriginText

func (a *ExecStmt) OriginText() string

OriginText returns original statement as a string.

func (*ExecStmt) PointGet

func (a *ExecStmt) PointGet(ctx context.Context) (*recordSet, error)

PointGet short path for point exec directly from plan, keep only necessary steps

func (*ExecStmt) RebuildPlan

func (a *ExecStmt) RebuildPlan(ctx context.Context) (int64, error)

RebuildPlan rebuilds current execute statement plan. It returns the current information schema version that 'a' is using.

func (*ExecStmt) SummaryStmt

func (a *ExecStmt) SummaryStmt(succ bool)

SummaryStmt collects statements for information_schema.statements_summary

type ExecuteExec

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

ExecuteExec represents an EXECUTE executor. It cannot be executed by itself, all it needs to do is to build another Executor from a prepared statement.

func (*ExecuteExec) Build

func (e *ExecuteExec) Build(b *executorBuilder) error

Build builds a prepared statement into an executor. After Build, e.StmtExec will be used to do the real execution.

func (*ExecuteExec) Close

func (e *ExecuteExec) Close() error

Close closes all executors and release all resources.

func (*ExecuteExec) Next

func (e *ExecuteExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*ExecuteExec) Open

func (e *ExecuteExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*ExecuteExec) Schema

func (e *ExecuteExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type Executor

type Executor interface {
	Open(context.Context) error
	Next(ctx context.Context, req *chunk.Chunk) error
	Close() error
	Schema() *expression.Schema
	// contains filtered or unexported methods
}

Executor is the physical implementation of a algebra operator.

In TiDB, all algebra operators are implemented as iterators, i.e., they support a simple Open-Next-Close protocol. See this paper for more details:

"Volcano-An Extensible and Parallel Query Evaluation System"

Different from Volcano's execution model, a "Next" function call in TiDB will return a batch of rows, other than a single row in Volcano. NOTE: Executors must call "chk.Reset()" before appending their results to it.

type ExplainExec

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

ExplainExec represents an explain executor.

func (*ExplainExec) Close

func (e *ExplainExec) Close() error

Close implements the Executor Close interface.

func (*ExplainExec) Next

func (e *ExplainExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*ExplainExec) Open

func (e *ExplainExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*ExplainExec) Schema

func (e *ExplainExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type FKCascadeExec

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

FKCascadeExec uses to execute foreign key cascade behaviour.

type FKCascadeRuntimeStats

type FKCascadeRuntimeStats struct {
	Total time.Duration
	Keys  int
}

FKCascadeRuntimeStats contains the FKCascadeExec runtime stats.

func (*FKCascadeRuntimeStats) Clone

Clone implements the RuntimeStats interface.

func (*FKCascadeRuntimeStats) Merge

Merge implements the RuntimeStats interface.

func (*FKCascadeRuntimeStats) String

func (s *FKCascadeRuntimeStats) String() string

String implements the RuntimeStats interface.

func (*FKCascadeRuntimeStats) Tp

func (s *FKCascadeRuntimeStats) Tp() int

Tp implements the RuntimeStats interface.

type FKCheckExec

type FKCheckExec struct {
	*plannercore.FKCheck
	// contains filtered or unexported fields
}

FKCheckExec uses to check foreign key constraint. When insert/update child table, need to check the row has related row exists in refer table. When insert/update parent table, need to check the row doesn't have related row exists in refer table.

type FKCheckRuntimeStats

type FKCheckRuntimeStats struct {
	Total time.Duration
	Check time.Duration
	Lock  time.Duration
	Keys  int
}

FKCheckRuntimeStats contains the FKCheckExec runtime stats.

func (*FKCheckRuntimeStats) Clone

Clone implements the RuntimeStats interface.

func (*FKCheckRuntimeStats) Merge

Merge implements the RuntimeStats interface.

func (*FKCheckRuntimeStats) String

func (s *FKCheckRuntimeStats) String() string

String implements the RuntimeStats interface.

func (*FKCheckRuntimeStats) Tp

func (s *FKCheckRuntimeStats) Tp() int

Tp implements the RuntimeStats interface.

type GrantExec

type GrantExec struct {
	Privs                 []*ast.PrivElem
	ObjectType            ast.ObjectTypeType
	Level                 *ast.GrantLevel
	Users                 []*ast.UserSpec
	AuthTokenOrTLSOptions []*ast.AuthTokenOrTLSOption

	WithGrant bool
	// contains filtered or unexported fields
}

GrantExec executes GrantStmt.

func (*GrantExec) Close

func (e *GrantExec) Close() error

Close closes all executors and release all resources.

func (*GrantExec) Next

func (e *GrantExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*GrantExec) Open

func (e *GrantExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*GrantExec) Schema

func (e *GrantExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type HashAggExec

type HashAggExec struct {
	PartialAggFuncs []aggfuncs.AggFunc
	FinalAggFuncs   []aggfuncs.AggFunc

	GroupByItems []expression.Expression
	// contains filtered or unexported fields
}

HashAggExec deals with all the aggregate functions. It is built from the Aggregate Plan. When Next() is called, it reads all the data from Src and updates all the items in PartialAggFuncs. The parallel execution flow is as the following graph shows:

                           +-------------+
                           | Main Thread |
                           +------+------+
                                  ^
                                  |
                                  +
                             +-+-            +-+
                             | |    ......   | |  finalOutputCh
                             +++-            +-+
                              ^
                              |
                              +---------------+
                              |               |
                +--------------+             +--------------+
                | final worker |     ......  | final worker |
                +------------+-+             +-+------------+
                             ^                 ^
                             |                 |
                            +-+  +-+  ......  +-+
                            | |  | |          | |
                            ...  ...          ...    partialOutputChs
                            | |  | |          | |
                            +++  +++          +++
                             ^    ^            ^
         +-+                 |    |            |
         | |        +--------o----+            |
inputCh  +-+        |        +-----------------+---+
         | |        |                              |
         ...    +---+------------+            +----+-----------+
         | |    | partial worker |   ......   | partial worker |
         +++    +--------------+-+            +-+--------------+
          |                     ^                ^
          |                     |                |
     +----v---------+          +++ +-+          +++
     | data fetcher | +------> | | | |  ......  | |   partialInputChs
     +--------------+          +-+ +-+          +-+

func (*HashAggExec) ActionSpill

func (e *HashAggExec) ActionSpill() *AggSpillDiskAction

ActionSpill returns a AggSpillDiskAction for spilling intermediate data for hashAgg.

func (*HashAggExec) Close

func (e *HashAggExec) Close() error

Close implements the Executor Close interface.

func (*HashAggExec) Next

func (e *HashAggExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*HashAggExec) Open

func (e *HashAggExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*HashAggExec) Schema

func (e *HashAggExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type HashAggFinalWorker

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

HashAggFinalWorker indicates the final workers of parallel hash agg execution, the number of the worker can be set by `tidb_hashagg_final_concurrency`.

type HashAggInput

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

HashAggInput indicates the input of hash agg exec.

type HashAggIntermData

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

HashAggIntermData indicates the intermediate data of aggregation execution.

type HashAggPartialWorker

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

HashAggPartialWorker indicates the partial workers of parallel hash agg execution, the number of the worker can be set by `tidb_hashagg_partial_concurrency`.

type HashAggRuntimeStats

type HashAggRuntimeStats struct {
	PartialConcurrency int
	PartialWallTime    int64
	FinalConcurrency   int
	FinalWallTime      int64
	PartialStats       []*AggWorkerStat
	FinalStats         []*AggWorkerStat
}

HashAggRuntimeStats record the HashAggExec runtime stat

func (*HashAggRuntimeStats) Clone

Clone implements the RuntimeStats interface.

func (*HashAggRuntimeStats) Merge

Merge implements the RuntimeStats interface.

func (*HashAggRuntimeStats) String

func (e *HashAggRuntimeStats) String() string

String implements the RuntimeStats interface.

func (*HashAggRuntimeStats) Tp

func (*HashAggRuntimeStats) Tp() int

Tp implements the RuntimeStats interface.

type HashJoinExec

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

HashJoinExec implements the hash join algorithm.

func (*HashJoinExec) Close

func (e *HashJoinExec) Close() error

Close implements the Executor Close interface.

func (*HashJoinExec) Next

func (e *HashJoinExec) Next(ctx context.Context, req *chunk.Chunk) (err error)

Next implements the Executor Next interface. hash join constructs the result following these steps: step 1. fetch data from build side child and build a hash table; step 2. fetch data from probe child in a background goroutine and probe the hash table in multiple join workers.

func (*HashJoinExec) Open

func (e *HashJoinExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*HashJoinExec) Schema

func (e *HashJoinExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type HistoryHotRegion

type HistoryHotRegion struct {
	UpdateTime    int64   `json:"update_time"`
	RegionID      uint64  `json:"region_id"`
	StoreID       uint64  `json:"store_id"`
	PeerID        uint64  `json:"peer_id"`
	IsLearner     bool    `json:"is_learner"`
	IsLeader      bool    `json:"is_leader"`
	HotRegionType string  `json:"hot_region_type"`
	HotDegree     int64   `json:"hot_degree"`
	FlowBytes     float64 `json:"flow_bytes"`
	KeyRate       float64 `json:"key_rate"`
	QueryRate     float64 `json:"query_rate"`
	StartKey      string  `json:"start_key"`
	EndKey        string  `json:"end_key"`
}

HistoryHotRegion records each hot region's statistics. it's the response of PD.

type HistoryHotRegions

type HistoryHotRegions struct {
	HistoryHotRegion []*HistoryHotRegion `json:"history_hot_region"`
}

HistoryHotRegions records filtered hot regions stored in each PD. it's the response of PD.

type HistoryHotRegionsRequest

type HistoryHotRegionsRequest struct {
	StartTime      int64    `json:"start_time,omitempty"`
	EndTime        int64    `json:"end_time,omitempty"`
	RegionIDs      []uint64 `json:"region_ids,omitempty"`
	StoreIDs       []uint64 `json:"store_ids,omitempty"`
	PeerIDs        []uint64 `json:"peer_ids,omitempty"`
	IsLearners     []bool   `json:"is_learners,omitempty"`
	IsLeaders      []bool   `json:"is_leaders,omitempty"`
	HotRegionTypes []string `json:"hot_region_type,omitempty"`
}

HistoryHotRegionsRequest wrap conditions push down to PD.

type IndexAdvice

type IndexAdvice struct {
}

IndexAdvice represents the index advice.

type IndexAdviseExec

type IndexAdviseExec struct {
	IsLocal bool
	// contains filtered or unexported fields
}

IndexAdviseExec represents a index advise executor.

func (*IndexAdviseExec) Close

func (e *IndexAdviseExec) Close() error

Close implements the Executor Close interface.

func (*IndexAdviseExec) Next

func (e *IndexAdviseExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*IndexAdviseExec) Open

func (e *IndexAdviseExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*IndexAdviseExec) Schema

func (e *IndexAdviseExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type IndexAdviseInfo

type IndexAdviseInfo struct {
	Path        string
	MaxMinutes  uint64
	MaxIndexNum *ast.MaxIndexNumClause
	core.LineFieldsInfo
	Ctx       sessionctx.Context
	StmtNodes [][]ast.StmtNode
	Result    *IndexAdvice
}

IndexAdviseInfo saves the information of index advise operation.

func (*IndexAdviseInfo) GetIndexAdvice

func (e *IndexAdviseInfo) GetIndexAdvice(ctx context.Context, data []byte) error

GetIndexAdvice gets the index advice by workload file.

type IndexAdviseVarKeyType

type IndexAdviseVarKeyType int

IndexAdviseVarKeyType is a dummy type to avoid naming collision in context.

const IndexAdviseVarKey IndexAdviseVarKeyType = 0

IndexAdviseVarKey is a variable key for index advise.

func (IndexAdviseVarKeyType) String

func (k IndexAdviseVarKeyType) String() string

String defines a Stringer function for debugging and pretty printing.

type IndexLookUpExecutor

type IndexLookUpExecutor struct {

	// PushedLimit is used to skip the preceding and tailing handles when Limit is sunk into IndexLookUpReader.
	PushedLimit *plannercore.PushedDownLimit
	// contains filtered or unexported fields
}

IndexLookUpExecutor implements double read for index scan.

func (*IndexLookUpExecutor) Close

func (e *IndexLookUpExecutor) Close() error

Close implements Exec Close interface.

func (*IndexLookUpExecutor) Next

func (e *IndexLookUpExecutor) Next(ctx context.Context, req *chunk.Chunk) error

Next implements Exec Next interface.

func (*IndexLookUpExecutor) Open

Open implements the Executor Open interface.

func (*IndexLookUpExecutor) Schema

func (e *IndexLookUpExecutor) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

func (*IndexLookUpExecutor) Table

func (e *IndexLookUpExecutor) Table() table.Table

Table implements the dataSourceExecutor interface.

type IndexLookUpJoin

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

IndexLookUpJoin employs one outer worker and N innerWorkers to execute concurrently. It preserves the order of the outer table and support batch lookup.

The execution flow is very similar to IndexLookUpReader: 1. outerWorker read N outer rows, build a task and send it to result channel and inner worker channel. 2. The innerWorker receives the task, builds key ranges from outer rows and fetch inner rows, builds inner row hash map. 3. main thread receives the task, waits for inner worker finish handling the task. 4. main thread join each outer row by look up the inner rows hash map in the task.

func (*IndexLookUpJoin) Close

func (e *IndexLookUpJoin) Close() error

Close implements the Executor interface.

func (*IndexLookUpJoin) Next

func (e *IndexLookUpJoin) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor interface.

func (*IndexLookUpJoin) Open

func (e *IndexLookUpJoin) Open(ctx context.Context) error

Open implements the Executor interface.

func (*IndexLookUpJoin) Schema

func (e *IndexLookUpJoin) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type IndexLookUpMergeJoin

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

IndexLookUpMergeJoin realizes IndexLookUpJoin by merge join It preserves the order of the outer table and support batch lookup.

The execution flow is very similar to IndexLookUpReader: 1. outerWorker read N outer rows, build a task and send it to result channel and inner worker channel. 2. The innerWorker receives the task, builds key ranges from outer rows and fetch inner rows, then do merge join. 3. main thread receives the task and fetch results from the channel in task one by one. 4. If channel has been closed, main thread receives the next task.

func (*IndexLookUpMergeJoin) Close

func (e *IndexLookUpMergeJoin) Close() error

Close implements the Executor interface.

func (*IndexLookUpMergeJoin) Next

func (e *IndexLookUpMergeJoin) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor interface

func (*IndexLookUpMergeJoin) Open

Open implements the Executor interface

func (*IndexLookUpMergeJoin) Schema

func (e *IndexLookUpMergeJoin) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type IndexLookUpRunTimeStats

type IndexLookUpRunTimeStats struct {
	FetchHandleTotal int64
	FetchHandle      int64
	TaskWait         int64
	TableRowScan     int64
	TableTaskNum     int64
	Concurrency      int
	// Record the `Next` call affected wait duration details.
	NextWaitIndexScan        time.Duration
	NextWaitTableLookUpBuild time.Duration
	NextWaitTableLookUpResp  time.Duration
	// contains filtered or unexported fields
}

IndexLookUpRunTimeStats record the indexlookup runtime stat

func (*IndexLookUpRunTimeStats) Clone

Clone implements the RuntimeStats interface.

func (*IndexLookUpRunTimeStats) Merge

Merge implements the RuntimeStats interface.

func (*IndexLookUpRunTimeStats) String

func (e *IndexLookUpRunTimeStats) String() string

func (*IndexLookUpRunTimeStats) Tp

func (e *IndexLookUpRunTimeStats) Tp() int

Tp implements the RuntimeStats interface.

type IndexMergeReaderExecutor

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

IndexMergeReaderExecutor accesses a table with multiple index/table scan. There are three types of workers: 1. partialTableWorker/partialIndexWorker, which are used to fetch the handles 2. indexMergeProcessWorker, which is used to do the `Union` operation. 3. indexMergeTableScanWorker, which is used to get the table tuples with the given handles.

The execution flow is really like IndexLookUpReader. However, it uses multiple index scans or table scans to get the handles:

  1. use the partialTableWorkers and partialIndexWorkers to fetch the handles (a batch per time) and send them to the indexMergeProcessWorker.
  2. indexMergeProcessWorker do the `Union` operation for a batch of handles it have got. For every handle in the batch:
  3. check whether it has been accessed.
  4. if not, record it and send it to the indexMergeTableScanWorker.
  5. if accessed, just ignore it.

func (*IndexMergeReaderExecutor) Close

func (e *IndexMergeReaderExecutor) Close() error

Close implements Exec Close interface.

func (*IndexMergeReaderExecutor) Next

Next implements Executor Next interface.

func (*IndexMergeReaderExecutor) Open

func (e *IndexMergeReaderExecutor) Open(ctx context.Context) (err error)

Open implements the Executor Open interface

func (*IndexMergeReaderExecutor) Schema

func (e *IndexMergeReaderExecutor) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

func (*IndexMergeReaderExecutor) Table

Table implements the dataSourceExecutor interface.

type IndexMergeRuntimeStat

type IndexMergeRuntimeStat struct {
	IndexMergeProcess time.Duration
	FetchIdxTime      int64
	WaitTime          int64
	FetchRow          int64
	TableTaskNum      int64
	Concurrency       int
}

IndexMergeRuntimeStat record the indexMerge runtime stat

func (*IndexMergeRuntimeStat) Clone

Clone implements the RuntimeStats interface.

func (*IndexMergeRuntimeStat) Merge

Merge implements the RuntimeStats interface.

func (*IndexMergeRuntimeStat) String

func (e *IndexMergeRuntimeStat) String() string

func (*IndexMergeRuntimeStat) Tp

func (e *IndexMergeRuntimeStat) Tp() int

Tp implements the RuntimeStats interface.

type IndexNestedLoopHashJoin

type IndexNestedLoopHashJoin struct {
	IndexLookUpJoin
	// contains filtered or unexported fields
}

IndexNestedLoopHashJoin employs one outer worker and N inner workers to execute concurrently. The output order is not promised.

The execution flow is very similar to IndexLookUpReader: 1. The outer worker reads N outer rows, builds a task and sends it to the inner worker channel. 2. The inner worker receives the tasks and does 3 things for every task:

  1. builds hash table from the outer rows
  2. builds key ranges from outer rows and fetches inner rows
  3. probes the hash table and sends the join result to the main thread channel. Note: step 1 and step 2 runs concurrently.

3. The main thread receives the join results.

func (*IndexNestedLoopHashJoin) Close

func (e *IndexNestedLoopHashJoin) Close() error

Close implements the IndexNestedLoopHashJoin Executor interface.

func (*IndexNestedLoopHashJoin) Next

Next implements the IndexNestedLoopHashJoin Executor interface.

func (*IndexNestedLoopHashJoin) Open

Open implements the IndexNestedLoopHashJoin Executor interface.

func (*IndexNestedLoopHashJoin) Schema

func (e *IndexNestedLoopHashJoin) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type IndexReaderExecutor

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

IndexReaderExecutor sends dag request and reads index data from kv layer.

func (*IndexReaderExecutor) Close

func (e *IndexReaderExecutor) Close() (err error)

Close clears all resources hold by current object.

func (*IndexReaderExecutor) Next

func (e *IndexReaderExecutor) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*IndexReaderExecutor) Open

Open implements the Executor Open interface.

func (*IndexReaderExecutor) Schema

func (e *IndexReaderExecutor) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

func (IndexReaderExecutor) SelectResult

func (sr IndexReaderExecutor) SelectResult(ctx context.Context, sctx sessionctx.Context, kvReq *kv.Request,
	fieldTypes []*types.FieldType, fb *statistics.QueryFeedback, copPlanIDs []int, rootPlanID int) (distsql.SelectResult, error)

func (*IndexReaderExecutor) Table

func (e *IndexReaderExecutor) Table() table.Table

Table implements the dataSourceExecutor interface.

type InsertExec

type InsertExec struct {
	*InsertValues
	OnDuplicate []*expression.Assignment

	Priority mysql.PriorityEnum
	// contains filtered or unexported fields
}

InsertExec represents an insert executor.

func (*InsertExec) Close

func (e *InsertExec) Close() error

Close implements the Executor Close interface.

func (*InsertExec) GetFKCascades

func (e *InsertExec) GetFKCascades() []*FKCascadeExec

GetFKCascades implements WithForeignKeyTrigger interface.

func (*InsertExec) GetFKChecks

func (e *InsertExec) GetFKChecks() []*FKCheckExec

GetFKChecks implements WithForeignKeyTrigger interface.

func (*InsertExec) HasFKCascades

func (e *InsertExec) HasFKCascades() bool

HasFKCascades implements WithForeignKeyTrigger interface.

func (*InsertExec) Next

func (e *InsertExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*InsertExec) Open

func (e *InsertExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (InsertExec) Schema

func (e InsertExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type InsertRuntimeStat

type InsertRuntimeStat struct {
	*execdetails.BasicRuntimeStats
	*txnsnapshot.SnapshotRuntimeStats
	*autoid.AllocatorRuntimeStats
	CheckInsertTime time.Duration
	Prefetch        time.Duration
	FKCheckTime     time.Duration
}

InsertRuntimeStat record the stat about insert and check

func (*InsertRuntimeStat) Clone

Clone implements the RuntimeStats interface.

func (*InsertRuntimeStat) Merge

func (e *InsertRuntimeStat) Merge(other execdetails.RuntimeStats)

Merge implements the RuntimeStats interface.

func (*InsertRuntimeStat) String

func (e *InsertRuntimeStat) String() string

func (*InsertRuntimeStat) Tp

func (e *InsertRuntimeStat) Tp() int

Tp implements the RuntimeStats interface.

type InsertValues

type InsertValues struct {
	SelectExec Executor

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

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

InsertValues is the data to insert. nolint:structcheck

func (*InsertValues) Close

func (e *InsertValues) Close() error

Close closes all executors and release all resources.

func (*InsertValues) Next

func (e *InsertValues) Next(ctx context.Context, req *chunk.Chunk) error

Next fills multiple rows into a chunk.

func (*InsertValues) Open

func (e *InsertValues) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*InsertValues) Schema

func (e *InsertValues) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type IterCb

type IterCb func(key uint64, e *entry)

IterCb :Iterator callback,called for every key,value found in maps. RLock is held for all calls for a given shard therefore callback sess consistent view of a shard, but not across the shards

type LimitExec

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

LimitExec represents limit executor It ignores 'Offset' rows from src, then returns 'Count' rows at maximum.

func (*LimitExec) Close

func (e *LimitExec) Close() error

Close implements the Executor Close interface.

func (*LimitExec) Next

func (e *LimitExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*LimitExec) Open

func (e *LimitExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*LimitExec) Schema

func (e *LimitExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type LoadDataActionExec

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

LoadDataActionExec executes LoadDataActionStmt.

func (*LoadDataActionExec) Close

func (e *LoadDataActionExec) Close() error

Close closes all executors and release all resources.

func (*LoadDataActionExec) Next

Next implements the Executor Next interface.

func (*LoadDataActionExec) Open

func (e *LoadDataActionExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*LoadDataActionExec) Schema

func (e *LoadDataActionExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type LoadDataExec

type LoadDataExec struct {
	FileLocRef  ast.FileLocRefTp
	OnDuplicate ast.OnDuplicateKeyHandlingType
	// contains filtered or unexported fields
}

LoadDataExec represents a load data executor.

func (*LoadDataExec) Close

func (e *LoadDataExec) Close() error

Close closes all executors and release all resources.

func (*LoadDataExec) Next

func (e *LoadDataExec) Next(ctx context.Context, req *chunk.Chunk) (err error)

Next implements the Executor Next interface.

func (*LoadDataExec) Open

func (e *LoadDataExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*LoadDataExec) Schema

func (e *LoadDataExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type LoadDataWorker

type LoadDataWorker struct {
	UserSctx sessionctx.Context
	// contains filtered or unexported fields
}

LoadDataWorker does a LOAD DATA job.

func NewLoadDataWorker

func NewLoadDataWorker(
	userSctx sessionctx.Context,
	plan *plannercore.LoadData,
	tbl table.Table,
) (w *LoadDataWorker, err error)

NewLoadDataWorker creates a new LoadDataWorker that is ready to work.

func (*LoadDataWorker) GetController

func (e *LoadDataWorker) GetController() *importer.LoadDataController

GetController get load data controller. used in unit test.

func (*LoadDataWorker) GetInfilePath

func (e *LoadDataWorker) GetInfilePath() string

GetInfilePath get infile path.

func (*LoadDataWorker) LoadLocal

func (e *LoadDataWorker) LoadLocal(ctx context.Context, r io.ReadCloser) error

LoadLocal reads from client connection and do load data job.

func (*LoadDataWorker) TestLoad

func (e *LoadDataWorker) TestLoad(parser mydump.Parser) error

TestLoad is a helper function for unit test.

type LoadStatsExec

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

LoadStatsExec represents a load statistic executor.

func (*LoadStatsExec) Close

func (e *LoadStatsExec) Close() error

Close implements the Executor Close interface.

func (*LoadStatsExec) Next

func (e *LoadStatsExec) Next(_ context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*LoadStatsExec) Open

func (e *LoadStatsExec) Open(_ context.Context) error

Open implements the Executor Open interface.

func (*LoadStatsExec) Schema

func (e *LoadStatsExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type LoadStatsInfo

type LoadStatsInfo struct {
	Path string
	Ctx  sessionctx.Context
}

LoadStatsInfo saves the information of loading statistic operation.

func (*LoadStatsInfo) Update

func (e *LoadStatsInfo) Update(data []byte) error

Update updates the stats of the corresponding table according to the data.

type LockStatsExec

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

LockStatsExec represents a lock statistic executor.

func (*LockStatsExec) Close

func (e *LockStatsExec) Close() error

Close implements the Executor Close interface.

func (*LockStatsExec) Next

func (e *LockStatsExec) Next(_ context.Context, _ *chunk.Chunk) error

Next implements the Executor Next interface.

func (*LockStatsExec) Open

func (e *LockStatsExec) Open(_ context.Context) error

Open implements the Executor Open interface.

func (*LockStatsExec) Schema

func (e *LockStatsExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type MPPGather

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

MPPGather dispatch MPP tasks and read data from root tasks.

func (*MPPGather) Close

func (e *MPPGather) Close() error

Close and release the used resources.

func (*MPPGather) Next

func (e *MPPGather) Next(ctx context.Context, chk *chunk.Chunk) error

Next fills data into the chunk passed by its caller.

func (*MPPGather) Open

func (e *MPPGather) Open(ctx context.Context) (err error)

Open decides the task counts and locations and generate exchange operators for every plan fragment. Then dispatch tasks to tiflash stores. If any task fails, it would cancel the rest tasks.

func (*MPPGather) Schema

func (e *MPPGather) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type MaxOneRowExec

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

MaxOneRowExec checks if the number of rows that a query returns is at maximum one. It's built from subquery expression.

func (*MaxOneRowExec) Close

func (e *MaxOneRowExec) Close() error

Close closes all executors and release all resources.

func (*MaxOneRowExec) Next

func (e *MaxOneRowExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*MaxOneRowExec) Open

func (e *MaxOneRowExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*MaxOneRowExec) Schema

func (e *MaxOneRowExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type MemTableReaderExec

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

MemTableReaderExec executes memTable information retrieving from the MemTable components

func (*MemTableReaderExec) Close

func (e *MemTableReaderExec) Close() error

Close implements the Executor Close interface.

func (*MemTableReaderExec) Next

func (e *MemTableReaderExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*MemTableReaderExec) Open

func (e *MemTableReaderExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*MemTableReaderExec) Schema

func (e *MemTableReaderExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type MergeJoinExec

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

MergeJoinExec implements the merge join algorithm. This operator assumes that two iterators of both sides will provide required order on join condition: 1. For equal-join, one of the join key from each side matches the order given. 2. For other cases its preferred not to use SMJ and operator will throw error.

func (*MergeJoinExec) Close

func (e *MergeJoinExec) Close() error

Close implements the Executor Close interface.

func (*MergeJoinExec) Next

func (e *MergeJoinExec) Next(ctx context.Context, req *chunk.Chunk) (err error)

Next implements the Executor Next interface. Note the inner group collects all identical keys in a group across multiple chunks, but the outer group just covers the identical keys within a chunk, so identical keys may cover more than one chunk.

func (*MergeJoinExec) Open

func (e *MergeJoinExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*MergeJoinExec) Schema

func (e *MergeJoinExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type MetricRetriever

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

MetricRetriever uses to read metric data.

type MetricsSummaryByLabelRetriever

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

MetricsSummaryByLabelRetriever uses to read metric detail data.

type MetricsSummaryRetriever

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

MetricsSummaryRetriever uses to read metric data.

type MockExecutorBuilder

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

MockExecutorBuilder is a wrapper for executorBuilder. ONLY used in test.

func NewMockExecutorBuilderForTest

func NewMockExecutorBuilderForTest(ctx sessionctx.Context, is infoschema.InfoSchema, ti *TelemetryInfo) *MockExecutorBuilder

NewMockExecutorBuilderForTest is ONLY used in test.

func (*MockExecutorBuilder) Build

Build builds an executor tree according to `p`.

type MockMetricsPromDataKey

type MockMetricsPromDataKey struct{}

MockMetricsPromDataKey is for test

type MockPhysicalPlan

type MockPhysicalPlan interface {
	plannercore.PhysicalPlan
	GetExecutor() Executor
}

MockPhysicalPlan is used to return a specified executor in when build. It is mainly used for testing.

type NAAJType

type NAAJType byte

NAAJType is join detail type only used by null-aware AntiLeftOuterSemiJoin.

const (
	// Unknown for those default value.
	Unknown NAAJType = 0
	// LeftHasNullRightNotNull means lhs is a null key, and rhs is not a null key.
	LeftHasNullRightNotNull NAAJType = 1
	// LeftHasNullRightHasNull means lhs is a null key, and rhs is a null key.
	LeftHasNullRightHasNull NAAJType = 2
	// LeftNotNullRightNotNull means lhs is in not a null key, and rhs is not a null key.
	LeftNotNullRightNotNull NAAJType = 3
	// LeftNotNullRightHasNull means lhs is in not a null key, and rhs is a null key.
	LeftNotNullRightHasNull NAAJType = 4
)

type NestedLoopApplyExec

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

NestedLoopApplyExec is the executor for apply.

func (*NestedLoopApplyExec) Close

func (e *NestedLoopApplyExec) Close() error

Close implements the Executor interface.

func (*NestedLoopApplyExec) Next

func (e *NestedLoopApplyExec) Next(ctx context.Context, req *chunk.Chunk) (err error)

Next implements the Executor interface.

func (*NestedLoopApplyExec) Open

Open implements the Executor interface.

func (*NestedLoopApplyExec) Schema

func (e *NestedLoopApplyExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type ParallelNestedLoopApplyExec

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

ParallelNestedLoopApplyExec is the executor for apply.

func (*ParallelNestedLoopApplyExec) Close

Close implements the Executor interface.

func (*ParallelNestedLoopApplyExec) Next

func (e *ParallelNestedLoopApplyExec) Next(ctx context.Context, req *chunk.Chunk) (err error)

Next implements the Executor interface.

func (*ParallelNestedLoopApplyExec) Open

Open implements the Executor interface.

func (*ParallelNestedLoopApplyExec) Schema

func (e *ParallelNestedLoopApplyExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type PartitionTelemetryInfo

type PartitionTelemetryInfo struct {
	UseTablePartition                bool
	UseTablePartitionList            bool
	UseTablePartitionRange           bool
	UseTablePartitionHash            bool
	UseTablePartitionRangeColumns    bool
	UseTablePartitionRangeColumnsGt1 bool
	UseTablePartitionRangeColumnsGt2 bool
	UseTablePartitionRangeColumnsGt3 bool
	UseTablePartitionListColumns     bool
	TablePartitionMaxPartitionsNum   uint64
	UseCreateIntervalPartition       bool
	UseAddIntervalPartition          bool
	UseDropIntervalPartition         bool
	UseCompactTablePartition         bool
	UseReorganizePartition           bool
}

PartitionTelemetryInfo records table partition telemetry information during execution.

type PauseDDLJobsExec

type PauseDDLJobsExec struct {
	*CommandDDLJobsExec
}

PauseDDLJobsExec indicates an Executor for Pause a DDL Job.

func (PauseDDLJobsExec) Close

func (e PauseDDLJobsExec) Close() error

Close closes all executors and release all resources.

func (PauseDDLJobsExec) Schema

func (e PauseDDLJobsExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type PessimisticLockCacheGetter

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

PessimisticLockCacheGetter implements the kv.Getter interface. It is used as a middle cache to construct the BufferedBatchGetter.

func (*PessimisticLockCacheGetter) Get

func (getter *PessimisticLockCacheGetter) Get(_ context.Context, key kv.Key) ([]byte, error)

Get implements the kv.Getter interface.

type PipelinedWindowExec

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

PipelinedWindowExec is the executor for window functions.

func (*PipelinedWindowExec) Close

func (e *PipelinedWindowExec) Close() error

Close implements the Executor Close interface.

func (*PipelinedWindowExec) Next

func (e *PipelinedWindowExec) Next(ctx context.Context, chk *chunk.Chunk) (err error)

Next implements the Executor Next interface.

func (*PipelinedWindowExec) Open

func (e *PipelinedWindowExec) Open(ctx context.Context) (err error)

Open implements the Executor Open interface

func (*PipelinedWindowExec) Schema

func (e *PipelinedWindowExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type PlanReplayerCaptureInfo

type PlanReplayerCaptureInfo struct {
	SQLDigest  string
	PlanDigest string
	Remove     bool
}

PlanReplayerCaptureInfo indicates capture info

type PlanReplayerDumpInfo

type PlanReplayerDumpInfo struct {
	ExecStmts []ast.StmtNode
	Analyze   bool
	Path      string
	File      *os.File
	FileName  string
	// contains filtered or unexported fields
}

PlanReplayerDumpInfo indicates dump info

func (*PlanReplayerDumpInfo) DumpSQLsFromFile

func (e *PlanReplayerDumpInfo) DumpSQLsFromFile(ctx context.Context, b []byte) error

DumpSQLsFromFile dumps plan replayer results for sqls from file

type PlanReplayerExec

type PlanReplayerExec struct {
	CaptureInfo *PlanReplayerCaptureInfo
	DumpInfo    *PlanReplayerDumpInfo
	// contains filtered or unexported fields
}

PlanReplayerExec represents a plan replayer executor.

func (*PlanReplayerExec) Close

func (e *PlanReplayerExec) Close() error

Close closes all executors and release all resources.

func (*PlanReplayerExec) Next

func (e *PlanReplayerExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*PlanReplayerExec) Open

func (e *PlanReplayerExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*PlanReplayerExec) Schema

func (e *PlanReplayerExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type PlanReplayerLoadExec

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

PlanReplayerLoadExec represents a plan replayer load executor.

func (*PlanReplayerLoadExec) Close

func (e *PlanReplayerLoadExec) Close() error

Close closes all executors and release all resources.

func (*PlanReplayerLoadExec) Next

func (e *PlanReplayerLoadExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*PlanReplayerLoadExec) Open

func (e *PlanReplayerLoadExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*PlanReplayerLoadExec) Schema

func (e *PlanReplayerLoadExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type PlanReplayerLoadInfo

type PlanReplayerLoadInfo struct {
	Path string
	Ctx  sessionctx.Context
}

PlanReplayerLoadInfo contains file path and session context.

func (*PlanReplayerLoadInfo) Update

func (e *PlanReplayerLoadInfo) Update(data []byte) error

Update updates the data of the corresponding table.

type PointGetExecutor

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

PointGetExecutor executes point select query.

func (*PointGetExecutor) Close

func (e *PointGetExecutor) Close() error

Close implements the Executor interface.

func (*PointGetExecutor) Init

Init set fields needed for PointGetExecutor reuse, this does NOT change baseExecutor field

func (*PointGetExecutor) Next

func (e *PointGetExecutor) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor interface.

func (*PointGetExecutor) Open

Open implements the Executor interface.

func (*PointGetExecutor) Schema

func (e *PointGetExecutor) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type PrepareExec

type PrepareExec struct {
	ID         uint32
	ParamCount int
	Fields     []*ast.ResultField
	Stmt       interface{}
	// contains filtered or unexported fields
}

PrepareExec represents a PREPARE executor.

func NewPrepareExec

func NewPrepareExec(ctx sessionctx.Context, sqlTxt string) *PrepareExec

NewPrepareExec creates a new PrepareExec.

func (*PrepareExec) Close

func (e *PrepareExec) Close() error

Close closes all executors and release all resources.

func (*PrepareExec) Next

func (e *PrepareExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*PrepareExec) Open

func (e *PrepareExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*PrepareExec) Schema

func (e *PrepareExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type ProjectionExec

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

ProjectionExec implements the physical Projection Operator: https://en.wikipedia.org/wiki/Projection_(relational_algebra)

func (*ProjectionExec) Close

func (e *ProjectionExec) Close() error

Close implements the Executor Close interface.

func (*ProjectionExec) Next

func (e *ProjectionExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

Here we explain the execution flow of the parallel projection implementation. There are 3 main components:

  1. "projectionInputFetcher": Fetch input "Chunk" from child.
  2. "projectionWorker": Do the projection work.
  3. "ProjectionExec.Next": Return result to parent.

1. "projectionInputFetcher" gets its input and output resources from its "inputCh" and "outputCh" channel, once the input and output resources are abtained, it fetches child's result into "input.chk" and:

a. Dispatches this input to the worker specified in "input.targetWorker"
b. Dispatches this output to the main thread: "ProjectionExec.Next"
c. Dispatches this output to the worker specified in "input.targetWorker"

It is finished and exited once:

a. There is no more input from child.
b. "ProjectionExec" close the "globalFinishCh"

2. "projectionWorker" gets its input and output resources from its "inputCh" and "outputCh" channel, once the input and output resources are abtained, it calculates the projection result use "input.chk" as the input and "output.chk" as the output, once the calculation is done, it:

a. Sends "nil" or error to "output.done" to mark this input is finished.
b. Returns the "input" resource to "projectionInputFetcher.inputCh"

They are finished and exited once:

a. "ProjectionExec" closes the "globalFinishCh"

3. "ProjectionExec.Next" gets its output resources from its "outputCh" channel. After receiving an output from "outputCh", it should wait to receive a "nil" or error from "output.done" channel. Once a "nil" or error is received:

a. Returns this output to its parent
b. Returns the "output" resource to "projectionInputFetcher.outputCh"

+-----------+----------------------+--------------------------+
|           |                      |                          |
|  +--------+---------+   +--------+---------+       +--------+---------+
|  | projectionWorker |   + projectionWorker |  ...  + projectionWorker |
|  +------------------+   +------------------+       +------------------+
|       ^       ^              ^       ^                  ^       ^
|       |       |              |       |                  |       |
|    inputCh outputCh       inputCh outputCh           inputCh outputCh
|       ^       ^              ^       ^                  ^       ^
|       |       |              |       |                  |       |
|                              |       |
|                              |       +----------------->outputCh
|                              |       |                      |
|                              |       |                      v
|                      +-------+-------+--------+   +---------------------+
|                      | projectionInputFetcher |   | ProjectionExec.Next |
|                      +------------------------+   +---------+-----------+
|                              ^       ^                      |
|                              |       |                      |
|                           inputCh outputCh                  |
|                              ^       ^                      |
|                              |       |                      |
+------------------------------+       +----------------------+

func (*ProjectionExec) Open

func (e *ProjectionExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*ProjectionExec) Schema

func (e *ProjectionExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type RecoverIndexExec

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

RecoverIndexExec represents a recover index executor. It is built from "admin recover index" statement, is used to backfill corrupted index.

func (*RecoverIndexExec) Close

func (e *RecoverIndexExec) Close() error

Close closes all executors and release all resources.

func (*RecoverIndexExec) Next

func (e *RecoverIndexExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*RecoverIndexExec) Open

func (e *RecoverIndexExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*RecoverIndexExec) Schema

func (e *RecoverIndexExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type ReloadExprPushdownBlacklistExec

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

ReloadExprPushdownBlacklistExec indicates ReloadExprPushdownBlacklist executor.

func (*ReloadExprPushdownBlacklistExec) Close

func (e *ReloadExprPushdownBlacklistExec) Close() error

Close closes all executors and release all resources.

func (*ReloadExprPushdownBlacklistExec) Next

Next implements the Executor Next interface.

func (*ReloadExprPushdownBlacklistExec) Open

func (e *ReloadExprPushdownBlacklistExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*ReloadExprPushdownBlacklistExec) Schema

func (e *ReloadExprPushdownBlacklistExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type ReloadOptRuleBlacklistExec

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

ReloadOptRuleBlacklistExec indicates ReloadOptRuleBlacklist executor.

func (*ReloadOptRuleBlacklistExec) Close

func (e *ReloadOptRuleBlacklistExec) Close() error

Close closes all executors and release all resources.

func (*ReloadOptRuleBlacklistExec) Next

Next implements the Executor Next interface.

func (*ReloadOptRuleBlacklistExec) Open

func (e *ReloadOptRuleBlacklistExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*ReloadOptRuleBlacklistExec) Schema

func (e *ReloadOptRuleBlacklistExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type ReplaceExec

type ReplaceExec struct {
	*InsertValues
	Priority int
}

ReplaceExec represents a replace executor.

func (*ReplaceExec) Close

func (e *ReplaceExec) Close() error

Close implements the Executor Close interface.

func (*ReplaceExec) GetFKCascades

func (e *ReplaceExec) GetFKCascades() []*FKCascadeExec

GetFKCascades implements WithForeignKeyTrigger interface.

func (*ReplaceExec) GetFKChecks

func (e *ReplaceExec) GetFKChecks() []*FKCheckExec

GetFKChecks implements WithForeignKeyTrigger interface.

func (*ReplaceExec) HasFKCascades

func (e *ReplaceExec) HasFKCascades() bool

HasFKCascades implements WithForeignKeyTrigger interface.

func (*ReplaceExec) Next

func (e *ReplaceExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*ReplaceExec) Open

func (e *ReplaceExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (ReplaceExec) Schema

func (e ReplaceExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type ResumeDDLJobsExec

type ResumeDDLJobsExec struct {
	*CommandDDLJobsExec
}

ResumeDDLJobsExec indicates an Executor for Resume a DDL Job.

func (ResumeDDLJobsExec) Close

func (e ResumeDDLJobsExec) Close() error

Close closes all executors and release all resources.

func (ResumeDDLJobsExec) Schema

func (e ResumeDDLJobsExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type RevokeExec

type RevokeExec struct {
	Privs      []*ast.PrivElem
	ObjectType ast.ObjectTypeType
	Level      *ast.GrantLevel
	Users      []*ast.UserSpec
	// contains filtered or unexported fields
}

RevokeExec executes RevokeStmt.

func (*RevokeExec) Close

func (e *RevokeExec) Close() error

Close closes all executors and release all resources.

func (*RevokeExec) Next

func (e *RevokeExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*RevokeExec) Open

func (e *RevokeExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*RevokeExec) Schema

func (e *RevokeExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type SQLBindExec

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

SQLBindExec represents a bind executor.

func (*SQLBindExec) Close

func (e *SQLBindExec) Close() error

Close closes all executors and release all resources.

func (*SQLBindExec) Next

func (e *SQLBindExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*SQLBindExec) Open

func (e *SQLBindExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*SQLBindExec) Schema

func (e *SQLBindExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type SelectIntoExec

type SelectIntoExec struct {
	core.LineFieldsInfo
	// contains filtered or unexported fields
}

SelectIntoExec represents a SelectInto executor.

func (*SelectIntoExec) Close

func (s *SelectIntoExec) Close() error

Close implements the Executor Close interface.

func (*SelectIntoExec) Next

func (s *SelectIntoExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*SelectIntoExec) Open

func (s *SelectIntoExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*SelectIntoExec) Schema

func (e *SelectIntoExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type SelectLockExec

type SelectLockExec struct {
	Lock *ast.SelectLockInfo
	// contains filtered or unexported fields
}

SelectLockExec represents a select lock executor. It is built from the "SELECT .. FOR UPDATE" or the "SELECT .. LOCK IN SHARE MODE" statement. For "SELECT .. FOR UPDATE" statement, it locks every row key from source Executor. After the execution, the keys are buffered in transaction, and will be sent to KV when doing commit. If there is any key already locked by another transaction, the transaction will rollback and retry.

func (*SelectLockExec) Close

func (e *SelectLockExec) Close() error

Close closes all executors and release all resources.

func (*SelectLockExec) Next

func (e *SelectLockExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*SelectLockExec) Open

func (e *SelectLockExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*SelectLockExec) Schema

func (e *SelectLockExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type SelectionExec

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

SelectionExec represents a filter executor.

func (*SelectionExec) Close

func (e *SelectionExec) Close() error

Close implements plannercore.Plan Close interface.

func (*SelectionExec) Next

func (e *SelectionExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*SelectionExec) Open

func (e *SelectionExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*SelectionExec) Schema

func (e *SelectionExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type SetConfigExec

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

SetConfigExec executes 'SET CONFIG' statement.

func (*SetConfigExec) Close

func (e *SetConfigExec) Close() error

Close closes all executors and release all resources.

func (*SetConfigExec) Next

func (s *SetConfigExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*SetConfigExec) Open

func (s *SetConfigExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*SetConfigExec) Schema

func (e *SetConfigExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type SetExecutor

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

SetExecutor executes set statement.

func (*SetExecutor) Close

func (e *SetExecutor) Close() error

Close closes all executors and release all resources.

func (*SetExecutor) Next

func (e *SetExecutor) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*SetExecutor) Open

func (e *SetExecutor) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*SetExecutor) Schema

func (e *SetExecutor) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type ShowDDLExec

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

ShowDDLExec represents a show DDL executor.

func (*ShowDDLExec) Close

func (e *ShowDDLExec) Close() error

Close closes all executors and release all resources.

func (*ShowDDLExec) Next

func (e *ShowDDLExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*ShowDDLExec) Open

func (e *ShowDDLExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*ShowDDLExec) Schema

func (e *ShowDDLExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type ShowDDLJobQueriesExec

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

ShowDDLJobQueriesExec represents a show DDL job queries executor. The jobs id that is given by 'admin show ddl job queries' statement, only be searched in the latest 10 history jobs.

func (*ShowDDLJobQueriesExec) Close

func (e *ShowDDLJobQueriesExec) Close() error

Close closes all executors and release all resources.

func (*ShowDDLJobQueriesExec) Next

Next implements the Executor Next interface.

func (*ShowDDLJobQueriesExec) Open

Open implements the Executor Open interface.

func (*ShowDDLJobQueriesExec) Schema

func (e *ShowDDLJobQueriesExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type ShowDDLJobQueriesWithRangeExec

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

ShowDDLJobQueriesWithRangeExec represents a show DDL job queries with range executor. The jobs id that is given by 'admin show ddl job queries' statement, can be searched within a specified range in history jobs using offset and limit.

func (*ShowDDLJobQueriesWithRangeExec) Close

func (e *ShowDDLJobQueriesWithRangeExec) Close() error

Close closes all executors and release all resources.

func (*ShowDDLJobQueriesWithRangeExec) Next

Next implements the Executor Next interface.

func (*ShowDDLJobQueriesWithRangeExec) Open

Open implements the Executor Open interface.

func (*ShowDDLJobQueriesWithRangeExec) Schema

func (e *ShowDDLJobQueriesWithRangeExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type ShowDDLJobsExec

type ShowDDLJobsExec struct {
	DDLJobRetriever
	// contains filtered or unexported fields
}

ShowDDLJobsExec represent a show DDL jobs executor.

func (*ShowDDLJobsExec) Close

func (e *ShowDDLJobsExec) Close() error

Close implements the Executor Close interface.

func (*ShowDDLJobsExec) Next

func (e *ShowDDLJobsExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*ShowDDLJobsExec) Open

func (e *ShowDDLJobsExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*ShowDDLJobsExec) Schema

func (e *ShowDDLJobsExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type ShowExec

type ShowExec struct {
	Tp                ast.ShowStmtType // Databases/Tables/Columns/....
	DBName            model.CIStr
	Table             *ast.TableName       // Used for showing columns.
	Partition         model.CIStr          // Used for showing partition
	Column            *ast.ColumnName      // Used for `desc table column`.
	IndexName         model.CIStr          // Used for show table regions.
	ResourceGroupName model.CIStr          // Used for showing resource group
	Flag              int                  // Some flag parsed from sql, such as FULL.
	Roles             []*auth.RoleIdentity // Used for show grants.
	User              *auth.UserIdentity   // Used by show grants, show create user.
	Extractor         plannercore.ShowPredicateExtractor

	CountWarningsOrErrors bool // Used for showing count(*) warnings | errors

	Full        bool
	IfNotExists bool // Used for `show create database if not exists`
	GlobalScope bool // GlobalScope is used by show variables
	Extended    bool // Used for `show extended columns from ...`

	LoadDataJobID *int64
	// contains filtered or unexported fields
}

ShowExec represents a show executor.

func (*ShowExec) Close

func (e *ShowExec) Close() error

Close closes all executors and release all resources.

func (*ShowExec) Next

func (e *ShowExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*ShowExec) Open

func (e *ShowExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*ShowExec) Schema

func (e *ShowExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type ShowNextRowIDExec

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

ShowNextRowIDExec represents a show the next row ID executor.

func (*ShowNextRowIDExec) Close

func (e *ShowNextRowIDExec) Close() error

Close closes all executors and release all resources.

func (*ShowNextRowIDExec) Next

func (e *ShowNextRowIDExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*ShowNextRowIDExec) Open

func (e *ShowNextRowIDExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*ShowNextRowIDExec) Schema

func (e *ShowNextRowIDExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type ShowSlowExec

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

ShowSlowExec represents the executor of showing the slow queries. It is build from the "admin show slow" statement:

admin show slow top [internal | all] N
admin show slow recent N

func (*ShowSlowExec) Close

func (e *ShowSlowExec) Close() error

Close closes all executors and release all resources.

func (*ShowSlowExec) Next

func (e *ShowSlowExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*ShowSlowExec) Open

func (e *ShowSlowExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*ShowSlowExec) Schema

func (e *ShowSlowExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type ShuffleExec

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

ShuffleExec is the executor to run other executors in a parallel manner.

  1. It fetches chunks from M `DataSources` (value of M depends on the actual executor, e.g. M = 1 for WindowExec, M = 2 for MergeJoinExec).

  2. It splits tuples from each `DataSource` into N partitions (Only "split by hash" is implemented so far).

  3. It invokes N workers in parallel, each one has M `receiver` to receive partitions from `DataSources`

  4. It assigns partitions received as input to each worker and executes child executors.

  5. It collects outputs from each worker, then sends outputs to its parent.

    +-------------+ +-------| Main Thread | | +------+------+ | ^ | | | + v +++ outputHolderCh | | outputCh (1 x Concurrency) v +++ | ^ | | | +-------+-------+ v | | +--------------+ +--------------+ +----- | worker | ....... | worker | worker (N Concurrency): child executor, eg. WindowExec (+SortExec) | +------------+-+ +-+------------+ | ^ ^ | | | | +-+ +-+ ...... +-+ | | | | | | | | ... ... ... inputCh (Concurrency x 1) v | | | | | | inputHolderCh +++ +++ +++ v ^ ^ ^ | | | | | +------o----+ | | | +-----------------+-----+ | | | | +---+------------+------------+----+-----------+ | | Partition Splitter | | +--------------+-+------------+-+--------------+ | ^ | | | +---------------v-----------------+ +----------> | fetch data from DataSource | +---------------------------------+

func (*ShuffleExec) Close

func (e *ShuffleExec) Close() error

Close implements the Executor Close interface.

func (*ShuffleExec) Next

func (e *ShuffleExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*ShuffleExec) Open

func (e *ShuffleExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*ShuffleExec) Schema

func (e *ShuffleExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type SimpleExec

type SimpleExec struct {
	Statement ast.StmtNode
	// IsFromRemote indicates whether the statement IS FROM REMOTE TiDB instance in cluster,
	//   and executing in coprocessor.
	//   Used for `global kill`. See https://github.com/pingcap/tidb/blob/master/docs/design/2020-06-01-global-kill.md.
	IsFromRemote bool
	// contains filtered or unexported fields
}

SimpleExec represents simple statement executor. For statements do simple execution. includes `UseStmt`, 'SetStmt`, `DoStmt`, `BeginStmt`, `CommitStmt`, `RollbackStmt`. TODO: list all simple statements.

func (*SimpleExec) Close

func (e *SimpleExec) Close() error

Close closes all executors and release all resources.

func (*SimpleExec) Next

func (e *SimpleExec) Next(ctx context.Context, req *chunk.Chunk) (err error)

Next implements the Executor Next interface.

func (*SimpleExec) Open

func (e *SimpleExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*SimpleExec) Schema

func (e *SimpleExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type SimpleSeekerOnReadCloser

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

SimpleSeekerOnReadCloser provides Seek(0, SeekCurrent) on ReadCloser.

func NewSimpleSeekerOnReadCloser

func NewSimpleSeekerOnReadCloser(r io.ReadCloser) *SimpleSeekerOnReadCloser

NewSimpleSeekerOnReadCloser creates a SimpleSeekerOnReadCloser.

func (*SimpleSeekerOnReadCloser) Close

func (s *SimpleSeekerOnReadCloser) Close() error

Close implements io.Closer.

func (*SimpleSeekerOnReadCloser) Read

func (s *SimpleSeekerOnReadCloser) Read(p []byte) (n int, err error)

Read implements io.Reader.

func (*SimpleSeekerOnReadCloser) Seek

func (s *SimpleSeekerOnReadCloser) Seek(offset int64, whence int) (int64, error)

Seek implements io.Seeker.

type SortExec

type SortExec struct {
	ByItems []*util.ByItems
	Idx     int
	// contains filtered or unexported fields
}

SortExec represents sorting executor.

func (*SortExec) Close

func (e *SortExec) Close() error

Close implements the Executor Close interface.

func (*SortExec) Next

func (e *SortExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface. Sort constructs the result following these step:

  1. Read as mush as rows into memory.
  2. If memory quota is triggered, sort these rows in memory and put them into disk as partition 1, then reset the memory quota trigger and return to step 1
  3. If memory quota is not triggered and child is consumed, sort these rows in memory as partition N.
  4. Merge sort if the count of partitions is larger than 1. If there is only one partition in step 4, it works just like in-memory sort before.

func (*SortExec) Open

func (e *SortExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*SortExec) Schema

func (e *SortExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type SplitIndexRegionExec

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

SplitIndexRegionExec represents a split index regions executor.

func (*SplitIndexRegionExec) Close

func (e *SplitIndexRegionExec) Close() error

Close closes all executors and release all resources.

func (*SplitIndexRegionExec) Next

func (e *SplitIndexRegionExec) Next(ctx context.Context, chk *chunk.Chunk) error

Next implements the Executor Next interface.

func (*SplitIndexRegionExec) Open

func (e *SplitIndexRegionExec) Open(ctx context.Context) (err error)

Open implements the Executor Open interface.

func (*SplitIndexRegionExec) Schema

func (e *SplitIndexRegionExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type SplitTableRegionExec

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

SplitTableRegionExec represents a split table regions executor.

func (*SplitTableRegionExec) Close

func (e *SplitTableRegionExec) Close() error

Close closes all executors and release all resources.

func (*SplitTableRegionExec) Next

func (e *SplitTableRegionExec) Next(ctx context.Context, chk *chunk.Chunk) error

Next implements the Executor Next interface.

func (*SplitTableRegionExec) Open

func (e *SplitTableRegionExec) Open(ctx context.Context) (err error)

Open implements the Executor Open interface.

func (*SplitTableRegionExec) Schema

func (e *SplitTableRegionExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type StreamAggExec

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

StreamAggExec deals with all the aggregate functions. It assumes all the input data is sorted by group by key. When Next() is called, it will return a result for the same group.

func (*StreamAggExec) Close

func (e *StreamAggExec) Close() error

Close implements the Executor Close interface.

func (*StreamAggExec) Next

func (e *StreamAggExec) Next(ctx context.Context, req *chunk.Chunk) (err error)

Next implements the Executor Next interface.

func (*StreamAggExec) Open

func (e *StreamAggExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*StreamAggExec) Schema

func (e *StreamAggExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type TableDualExec

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

TableDualExec represents a dual table executor.

func (*TableDualExec) Close

func (e *TableDualExec) Close() error

Close closes all executors and release all resources.

func (*TableDualExec) Next

func (e *TableDualExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*TableDualExec) Open

func (e *TableDualExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*TableDualExec) Schema

func (e *TableDualExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type TableReaderExecutor

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

TableReaderExecutor sends DAG request and reads table data from kv layer.

func (*TableReaderExecutor) Close

func (e *TableReaderExecutor) Close() error

Close implements the Executor Close interface.

func (*TableReaderExecutor) Next

func (e *TableReaderExecutor) Next(ctx context.Context, req *chunk.Chunk) error

Next fills data into the chunk passed by its caller. The task was actually done by tableReaderHandler.

func (*TableReaderExecutor) Open

Open initializes necessary variables for using this executor.

func (*TableReaderExecutor) Schema

func (e *TableReaderExecutor) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

func (TableReaderExecutor) SelectResult

func (sr TableReaderExecutor) SelectResult(ctx context.Context, sctx sessionctx.Context, kvReq *kv.Request,
	fieldTypes []*types.FieldType, fb *statistics.QueryFeedback, copPlanIDs []int, rootPlanID int) (distsql.SelectResult, error)

func (*TableReaderExecutor) Table

func (e *TableReaderExecutor) Table() table.Table

Table implements the dataSourceExecutor interface.

type TableSampleExecutor

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

TableSampleExecutor fetches a few rows through kv.Scan according to the specific sample method.

func (*TableSampleExecutor) Close

func (e *TableSampleExecutor) Close() error

Close implements the Executor Close interface.

func (*TableSampleExecutor) Next

func (e *TableSampleExecutor) Next(ctx context.Context, req *chunk.Chunk) error

Next fills data into the chunk passed by its caller. The task was actually done by sampler.

func (*TableSampleExecutor) Open

Open initializes necessary variables for using this executor.

func (*TableSampleExecutor) Schema

func (e *TableSampleExecutor) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type TableScanExec

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

TableScanExec is a table scan executor without result fields.

func (*TableScanExec) Close

func (e *TableScanExec) Close() error

Close closes all executors and release all resources.

func (*TableScanExec) Next

func (e *TableScanExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*TableScanExec) Open

func (e *TableScanExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*TableScanExec) Schema

func (e *TableScanExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type TelemetryInfo

type TelemetryInfo struct {
	UseNonRecursive       bool
	UseRecursive          bool
	UseMultiSchemaChange  bool
	UseExchangePartition  bool
	UseFlashbackToCluster bool
	PartitionTelemetry    *PartitionTelemetryInfo
	AccountLockTelemetry  *AccountLockTelemetryInfo
	UseIndexMerge         bool
	UseTableLookUp        atomic.Bool
}

TelemetryInfo records some telemetry information during execution.

type TestShowClusterConfigFunc

type TestShowClusterConfigFunc func() ([][]types.Datum, error)

TestShowClusterConfigFunc is used to test 'show config ...'.

type TiFlashSystemTableRetriever

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

TiFlashSystemTableRetriever is used to read system table from tiflash.

type TopNExec

type TopNExec struct {
	SortExec
	// contains filtered or unexported fields
}

TopNExec implements a Top-N algorithm and it is built from a SELECT statement with ORDER BY and LIMIT. Instead of sorting all the rows fetched from the table, it keeps the Top-N elements only in a heap to reduce memory usage.

func (*TopNExec) Next

func (e *TopNExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*TopNExec) Open

func (e *TopNExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*TopNExec) Schema

func (e *TopNExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type TraceExec

type TraceExec struct {

	// CollectedSpans collects all span during execution. Span is appended via
	// callback method which passes into tracer implementation.
	CollectedSpans []basictracer.RawSpan
	// contains filtered or unexported fields
}

TraceExec represents a root executor of trace query.

func (*TraceExec) Close

func (e *TraceExec) Close() error

Close closes all executors and release all resources.

func (*TraceExec) Next

func (e *TraceExec) Next(ctx context.Context, req *chunk.Chunk) error

Next executes real query and collects span later.

func (*TraceExec) Open

func (e *TraceExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*TraceExec) Schema

func (e *TraceExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type UnionExec

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

UnionExec pulls all it's children's result and returns to its parent directly. A "resultPuller" is started for every child to pull result from that child and push it to the "resultPool", the used "Chunk" is obtained from the corresponding "resourcePool". All resultPullers are running concurrently.

                          +----------------+
+---> resourcePool 1 ---> | resultPuller 1 |-----+
|                         +----------------+     |
|                                                |
|                         +----------------+     v
+---> resourcePool 2 ---> | resultPuller 2 |-----> resultPool ---+
|                         +----------------+     ^               |
|                               ......           |               |
|                         +----------------+     |               |
+---> resourcePool n ---> | resultPuller n |-----+               |
|                         +----------------+                     |
|                                                                |
|                          +-------------+                       |
|--------------------------| main thread | <---------------------+
                           +-------------+

func (*UnionExec) Close

func (e *UnionExec) Close() error

Close implements the Executor Close interface.

func (*UnionExec) Next

func (e *UnionExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*UnionExec) Open

func (e *UnionExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*UnionExec) Schema

func (e *UnionExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type UnionScanExec

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

UnionScanExec merges the rows from dirty table and the rows from distsql request.

func (*UnionScanExec) Close

func (us *UnionScanExec) Close() error

Close implements the Executor Close interface.

func (*UnionScanExec) Next

func (us *UnionScanExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*UnionScanExec) Open

func (us *UnionScanExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*UnionScanExec) Schema

func (e *UnionScanExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type UnlockStatsExec

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

UnlockStatsExec represents a unlock statistic executor.

func (*UnlockStatsExec) Close

func (e *UnlockStatsExec) Close() error

Close implements the Executor Close interface.

func (*UnlockStatsExec) Next

Next implements the Executor Next interface.

func (*UnlockStatsExec) Open

func (e *UnlockStatsExec) Open(_ context.Context) error

Open implements the Executor Open interface.

func (*UnlockStatsExec) Schema

func (e *UnlockStatsExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type UpdateExec

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

UpdateExec represents a new update executor.

func (*UpdateExec) Close

func (e *UpdateExec) Close() error

Close implements the Executor Close interface.

func (*UpdateExec) GetFKCascades

func (e *UpdateExec) GetFKCascades() []*FKCascadeExec

GetFKCascades implements WithForeignKeyTrigger interface.

func (*UpdateExec) GetFKChecks

func (e *UpdateExec) GetFKChecks() []*FKCheckExec

GetFKChecks implements WithForeignKeyTrigger interface.

func (*UpdateExec) HasFKCascades

func (e *UpdateExec) HasFKCascades() bool

HasFKCascades implements WithForeignKeyTrigger interface.

func (*UpdateExec) Next

func (e *UpdateExec) Next(ctx context.Context, req *chunk.Chunk) error

Next implements the Executor Next interface.

func (*UpdateExec) Open

func (e *UpdateExec) Open(ctx context.Context) error

Open implements the Executor Open interface.

func (*UpdateExec) Schema

func (e *UpdateExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type UpdatedValuesCouple

type UpdatedValuesCouple struct {
	NewValues     []types.Datum
	OldValuesList [][]types.Datum
}

UpdatedValuesCouple contains the updated new row the old rows, exporting for test.

type UpsertCb

type UpsertCb func(exist bool, valueInMap, newValue *entry) *entry

UpsertCb : Callback to return new element to be inserted into the map It is called while lock is held, therefore it MUST NOT try to access other keys in same map, as it can lead to deadlock since Go sync.RWLock is not reentrant

type WindowExec

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

WindowExec is the executor for window functions.

func (*WindowExec) Close

func (e *WindowExec) Close() error

Close implements the Executor Close interface.

func (*WindowExec) Next

func (e *WindowExec) Next(ctx context.Context, chk *chunk.Chunk) error

Next implements the Executor Next interface.

func (*WindowExec) Open

func (e *WindowExec) Open(ctx context.Context) error

Open initializes children recursively and "childrenResults" according to children's schemas.

func (*WindowExec) Schema

func (e *WindowExec) Schema() *expression.Schema

Schema returns the current baseExecutor's schema. If it is nil, then create and return a new one.

type WithForeignKeyTrigger

type WithForeignKeyTrigger interface {
	GetFKChecks() []*FKCheckExec
	GetFKCascades() []*FKCascadeExec
	HasFKCascades() bool
}

WithForeignKeyTrigger indicates the executor has foreign key check or cascade.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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