Documentation ¶
Index ¶
- Constants
- Variables
- func CompileExecutePreparedStmt(ctx context.Context, ID uint32, args ...interface{}) ast.Statement
- type ApplyExec
- type CacheExec
- type CheckTableExec
- type Closeable
- type Compiler
- type DDLExec
- type DeallocateExec
- type DeleteExec
- type DistinctExec
- type DummyScanExec
- type ExecuteExec
- type Executor
- type ExistsExec
- type ExplainExec
- type GrantExec
- type HashAggExec
- type HashJoinExec
- type HashSemiJoinExec
- type InsertExec
- type InsertValues
- type LimitExec
- type LoadData
- type LoadDataInfo
- type MaxOneRowExec
- type PrepareExec
- type Prepared
- type ProjectionExec
- type ReplaceExec
- type ReverseExec
- type Row
- type RowKeyEntry
- type SelectLockExec
- type SelectionExec
- type ShowDDLExec
- type ShowExec
- type SimpleExec
- type SortExec
- type StreamAggExec
- type TableDualExec
- type TableScanExec
- type TopnExec
- type TrimExec
- type UnionExec
- type UnionScanExec
- type UpdateExec
- type XSelectIndexExec
- type XSelectTableExec
Constants ¶
const ( // IGNORE is a special label to identify the situations we want to ignore. IGNORE = "Ignore" // SimpleSelect represents SELECT statements like "select a from t" or "select 2". SimpleSelect = "Simple-Select" // ComplexSelect represents the other SELECT statements besides SIMPLE_SELECT. ComplexSelect = "Complex-Select" // AlterTable represents alter table statements. AlterTable = "AlterTable" // AnalyzeTable represents analyze table statements. AnalyzeTable = "AnalyzeTable" // Begin represents begin statements. Begin = "Begin" // Commit represents commit statements. Commit = "Commit" // CreateDatabase represents create database statements. CreateDatabase = "CreateDatabase" // CreateIndex represents create index statements. CreateIndex = "CreateIndex" // CreateTable represents create table statements. CreateTable = "CreateTable" // CreateUser represents create user statements. CreateUser = "CreateUser" // Delete represents delete statements. Delete = "Delete" // DropDatabase represents drop database statements. DropDatabase = "DropDatabase" // DropIndex represents drop index statements. DropIndex = "DropIndex" // DropTable represents drop table statements. DropTable = "DropTable" // Explain represents explain statements. Explain = "Explain" // Replace represents replace statements. Replace = "Replace" // Insert represents insert statements. Insert = "Insert" // LoadDataStmt represents load data statements. LoadDataStmt = "LoadData" // RollBack represents roll back statements. RollBack = "RollBack" // Set represents set statements. Set = "Set" // Show represents show statements. Show = "Show" // TruncateTable represents truncate table statements. TruncateTable = "TruncateTable" // Update represents update statements. Update = "Update" )
const ( CodeUnknownPlan terror.ErrCode = 1 CodePrepareMulti terror.ErrCode = 2 CodeStmtNotFound terror.ErrCode = 3 CodeSchemaChanged terror.ErrCode = 4 CodeWrongParamCount terror.ErrCode = 5 CodeRowKeyCount terror.ErrCode = 6 CodePrepareDDL terror.ErrCode = 7 // MySQL error code CodeCannotUser terror.ErrCode = 1396 )
Error codes.
const DirtyDBKey dirtyDBKeyType = 1
DirtyDBKey is the key to *dirtyDB for a context.
const LoadDataVarKey loadDataVarKeyType = 0
LoadDataVarKey is a variable key for load data.
Variables ¶
var ( ErrUnknownPlan = terror.ClassExecutor.New(CodeUnknownPlan, "Unknown plan") ErrPrepareMulti = terror.ClassExecutor.New(CodePrepareMulti, "Can not prepare multiple statements") ErrStmtNotFound = terror.ClassExecutor.New(CodeStmtNotFound, "Prepared statement not found") ErrSchemaChanged = terror.ClassExecutor.New(CodeSchemaChanged, "Schema has changed") ErrWrongParamCount = terror.ClassExecutor.New(CodeWrongParamCount, "Wrong parameter count") ErrRowKeyCount = terror.ClassExecutor.New(CodeRowKeyCount, "Wrong row key entry count") ErrPrepareDDL = terror.ClassExecutor.New(CodePrepareDDL, "Can not prepare DDL statements") )
Error instances.
var BaseLookupTableTaskSize = 1024
BaseLookupTableTaskSize represents base number of handles for a lookupTableTask.
var MaxLookupTableTaskSize = 20480
MaxLookupTableTaskSize represents max number of handles for a lookupTableTask.
Functions ¶
Types ¶
type ApplyExec ¶
type ApplyExec struct { Src Executor // contains filtered or unexported fields }
ApplyExec represents apply executor. Apply gets one row from outer executor and gets one row from inner executor according to outer row.
func (*ApplyExec) Schema ¶
func (e *ApplyExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type CacheExec ¶
type CacheExec struct { Src Executor // contains filtered or unexported fields }
CacheExec represents Cache executor. it stores the return values of the executor of its child node.
func (*CacheExec) Schema ¶
func (e *CacheExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
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 plan.Plan Close interface.
func (*CheckTableExec) Next ¶
func (e *CheckTableExec) Next() (*Row, error)
Next implements the Executor Next interface.
func (*CheckTableExec) Schema ¶
func (e *CheckTableExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type Closeable ¶
type Closeable interface { // Close closes the object. Close() error }
Closeable is a interface for closeable structures.
type DDLExec ¶
DDLExec represents a DDL executor. It grabs a DDL instance from Domain, calling the DDL methods to do the work.
func (*DDLExec) Schema ¶
func (e *DDLExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
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 implements plan.Plan Close interface.
func (*DeallocateExec) Next ¶
func (e *DeallocateExec) Next() (*Row, error)
Next implements the Executor Next interface.
func (*DeallocateExec) Schema ¶
func (e *DeallocateExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
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() (*Row, error)
Next implements the Executor Next interface.
func (*DeleteExec) Schema ¶
func (e *DeleteExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type DistinctExec ¶
type DistinctExec struct { Src Executor // contains filtered or unexported fields }
DistinctExec represents Distinct executor. It ignores duplicate rows from source Executor by using a *distinct.Checker which maintains a map to check duplication. Because every distinct row will be added to the map, the memory usage might be very high.
func (*DistinctExec) Close ¶
func (e *DistinctExec) Close() error
Close implements the Executor Close interface.
func (*DistinctExec) Next ¶
func (e *DistinctExec) Next() (*Row, error)
Next implements the Executor Next interface.
func (*DistinctExec) Schema ¶
func (e *DistinctExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type DummyScanExec ¶
type DummyScanExec struct {
// contains filtered or unexported fields
}
DummyScanExec returns zero results, when some where condition never match, there won't be any rows to return, so DummyScan is used to avoid real scan on KV.
func (*DummyScanExec) Close ¶
func (e *DummyScanExec) Close() error
Close implements the Executor Close interface.
func (*DummyScanExec) Next ¶
func (e *DummyScanExec) Next() (*Row, error)
Next implements the Executor Next interface.
func (*DummyScanExec) Schema ¶
func (e *DummyScanExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type ExecuteExec ¶
type ExecuteExec struct { IS infoschema.InfoSchema Ctx context.Context Name string UsingVars []ast.ExprNode ID uint32 StmtExec Executor Stmt ast.StmtNode }
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 implements plan.Plan Close interface.
func (*ExecuteExec) Next ¶
func (e *ExecuteExec) Next() (*Row, error)
Next implements the Executor Next interface.
func (*ExecuteExec) Schema ¶
func (e *ExecuteExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type Executor ¶
type Executor interface { Next() (*Row, error) Close() error Schema() expression.Schema }
Executor executes a query.
type ExistsExec ¶
type ExistsExec struct { Src Executor // contains filtered or unexported fields }
ExistsExec represents exists executor.
func (*ExistsExec) Close ¶
func (e *ExistsExec) Close() error
Close implements the Executor Close interface.
func (*ExistsExec) Next ¶
func (e *ExistsExec) Next() (*Row, error)
Next implements the Executor Next interface. We always return one row with one column which has true or false value.
func (*ExistsExec) Schema ¶
func (e *ExistsExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type ExplainExec ¶
ExplainExec represents an explain executor. See https://dev.mysql.com/doc/refman/5.7/en/explain-output.html
func (*ExplainExec) Close ¶
func (e *ExplainExec) Close() error
Close implements the Executor Close interface.
func (*ExplainExec) Next ¶
func (e *ExplainExec) Next() (*Row, error)
Next implements Execution Next interface.
func (*ExplainExec) Schema ¶
func (e *ExplainExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type GrantExec ¶
type GrantExec struct { Privs []*ast.PrivElem ObjectType ast.ObjectTypeType Level *ast.GrantLevel Users []*ast.UserSpec // contains filtered or unexported fields }
GrantExec executes GrantStmt.
func (*GrantExec) Schema ¶
func (e *GrantExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type HashAggExec ¶
type HashAggExec struct { Src Executor AggFuncs []expression.AggregationFunction 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() (*Row, error)
Next implements the Executor Next interface.
func (*HashAggExec) Schema ¶
func (e *HashAggExec) Schema() expression.Schema
Schema implements the Executor Schema 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() (*Row, error)
Next implements the Executor Next interface.
func (*HashJoinExec) Schema ¶
func (e *HashJoinExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type HashSemiJoinExec ¶
type HashSemiJoinExec struct {
// contains filtered or unexported fields
}
HashSemiJoinExec implements the hash join algorithm for semi join.
func (*HashSemiJoinExec) Close ¶
func (e *HashSemiJoinExec) Close() error
Close implements the Executor Close interface.
func (*HashSemiJoinExec) Next ¶
func (e *HashSemiJoinExec) Next() (*Row, error)
Next implements the Executor Next interface.
func (*HashSemiJoinExec) Schema ¶
func (e *HashSemiJoinExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type InsertExec ¶
type InsertExec struct { *InsertValues OnDuplicate []*ast.Assignment Priority int Ignore 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() (*Row, error)
Next implements the Executor Next interface.
func (*InsertExec) Schema ¶
func (e *InsertExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type InsertValues ¶
type InsertValues struct { SelectExec Executor Table table.Table Columns []*ast.ColumnName Lists [][]ast.ExprNode Setlist []*ast.Assignment IsPrepare bool // contains filtered or unexported fields }
InsertValues is the data to insert.
type LimitExec ¶
type LimitExec struct { Src Executor Offset uint64 Count uint64 Idx uint64 // contains filtered or unexported fields }
LimitExec represents limit executor It ignores 'Offset' rows from src, then returns 'Count' rows at maximum.
func (*LimitExec) Schema ¶
func (e *LimitExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type LoadData ¶
type LoadData struct { IsLocal bool // contains filtered or unexported fields }
LoadData represents a load data executor.
func (*LoadData) Schema ¶
func (e *LoadData) Schema() expression.Schema
Schema implements the Executor Schema interface.
type LoadDataInfo ¶
type LoadDataInfo struct { Path string Table table.Table FieldsInfo *ast.FieldsClause LinesInfo *ast.LinesClause // contains filtered or unexported fields }
LoadDataInfo saves the information of loading data operation.
func NewLoadDataInfo ¶
NewLoadDataInfo returns a LoadDataInfo structure, and it's only used for tests now.
func (*LoadDataInfo) InsertData ¶
func (e *LoadDataInfo) InsertData(prevData, curData []byte) ([]byte, 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 prevData isn't nil and curData is nil, there are no other data to deal with and the isEOF is true.
type MaxOneRowExec ¶
type MaxOneRowExec struct { Src Executor // 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 implements the Executor Close interface.
func (*MaxOneRowExec) Next ¶
func (e *MaxOneRowExec) Next() (*Row, error)
Next implements the Executor Next interface.
func (*MaxOneRowExec) Schema ¶
func (e *MaxOneRowExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type PrepareExec ¶
type PrepareExec struct { IS infoschema.InfoSchema Ctx context.Context Name string SQLText string ID uint32 ParamCount int Err error }
PrepareExec represents a PREPARE executor.
func (*PrepareExec) Close ¶
func (e *PrepareExec) Close() error
Close implements plan.Plan Close interface.
func (*PrepareExec) DoPrepare ¶
func (e *PrepareExec) DoPrepare()
DoPrepare prepares the statement, it can be called multiple times without side effect.
func (*PrepareExec) Next ¶
func (e *PrepareExec) Next() (*Row, error)
Next implements the Executor Next interface.
func (*PrepareExec) Schema ¶
func (e *PrepareExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type Prepared ¶
type Prepared struct { Stmt ast.StmtNode Params []*ast.ParamMarkerExpr SchemaVersion int64 }
Prepared represents a prepared statement.
type ProjectionExec ¶
type ProjectionExec struct { Src Executor // contains filtered or unexported fields }
ProjectionExec represents a select fields executor.
func (*ProjectionExec) Close ¶
func (e *ProjectionExec) Close() error
Close implements the Executor Close interface.
func (*ProjectionExec) Next ¶
func (e *ProjectionExec) Next() (retRow *Row, err error)
Next implements the Executor Next interface.
func (*ProjectionExec) Schema ¶
func (e *ProjectionExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
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() (*Row, error)
Next implements the Executor Next interface.
func (*ReplaceExec) Schema ¶
func (e *ReplaceExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type ReverseExec ¶
type ReverseExec struct { Src Executor // contains filtered or unexported fields }
ReverseExec produces reverse ordered result, it is used to wrap executors that do not support reverse scan.
func (*ReverseExec) Close ¶
func (e *ReverseExec) Close() error
Close implements the Executor Close interface.
func (*ReverseExec) Next ¶
func (e *ReverseExec) Next() (*Row, error)
Next implements the Executor Next interface.
func (*ReverseExec) Schema ¶
func (e *ReverseExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type Row ¶
type Row struct { // Data is the output record data for current Plan. Data []types.Datum // RowKeys contains all table row keys in the row. RowKeys []*RowKeyEntry }
Row represents a result set row, it may be returned from a table, a join, or a projection.
type RowKeyEntry ¶
type RowKeyEntry struct { // The table which this row come from. Tbl table.Table // Row key. Handle int64 // Table alias name. TableAsName *model.CIStr }
RowKeyEntry represents a row key read from a table.
type SelectLockExec ¶
type SelectLockExec struct { Src Executor 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 implements the Executor Close interface.
func (*SelectLockExec) Next ¶
func (e *SelectLockExec) Next() (*Row, error)
Next implements the Executor Next interface.
func (*SelectLockExec) Schema ¶
func (e *SelectLockExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type SelectionExec ¶
type SelectionExec struct { Src Executor Condition expression.Expression // contains filtered or unexported fields }
SelectionExec represents a filter executor.
func (*SelectionExec) Close ¶
func (e *SelectionExec) Close() error
Close implements the Executor Close interface.
func (*SelectionExec) Next ¶
func (e *SelectionExec) Next() (*Row, error)
Next implements the Executor Next interface.
func (*SelectionExec) Schema ¶
func (e *SelectionExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
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 implements the Executor Close interface.
func (*ShowDDLExec) Next ¶
func (e *ShowDDLExec) Next() (*Row, error)
Next implements the Executor Next interface.
func (*ShowDDLExec) Schema ¶
func (e *ShowDDLExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
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 string // Used for show grants. // Used by show variables GlobalScope bool // contains filtered or unexported fields }
ShowExec represents a show executor.
func (*ShowExec) Schema ¶
func (e *ShowExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type SimpleExec ¶
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 implements the Executor Close interface.
func (*SimpleExec) Next ¶
func (e *SimpleExec) Next() (*Row, error)
Next implements Execution Next interface.
func (*SimpleExec) Schema ¶
func (e *SimpleExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type SortExec ¶
type SortExec struct { Src Executor ByItems []*plan.ByItems Rows []*orderByRow Idx int // contains filtered or unexported fields }
SortExec represents sorting executor.
func (*SortExec) Schema ¶
func (e *SortExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type StreamAggExec ¶
type StreamAggExec struct { Src Executor AggFuncs []expression.AggregationFunction GroupByItems []expression.Expression // contains filtered or unexported fields }
StreamAggExec deals with all the aggregate functions. It assumes all the input datas 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() (*Row, error)
Next implements the Executor Next interface.
func (*StreamAggExec) Schema ¶
func (e *StreamAggExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
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 implements the Executor interface.
func (*TableDualExec) Init ¶
func (e *TableDualExec) Init()
Init implements the Executor Init interface.
func (*TableDualExec) Next ¶
func (e *TableDualExec) Next() (*Row, error)
Next implements the Executor Next interface.
func (*TableDualExec) Schema ¶
func (e *TableDualExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
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 implements the Executor Close interface.
func (*TableScanExec) Next ¶
func (e *TableScanExec) Next() (*Row, error)
Next implements the Executor interface.
func (*TableScanExec) Schema ¶
func (e *TableScanExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
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.
type TrimExec ¶
type TrimExec struct { Src Executor // contains filtered or unexported fields }
TrimExec truncates extra columns in the Src rows. Some columns in src rows are not needed in the result. For example, in the 'SELECT a from t order by b' statement, 'b' is needed for ordering, but not needed in the result.
func (*TrimExec) Schema ¶
func (e *TrimExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type UnionExec ¶
type UnionExec struct { Srcs []Executor // contains filtered or unexported fields }
UnionExec represents union executor. UnionExec has multiple source Executors, it executes them sequentially, and do conversion to the same type as source Executors may has different field type, we need to do conversion.
func (*UnionExec) Schema ¶
func (e *UnionExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type UnionScanExec ¶
type UnionScanExec struct { Src Executor // contains filtered or unexported fields }
UnionScanExec merges the rows from dirty table and the rows from XAPI request.
func (*UnionScanExec) Close ¶
func (us *UnionScanExec) Close() error
Close implements the Executor Close interface.
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 (us *UnionScanExec) Next() (*Row, error)
Next implements Execution Next interface.
func (*UnionScanExec) Schema ¶
func (us *UnionScanExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
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 // 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() (*Row, error)
Next implements the Executor Next interface.
func (*UpdateExec) Schema ¶
func (e *UpdateExec) Schema() expression.Schema
Schema implements the Executor Schema interface.
type XSelectIndexExec ¶
type XSelectIndexExec struct {
// contains filtered or unexported fields
}
XSelectIndexExec represents the DistSQL select index executor. There are two execution modes. One is single-read, in which case we only need to read index keys. The other one is double-read, in which case we first do index request to get handles, we use each partial result to build a lookupTableTask.
Each lookupTableTask works like XSelectTableExec. It sorts the handles, sends an *tipb.SelectRequest, then gets distsql.SelectResult which returns multiple distsql.PartialResults, we fetch all the rows from each distsql.PartialResult, then sort the rows by the original index order.
So there might be many tasks built from index request, each task do its own table request. If we do it one by one, the execution might be very slow.
To speed up the execution, index request or table request is done concurrently. The concurrency is controlled by kv.Client, we only need to pass the concurrency parameter.
We also make a higher level of concurrency by doing index request in a background goroutine. The index goroutine starts multple worker goroutines and fetches handles from each index partial request, builds lookup table tasks and sends the task to 'workerCh'.
Each worker goroutine receives tasks through the 'workerCh', then executes the task. After finishing the task, the workers send the task to a taskChan. At the outer most Executor.Next method, we receive the finished task through taskChan, and return each row in that task until no more tasks to receive.
func (*XSelectIndexExec) Close ¶
func (e *XSelectIndexExec) Close() error
Close implements Exec Close interface.
func (*XSelectIndexExec) Next ¶
func (e *XSelectIndexExec) Next() (*Row, error)
Next implements the Executor Next interface.
func (*XSelectIndexExec) Schema ¶
func (e *XSelectIndexExec) Schema() expression.Schema
Schema implements Exec Schema interface.
type XSelectTableExec ¶
type XSelectTableExec struct { Columns []*model.ColumnInfo // contains filtered or unexported fields }
XSelectTableExec represents the DistSQL select table executor. Its execution is pushed down to KV layer.
func (*XSelectTableExec) Close ¶
func (e *XSelectTableExec) Close() error
Close implements the Executor Close interface.
func (*XSelectTableExec) Next ¶
func (e *XSelectTableExec) Next() (*Row, error)
Next implements the Executor interface.
func (*XSelectTableExec) Schema ¶
func (e *XSelectTableExec) Schema() expression.Schema
Schema implements the Executor Schema interface.