core

package
v0.0.0-...-d04bc5a Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknown                         = terror.ClassOptimizer.New(mysql.ErrUnknown, mysql.MySQLErrName[mysql.ErrUnknown])
	ErrUnknownColumn                   = terror.ClassOptimizer.New(mysql.ErrBadField, mysql.MySQLErrName[mysql.ErrBadField])
	ErrAmbiguous                       = terror.ClassOptimizer.New(mysql.ErrNonUniq, mysql.MySQLErrName[mysql.ErrNonUniq])
	ErrUnsupportedType                 = terror.ClassOptimizer.New(mysql.ErrUnsupportedType, mysql.MySQLErrName[mysql.ErrUnsupportedType])
	ErrDupFieldName                    = terror.ClassOptimizer.New(mysql.ErrDupFieldName, mysql.MySQLErrName[mysql.ErrDupFieldName])
	ErrInvalidWildCard                 = terror.ClassOptimizer.New(mysql.ErrInvalidWildCard, mysql.MySQLErrName[mysql.ErrInvalidWildCard])
	ErrNoDB                            = terror.ClassOptimizer.New(mysql.ErrNoDB, mysql.MySQLErrName[mysql.ErrNoDB])
	ErrBadTable                        = terror.ClassOptimizer.New(mysql.ErrBadTable, mysql.MySQLErrName[mysql.ErrBadTable])
	ErrNonUniqTable                    = terror.ClassOptimizer.New(mysql.ErrNonuniqTable, mysql.MySQLErrName[mysql.ErrNonuniqTable])
	ErrIllegalReference                = terror.ClassOptimizer.New(mysql.ErrIllegalReference, mysql.MySQLErrName[mysql.ErrIllegalReference])
	ErrWrongGroupField                 = terror.ClassOptimizer.New(mysql.ErrWrongGroupField, mysql.MySQLErrName[mysql.ErrWrongGroupField])
	ErrInvalidGroupFuncUse             = terror.ClassOptimizer.New(mysql.ErrInvalidGroupFuncUse, mysql.MySQLErrName[mysql.ErrInvalidGroupFuncUse])
	ErrWrongUsage                      = terror.ClassOptimizer.New(mysql.ErrWrongUsage, mysql.MySQLErrName[mysql.ErrWrongUsage])
	ErrWindowInvalidWindowFuncAliasUse = terror.ClassOptimizer.New(mysql.ErrWindowInvalidWindowFuncAliasUse, mysql.MySQLErrName[mysql.ErrWindowInvalidWindowFuncAliasUse])
	ErrWrongArguments                  = terror.ClassOptimizer.New(mysql.ErrWrongArguments, mysql.MySQLErrName[mysql.ErrWrongArguments])
	ErrTablenameNotAllowedHere         = terror.ClassOptimizer.New(mysql.ErrTablenameNotAllowedHere, mysql.MySQLErrName[mysql.ErrTablenameNotAllowedHere])
	ErrWrongNumberOfColumnsInSelect    = terror.ClassOptimizer.New(mysql.ErrWrongNumberOfColumnsInSelect, mysql.MySQLErrName[mysql.ErrWrongNumberOfColumnsInSelect])
	ErrDBaccessDenied                  = terror.ClassOptimizer.New(mysql.ErrDBaccessDenied, mysql.MySQLErrName[mysql.ErrDBaccessDenied])
	ErrTableaccessDenied               = terror.ClassOptimizer.New(mysql.ErrTableaccessDenied, mysql.MySQLErrName[mysql.ErrTableaccessDenied])
	ErrPrivilegeCheckFail              = terror.ClassOptimizer.New(mysql.ErrPrivilegeCheckFail, mysql.MySQLErrName[mysql.ErrPrivilegeCheckFail])
	ErrSpecificAccessDenied            = terror.ClassOptimizer.New(mysql.ErrSpecificAccessDenied, mysql.MySQLErrName[mysql.ErrSpecificAccessDenied])
	ErrViewInvalid                     = terror.ClassOptimizer.New(mysql.ErrViewInvalid, mysql.MySQLErrName[mysql.ErrViewInvalid])
	ErrWindowInvalidWindowFuncUse      = terror.ClassOptimizer.New(mysql.ErrWindowInvalidWindowFuncUse, mysql.MySQLErrName[mysql.ErrWindowInvalidWindowFuncUse])
	ErrWindowNoSuchWindow              = terror.ClassOptimizer.New(mysql.ErrWindowNoSuchWindow, mysql.MySQLErrName[mysql.ErrWindowNoSuchWindow])
	ErrWindowCircularityInWindowGraph  = terror.ClassOptimizer.New(mysql.ErrWindowCircularityInWindowGraph, mysql.MySQLErrName[mysql.ErrWindowCircularityInWindowGraph])
	ErrWindowNoChildPartitioning       = terror.ClassOptimizer.New(mysql.ErrWindowNoChildPartitioning, mysql.MySQLErrName[mysql.ErrWindowNoChildPartitioning])
	ErrWindowNoInherentFrame           = terror.ClassOptimizer.New(mysql.ErrWindowNoInherentFrame, mysql.MySQLErrName[mysql.ErrWindowNoInherentFrame])
	ErrWindowNoRedefineOrderBy         = terror.ClassOptimizer.New(mysql.ErrWindowNoRedefineOrderBy, mysql.MySQLErrName[mysql.ErrWindowNoRedefineOrderBy])
	ErrWindowDuplicateName             = terror.ClassOptimizer.New(mysql.ErrWindowDuplicateName, mysql.MySQLErrName[mysql.ErrWindowDuplicateName])
	ErrPartitionClauseOnNonpartitioned = terror.ClassOptimizer.New(mysql.ErrPartitionClauseOnNonpartitioned, mysql.MySQLErrName[mysql.ErrPartitionClauseOnNonpartitioned])
	ErrWindowFrameStartIllegal         = terror.ClassOptimizer.New(mysql.ErrWindowFrameStartIllegal, mysql.MySQLErrName[mysql.ErrWindowFrameStartIllegal])
	ErrWindowFrameEndIllegal           = terror.ClassOptimizer.New(mysql.ErrWindowFrameEndIllegal, mysql.MySQLErrName[mysql.ErrWindowFrameEndIllegal])
	ErrWindowFrameIllegal              = terror.ClassOptimizer.New(mysql.ErrWindowFrameIllegal, mysql.MySQLErrName[mysql.ErrWindowFrameIllegal])
	ErrWindowRangeFrameOrderType       = terror.ClassOptimizer.New(mysql.ErrWindowRangeFrameOrderType, mysql.MySQLErrName[mysql.ErrWindowRangeFrameOrderType])
	ErrWindowRangeFrameTemporalType    = terror.ClassOptimizer.New(mysql.ErrWindowRangeFrameTemporalType, mysql.MySQLErrName[mysql.ErrWindowRangeFrameTemporalType])
	ErrWindowRangeFrameNumericType     = terror.ClassOptimizer.New(mysql.ErrWindowRangeFrameNumericType, mysql.MySQLErrName[mysql.ErrWindowRangeFrameNumericType])
	ErrWindowRangeBoundNotConstant     = terror.ClassOptimizer.New(mysql.ErrWindowRangeBoundNotConstant, mysql.MySQLErrName[mysql.ErrWindowRangeBoundNotConstant])
	ErrWindowRowsIntervalUse           = terror.ClassOptimizer.New(mysql.ErrWindowRowsIntervalUse, mysql.MySQLErrName[mysql.ErrWindowRowsIntervalUse])
	ErrWindowFunctionIgnoresFrame      = terror.ClassOptimizer.New(mysql.ErrWindowFunctionIgnoresFrame, mysql.MySQLErrName[mysql.ErrWindowFunctionIgnoresFrame])
	ErrNotSupportedYet                 = terror.ClassOptimizer.New(mysql.ErrNotSupportedYet, mysql.MySQLErrName[mysql.ErrNotSupportedYet])
)

Functions

func AddSelection

func AddSelection(p LogicalPlan, child LogicalPlan, conditions []expression.Expression, chIdx int)

func BuildChildCtx

func BuildChildCtx(d Dialect, in LogicalPlan) (*runSqlCtx, error)

func CheckAggFuncArgInGroupByItems

func CheckAggFuncArgInGroupByItems(p LogicalPlan) error

func CheckPrivilege

func CheckPrivilege(activeRoles []*auth.RoleIdentity, pm privilege.Manager, vs []visitInfo) error

CheckPrivilege checks the privilege for a user.

func DeriveOtherConditions

func DeriveOtherConditions(p *LogicalJoin, deriveLeft bool, deriveRight bool) (leftCond []expression.Expression,
	rightCond []expression.Expression)

DeriveOtherConditions given a LogicalJoin, check the OtherConditions to see if we can derive more conditions for left/right child pushdown.

func DrawLogicalPlan

func DrawLogicalPlan(lp LogicalPlan) string

DrawLogicalPlan draws a logical plan in Graphviz format. One can visualize the returned string at http://www.webgraphviz.com/

func ExprsHasSideEffects

func ExprsHasSideEffects(exprs []expression.Expression) bool

ExprsHasSideEffects checks if any of the expressions has side effects.

func InPrepare

func InPrepare(p *preprocessor)

InPrepare is a PreprocessOpt that indicates preprocess is executing under prepare statement.

func InTxnRetry

func InTxnRetry(p *preprocessor)

InTxnRetry is a PreprocessOpt that indicates preprocess is executing under transaction retry.

func NewRunSqlCtx

func NewRunSqlCtx() *runSqlCtx

func Preprocess

func Preprocess(ctx sessionctx.Context, node ast.Node, is infoschema.InfoSchema, preprocessOpt ...PreprocessOpt) error

Preprocess resolves table names of the node, and checks some statements validation.

func ReplaceColumnOfExpr

func ReplaceColumnOfExpr(expr expression.Expression, proj *LogicalProjection, schema *expression.Schema) expression.Expression

ReplaceColumnOfExpr replaces column of expression by another LogicalProjection.

func ReplaceTableNameInSQL

func ReplaceTableNameInSQL(sql string, dialect format.Dialect, restoreFlags format.RestoreFlags, m map[DbTable]DbTable) (newSql string, err error)

func ResolveExprAndReplace

func ResolveExprAndReplace(origin expression.Expression, replace map[string]*expression.Column)

ResolveExprAndReplace replaces columns fields of expressions by children logical plans.

func RewriteSQLFromLP

func RewriteSQLFromLP(lp LogicalPlan, m map[DbTable]DbTable, needRewrite bool) (sql string, newTableRefs []string, err error)

RewriteSQLFromLP create sql string from lp with dialect

func ToString

func ToString(p Plan) string

ToString explains a Plan, returns description string.

Types

type AggregateFuncExtractor

type AggregateFuncExtractor struct {

	// AggFuncs is the collected AggregateFuncExprs.
	AggFuncs []*ast.AggregateFuncExpr
	// contains filtered or unexported fields
}

AggregateFuncExtractor visits Expr tree. It converts ColunmNameExpr to AggregateFuncExpr and collects AggregateFuncExpr.

func (*AggregateFuncExtractor) Enter

func (a *AggregateFuncExtractor) Enter(n ast.Node) (ast.Node, bool)

Enter implements Visitor interface.

func (*AggregateFuncExtractor) Leave

func (a *AggregateFuncExtractor) Leave(n ast.Node) (ast.Node, bool)

Leave implements Visitor interface.

type ByItems

type ByItems struct {
	Expr expression.Expression
	Desc bool
}

ByItems wraps a "by" item.

func (*ByItems) Clone

func (by *ByItems) Clone() *ByItems

Clone makes a copy of ByItems.

func (*ByItems) String

func (by *ByItems) String() string

String implements fmt.Stringer interface.

type CVSDBDialect

type CVSDBDialect struct {
	MySQLDialect
}

func NewCVSDBDialect

func NewCVSDBDialect() *CVSDBDialect

func (*CVSDBDialect) GetFormatDialect

func (d *CVSDBDialect) GetFormatDialect() format.Dialect

func (*CVSDBDialect) GetRestoreFlags

func (d *CVSDBDialect) GetRestoreFlags() format.RestoreFlags

func (*CVSDBDialect) SupportAnyValue

func (d *CVSDBDialect) SupportAnyValue() bool

type ClauseType

type ClauseType int
const (
	// table source includes join, union, table
	ClauseTableSource ClauseType = iota
	ClauseWhere
	ClauseAggregate
	ClauseHaving
	ClauseWindow
	ClauseProjection
	ClauseOrderby
	ClauseLimit
)

type DBType

type DBType int
const (
	DBTypeUnknown DBType = iota
	DBTypeMySQL
	DBTypeSQLite
	DBTypePostgres
	DBTypeCSVDB
	DBTypeODPS
)

func ParseDBType

func ParseDBType(tp string) (DBType, error)

func RewriteTableRefsAndGetDBType

func RewriteTableRefsAndGetDBType(m map[DbTable]DbTable, tableRefs []string) ([]string, DBType, error)

RewriteTableRefsAndGetDBType rewrites the tableRefs with local db_dbname.table_name and get db type of table

func (DBType) String

func (t DBType) String() string

type DDL

type DDL struct {
	Statement ast.DDLNode
	// contains filtered or unexported fields
}

DDL represents a DDL statement plan.

func (*DDL) OutputNames

func (s *DDL) OutputNames() types.NameSlice

OutputNames returns the outputting names of each column.

func (*DDL) Schema

func (s *DDL) Schema() *expression.Schema

Schema implements the Plan.Schema interface.

func (*DDL) SetOutputNames

func (s *DDL) SetOutputNames(names types.NameSlice)

func (*DDL) SetSchema

func (s *DDL) SetSchema(schema *expression.Schema)

SetSchema implements the Plan.SetSchema interface.

type DataSource

type DataSource struct {
	Columns   []*model.ColumnInfo
	DBName    model.CIStr
	PartyName model.CIStr

	TableAsName *model.CIStr

	// TblCols contains the original columns of table before being pruned, and it
	// is used for estimating table scan cost.
	TblCols []*expression.Column
	// contains filtered or unexported fields
}

DataSource represents a tableScan without condition push down.

func (*DataSource) BuildKeyInfo

func (p *DataSource) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (DataSource) Init

func (ds DataSource) Init(ctx sessionctx.Context, offset int) *DataSource

Init initializes DataSource.

func (*DataSource) OutputNames

func (s *DataSource) OutputNames() types.NameSlice

func (*DataSource) PredicatePushDown

func (ds *DataSource) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*DataSource) PruneColumns

func (ds *DataSource) PruneColumns(parentUsedCols []*expression.Column) error

PruneColumns implements LogicalPlan interface.

func (*DataSource) Schema

func (s *DataSource) Schema() *expression.Schema

Schema implements the Plan.Schema interface.

func (*DataSource) SetOutputNames

func (s *DataSource) SetOutputNames(names types.NameSlice)

func (*DataSource) SetSchema

func (s *DataSource) SetSchema(schema *expression.Schema)

func (*DataSource) SqlStmt

func (p *DataSource) SqlStmt(d Dialect) (*runSqlCtx, error)

func (*DataSource) TableInfo

func (ds *DataSource) TableInfo() *model.TableInfo

TableInfo returns the *TableInfo of data source.

type DbTable

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

func GetSourceTables

func GetSourceTables(sql string) ([]DbTable, error)

func NewDbTable

func NewDbTable(db, table string) DbTable

func NewDbTableFromString

func NewDbTableFromString(dbTableName string) (DbTable, error)

func (*DbTable) GetDbName

func (dt *DbTable) GetDbName() string

func (*DbTable) GetTableName

func (dt *DbTable) GetTableName() string

func (*DbTable) SetDBType

func (dt *DbTable) SetDBType(dbType DBType)

func (*DbTable) String

func (dt *DbTable) String() string

type DbTableRewriter

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

replace ref table name by local table name

func NewDbTableRewriter

func NewDbTableRewriter(m map[DbTable]DbTable) *DbTableRewriter

func (*DbTableRewriter) Enter

func (r *DbTableRewriter) Enter(in ast.Node) (ast.Node, bool)

func (*DbTableRewriter) Error

func (r *DbTableRewriter) Error() error

func (*DbTableRewriter) Leave

func (r *DbTableRewriter) Leave(in ast.Node) (ast.Node, bool)

type DbTableVisitor

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

replace ref table name by local table name

func NewDbTableVisitor

func NewDbTableVisitor() *DbTableVisitor

func (*DbTableVisitor) Enter

func (r *DbTableVisitor) Enter(in ast.Node) (ast.Node, bool)

func (*DbTableVisitor) Error

func (r *DbTableVisitor) Error() error

func (*DbTableVisitor) Leave

func (r *DbTableVisitor) Leave(in ast.Node) (ast.Node, bool)

func (*DbTableVisitor) Tables

func (r *DbTableVisitor) Tables() []DbTable

type Dialect

type Dialect interface {
	GetRestoreFlags() format.RestoreFlags
	GetFormatDialect() format.Dialect
	SupportAnyValue() bool
}

type Explain

type Explain struct {
	TargetPlan Plan
	Format     string
	Analyze    bool
	ExecStmt   ast.StmtNode

	Rows [][]string
	// contains filtered or unexported fields
}

Explain represents a explain plan.

func (*Explain) OutputNames

func (s *Explain) OutputNames() types.NameSlice

OutputNames returns the outputting names of each column.

func (*Explain) Schema

func (s *Explain) Schema() *expression.Schema

Schema implements the Plan.Schema interface.

func (*Explain) SetOutputNames

func (s *Explain) SetOutputNames(names types.NameSlice)

func (*Explain) SetSchema

func (s *Explain) SetSchema(schema *expression.Schema)

SetSchema implements the Plan.SetSchema interface.

type FrameBound

type FrameBound struct {
	Type      ast.BoundType
	UnBounded bool
	Num       uint64
	// CalcFuncs is used for range framed windows.
	// We will build the date_add or date_sub functions for frames like `INTERVAL '2:30' MINUTE_SECOND FOLLOWING`,
	// and plus or minus for frames like `1 preceding`.
	CalcFuncs []expression.Expression
	// CmpFuncs is used to decide whether one row is included in the current frame.
	CmpFuncs []expression.CompareFunc
}

FrameBound is the boundary of a frame.

type InsertTableOption

type InsertTableOption struct {
	TableName string
	Columns   []string
}

type JoinType

type JoinType int
const (
	// InnerJoin means inner join.
	InnerJoin JoinType = iota
	// LeftOuterJoin means left join.
	LeftOuterJoin
	// RightOuterJoin means right join.
	RightOuterJoin
	// SemiJoin means if row a in table A matches some rows in B, just output a.
	SemiJoin
	// AntiSemiJoin means if row a in table A does not match any row in B, then output a.
	AntiSemiJoin
	// LeftOuterSemiJoin means if row a in table A matches some rows in B, output (a, true), otherwise, output (a, false).
	LeftOuterSemiJoin
	// AntiLeftOuterSemiJoin means if row a in table A matches some rows in B, output (a, false), otherwise, output (a, true).
	AntiLeftOuterSemiJoin
)

func (JoinType) IsOuterJoin

func (tp JoinType) IsOuterJoin() bool

IsOuterJoin returns if this joiner is a outer joiner

func (JoinType) String

func (tp JoinType) String() string

type LogicalAggregation

type LogicalAggregation struct {
	AggFuncs     []*aggregation.AggFuncDesc
	GroupByItems []expression.Expression

	// LogicalAggregation is produced by `select distinct`
	ProducedByDistinct bool
	// contains filtered or unexported fields
}

LogicalAggregation represents an aggregate plan.

func (*LogicalAggregation) BuildKeyInfo

func (p *LogicalAggregation) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalAggregation) GetGroupByCols

func (la *LogicalAggregation) GetGroupByCols() []*expression.Column

GetGroupByCols returns the groupByCols. If the groupByCols haven't be collected, this method would collect them at first. If the GroupByItems have been changed, we should explicitly collect GroupByColumns before this method.

func (LogicalAggregation) Init

Init initializes LogicalAggregation.

func (*LogicalAggregation) OutputNames

func (s *LogicalAggregation) OutputNames() types.NameSlice

func (*LogicalAggregation) PredicatePushDown

func (la *LogicalAggregation) PredicatePushDown(predicates []expression.Expression) (ret []expression.Expression, retPlan LogicalPlan)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalAggregation) PruneColumns

func (la *LogicalAggregation) PruneColumns(parentUsedCols []*expression.Column) error

PruneColumns implements LogicalPlan interface.

func (*LogicalAggregation) Schema

func (s *LogicalAggregation) Schema() *expression.Schema

Schema implements the Plan.Schema interface.

func (*LogicalAggregation) SetOutputNames

func (s *LogicalAggregation) SetOutputNames(names types.NameSlice)

func (*LogicalAggregation) SetSchema

func (s *LogicalAggregation) SetSchema(schema *expression.Schema)

func (*LogicalAggregation) SqlStmt

func (p *LogicalAggregation) SqlStmt(d Dialect) (*runSqlCtx, error)

type LogicalApply

type LogicalApply struct {
	LogicalJoin

	CorCols []*expression.CorrelatedColumn
}

LogicalApply gets one row from outer executor and gets one row from inner executor according to outer row.

func (LogicalApply) Init

func (la LogicalApply) Init(ctx sessionctx.Context, offset int) *LogicalApply

Init initializes LogicalApply.

func (*LogicalApply) OutputNames

func (s *LogicalApply) OutputNames() types.NameSlice

func (*LogicalApply) PruneColumns

func (la *LogicalApply) PruneColumns(parentUsedCols []*expression.Column) error

PruneColumns implements LogicalPlan interface.

func (*LogicalApply) Schema

func (s *LogicalApply) Schema() *expression.Schema

Schema implements the Plan.Schema interface.

func (*LogicalApply) SetOutputNames

func (s *LogicalApply) SetOutputNames(names types.NameSlice)

func (*LogicalApply) SetSchema

func (s *LogicalApply) SetSchema(schema *expression.Schema)

func (*LogicalApply) SqlStmt

func (p *LogicalApply) SqlStmt(d Dialect) (*runSqlCtx, error)

type LogicalJoin

type LogicalJoin struct {
	JoinType JoinType

	EqualConditions []*expression.ScalarFunction
	LeftConditions  expression.CNFExprs
	RightConditions expression.CNFExprs
	OtherConditions expression.CNFExprs

	LeftJoinKeys  []*expression.Column
	RightJoinKeys []*expression.Column

	// DefaultValues is only used for left/right outer join, which is values the inner row's should be when the outer table
	// doesn't match any inner table's row.
	// That it's nil just means the default values is a slice of NULL.
	// Currently, only `aggregation push down` phase will set this.
	DefaultValues []types.Datum
	// contains filtered or unexported fields
}

func (*LogicalJoin) AppendJoinConds

func (p *LogicalJoin) AppendJoinConds(eq []*expression.ScalarFunction, left, right, other []expression.Expression)

AppendJoinConds appends new join conditions.

func (*LogicalJoin) AttachOnConds

func (p *LogicalJoin) AttachOnConds(onConds []expression.Expression)

AttachOnConds extracts on conditions for join and set the `EqualConditions`, `LeftConditions`, `RightConditions` and `OtherConditions` by the result of extract.

func (*LogicalJoin) BuildKeyInfo

func (p *LogicalJoin) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)

func (*LogicalJoin) ExtractOnCondition

func (p *LogicalJoin) ExtractOnCondition(
	conditions []expression.Expression,
	leftSchema *expression.Schema,
	rightSchema *expression.Schema,
	deriveLeft bool,
	deriveRight bool) (eqCond []*expression.ScalarFunction, leftCond []expression.Expression,
	rightCond []expression.Expression, otherCond []expression.Expression)

ExtractOnCondition divide conditions in CNF of join node into 4 groups. These conditions can be where conditions, join conditions, or collection of both. If deriveLeft/deriveRight is set, we would try to derive more conditions for left/right plan.

func (LogicalJoin) Init

func (p LogicalJoin) Init(ctx sessionctx.Context, offset int) *LogicalJoin

func (*LogicalJoin) OutputNames

func (s *LogicalJoin) OutputNames() types.NameSlice

func (*LogicalJoin) PredicatePushDown

func (p *LogicalJoin) PredicatePushDown(predicates []expression.Expression) (ret []expression.Expression, retPlan LogicalPlan)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalJoin) PruneColumns

func (p *LogicalJoin) PruneColumns(parentUsedCols []*expression.Column) error

func (*LogicalJoin) Schema

func (s *LogicalJoin) Schema() *expression.Schema

Schema implements the Plan.Schema interface.

func (*LogicalJoin) SetOutputNames

func (s *LogicalJoin) SetOutputNames(names types.NameSlice)

func (*LogicalJoin) SetSchema

func (s *LogicalJoin) SetSchema(schema *expression.Schema)

func (*LogicalJoin) SqlStmt

func (p *LogicalJoin) SqlStmt(d Dialect) (*runSqlCtx, error)

type LogicalLimit

type LogicalLimit struct {
	Offset uint64
	Count  uint64
	// contains filtered or unexported fields
}

LogicalLimit represents offset and limit plan.

func (*LogicalLimit) BuildKeyInfo

func (p *LogicalLimit) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalLimit) Children

func (p *LogicalLimit) Children() []LogicalPlan

func (*LogicalLimit) ExplainInfo

func (p *LogicalLimit) ExplainInfo() string

func (*LogicalLimit) HashCode

func (p *LogicalLimit) HashCode() []byte

HashCode implements LogicalPlan interface.

func (LogicalLimit) Init

func (p LogicalLimit) Init(ctx sessionctx.Context, offset int) *LogicalLimit

Init initializes LogicalLimit.

func (*LogicalLimit) OutputNames

func (p *LogicalLimit) OutputNames() types.NameSlice

func (*LogicalLimit) PredicatePushDown

func (p *LogicalLimit) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan)

PredicatePushDown implements LogicalPlan interface.

func (*LogicalLimit) PruneColumns

func (p *LogicalLimit) PruneColumns(parentUsedCols []*expression.Column) error

PruneColumns implements LogicalPlan interface.

func (*LogicalLimit) Schema

func (p *LogicalLimit) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (*LogicalLimit) SetChild

func (p *LogicalLimit) SetChild(i int, child LogicalPlan)

func (*LogicalLimit) SetChildren

func (p *LogicalLimit) SetChildren(children ...LogicalPlan)

func (*LogicalLimit) SetOutputNames

func (p *LogicalLimit) SetOutputNames(names types.NameSlice)

func (*LogicalLimit) SqlStmt

func (p *LogicalLimit) SqlStmt(d Dialect) (*runSqlCtx, error)

type LogicalMaxOneRow

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

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

func (*LogicalMaxOneRow) BuildKeyInfo

func (p *LogicalMaxOneRow) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalMaxOneRow) Children

func (p *LogicalMaxOneRow) Children() []LogicalPlan

func (*LogicalMaxOneRow) ExplainInfo

func (p *LogicalMaxOneRow) ExplainInfo() string

func (*LogicalMaxOneRow) HashCode

func (p *LogicalMaxOneRow) HashCode() []byte

HashCode implements LogicalPlan interface.

func (LogicalMaxOneRow) Init

Init initializes LogicalMaxOneRow.

func (*LogicalMaxOneRow) OutputNames

func (p *LogicalMaxOneRow) OutputNames() types.NameSlice

func (*LogicalMaxOneRow) PredicatePushDown

func (p *LogicalMaxOneRow) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan)

PredicatePushDown implements LogicalPlan interface.

func (*LogicalMaxOneRow) PruneColumns

func (p *LogicalMaxOneRow) PruneColumns(parentUsedCols []*expression.Column) error

PruneColumns implements LogicalPlan interface.

func (*LogicalMaxOneRow) Schema

func (p *LogicalMaxOneRow) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (*LogicalMaxOneRow) SetChild

func (p *LogicalMaxOneRow) SetChild(i int, child LogicalPlan)

func (*LogicalMaxOneRow) SetChildren

func (p *LogicalMaxOneRow) SetChildren(children ...LogicalPlan)

func (*LogicalMaxOneRow) SetOutputNames

func (p *LogicalMaxOneRow) SetOutputNames(names types.NameSlice)

func (*LogicalMaxOneRow) SqlStmt

func (p *LogicalMaxOneRow) SqlStmt(d Dialect) (*runSqlCtx, error)

type LogicalPlan

type LogicalPlan interface {
	Plan

	// HashCode encodes a LogicalPlan to fast compare whether a LogicalPlan equals to another.
	// We use a strict encode method here which ensures there is no conflict.
	HashCode() []byte

	// PredicatePushDown pushes down the predicates in the where/on/having clauses as deeply as possible.
	// It will accept a predicate that is an expression slice, and return the expressions that can't be pushed.
	// Because it might change the root if the having clause exists, we need to return a plan that represents a new root.
	PredicatePushDown([]expression.Expression) ([]expression.Expression, LogicalPlan)

	// PruneColumns prunes the unused columns.
	PruneColumns([]*expression.Column) error

	// BuildKeyInfo will collect the information of unique keys into schema.
	BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)

	// Get all the children.
	Children() []LogicalPlan

	// SetChildren sets the children for the plan.
	SetChildren(...LogicalPlan)

	// SetChild sets the ith child for the plan.
	SetChild(i int, child LogicalPlan)

	SqlStmt(Dialect) (*runSqlCtx, error)

	// Added for SCQL
	SetIntoOpt(option *ast.SelectIntoOption)
	IntoOpt() *ast.SelectIntoOption
	SetInsertTableOpt(option *InsertTableOption)
	InsertTableOpt() *InsertTableOption
	// contains filtered or unexported methods
}

func BuildLogicalPlanWithOptimization

func BuildLogicalPlanWithOptimization(ctx context.Context, sctx sessionctx.Context, node ast.Node, is infoschema.InfoSchema) (LogicalPlan, types.NameSlice, error)

BuildLogicalPlanWithOptimization used to build logical plan from ast.Node and optimize it on logical level.

type LogicalProjection

type LogicalProjection struct {
	Exprs []expression.Expression

	// CalculateNoDelay indicates this Projection is the root Plan and should be
	// calculated without delay and will not return any result to client.
	// Currently it is "true" only when the current sql query is a "DO" statement.
	// See "https://dev.mysql.com/doc/refman/5.7/en/do.html" for more detail.
	CalculateNoDelay bool

	// AvoidColumnEvaluator is a temporary variable which is ONLY used to avoid
	// building columnEvaluator for the expressions of Projection which is
	// built by buildProjection4Union.
	// This can be removed after column pool being supported.
	// Related issue: TiDB#8141(https://github.com/pingcap/tidb/issues/8141)
	AvoidColumnEvaluator bool
	// contains filtered or unexported fields
}

func (*LogicalProjection) BuildKeyInfo

func (p *LogicalProjection) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (LogicalProjection) Init

Init initializes LogicalProjection.

func (*LogicalProjection) OutputNames

func (s *LogicalProjection) OutputNames() types.NameSlice

func (*LogicalProjection) PredicatePushDown

func (p *LogicalProjection) PredicatePushDown(predicates []expression.Expression) (ret []expression.Expression, retPlan LogicalPlan)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalProjection) PruneColumns

func (p *LogicalProjection) PruneColumns(parentUsedCols []*expression.Column) error

PruneColumns implements LogicalPlan interface.

func (*LogicalProjection) Schema

func (s *LogicalProjection) Schema() *expression.Schema

Schema implements the Plan.Schema interface.

func (*LogicalProjection) SetOutputNames

func (s *LogicalProjection) SetOutputNames(names types.NameSlice)

func (*LogicalProjection) SetSchema

func (s *LogicalProjection) SetSchema(schema *expression.Schema)

func (*LogicalProjection) SqlStmt

func (p *LogicalProjection) SqlStmt(d Dialect) (*runSqlCtx, error)

type LogicalSelection

type LogicalSelection struct {

	// Originally the WHERE or ON condition is parsed into a single expression,
	// but after we converted to CNF(Conjunctive normal form), it can be
	// split into a list of AND conditions.
	Conditions               []expression.Expression
	AffectedByGroupThreshold bool
	// contains filtered or unexported fields
}

LogicalSelection represents a where or having predicate.

func (*LogicalSelection) BuildKeyInfo

func (p *LogicalSelection) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalSelection) Children

func (p *LogicalSelection) Children() []LogicalPlan

func (*LogicalSelection) ExplainInfo

func (p *LogicalSelection) ExplainInfo() string

func (*LogicalSelection) HashCode

func (p *LogicalSelection) HashCode() []byte

HashCode implements LogicalPlan interface.

func (LogicalSelection) Init

Init initializes LogicalSelection.

func (*LogicalSelection) OutputNames

func (p *LogicalSelection) OutputNames() types.NameSlice

func (*LogicalSelection) PredicatePushDown

func (p *LogicalSelection) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalSelection) PruneColumns

func (p *LogicalSelection) PruneColumns(parentUsedCols []*expression.Column) error

PruneColumns implements LogicalPlan interface.

func (*LogicalSelection) Schema

func (p *LogicalSelection) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (*LogicalSelection) SetChild

func (p *LogicalSelection) SetChild(i int, child LogicalPlan)

func (*LogicalSelection) SetChildren

func (p *LogicalSelection) SetChildren(children ...LogicalPlan)

func (*LogicalSelection) SetOutputNames

func (p *LogicalSelection) SetOutputNames(names types.NameSlice)

func (*LogicalSelection) SqlStmt

func (p *LogicalSelection) SqlStmt(d Dialect) (*runSqlCtx, error)

type LogicalShow

type LogicalShow struct {
	ShowContents
	// contains filtered or unexported fields
}

LogicalShow represents a show plan.

func (*LogicalShow) BuildKeyInfo

func (p *LogicalShow) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (LogicalShow) Init

Init initializes LogicalShow.

func (*LogicalShow) OutputNames

func (s *LogicalShow) OutputNames() types.NameSlice

func (*LogicalShow) Schema

func (s *LogicalShow) Schema() *expression.Schema

Schema implements the Plan.Schema interface.

func (*LogicalShow) SetOutputNames

func (s *LogicalShow) SetOutputNames(names types.NameSlice)

func (*LogicalShow) SetSchema

func (s *LogicalShow) SetSchema(schema *expression.Schema)

type LogicalSort

type LogicalSort struct {
	ByItems []*ByItems
	// contains filtered or unexported fields
}

LogicalSort stands for the order by plan.

func (*LogicalSort) BuildKeyInfo

func (p *LogicalSort) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalSort) Children

func (p *LogicalSort) Children() []LogicalPlan

func (*LogicalSort) ExplainInfo

func (p *LogicalSort) ExplainInfo() string

func (*LogicalSort) HashCode

func (p *LogicalSort) HashCode() []byte

HashCode implements LogicalPlan interface.

func (LogicalSort) Init

func (ls LogicalSort) Init(ctx sessionctx.Context, offset int) *LogicalSort

Init initializes LogicalSort.

func (*LogicalSort) OutputNames

func (p *LogicalSort) OutputNames() types.NameSlice

func (*LogicalSort) PredicatePushDown

func (p *LogicalSort) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan)

PredicatePushDown implements LogicalPlan interface.

func (*LogicalSort) PruneColumns

func (ls *LogicalSort) PruneColumns(parentUsedCols []*expression.Column) error

PruneColumns implements LogicalPlan interface. If any expression can view as a constant in execution stage, such as correlated column, constant, we do prune them. Note that we can't prune the expressions contain non-deterministic functions, such as rand().

func (*LogicalSort) Schema

func (p *LogicalSort) Schema() *expression.Schema

Schema implements Plan Schema interface.

func (*LogicalSort) SetChild

func (p *LogicalSort) SetChild(i int, child LogicalPlan)

func (*LogicalSort) SetChildren

func (p *LogicalSort) SetChildren(children ...LogicalPlan)

func (*LogicalSort) SetOutputNames

func (p *LogicalSort) SetOutputNames(names types.NameSlice)

func (*LogicalSort) SqlStmt

func (p *LogicalSort) SqlStmt(d Dialect) (*runSqlCtx, error)

type LogicalTableDual

type LogicalTableDual struct {
	RowCount int
	// contains filtered or unexported fields
}

LogicalTableDual represents a dual table plan.

func (*LogicalTableDual) BuildKeyInfo

func (p *LogicalTableDual) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (LogicalTableDual) Init

Init initializes LogicalTableDual.

func (*LogicalTableDual) OutputNames

func (s *LogicalTableDual) OutputNames() types.NameSlice

func (*LogicalTableDual) Schema

func (s *LogicalTableDual) Schema() *expression.Schema

Schema implements the Plan.Schema interface.

func (*LogicalTableDual) SetOutputNames

func (s *LogicalTableDual) SetOutputNames(names types.NameSlice)

func (*LogicalTableDual) SetSchema

func (s *LogicalTableDual) SetSchema(schema *expression.Schema)

type LogicalTableScan

type LogicalTableScan struct {
	Source *DataSource
	Ranges []*ranger.Range
	// contains filtered or unexported fields
}

LogicalTableScan is the logical table scan operator.

func (*LogicalTableScan) BuildKeyInfo

func (p *LogicalTableScan) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (LogicalTableScan) Init

func (ts LogicalTableScan) Init(ctx sessionctx.Context, offset int) *LogicalTableScan

Init initializes LogicalTableScan.

func (*LogicalTableScan) OutputNames

func (s *LogicalTableScan) OutputNames() types.NameSlice

func (*LogicalTableScan) Schema

func (s *LogicalTableScan) Schema() *expression.Schema

Schema implements the Plan.Schema interface.

func (*LogicalTableScan) SetOutputNames

func (s *LogicalTableScan) SetOutputNames(names types.NameSlice)

func (*LogicalTableScan) SetSchema

func (s *LogicalTableScan) SetSchema(schema *expression.Schema)

type LogicalUnionAll

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

LogicalUnionAll represents LogicalUnionAll plan.

func (*LogicalUnionAll) BuildKeyInfo

func (p *LogicalUnionAll) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (LogicalUnionAll) Init

func (p LogicalUnionAll) Init(ctx sessionctx.Context, offset int) *LogicalUnionAll

Init initializes LogicalUnionAll.

func (*LogicalUnionAll) OutputNames

func (s *LogicalUnionAll) OutputNames() types.NameSlice

func (*LogicalUnionAll) PredicatePushDown

func (p *LogicalUnionAll) PredicatePushDown(predicates []expression.Expression) (ret []expression.Expression, retPlan LogicalPlan)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalUnionAll) PruneColumns

func (p *LogicalUnionAll) PruneColumns(parentUsedCols []*expression.Column) error

PruneColumns implements LogicalPlan interface.

func (*LogicalUnionAll) Schema

func (s *LogicalUnionAll) Schema() *expression.Schema

Schema implements the Plan.Schema interface.

func (*LogicalUnionAll) SetOutputNames

func (s *LogicalUnionAll) SetOutputNames(names types.NameSlice)

func (*LogicalUnionAll) SetSchema

func (s *LogicalUnionAll) SetSchema(schema *expression.Schema)

func (*LogicalUnionAll) SqlStmt

func (p *LogicalUnionAll) SqlStmt(d Dialect) (*runSqlCtx, error)

type LogicalWindow

type LogicalWindow struct {
	WindowFuncDescs []*aggregation.WindowFuncDesc
	PartitionBy     []property.Item
	OrderBy         []property.Item
	Frame           *WindowFrame
	// contains filtered or unexported fields
}

LogicalWindow represents a logical window function plan.

func (*LogicalWindow) BuildKeyInfo

func (p *LogicalWindow) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalWindow) GetPartitionByCols

func (p *LogicalWindow) GetPartitionByCols() []*expression.Column

func (*LogicalWindow) GetWindowResultColumns

func (p *LogicalWindow) GetWindowResultColumns() []*expression.Column

GetWindowResultColumns returns the columns storing the result of the window function.

func (LogicalWindow) Init

func (p LogicalWindow) Init(ctx sessionctx.Context, offset int) *LogicalWindow

Init initializes LogicalWindow.

func (*LogicalWindow) OutputNames

func (s *LogicalWindow) OutputNames() types.NameSlice

func (*LogicalWindow) PredicatePushDown

func (p *LogicalWindow) PredicatePushDown(predicates []expression.Expression) ([]expression.Expression, LogicalPlan)

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalWindow) PruneColumns

func (p *LogicalWindow) PruneColumns(parentUsedCols []*expression.Column) error

PruneColumns implements LogicalPlan interface.

func (*LogicalWindow) Schema

func (s *LogicalWindow) Schema() *expression.Schema

Schema implements the Plan.Schema interface.

func (*LogicalWindow) SetOutputNames

func (s *LogicalWindow) SetOutputNames(names types.NameSlice)

func (*LogicalWindow) SetSchema

func (s *LogicalWindow) SetSchema(schema *expression.Schema)

func (*LogicalWindow) SqlStmt

func (p *LogicalWindow) SqlStmt(d Dialect) (*runSqlCtx, error)

type MySQLDialect

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

func NewMySQLDialect

func NewMySQLDialect() *MySQLDialect

func (*MySQLDialect) GetFormatDialect

func (d *MySQLDialect) GetFormatDialect() format.Dialect

func (*MySQLDialect) GetRestoreFlags

func (d *MySQLDialect) GetRestoreFlags() format.RestoreFlags

func (*MySQLDialect) SupportAnyValue

func (d *MySQLDialect) SupportAnyValue() bool

type OdpsDialect

type OdpsDialect struct {
	MySQLDialect
}

func NewOdpsDialect

func NewOdpsDialect() *OdpsDialect

func (*OdpsDialect) GetFormatDialect

func (d *OdpsDialect) GetFormatDialect() format.Dialect

func (*OdpsDialect) GetRestoreFlags

func (d *OdpsDialect) GetRestoreFlags() format.RestoreFlags

func (*OdpsDialect) SupportAnyValue

func (d *OdpsDialect) SupportAnyValue() bool

type Plan

type Plan interface {
	// Get the schema.
	Schema() *expression.Schema

	// Get the ID.
	ID() int

	// TP get the plan type.
	TP() string

	// Get the ID in explain statement
	ExplainID() fmt.Stringer

	// ExplainInfo returns operator information to be explained.
	ExplainInfo() string

	SCtx() sessionctx.Context

	// OutputNames returns the outputting names of each column.
	OutputNames() types.NameSlice

	// SetOutputNames sets the outputting name by the given slice.
	SetOutputNames(names types.NameSlice)

	SelectBlockOffset() int
	// contains filtered or unexported methods
}

func BuildLogicalPlan

func BuildLogicalPlan(ctx context.Context, sctx sessionctx.Context, node ast.Node, is infoschema.InfoSchema) (Plan, types.NameSlice, error)

BuildLogicalPlan used to build logical plan from ast.Node.

type PlanBuilder

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

PlanBuilder builds Plan from an ast.Node. It just builds the ast node straightforwardly.

func NewPlanBuilder

func NewPlanBuilder(sctx sessionctx.Context, is infoschema.InfoSchema) *PlanBuilder

NewPlanBuilder creates a new PlanBuilder.

func (*PlanBuilder) Build

func (b *PlanBuilder) Build(ctx context.Context, node ast.Node) (Plan, error)

Build builds the ast node to a Plan.

func (*PlanBuilder) BuildDataSourceFromView

func (b *PlanBuilder) BuildDataSourceFromView(ctx context.Context, dbName model.CIStr, tableInfo *model.TableInfo) (LogicalPlan, error)

BuildDataSourceFromView is used to build LogicalPlan from view

func (*PlanBuilder) GetOptFlag

func (b *PlanBuilder) GetOptFlag() uint64

GetOptFlag gets the optFlag of the PlanBuilder.

func (*PlanBuilder) GetVisitInfo

func (b *PlanBuilder) GetVisitInfo() []visitInfo

GetVisitInfo gets the visitInfo of the PlanBuilder.

func (*PlanBuilder) TableHints

func (b *PlanBuilder) TableHints() *tableHintInfo

TableHints returns the *tableHintInfo of PlanBuilder.

type PostgresDialect

type PostgresDialect struct {
	MySQLDialect
}

func NewPostgresDialect

func NewPostgresDialect() *PostgresDialect

func (*PostgresDialect) GetFormatDialect

func (d *PostgresDialect) GetFormatDialect() format.Dialect

func (*PostgresDialect) GetRestoreFlags

func (d *PostgresDialect) GetRestoreFlags() format.RestoreFlags

func (*PostgresDialect) SupportAnyValue

func (d *PostgresDialect) SupportAnyValue() bool

type PreprocessOpt

type PreprocessOpt func(*preprocessor)

PreprocessOpt presents optional parameters to `Preprocess` method.

type Set

type Set struct {
	VarAssigns []*expression.VarAssignment
	// contains filtered or unexported fields
}

func (*Set) OutputNames

func (s *Set) OutputNames() types.NameSlice

OutputNames returns the outputting names of each column.

func (*Set) Schema

func (s *Set) Schema() *expression.Schema

Schema implements the Plan.Schema interface.

func (*Set) SetOutputNames

func (s *Set) SetOutputNames(names types.NameSlice)

func (*Set) SetSchema

func (s *Set) SetSchema(schema *expression.Schema)

SetSchema implements the Plan.SetSchema interface.

type ShowContents

type ShowContents struct {
	Tp        ast.ShowStmtType // Databases/Tables/Columns/....
	DBName    string
	Table     *ast.TableName  // Used for showing columns.
	Column    *ast.ColumnName // Used for `desc table column`.
	IndexName model.CIStr
	Flag      int                  // Some flag parsed from sql, such as FULL.
	User      *auth.UserIdentity   // Used for show grants.
	Roles     []*auth.RoleIdentity // Used for show grants.

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

ShowContents stores the contents for the `SHOW` statement.

type Simple

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

Simple represents a simple statement plan which doesn't need any optimization.

func (*Simple) OutputNames

func (s *Simple) OutputNames() types.NameSlice

OutputNames returns the outputting names of each column.

func (*Simple) Schema

func (s *Simple) Schema() *expression.Schema

Schema implements the Plan.Schema interface.

func (*Simple) SetOutputNames

func (s *Simple) SetOutputNames(names types.NameSlice)

func (*Simple) SetSchema

func (s *Simple) SetSchema(schema *expression.Schema)

SetSchema implements the Plan.SetSchema interface.

type WindowFrame

type WindowFrame struct {
	Type  ast.FrameType
	Start *FrameBound
	End   *FrameBound
}

WindowFrame represents a window function frame.

type WindowFuncExtractor

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

WindowFuncExtractor visits Expr tree. It converts ColunmNameExpr to WindowFuncExpr and collects WindowFuncExpr.

func (*WindowFuncExtractor) Enter

func (a *WindowFuncExtractor) Enter(n ast.Node) (ast.Node, bool)

Enter implements Visitor interface.

func (*WindowFuncExtractor) Leave

func (a *WindowFuncExtractor) Leave(n ast.Node) (ast.Node, bool)

Leave implements Visitor interface.

Jump to

Keyboard shortcuts

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