executor

package
v0.0.0-...-815d2fd Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2016 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
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
)

Error codes.

View Source
const DirtyDBKey dirtyDBKeyType = 1

DirtyDBKey is the key to *dirtyDB for a context.

Variables

View Source
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")
)

Error instances.

View Source
var BaseLookupTableTaskSize = 1024

BaseLookupTableTaskSize represents base number of handles for a lookupTableTask.

View Source
var MaxLookupTableTaskSize = 1024

MaxLookupTableTaskSize represents max number of handles for a lookupTableTask.

View Source
var SortBufferSize = 500

SortBufferSize represents the total extra row count that sort can use.

Functions

func CompileExecutePreparedStmt

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

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

func NewSubQueryBuilder

func NewSubQueryBuilder(is infoschema.InfoSchema) plan.SubQueryBuilder

NewSubQueryBuilder builds and returns a new SubQuery builder.

Types

type AggregateExec

type AggregateExec struct {
	Src          Executor
	ResultFields []*ast.ResultField

	AggFuncs []*ast.AggregateFuncExpr

	GroupByItems []*ast.ByItem
	// contains filtered or unexported fields
}

AggregateExec deals with all the aggregate functions. It is built from Aggregate Plan. When Next() is called, it reads all the data from Src and updates all the items in AggFuncs. TODO: Support having.

func (*AggregateExec) Close

func (e *AggregateExec) Close() error

Close implements Executor Close interface.

func (*AggregateExec) Fields

func (e *AggregateExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*AggregateExec) Next

func (e *AggregateExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*AggregateExec) Schema

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

Schema implements Executor Schema interface.

type AggregationExec

type AggregationExec struct {
	Src Executor

	ResultFields []*ast.ResultField

	AggFuncs []expression.AggregationFunction

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

AggregationExec deals with all the aggregate functions. It is built from Aggregate Plan. When Next() is called, it reads all the data from Src and updates all the items in AggFuncs.

func (*AggregationExec) Close

func (e *AggregationExec) Close() error

Close implements Executor Close interface.

func (*AggregationExec) Fields

func (e *AggregationExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*AggregationExec) Next

func (e *AggregationExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*AggregationExec) Schema

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

Schema implements Executor Schema interface.

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

func (e *ApplyExec) Close() error

Close implements Executor Close interface.

func (*ApplyExec) Fields

func (e *ApplyExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*ApplyExec) Next

func (e *ApplyExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*ApplyExec) Schema

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

Schema implements Executor Schema interface.

type CheckTableExec

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

CheckTableExec represents a check table executor.

func (*CheckTableExec) Close

func (e *CheckTableExec) Close() error

Close implements plan.Plan Close interface.

func (*CheckTableExec) Fields

func (e *CheckTableExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*CheckTableExec) Next

func (e *CheckTableExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*CheckTableExec) Schema

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

Schema implements Executor Schema interface.

type Compiler

type Compiler struct {
}

Compiler compiles an ast.StmtNode to a stmt.Statement.

func (*Compiler) Compile

func (c *Compiler) Compile(ctx context.Context, node ast.StmtNode) (ast.Statement, error)

Compile compiles an ast.StmtNode to a stmt.Statement. If it is supported to use new plan and executer, it optimizes the node to a plan, and we wrap the plan in an adapter as stmt.Statement. If it is not supported, the node will be converted to old statement.

type DDLExec

type DDLExec struct {
	Statement ast.StmtNode
	// contains filtered or unexported fields
}

DDLExec represents a DDL executor.

func (*DDLExec) Close

func (e *DDLExec) Close() error

Close implements Executor Close interface.

func (*DDLExec) Fields

func (e *DDLExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*DDLExec) Next

func (e *DDLExec) Next() (*Row, error)

Next implements Execution Next interface.

func (*DDLExec) Schema

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

Schema implements 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) Fields

func (e *DeallocateExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*DeallocateExec) Next

func (e *DeallocateExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*DeallocateExec) Schema

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

Schema implements 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 Executor Close interface.

func (*DeleteExec) Fields

func (e *DeleteExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface. Returns nil to indicate there is no output.

func (*DeleteExec) Next

func (e *DeleteExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*DeleteExec) Schema

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

Schema implements Executor Schema interface.

type DistinctExec

type DistinctExec struct {
	Src Executor
	// contains filtered or unexported fields
}

DistinctExec represents Distinct executor.

func (*DistinctExec) Close

func (e *DistinctExec) Close() error

Close implements Executor Close interface.

func (*DistinctExec) Fields

func (e *DistinctExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*DistinctExec) Next

func (e *DistinctExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*DistinctExec) Schema

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

Schema implements 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 executes a prepared statement.

func (*ExecuteExec) Build

func (e *ExecuteExec) Build() error

Build builds a prepared statement into an executor.

func (*ExecuteExec) Close

func (e *ExecuteExec) Close() error

Close implements plan.Plan Close interface.

func (*ExecuteExec) Fields

func (e *ExecuteExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*ExecuteExec) Next

func (e *ExecuteExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*ExecuteExec) Schema

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

Schema implements Executor Schema interface.

type Executor

type Executor interface {
	Fields() []*ast.ResultField
	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 Executor Close interface.

func (*ExistsExec) Fields

func (e *ExistsExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*ExistsExec) Next

func (e *ExistsExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*ExistsExec) Schema

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

Schema implements Executor Schema interface.

type ExplainExec

type ExplainExec struct {
	StmtPlan plan.Plan
	// contains filtered or unexported fields
}

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 Executor Close interface.

func (*ExplainExec) Fields

func (e *ExplainExec) Fields() []*ast.ResultField

Fields implements Executor Fields 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 Executor Schema interface.

type FilterExec

type FilterExec struct {
	Src       Executor
	Condition ast.ExprNode
	// contains filtered or unexported fields
}

FilterExec represents a filter executor.

func (*FilterExec) Close

func (e *FilterExec) Close() error

Close implements Executor Close interface.

func (*FilterExec) Fields

func (e *FilterExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*FilterExec) Next

func (e *FilterExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*FilterExec) Schema

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

Schema implements 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) Close

func (e *GrantExec) Close() error

Close implements Executor Close interface.

func (*GrantExec) Fields

func (e *GrantExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*GrantExec) Next

func (e *GrantExec) Next() (*Row, error)

Next implements Execution Next interface.

func (*GrantExec) Schema

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

Schema implements 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 Executor Close interface.

func (*HashJoinExec) Fields

func (e *HashJoinExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*HashJoinExec) Next

func (e *HashJoinExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*HashJoinExec) Schema

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

Schema implements 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 Executor Close interface.

func (*HashSemiJoinExec) Fields

func (e *HashSemiJoinExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*HashSemiJoinExec) Next

func (e *HashSemiJoinExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*HashSemiJoinExec) Schema

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

Schema implements Executor Schema interface.

type IndexRangeExec

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

IndexRangeExec represents an index range scan executor.

func (*IndexRangeExec) Close

func (e *IndexRangeExec) Close() error

Close implements Executor Close interface.

func (*IndexRangeExec) Fields

func (e *IndexRangeExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*IndexRangeExec) Next

func (e *IndexRangeExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*IndexRangeExec) Schema

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

Schema implements Executor Schema interface.

type IndexScanExec

type IndexScanExec struct {
	Ranges []*IndexRangeExec
	Desc   bool
	// contains filtered or unexported fields
}

IndexScanExec represents an index scan executor.

func (*IndexScanExec) Close

func (e *IndexScanExec) Close() error

Close implements Executor Close interface.

func (*IndexScanExec) Fields

func (e *IndexScanExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*IndexScanExec) Next

func (e *IndexScanExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*IndexScanExec) Schema

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

Schema implements Executor Schema interface.

type InsertExec

type InsertExec struct {
	*InsertValues

	OnDuplicate []*ast.Assignment

	Priority int
	// contains filtered or unexported fields
}

InsertExec represents an insert executor.

func (*InsertExec) Close

func (e *InsertExec) Close() error

Close implements Executor Close interface.

func (*InsertExec) Fields

func (e *InsertExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface. Returns nil to indicate there is no output.

func (*InsertExec) Next

func (e *InsertExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*InsertExec) Schema

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

Schema implements 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 JoinInnerExec

type JoinInnerExec struct {
	InnerPlans []plan.Plan

	Condition ast.ExprNode
	// contains filtered or unexported fields
}

JoinInnerExec represents an inner join executor.

func (*JoinInnerExec) Close

func (e *JoinInnerExec) Close() error

Close implements Executor Close interface.

func (*JoinInnerExec) Fields

func (e *JoinInnerExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*JoinInnerExec) Next

func (e *JoinInnerExec) Next() (*Row, error)

Next implements Executor Next interface. The data in the returned row is not used by caller.

func (*JoinInnerExec) Schema

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

Schema implements Executor Schema interface.

type JoinOuterExec

type JoinOuterExec struct {
	OuterExec Executor
	InnerPlan plan.Plan
	// contains filtered or unexported fields
}

JoinOuterExec represents an outer join executor.

func (*JoinOuterExec) Close

func (e *JoinOuterExec) Close() error

Close implements Executor Close interface.

func (*JoinOuterExec) Fields

func (e *JoinOuterExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*JoinOuterExec) Next

func (e *JoinOuterExec) Next() (*Row, error)

Next implements Executor Next interface. The data in the returned row is not used by caller. If inner executor didn't get any row for an outer executor row, a row with 0 len Data indicates there is no inner row matched for an outer row.

func (*JoinOuterExec) Schema

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

Schema implements Executor Schema interface.

type LimitExec

type LimitExec struct {
	Src    Executor
	Offset uint64
	Count  uint64
	Idx    uint64
	// contains filtered or unexported fields
}

LimitExec represents limit executor

func (*LimitExec) Close

func (e *LimitExec) Close() error

Close implements Executor Close interface.

func (*LimitExec) Fields

func (e *LimitExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*LimitExec) Next

func (e *LimitExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*LimitExec) Schema

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

Schema implements Executor Schema interface.

type MaxOneRowExec

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

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

func (*MaxOneRowExec) Close

func (e *MaxOneRowExec) Close() error

Close implements Executor Close interface.

func (*MaxOneRowExec) Fields

func (e *MaxOneRowExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*MaxOneRowExec) Next

func (e *MaxOneRowExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*MaxOneRowExec) Schema

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

Schema implements Executor Schema interface.

type NewSortExec

type NewSortExec struct {
	Src     Executor
	ByItems []*plan.ByItems
	Rows    []*orderByRow

	Limit *plan.Limit
	Idx   int
	// contains filtered or unexported fields
}

NewSortExec represents sorting executor.

func (*NewSortExec) Close

func (e *NewSortExec) Close() error

Close implements Executor Close interface.

func (*NewSortExec) Fields

func (e *NewSortExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*NewSortExec) Len

func (e *NewSortExec) Len() int

Len returns the number of rows.

func (*NewSortExec) Less

func (e *NewSortExec) Less(i, j int) bool

Less implements sort.Interface Less interface.

func (*NewSortExec) Next

func (e *NewSortExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*NewSortExec) Schema

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

Schema implements Executor Schema interface.

func (*NewSortExec) Swap

func (e *NewSortExec) Swap(i, j int)

Swap implements sort.Interface Swap interface.

type NewTableDualExec

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

NewTableDualExec represents a dual table executor.

func (*NewTableDualExec) Close

func (e *NewTableDualExec) Close() error

Close implements Executor interface.

func (*NewTableDualExec) Fields

func (e *NewTableDualExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*NewTableDualExec) Init

func (e *NewTableDualExec) Init()

Init implements NewExecutor Init interface.

func (*NewTableDualExec) Next

func (e *NewTableDualExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*NewTableDualExec) Schema

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

Schema implements Executor Schema interface.

type NewTableScanExec

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

NewTableScanExec is a table scan executor without result fields.

func (*NewTableScanExec) Close

func (e *NewTableScanExec) Close() error

Close implements Executor Close interface.

func (*NewTableScanExec) Fields

func (e *NewTableScanExec) Fields() []*ast.ResultField

Fields implements Executor interface.

func (*NewTableScanExec) Next

func (e *NewTableScanExec) Next() (*Row, error)

Next implements Executor interface.

func (*NewTableScanExec) Schema

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

Schema implements Executor Schema interface.

type NewUnionExec

type NewUnionExec struct {
	Srcs []Executor
	// contains filtered or unexported fields
}

NewUnionExec represents union executor.

func (*NewUnionExec) Close

func (e *NewUnionExec) Close() error

Close implements Executor Close interface.

func (*NewUnionExec) Fields

func (e *NewUnionExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*NewUnionExec) Next

func (e *NewUnionExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*NewUnionExec) Schema

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

Schema implements Executor Schema interface.

type NewXSelectIndexExec

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

NewXSelectIndexExec represents XAPI select index executor without result fields.

func (*NewXSelectIndexExec) Close

func (e *NewXSelectIndexExec) Close() error

Close implements Exec Close interface.

func (*NewXSelectIndexExec) Fields

func (e *NewXSelectIndexExec) Fields() []*ast.ResultField

Fields implements Exec Fields interface.

func (*NewXSelectIndexExec) Next

func (e *NewXSelectIndexExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*NewXSelectIndexExec) Schema

Schema implements Exec Schema interface.

type NewXSelectTableExec

type NewXSelectTableExec struct {
	Columns []*model.ColumnInfo
	// contains filtered or unexported fields
}

NewXSelectTableExec represents XAPI select executor without result fields.

func (*NewXSelectTableExec) Close

func (e *NewXSelectTableExec) Close() error

Close implements Executor Close interface.

func (*NewXSelectTableExec) Fields

func (e *NewXSelectTableExec) Fields() []*ast.ResultField

Fields implements Executor interface.

func (*NewXSelectTableExec) Next

func (e *NewXSelectTableExec) Next() (*Row, error)

Next implements Executor interface.

func (*NewXSelectTableExec) Schema

Schema implements Executor Schema interface.

type PrepareExec

type PrepareExec struct {
	IS      infoschema.InfoSchema
	Ctx     context.Context
	Name    string
	SQLText string

	ID           uint32
	ResultFields []*ast.ResultField
	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) Fields

func (e *PrepareExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*PrepareExec) Next

func (e *PrepareExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*PrepareExec) Schema

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

Schema implements 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
	ResultFields []*ast.ResultField
	// contains filtered or unexported fields
}

ProjectionExec represents a select fields executor.

func (*ProjectionExec) Close

func (e *ProjectionExec) Close() error

Close implements Executor Close interface.

func (*ProjectionExec) Fields

func (e *ProjectionExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*ProjectionExec) Next

func (e *ProjectionExec) Next() (retRow *Row, err error)

Next implements Executor Next interface.

func (*ProjectionExec) Schema

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

Schema implements 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 Executor Close interface.

func (*ReplaceExec) Fields

func (e *ReplaceExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface. Returns nil to indicate there is no output.

func (*ReplaceExec) Next

func (e *ReplaceExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*ReplaceExec) Schema

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

Schema implements 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 Executor Close interface.

func (*ReverseExec) Fields

func (e *ReverseExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*ReverseExec) Next

func (e *ReverseExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*ReverseExec) Schema

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

Schema implements Executor Schema interface.

type Row

type Row struct {
	// Data is the output record data for current Plan.
	Data []types.Datum

	RowKeys []*RowKeyEntry
}

Row represents a record row.

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 is designed for Delete statement in multi-table mode, we should know which table this row comes from.

type SelectFieldsExec

type SelectFieldsExec struct {
	Src          Executor
	ResultFields []*ast.ResultField
	// contains filtered or unexported fields
}

SelectFieldsExec represents a select fields executor.

func (*SelectFieldsExec) Close

func (e *SelectFieldsExec) Close() error

Close implements Executor Close interface.

func (*SelectFieldsExec) Fields

func (e *SelectFieldsExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*SelectFieldsExec) Next

func (e *SelectFieldsExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*SelectFieldsExec) Schema

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

Schema implements Executor Schema interface.

type SelectLockExec

type SelectLockExec struct {
	Src  Executor
	Lock ast.SelectLockType
	// contains filtered or unexported fields
}

SelectLockExec represents a select lock executor.

func (*SelectLockExec) Close

func (e *SelectLockExec) Close() error

Close implements Executor Close interface.

func (*SelectLockExec) Fields

func (e *SelectLockExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*SelectLockExec) Next

func (e *SelectLockExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*SelectLockExec) Schema

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

Schema implements 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 Executor Close interface.

func (*SelectionExec) Fields

func (e *SelectionExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*SelectionExec) Next

func (e *SelectionExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*SelectionExec) Schema

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

Schema implements 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 Executor Close interface.

func (*ShowDDLExec) Fields

func (e *ShowDDLExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*ShowDDLExec) Next

func (e *ShowDDLExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*ShowDDLExec) Schema

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

Schema implements 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) Close

func (e *ShowExec) Close() error

Close implements Executor Close interface.

func (*ShowExec) Fields

func (e *ShowExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*ShowExec) Next

func (e *ShowExec) Next() (*Row, error)

Next implements Execution Next interface.

func (*ShowExec) Schema

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

Schema implements Executor Schema interface.

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 implements Executor Close interface.

func (*SimpleExec) Fields

func (e *SimpleExec) Fields() []*ast.ResultField

Fields implements Executor Fields 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 Executor Schema interface.

type SortExec

type SortExec struct {
	Src     Executor
	ByItems []*ast.ByItem
	Rows    []*orderByRow

	Limit *plan.Limit
	Idx   int
	// contains filtered or unexported fields
}

SortExec represents sorting executor.

func (*SortExec) Close

func (e *SortExec) Close() error

Close implements Executor Close interface.

func (*SortExec) Fields

func (e *SortExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*SortExec) Len

func (e *SortExec) Len() int

Len returns the number of rows.

func (*SortExec) Less

func (e *SortExec) Less(i, j int) bool

Less implements sort.Interface Less interface.

func (*SortExec) Next

func (e *SortExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*SortExec) Schema

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

Schema implements Executor Schema interface.

func (*SortExec) Swap

func (e *SortExec) Swap(i, j int)

Swap implements sort.Interface Swap 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 plan.Plan Close interface.

func (*TableDualExec) Fields

func (e *TableDualExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*TableDualExec) Next

func (e *TableDualExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*TableDualExec) Schema

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

Schema implements Executor Schema interface.

type TableScanExec

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

TableScanExec represents a table scan executor.

func (*TableScanExec) Close

func (e *TableScanExec) Close() error

Close implements Executor Close interface.

func (*TableScanExec) Fields

func (e *TableScanExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*TableScanExec) Next

func (e *TableScanExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*TableScanExec) Schema

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

Schema implements Executor Schema interface.

type TrimExec

type TrimExec struct {
	Src Executor
	// contains filtered or unexported fields
}

TrimExec truncates src rows.

func (*TrimExec) Close

func (e *TrimExec) Close() error

Close implements Executor Close interface.

func (*TrimExec) Fields

func (e *TrimExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*TrimExec) Next

func (e *TrimExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*TrimExec) Schema

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

Schema implements Executor Schema interface.

type UnionExec

type UnionExec struct {
	Sels []Executor
	// contains filtered or unexported fields
}

UnionExec represents union executor.

func (*UnionExec) Close

func (e *UnionExec) Close() error

Close implements Executor Close interface.

func (*UnionExec) Fields

func (e *UnionExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*UnionExec) Next

func (e *UnionExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*UnionExec) Schema

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

Schema implements 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 Executor Close interface.

func (*UnionScanExec) Fields

func (us *UnionScanExec) Fields() []*ast.ResultField

Fields implements Executor Fields 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 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 []*ast.Assignment
	// contains filtered or unexported fields
}

UpdateExec represents an update executor.

func (*UpdateExec) Close

func (e *UpdateExec) Close() error

Close implements Executor Close interface.

func (*UpdateExec) Fields

func (e *UpdateExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface. Returns nil to indicate there is no output.

func (*UpdateExec) Next

func (e *UpdateExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*UpdateExec) Schema

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

Schema implements Executor Schema interface.

type XAggregateExec

type XAggregateExec struct {
	Src          Executor
	ResultFields []*ast.ResultField
	AggFields    []*types.FieldType

	AggFuncs []*ast.AggregateFuncExpr
	// contains filtered or unexported fields
}

XAggregateExec deals with all the aggregate functions. It is built from Aggregate Plan. When Next() is called, it reads all the data from Src and updates all the items in AggFuncs. TODO: Support having.

func (*XAggregateExec) Close

func (e *XAggregateExec) Close() error

Close implements Executor Close interface.

func (*XAggregateExec) Fields

func (e *XAggregateExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*XAggregateExec) Next

func (e *XAggregateExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*XAggregateExec) Schema

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

Schema implements Executor Schema interface.

type XExecutor

type XExecutor interface {
	// AddAggregate adds aggregate info into an executor.
	AddAggregate(funcs []*tipb.Expr, byItems []*tipb.ByItem, fields []*types.FieldType)
	// GetTableName gets the table name of this XExecutor.
	GetTableName() *ast.TableName
}

XExecutor defines some interfaces used by dist-sql.

type XSelectIndexExec

type XSelectIndexExec struct {
	XExecutor
	// contains filtered or unexported fields
}

XSelectIndexExec represents XAPI select index executor.

func (*XSelectIndexExec) AddAggregate

func (e *XSelectIndexExec) AddAggregate(funcs []*tipb.Expr, byItems []*tipb.ByItem, fields []*types.FieldType)

AddAggregate implements XExecutor interface.

func (*XSelectIndexExec) Close

func (e *XSelectIndexExec) Close() error

Close implements Executor Close interface.

func (*XSelectIndexExec) Fields

func (e *XSelectIndexExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*XSelectIndexExec) GetTableName

func (e *XSelectIndexExec) GetTableName() *ast.TableName

GetTableName implements XExecutor interface.

func (*XSelectIndexExec) Next

func (e *XSelectIndexExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*XSelectIndexExec) Schema

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

Schema implements Executor Schema interface.

type XSelectTableExec

type XSelectTableExec struct {
	XExecutor
	// contains filtered or unexported fields
}

XSelectTableExec represents XAPI select executor.

func (*XSelectTableExec) AddAggregate

func (e *XSelectTableExec) AddAggregate(funcs []*tipb.Expr, byItems []*tipb.ByItem, fields []*types.FieldType)

AddAggregate implements XExecutor interface.

func (*XSelectTableExec) Close

func (e *XSelectTableExec) Close() error

Close implements Executor Close interface.

func (*XSelectTableExec) Fields

func (e *XSelectTableExec) Fields() []*ast.ResultField

Fields implements Executor Fields interface.

func (*XSelectTableExec) GetTableName

func (e *XSelectTableExec) GetTableName() *ast.TableName

GetTableName implements XExecutor interface.

func (*XSelectTableExec) Next

func (e *XSelectTableExec) Next() (*Row, error)

Next implements Executor Next interface.

func (*XSelectTableExec) Schema

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

Schema implements Executor Schema interface.

Jump to

Keyboard shortcuts

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