executor

package
v2.0.0-rc.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2018 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FlagIgnoreTruncate indicates if truncate error should be ignored.
	// Read-only statements should ignore truncate error, write statements should not ignore truncate error.
	FlagIgnoreTruncate uint64 = 1
	// FlagTruncateAsWarning indicates if truncate error should be returned as warning.
	// This flag only matters if FlagIgnoreTruncate is not set, in strict sql mode, truncate error should
	// be returned as error, in non-strict sql mode, truncate error should be saved as warning.
	FlagTruncateAsWarning uint64 = 1 << 1

	// FlagPadCharToFullLength indicates if sql_mode 'PAD_CHAR_TO_FULL_LENGTH' is set.
	FlagPadCharToFullLength uint64 = 1 << 2
)

Flags are used by tipb.SelectRequest.Flags to handle execution mode, like how to handle truncate error.

View Source
const (
	CodePasswordNoMatch terror.ErrCode = 1133 // MySQL error code
	CodeCannotUser      terror.ErrCode = 1396 // MySQL error code

)

Error codes.

View Source
const (
	// DirtyTableAddRow is the constant for dirty table operation type.
	DirtyTableAddRow = iota
	// DirtyTableDeleteRow is the constant for dirty table operation type.
	DirtyTableDeleteRow
	// DirtyTableTruncate is the constant for dirty table operation type.
	DirtyTableTruncate
)
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.

Variables

View Source
var (
	ErrUnknownPlan          = terror.ClassExecutor.New(codeUnknownPlan, "Unknown plan")
	ErrPrepareMulti         = terror.ClassExecutor.New(codePrepareMulti, "Can not prepare multiple statements")
	ErrPrepareDDL           = terror.ClassExecutor.New(codePrepareDDL, "Can not prepare DDL statements")
	ErrPasswordNoMatch      = terror.ClassExecutor.New(CodePasswordNoMatch, "Can't find any matching row in the user table")
	ErrResultIsEmpty        = terror.ClassExecutor.New(codeResultIsEmpty, "result is empty")
	ErrBuildExecutor        = terror.ClassExecutor.New(codeErrBuildExec, "Failed to build executor")
	ErrBatchInsertFail      = terror.ClassExecutor.New(codeBatchInsertFail, "Batch insert failed, please clean the table and try again.")
	ErrWrongValueCountOnRow = terror.ClassExecutor.New(codeWrongValueCountOnRow, "Column count doesn't match value count at row %d")
	ErrPasswordFormat       = terror.ClassExecutor.New(codePasswordFormat, "The password hash doesn't have the expected format. Check if the correct password algorithm is being used with the PASSWORD() function.")
)

Error instances.

View Source
var LookupTableTaskChannelSize int32 = 50

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

Functions

func CompileExecutePreparedStmt

func CompileExecutePreparedStmt(ctx sessionctx.Context, ID uint32, args ...interface{}) (ast.Statement, error)

CompileExecutePreparedStmt compiles a session Execute command to a stmt.Statement.

func CountStmtNode

func CountStmtNode(stmtNode ast.StmtNode, inRestrictedSQL bool)

CountStmtNode records the number of statements with the same type.

func GetFieldsFromLine

func GetFieldsFromLine(line []byte, fieldsInfo *ast.FieldsClause) ([]string, error)

GetFieldsFromLine splits line according to fieldsInfo, this function is exported for testing.

func GetInfoSchema

func GetInfoSchema(ctx sessionctx.Context) infoschema.InfoSchema

GetInfoSchema gets TxnCtx InfoSchema if snapshot schema is not set, Otherwise, snapshot schema is returned.

func GetLackHandles

func GetLackHandles(expectedHandles []int64, obtainedHandlesMap map[int64]struct{}) []int64

GetLackHandles gets the handles in expectedHandles but not in obtainedHandlesMap.

func GetStmtLabel

func GetStmtLabel(stmtNode ast.StmtNode) string

GetStmtLabel generates a label for a statement.

func IsPointGetWithPKOrUniqueKeyByAutoCommit

func IsPointGetWithPKOrUniqueKeyByAutoCommit(ctx sessionctx.Context, p plan.Plan) bool

IsPointGetWithPKOrUniqueKeyByAutoCommit returns true when meets following conditions:

  1. ctx is auto commit tagged
  2. txn is nil
  3. plan is point get by pk or unique key

func ResetStmtCtx

func ResetStmtCtx(ctx sessionctx.Context, s ast.StmtNode)

ResetStmtCtx resets the StmtContext. Before every execution, we must clear statement context.

Types

type AnalyzeColumnsExec

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

AnalyzeColumnsExec represents Analyze columns push down executor.

type AnalyzeExec

type AnalyzeExec struct {
	// 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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*AnalyzeExec) NextChunk

func (e *AnalyzeExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 AnalyzeIndexExec

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

AnalyzeIndexExec represents analyze index push down executor.

type CancelDDLJobsExec added in v1.0.1

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

CancelDDLJobsExec represents a cancel DDL jobs executor.

func (*CancelDDLJobsExec) Close added in v1.0.1

func (e *CancelDDLJobsExec) Close() error

Close closes all executors and release all resources.

func (*CancelDDLJobsExec) Next added in v1.0.1

func (e *CancelDDLJobsExec) Next(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*CancelDDLJobsExec) NextChunk

func (e *CancelDDLJobsExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk interface.

func (*CancelDDLJobsExec) Open added in v1.0.1

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

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

func (*CancelDDLJobsExec) Schema added in v1.0.1

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 CheckIndexExec

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

CheckIndexExec represents the executor of checking an index. It is built from the "admin check index" statement, and it checks the consistency of the index data with the records of the table.

func (*CheckIndexExec) Close

func (e *CheckIndexExec) Close() error

Close closes all executors and release all resources.

func (*CheckIndexExec) Next

func (e *CheckIndexExec) Next(ctx context.Context) (Row, error)

Next implements the Executor Next interface.

func (*CheckIndexExec) NextChunk

func (e *CheckIndexExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk interface.

func (*CheckIndexExec) Open

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

Open implements the Executor Open interface.

func (*CheckIndexExec) Schema

func (e *CheckIndexExec) 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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*CheckIndexRangeExec) NextChunk

func (e *CheckIndexRangeExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 closes all executors and release all resources.

func (*CheckTableExec) Next

func (e *CheckTableExec) Next(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*CheckTableExec) NextChunk

func (e *CheckTableExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*ChecksumTableExec) NextChunk

func (e *ChecksumTableExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 Closeable

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

Closeable is a interface for closeable structures.

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, error)

Compile compiles an ast.StmtNode to a physical plan.

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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*DDLExec) NextChunk

func (e *DDLExec) NextChunk(ctx context.Context, chk *chunk.Chunk) (err error)

NextChunk implements the Executor NextChunk 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 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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*DeallocateExec) NextChunk

func (e *DeallocateExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 {
	SelectExec Executor

	Tables       []*ast.TableName
	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) Next

func (e *DeleteExec) Next(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*DeleteExec) NextChunk

func (e *DeleteExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 DirtyDB

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

DirtyDB stores uncommitted write operations for a transaction. It is stored and retrieved by context.Value and context.SetValue method.

func GetDirtyDB

func GetDirtyDB(ctx sessionctx.Context) *DirtyDB

GetDirtyDB returns the DirtyDB bind to the context.

func (*DirtyDB) AddRow

func (udb *DirtyDB) AddRow(tid, handle int64, row []types.Datum)

AddRow adds a row to the DirtyDB.

func (*DirtyDB) DeleteRow

func (udb *DirtyDB) DeleteRow(tid int64, handle int64)

DeleteRow deletes a row from the DirtyDB.

func (*DirtyDB) GetDirtyTable

func (udb *DirtyDB) GetDirtyTable(tid int64) *DirtyTable

GetDirtyTable gets the DirtyTable by id from the DirtyDB.

func (*DirtyDB) TruncateTable

func (udb *DirtyDB) TruncateTable(tid int64)

TruncateTable truncates a table.

type DirtyTable

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

DirtyTable stores uncommitted write operation for a transaction.

type ExecStmt

type ExecStmt struct {
	// InfoSchema stores a reference to the schema information.
	InfoSchema infoschema.InfoSchema
	// Plan stores a reference to the final physical plan.
	Plan plan.Plan
	// Expensive represents whether this query is an expensive one.
	Expensive bool
	// Cacheable represents whether the physical plan can be cached.
	Cacheable bool
	// Text represents the origin query text.
	Text string

	StmtNode ast.StmtNode

	Ctx sessionctx.Context
	// contains filtered or unexported fields
}

ExecStmt implements the ast.Statement interface, it builds a plan.Plan to an ast.Statement.

func (*ExecStmt) Exec

func (a *ExecStmt) Exec(ctx context.Context) (ast.RecordSet, 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 ast.RecordSet Next method.

func (*ExecStmt) IsPrepared

func (a *ExecStmt) IsPrepared() bool

IsPrepared returns true if stmt is a prepare statement.

func (*ExecStmt) IsReadOnly added in v1.0.3

func (a *ExecStmt) IsReadOnly() bool

IsReadOnly returns true if a statement is read only. It will update readOnlyCheckStmt if current ExecStmt can be conveted to a plan.Execute. Last step is using ast.IsReadOnly function to determine a statement is read only or not.

func (*ExecStmt) OriginText

func (a *ExecStmt) OriginText() string

OriginText returns original statement as a string.

func (*ExecStmt) RebuildPlan added in v1.0.3

func (a *ExecStmt) RebuildPlan() error

RebuildPlan rebuilds current execute statement plan.

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() 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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*ExecuteExec) NextChunk

func (e *ExecuteExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 {
	Next(context.Context) (Row, error)
	Close() error
	Open(context.Context) error
	Schema() *expression.Schema

	// NextChunk fills a chunk with multiple rows
	// NOTE: chunk has to call Reset() method before any use.
	NextChunk(ctx context.Context, chk *chunk.Chunk) error
	// contains filtered or unexported methods
}

Executor executes a query.

type ExistsExec

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

ExistsExec represents exists executor.

func (*ExistsExec) Close

func (e *ExistsExec) Close() error

Close closes all executors and release all resources.

func (*ExistsExec) Next

func (e *ExistsExec) Next(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*ExistsExec) NextChunk

func (e *ExistsExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk interface.

func (*ExistsExec) Open

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

Open implements the Executor Open interface.

func (*ExistsExec) Schema

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

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

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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*ExplainExec) NextChunk

func (e *ExplainExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk interface.

func (*ExplainExec) Open

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

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

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 GrantExec

type GrantExec struct {
	Privs      []*ast.PrivElem
	ObjectType ast.ObjectTypeType
	Level      *ast.GrantLevel
	Users      []*ast.UserSpec
	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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*GrantExec) NextChunk

func (e *GrantExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 {
	AggFuncs []aggregation.Aggregation

	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 AggFuncs.

func (*HashAggExec) Close

func (e *HashAggExec) Close() error

Close implements the Executor Close interface.

func (*HashAggExec) Next

func (e *HashAggExec) Next(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*HashAggExec) NextChunk

func (e *HashAggExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*HashJoinExec) NextChunk

func (e *HashJoinExec) NextChunk(ctx context.Context, chk *chunk.Chunk) (err error)

NextChunk implements the Executor NextChunk interface. hash join constructs the result following these steps: step 1. fetch data from inner child and build a hash table; step 2. fetch data from outer 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 IndexLookUpExecutor

type IndexLookUpExecutor struct {
	// 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) (Row, error)

Next implements Exec Next interface.

func (*IndexLookUpExecutor) NextChunk

func (e *IndexLookUpExecutor) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements Exec NextChunk 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.

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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*IndexLookUpJoin) NextChunk

func (e *IndexLookUpJoin) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk 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 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() error

Close clears all resources hold by current object.

func (*IndexReaderExecutor) Next

func (e *IndexReaderExecutor) Next(ctx context.Context) (Row, error)

Next returns next available Row. In its process, any error will be returned. It first try to fetch a partial result if current partial result is nil. If any error appears during this stage, it simply return a error to its caller. If it successfully initialize its partial result, it will use this to get next available row.

func (*IndexReaderExecutor) NextChunk

func (e *IndexReaderExecutor) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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.

type InsertExec

type InsertExec struct {
	*InsertValues

	OnDuplicate []*expression.Assignment

	Priority  mysql.PriorityEnum
	IgnoreErr bool
	// 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) Next

func (e InsertExec) Next(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*InsertExec) NextChunk

func (e *InsertExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements Exec NextChunk interface.

func (*InsertExec) Open

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

Open implements the Executor Close 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 InsertValues

type InsertValues struct {
	SelectExec Executor

	Table     table.Table
	Columns   []*ast.ColumnName
	Lists     [][]expression.Expression
	Setlist   []*expression.Assignment
	IsPrepare bool

	GenColumns []*ast.ColumnName
	GenExprs   []expression.Expression
	// contains filtered or unexported fields
}

InsertValues is the data to insert.

func (*InsertValues) Close

func (e *InsertValues) Close() error

Close closes all executors and release all resources.

func (*InsertValues) Next

func (e *InsertValues) Next(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*InsertValues) NextChunk

func (e *InsertValues) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk fills mutiple 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 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 closes all executors and release all resources.

func (*LimitExec) Next

func (e *LimitExec) Next(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*LimitExec) NextChunk

func (e *LimitExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 LoadData

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

LoadData represents a load data executor.

func (*LoadData) Close

func (e *LoadData) Close() error

Close implements the Executor Close interface.

func (*LoadData) Next

func (e *LoadData) Next(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*LoadData) NextChunk

func (e *LoadData) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk interface.

func (*LoadData) Open

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

Open implements the Executor Open interface.

func (*LoadData) Schema

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

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

type LoadDataInfo

type LoadDataInfo struct {
	Path       string
	Table      table.Table
	FieldsInfo *ast.FieldsClause
	LinesInfo  *ast.LinesClause
	Ctx        sessionctx.Context
	// contains filtered or unexported fields
}

LoadDataInfo saves the information of loading data operation.

func NewLoadDataInfo

func NewLoadDataInfo(ctx sessionctx.Context, row []types.Datum, tbl table.Table, cols []*table.Column) *LoadDataInfo

NewLoadDataInfo returns a LoadDataInfo structure, and it's only used for tests now.

func (*LoadDataInfo) InsertData

func (e *LoadDataInfo) InsertData(prevData, curData []byte) ([]byte, bool, error)

InsertData inserts data into specified table according to the specified format. If it has the rest of data isn't completed the processing, then is returns without completed data. If the number of inserted rows reaches the batchRows, then the second return value is true. If prevData isn't nil and curData is nil, there are no other data to deal with and the isEOF is true.

func (*LoadDataInfo) SetMaxRowsInBatch

func (e *LoadDataInfo) SetMaxRowsInBatch(limit uint64)

SetMaxRowsInBatch sets the max number of rows to insert in a batch.

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(ctx context.Context) (Row, error)

Next implements the Executor Next interface.

func (*LoadStatsExec) NextChunk

func (e *LoadStatsExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk interface.

func (*LoadStatsExec) Open

func (e *LoadStatsExec) Open(ctx 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 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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*MaxOneRowExec) NextChunk

func (e *MaxOneRowExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*MergeJoinExec) NextChunk

func (e *MergeJoinExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk interface.

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 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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*NestedLoopApplyExec) NextChunk

func (e *NestedLoopApplyExec) NextChunk(ctx context.Context, chk *chunk.Chunk) (err error)

NextChunk 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 PrepareExec

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

PrepareExec represents a PREPARE executor.

func NewPrepareExec

func NewPrepareExec(ctx sessionctx.Context, is infoschema.InfoSchema, 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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*PrepareExec) NextChunk

func (e *PrepareExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 represents a select fields executor.

func (*ProjectionExec) Close

func (e *ProjectionExec) Close() error

Close closes all executors and release all resources.

func (*ProjectionExec) Next

func (e *ProjectionExec) Next(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*ProjectionExec) NextChunk

func (e *ProjectionExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk interface.

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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*RecoverIndexExec) NextChunk

func (e *RecoverIndexExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 ReplaceExec

type ReplaceExec struct {
	*InsertValues
	Priority int
	// contains filtered or unexported fields
}

ReplaceExec represents a replace executor.

func (*ReplaceExec) Close

func (e *ReplaceExec) Close() error

Close implements the Executor Close interface.

func (ReplaceExec) Next

func (e ReplaceExec) Next(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*ReplaceExec) NextChunk

func (e *ReplaceExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*RevokeExec) NextChunk

func (e *RevokeExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 Row

type Row = types.DatumRow

Row represents a result set row, it may be returned from a table, a join, or a projection.

The following cases will need store the handle information:

If the top plan is update or delete, then every executor will need the handle. If there is an union scan, then the below scan plan must store the handle. If there is sort need in the double read, then the table scan of the double read must store the handle. If there is a select for update. then we need to store the handle until the lock plan. But if there is aggregation, the handle info can be removed. Otherwise the executor's returned rows don't need to store the handle information.

type SelectLockExec

type SelectLockExec struct {
	Lock ast.SelectLockType
	// 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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*SelectLockExec) NextChunk

func (e *SelectLockExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 plan.Plan Close interface.

func (*SelectionExec) Next

func (e *SelectionExec) Next(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*SelectionExec) NextChunk

func (e *SelectionExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*SetExecutor) NextChunk

func (e *SetExecutor) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*ShowDDLExec) NextChunk

func (e *ShowDDLExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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

func (e *ShowDDLJobQueriesExec) Next(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*ShowDDLJobQueriesExec) NextChunk

func (e *ShowDDLJobQueriesExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 ShowDDLJobsExec

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

ShowDDLJobsExec represent a show DDL jobs executor.

func (*ShowDDLJobsExec) Close

func (e *ShowDDLJobsExec) Close() error

Close closes all executors and release all resources.

func (*ShowDDLJobsExec) Next

func (e *ShowDDLJobsExec) Next(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*ShowDDLJobsExec) NextChunk

func (e *ShowDDLJobsExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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.
	Column *ast.ColumnName // Used for `desc table column`.
	Flag   int             // Some flag parsed from sql, such as FULL.
	Full   bool
	User   *auth.UserIdentity // Used for show grants.

	// GlobalScope is used by show variables
	GlobalScope bool
	// 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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*ShowExec) NextChunk

func (e *ShowExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 SimpleExec

type SimpleExec struct {
	Statement ast.StmtNode
	// 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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*SimpleExec) NextChunk

func (e *SimpleExec) NextChunk(ctx context.Context, chk *chunk.Chunk) (err error)

NextChunk implements the Executor NextChunk 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 SortExec

type SortExec struct {
	ByItems []*plan.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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*SortExec) NextChunk

func (e *SortExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk interface.

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 StreamAggExec

type StreamAggExec struct {
	StmtCtx  *stmtctx.StatementContext
	AggFuncs []aggregation.Aggregation

	GroupByItems []expression.Expression
	// 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 closes all executors and release all resources.

func (*StreamAggExec) Next

func (e *StreamAggExec) Next(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*StreamAggExec) NextChunk

func (e *StreamAggExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*TableDualExec) NextChunk

func (e *TableDualExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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) (Row, error)

Next returns next available Row. In its process, any error will be returned. It first try to fetch a partial result if current partial result is nil. If any error appears during this stage, it simply return a error to its caller. If it successfully initialize its partial result, it will use this to get next available row.

func (*TableReaderExecutor) NextChunk

func (e *TableReaderExecutor) NextChunk(ctx context.Context, chk *chunk.Chunk) error

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

func (*TableReaderExecutor) Open

Open initialzes 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.

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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*TableScanExec) NextChunk

func (e *TableScanExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*TopNExec) NextChunk

func (e *TopNExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 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(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*UnionExec) NextChunk

func (e *UnionExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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 XAPI request.

func (*UnionScanExec) Close

func (e *UnionScanExec) Close() error

Close closes all executors and release all resources.

func (*UnionScanExec) Len

func (us *UnionScanExec) Len() int

Len implements sort.Interface interface.

func (*UnionScanExec) Less

func (us *UnionScanExec) Less(i, j int) bool

Less implements sort.Interface interface.

func (*UnionScanExec) Next

func (e *UnionScanExec) Next(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*UnionScanExec) NextChunk

func (us *UnionScanExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk interface.

func (*UnionScanExec) Open

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

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

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.

func (*UnionScanExec) Swap

func (us *UnionScanExec) Swap(i, j int)

Swap implements sort.Interface interface.

type UpdateExec

type UpdateExec struct {
	SelectExec  Executor
	OrderedList []*expression.Assignment
	IgnoreErr   bool
	// 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) Next

func (e *UpdateExec) Next(context.Context) (Row, error)

Next implements interface Executor. To be removed in near future.

func (*UpdateExec) NextChunk

func (e *UpdateExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error

NextChunk implements the Executor NextChunk 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.

Jump to

Keyboard shortcuts

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