executor

package
v0.0.0-...-e0c7ee5 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResultMaxRows = 1024
	InitChunkSize = 1024
	MaxChunkSize  = 1024
)
View Source
const (
	TableTypeBase = `BASE TABLE`
	TableTypeView = `VIEW`
)

Variables

Error instances.

Functions

func CheckUserGrantPriv

func CheckUserGrantPriv(store *gorm.DB, issuerUser, curUser *auth.UserIdentity, privs []*ast.PrivElem) error

func Run

func Run(ctx sessionctx.Context, stmt string, is infoschema.InfoSchema) ([]*scql.Tensor, error)

Run runs an DDL/DCL statement on SCDB

func SetAllGrantPrivTo

func SetAllGrantPrivTo(level ast.GrantLevelType, attributes map[string]interface{}, value bool) error

Types

type DDLExec

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

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

func (*DDLExec) Close

func (e *DDLExec) Close() error

Close closes all executors and release all resources.

func (*DDLExec) Next

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

Next implements the Executor Next interface.

func (*DDLExec) Open

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

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

func (*DDLExec) Schema

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

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

type Executor

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

Executor is the physical implementation of a algebra operator.

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

"Volcano-An Extensible and Parallel Query Evaluation System"

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

type GrantExec

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

	WithGrant bool
	// contains filtered or unexported fields
}

GrantExec executes GrantStmt.

func (*GrantExec) Close

func (e *GrantExec) Close() error

Close closes all executors and release all resources.

func (*GrantExec) Next

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

Next implements the Executor Next interface.

func (*GrantExec) Open

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

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

func (*GrantExec) Schema

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

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

type RevokeExec

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

RevokeExec executes RevokeStmt.

func (*RevokeExec) Close

func (e *RevokeExec) Close() error

Close closes all executors and release all resources.

func (*RevokeExec) Next

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

Next implements the Executor Next interface.

func (*RevokeExec) Open

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

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

func (*RevokeExec) Schema

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

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

type SetExecutor

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

SetExecutor executes set statement.

func (*SetExecutor) Close

func (e *SetExecutor) Close() error

Close closes all executors and release all resources.

func (*SetExecutor) Next

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

Next implements the Executor Next interface.

func (*SetExecutor) Open

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

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

func (*SetExecutor) Schema

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

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

type 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`.
	IndexName model.CIStr          // Used for show table regions.
	Flag      int                  // Some flag parsed from sql, such as FULL.
	Roles     []*auth.RoleIdentity // Used for show grants.
	User      *auth.UserIdentity   // Used by show grants, show create user.

	Full        bool
	IfNotExists bool // Used for `show create database if not exists`
	GlobalScope bool // GlobalScope is used by show variables
	Extended    bool // Used for `show extended columns from ...`
	// contains filtered or unexported fields
}

ShowExec represents a show executor.

func (*ShowExec) Close

func (e *ShowExec) Close() error

Close closes all executors and release all resources.

func (*ShowExec) Next

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

Next implements the Executor Next interface.

func (*ShowExec) Open

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

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

func (*ShowExec) Schema

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

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

type 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`.

func (*SimpleExec) Close

func (e *SimpleExec) Close() error

Close closes all executors and release all resources.

func (*SimpleExec) Next

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

Next implements the Executor Next interface.

func (*SimpleExec) Open

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

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

func (*SimpleExec) Schema

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

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

Jump to

Keyboard shortcuts

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