tidb: github.com/pingcap/tidb/planner/core Index | Files

package core

import "github.com/pingcap/tidb/planner/core"

Index

Package Files

cache.go cacheable_checker.go common_plans.go encode.go errors.go exhaust_physical_plans.go explain.go expression_rewriter.go find_best_task.go hashcode.go hints.go initialize.go logical_plan_builder.go logical_plans.go memtable_predicate_extractor.go mock.go optimizer.go pb_to_plan.go physical_plans.go plan.go plan_to_pb.go planbuilder.go point_get_plan.go preprocess.go property_cols_prune.go resolve_indices.go rule_aggregation_elimination.go rule_aggregation_push_down.go rule_build_key_info.go rule_column_pruning.go rule_decorrelate.go rule_eliminate_projection.go rule_inject_extra_projection.go rule_join_elimination.go rule_join_reorder.go rule_join_reorder_dp.go rule_join_reorder_greedy.go rule_max_min_eliminate.go rule_partition_processor.go rule_predicate_push_down.go rule_topn_push_down.go stats.go stringer.go task.go trace.go util.go

Constants

const (
    // TiDBMergeJoin is hint enforce merge join.
    TiDBMergeJoin = "tidb_smj"
    // HintSMJ is hint enforce merge join.
    HintSMJ = "sm_join"
    // TiDBIndexNestedLoopJoin is hint enforce index nested loop join.
    TiDBIndexNestedLoopJoin = "tidb_inlj"
    // HintINLJ is hint enforce index nested loop join.
    HintINLJ = "inl_join"
    // HintINLHJ is hint enforce index nested loop hash join.
    HintINLHJ = "inl_hash_join"
    // HintINLMJ is hint enforce index nested loop merge join.
    HintINLMJ = "inl_merge_join"
    // TiDBHashJoin is hint enforce hash join.
    TiDBHashJoin = "tidb_hj"
    // HintHJ is hint enforce hash join.
    HintHJ = "hash_join"
    // HintHashAgg is hint enforce hash aggregation.
    HintHashAgg = "hash_agg"
    // HintStreamAgg is hint enforce stream aggregation.
    HintStreamAgg = "stream_agg"
    // HintUseIndex is hint enforce using some indexes.
    HintUseIndex = "use_index"
    // HintIgnoreIndex is hint enforce ignoring some indexes.
    HintIgnoreIndex = "ignore_index"
    // HintAggToCop is hint enforce pushing aggregation to coprocessor.
    HintAggToCop = "agg_to_cop"
    // HintReadFromStorage is hint enforce some tables read from specific type of storage.
    HintReadFromStorage = "read_from_storage"
    // HintTiFlash is a label represents the tiflash storage type.
    HintTiFlash = "tiflash"
    // HintTiKV is a label represents the tikv storage type.
    HintTiKV = "tikv"
    // HintIndexMerge is a hint to enforce using some indexes at the same time.
    HintIndexMerge = "use_index_merge"
)
const (
    // ErrExprInSelect  is in select fields for the error of ErrFieldNotInGroupBy
    ErrExprInSelect = "SELECT list"
    // ErrExprInOrderBy  is in order by items for the error of ErrFieldNotInGroupBy
    ErrExprInOrderBy = "ORDER BY"
)
const (
    // TraceFormatRow indicates row tracing format.
    TraceFormatRow = "row"
    // TraceFormatJSON indicates json tracing format.
    TraceFormatJSON = "json"
    // TraceFormatLog indicates log tracing format.
    TraceFormatLog = "log"
)
const (
    // PartitionHashSplitterType is the splitter splits by hash.
    PartitionHashSplitterType = iota
)
const (
    // SelectionFactor is the default factor of the selectivity.
    // For example, If we have no idea how to estimate the selectivity
    // of a Selection or a JoinCondition, we can use this default value.
    SelectionFactor = 0.8
)

Variables

var (

    // PreparedPlanCacheCapacity stores the global config "prepared-plan-cache-capacity".
    PreparedPlanCacheCapacity uint
    // PreparedPlanCacheMemoryGuardRatio stores the global config "prepared-plan-cache-memory-guard-ratio".
    PreparedPlanCacheMemoryGuardRatio float64
    // PreparedPlanCacheMaxMemory stores the max memory size defined in the global config "performance-max-memory".
    PreparedPlanCacheMaxMemory atomic2.Uint64
)
var (
    ErrUnsupportedType                 = terror.ClassOptimizer.New(mysql.ErrUnsupportedType, mysql.MySQLErrName[mysql.ErrUnsupportedType])
    ErrAnalyzeMissIndex                = terror.ClassOptimizer.New(mysql.ErrAnalyzeMissIndex, mysql.MySQLErrName[mysql.ErrAnalyzeMissIndex])
    ErrWrongParamCount                 = terror.ClassOptimizer.New(mysql.ErrWrongParamCount, mysql.MySQLErrName[mysql.ErrWrongParamCount])
    ErrSchemaChanged                   = terror.ClassOptimizer.New(mysql.ErrSchemaChanged, mysql.MySQLErrName[mysql.ErrSchemaChanged])
    ErrTablenameNotAllowedHere         = terror.ClassOptimizer.New(mysql.ErrTablenameNotAllowedHere, mysql.MySQLErrName[mysql.ErrTablenameNotAllowedHere])
    ErrNotSupportedYet                 = terror.ClassOptimizer.New(mysql.ErrNotSupportedYet, mysql.MySQLErrName[mysql.ErrNotSupportedYet])
    ErrWrongUsage                      = terror.ClassOptimizer.New(mysql.ErrWrongUsage, mysql.MySQLErrName[mysql.ErrWrongUsage])
    ErrUnknown                         = terror.ClassOptimizer.New(mysql.ErrUnknown, mysql.MySQLErrName[mysql.ErrUnknown])
    ErrUnknownTable                    = terror.ClassOptimizer.New(mysql.ErrUnknownTable, mysql.MySQLErrName[mysql.ErrUnknownTable])
    ErrWrongArguments                  = terror.ClassOptimizer.New(mysql.ErrWrongArguments, mysql.MySQLErrName[mysql.ErrWrongArguments])
    ErrWrongNumberOfColumnsInSelect    = terror.ClassOptimizer.New(mysql.ErrWrongNumberOfColumnsInSelect, mysql.MySQLErrName[mysql.ErrWrongNumberOfColumnsInSelect])
    ErrBadGeneratedColumn              = terror.ClassOptimizer.New(mysql.ErrBadGeneratedColumn, mysql.MySQLErrName[mysql.ErrBadGeneratedColumn])
    ErrFieldNotInGroupBy               = terror.ClassOptimizer.New(mysql.ErrFieldNotInGroupBy, mysql.MySQLErrName[mysql.ErrFieldNotInGroupBy])
    ErrBadTable                        = terror.ClassOptimizer.New(mysql.ErrBadTable, mysql.MySQLErrName[mysql.ErrBadTable])
    ErrKeyDoesNotExist                 = terror.ClassOptimizer.New(mysql.ErrKeyDoesNotExist, mysql.MySQLErrName[mysql.ErrKeyDoesNotExist])
    ErrOperandColumns                  = terror.ClassOptimizer.New(mysql.ErrOperandColumns, mysql.MySQLErrName[mysql.ErrOperandColumns])
    ErrInvalidGroupFuncUse             = terror.ClassOptimizer.New(mysql.ErrInvalidGroupFuncUse, mysql.MySQLErrName[mysql.ErrInvalidGroupFuncUse])
    ErrIllegalReference                = terror.ClassOptimizer.New(mysql.ErrIllegalReference, mysql.MySQLErrName[mysql.ErrIllegalReference])
    ErrNoDB                            = terror.ClassOptimizer.New(mysql.ErrNoDB, mysql.MySQLErrName[mysql.ErrNoDB])
    ErrUnknownExplainFormat            = terror.ClassOptimizer.New(mysql.ErrUnknownExplainFormat, mysql.MySQLErrName[mysql.ErrUnknownExplainFormat])
    ErrWrongGroupField                 = terror.ClassOptimizer.New(mysql.ErrWrongGroupField, mysql.MySQLErrName[mysql.ErrWrongGroupField])
    ErrDupFieldName                    = terror.ClassOptimizer.New(mysql.ErrDupFieldName, mysql.MySQLErrName[mysql.ErrDupFieldName])
    ErrNonUpdatableTable               = terror.ClassOptimizer.New(mysql.ErrNonUpdatableTable, mysql.MySQLErrName[mysql.ErrNonUpdatableTable])
    ErrInternal                        = terror.ClassOptimizer.New(mysql.ErrInternal, mysql.MySQLErrName[mysql.ErrInternal])
    ErrNonUniqTable                    = terror.ClassOptimizer.New(mysql.ErrNonuniqTable, mysql.MySQLErrName[mysql.ErrNonuniqTable])
    ErrWindowInvalidWindowFuncUse      = terror.ClassOptimizer.New(mysql.ErrWindowInvalidWindowFuncUse, mysql.MySQLErrName[mysql.ErrWindowInvalidWindowFuncUse])
    ErrWindowInvalidWindowFuncAliasUse = terror.ClassOptimizer.New(mysql.ErrWindowInvalidWindowFuncAliasUse, mysql.MySQLErrName[mysql.ErrWindowInvalidWindowFuncAliasUse])
    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])
    ErrUnsupportedOnGeneratedColumn    = terror.ClassOptimizer.New(mysql.ErrUnsupportedOnGeneratedColumn, mysql.MySQLErrName[mysql.ErrUnsupportedOnGeneratedColumn])
    ErrPrivilegeCheckFail              = terror.ClassOptimizer.New(mysql.ErrPrivilegeCheckFail, mysql.MySQLErrName[mysql.ErrPrivilegeCheckFail])
    ErrInvalidWildCard                 = terror.ClassOptimizer.New(mysql.ErrInvalidWildCard, mysql.MySQLErrName[mysql.ErrInvalidWildCard])
    ErrMixOfGroupFuncAndFields         = terror.ClassOptimizer.New(mysql.ErrMixOfGroupFuncAndFieldsIncompatible, mysql.MySQLErrName[mysql.ErrMixOfGroupFuncAndFieldsIncompatible])

    ErrDBaccessDenied              = terror.ClassOptimizer.New(mysql.ErrDBaccessDenied, mysql.MySQLErrName[mysql.ErrDBaccessDenied])
    ErrTableaccessDenied           = terror.ClassOptimizer.New(mysql.ErrTableaccessDenied, mysql.MySQLErrName[mysql.ErrTableaccessDenied])
    ErrSpecificAccessDenied        = terror.ClassOptimizer.New(mysql.ErrSpecificAccessDenied, mysql.MySQLErrName[mysql.ErrSpecificAccessDenied])
    ErrViewNoExplain               = terror.ClassOptimizer.New(mysql.ErrViewNoExplain, mysql.MySQLErrName[mysql.ErrViewNoExplain])
    ErrWrongValueCountOnRow        = terror.ClassOptimizer.New(mysql.ErrWrongValueCountOnRow, mysql.MySQLErrName[mysql.ErrWrongValueCountOnRow])
    ErrViewInvalid                 = terror.ClassOptimizer.New(mysql.ErrViewInvalid, mysql.MySQLErrName[mysql.ErrViewInvalid])
    ErrNoSuchThread                = terror.ClassOptimizer.New(mysql.ErrNoSuchThread, mysql.MySQLErrName[mysql.ErrNoSuchThread])
    ErrUnknownColumn               = terror.ClassOptimizer.New(mysql.ErrBadField, mysql.MySQLErrName[mysql.ErrBadField])
    ErrCartesianProductUnsupported = terror.ClassOptimizer.New(mysql.ErrCartesianProductUnsupported, mysql.MySQLErrName[mysql.ErrCartesianProductUnsupported])
    ErrStmtNotFound                = terror.ClassOptimizer.New(mysql.ErrPreparedStmtNotFound, mysql.MySQLErrName[mysql.ErrPreparedStmtNotFound])
    ErrAmbiguous                   = terror.ClassOptimizer.New(mysql.ErrNonUniq, mysql.MySQLErrName[mysql.ErrNonUniq])
    // Since we cannot know if user loggined with a password, use message of ErrAccessDeniedNoPassword instead
    ErrAccessDenied = terror.ClassOptimizer.New(mysql.ErrAccessDenied, mysql.MySQLErrName[mysql.ErrAccessDeniedNoPassword])
)

error definitions.

var AllowCartesianProduct = atomic.NewBool(true)

AllowCartesianProduct means whether tidb allows cartesian join without equal conditions.

var DefaultDisabledLogicalRulesList *atomic.Value

DefaultDisabledLogicalRulesList indicates the logical rules which should be banned.

var EvalSubquery func(ctx context.Context, p PhysicalPlan, is infoschema.InfoSchema, sctx sessionctx.Context) ([][]types.Datum, error)

EvalSubquery evaluates incorrelated subqueries once.

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

OptimizeAstNode optimizes the query to a physical plan directly.

func BuildFinalModeAggregation Uses

func BuildFinalModeAggregation(
    sctx sessionctx.Context,
    aggFuncs []*aggregation.AggFuncDesc,
    groupByItems []expression.Expression,
    finalSchema *expression.Schema) (finalAggFuncs []*aggregation.AggFuncDesc, finalGbyItems []expression.Expression, partialSchema *expression.Schema)

BuildFinalModeAggregation splits either LogicalAggregation or PhysicalAggregation to finalAgg and partial1Agg, returns the body of finalAgg and the schema of partialAgg.

func BuildPhysicalJoinSchema Uses

func BuildPhysicalJoinSchema(joinType JoinType, join PhysicalPlan) *expression.Schema

BuildPhysicalJoinSchema builds the schema of PhysicalJoin from it's children's schema.

func Cacheable Uses

func Cacheable(node ast.Node) bool

Cacheable checks whether the input ast is cacheable.

func CheckAggCanPushCop Uses

func CheckAggCanPushCop(sctx sessionctx.Context, aggFuncs []*aggregation.AggFuncDesc, groupByItems []expression.Expression, copToFlash bool) bool

CheckAggCanPushCop checks whether the aggFuncs and groupByItems can be pushed down to coprocessor.

func CheckPrivilege Uses

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

CheckPrivilege checks the privilege for a user.

func CheckTableLock Uses

func CheckTableLock(ctx sessionctx.Context, is infoschema.InfoSchema, vs []visitInfo) error

CheckTableLock checks the table lock.

func CollectPlanStatsVersion Uses

func CollectPlanStatsVersion(plan PhysicalPlan, statsInfos map[string]uint64) map[string]uint64

CollectPlanStatsVersion uses to collect the statistics version of the plan.

func DeriveOtherConditions Uses

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 EncodePlan Uses

func EncodePlan(p Plan) string

EncodePlan is used to encodePlan the plan to the plan tree with compressing.

func EraseLastSemicolon Uses

func EraseLastSemicolon(stmt ast.StmtNode)

EraseLastSemicolon removes last semicolon of sql.

func ExprsHasSideEffects Uses

func ExprsHasSideEffects(exprs []expression.Expression) bool

ExprsHasSideEffects checks if any of the expressions has side effects.

func FindColumnInfoByID Uses

func FindColumnInfoByID(colInfos []*model.ColumnInfo, id int64) *model.ColumnInfo

FindColumnInfoByID finds ColumnInfo in cols by ID.

func GenHintsFromPhysicalPlan Uses

func GenHintsFromPhysicalPlan(p Plan) string

GenHintsFromPhysicalPlan generates hints from physical plan.

func GetMetricTablePromQL Uses

func GetMetricTablePromQL(sctx sessionctx.Context, lowerTableName string, labels map[string]set.StringSet, quantiles []float64) string

GetMetricTablePromQL uses to get the promQL of metric table.

func GetPropByOrderByItems Uses

func GetPropByOrderByItems(items []*ByItems) (*property.PhysicalProperty, bool)

GetPropByOrderByItems will check if this sort property can be pushed or not. In order to simplify the problem, we only consider the case that all expression are columns.

func GetStatsInfo Uses

func GetStatsInfo(i interface{}) map[string]uint64

GetStatsInfo gets the statistics info from a physical plan tree.

func HasMaxOneRow Uses

func HasMaxOneRow(p LogicalPlan, childMaxOneRow []bool) bool

HasMaxOneRow returns if the LogicalPlan will output at most one row.

func InPrepare Uses

func InPrepare(p *preprocessor)

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

func InTxnRetry Uses

func InTxnRetry(p *preprocessor)

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

func IsAutoCommitTxn Uses

func IsAutoCommitTxn(ctx sessionctx.Context) bool

IsAutoCommitTxn checks if session is in autocommit mode and not InTxn used for fast plan like point get

func IsPointGetWithPKOrUniqueKeyByAutoCommit Uses

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

IsPointGetWithPKOrUniqueKeyByAutoCommit returns true when meets following conditions:

1. ctx is auto commit tagged
2. session is not InTxn
3. plan is point get by pk, or point get by unique index (no double read)

func IsPointUpdateByAutoCommit Uses

func IsPointUpdateByAutoCommit(ctx sessionctx.Context, p Plan) (bool, error)

IsPointUpdateByAutoCommit checks if plan p is point update and is in autocommit context

func MatchItems Uses

func MatchItems(p *property.PhysicalProperty, items []*ByItems) bool

MatchItems checks if this prop's columns can match by items totally.

func MockContext Uses

func MockContext() sessionctx.Context

MockContext is only used for plan related tests.

func MockPartitionInfoSchema Uses

func MockPartitionInfoSchema(definitions []model.PartitionDefinition) infoschema.InfoSchema

MockPartitionInfoSchema mocks an info schema for partition table.

func MockSignedTable Uses

func MockSignedTable() *model.TableInfo

MockSignedTable is only used for plan related tests.

func MockUnsignedTable Uses

func MockUnsignedTable() *model.TableInfo

MockUnsignedTable is only used for plan related tests.

func MockView Uses

func MockView() *model.TableInfo

MockView is only used for plan related tests.

func NewPSTMTPlanCacheKey Uses

func NewPSTMTPlanCacheKey(sessionVars *variable.SessionVars, pstmtID uint32, schemaVersion int64) kvcache.Key

NewPSTMTPlanCacheKey creates a new pstmtPlanCacheKey object.

func NewProjInjector Uses

func NewProjInjector() *projInjector

NewProjInjector builds a projInjector.

func NormalizePlan Uses

func NormalizePlan(p Plan) (normalized, digest string)

NormalizePlan is used to normalize the plan and generate plan digest.

func PreparedPlanCacheEnabled Uses

func PreparedPlanCacheEnabled() bool

PreparedPlanCacheEnabled returns whether the prepared plan cache is enabled.

func Preprocess Uses

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 RemoveUnnecessaryFirstRow Uses

func RemoveUnnecessaryFirstRow(
    sctx sessionctx.Context,
    finalAggFuncs []*aggregation.AggFuncDesc,
    finalGbyItems []expression.Expression,
    partialAggFuncs []*aggregation.AggFuncDesc,
    partialGbyItems []expression.Expression,
    partialSchema *expression.Schema) []*aggregation.AggFuncDesc

RemoveUnnecessaryFirstRow removes unnecessary FirstRow of the aggregation. This function can be used for both LogicalAggregation and PhysicalAggregation. When the select column is same with the group by key, the column can be removed and gets value from the group by key. e.g select a, count(b) from t group by a; The schema is [firstrow(a), count(b), a]. The column firstrow(a) is unnecessary. Can optimize the schema to [count(b), a] , and change the index to get value.

func ReplaceColumnOfExpr Uses

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

ReplaceColumnOfExpr replaces column of expression by another LogicalProjection.

func ResolveExprAndReplace Uses

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

ResolveExprAndReplace replaces columns fields of expressions by children logical plans.

func SetPBColumnsDefaultValue Uses

func SetPBColumnsDefaultValue(ctx sessionctx.Context, pbColumns []*tipb.ColumnInfo, columns []*model.ColumnInfo) error

SetPBColumnsDefaultValue sets the default values of tipb.ColumnInfos.

func SetPreparedPlanCache Uses

func SetPreparedPlanCache(isEnabled bool)

SetPreparedPlanCache sets isEnabled to true, then prepared plan cache is enabled.

func SetPstmtIDSchemaVersion Uses

func SetPstmtIDSchemaVersion(key kvcache.Key, pstmtID uint32, schemaVersion int64)

SetPstmtIDSchemaVersion implements PstmtCacheKeyMutator interface to change pstmtID and schemaVersion of cacheKey. so we can reuse Key instead of new every time.

func SupportStreaming Uses

func SupportStreaming(p PhysicalPlan) bool

SupportStreaming returns true if a pushed down operation supports using coprocessor streaming API. Note that this function handle pushed down physical plan only! It's called in constructDAGReq. Some plans are difficult (if possible) to implement streaming, and some are pointless to do so. TODO: Support more kinds of physical plan.

func ToString Uses

func ToString(p Plan) string

ToString explains a Plan, returns description string.

type AdminPlugins Uses

type AdminPlugins struct {
    Action  AdminPluginsAction
    Plugins []string
    // contains filtered or unexported fields
}

AdminPlugins administrates tidb plugins.

func (*AdminPlugins) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*AdminPlugins) ResolveIndices Uses

func (p *AdminPlugins) ResolveIndices() (err error)

func (*AdminPlugins) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*AdminPlugins) SetOutputNames Uses

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

func (*AdminPlugins) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type AdminPluginsAction Uses

type AdminPluginsAction int

AdminPluginsAction indicate action will be taken on plugins.

const (
    // Enable indicates enable plugins.
    Enable AdminPluginsAction = iota + 1
    // Disable indicates disable plugins.
    Disable
)

type AggregateFuncExtractor Uses

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 Uses

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

Enter implements Visitor interface.

func (*AggregateFuncExtractor) Leave Uses

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

Leave implements Visitor interface.

type Analyze Uses

type Analyze struct {
    ColTasks []AnalyzeColumnsTask
    IdxTasks []AnalyzeIndexTask
    Opts     map[ast.AnalyzeOptionType]uint64
    // contains filtered or unexported fields
}

Analyze represents an analyze plan

func (*Analyze) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*Analyze) ResolveIndices Uses

func (p *Analyze) ResolveIndices() (err error)

func (*Analyze) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*Analyze) SetOutputNames Uses

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

func (*Analyze) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type AnalyzeColumnsTask Uses

type AnalyzeColumnsTask struct {
    PKInfo   *model.ColumnInfo
    ColsInfo []*model.ColumnInfo
    TblInfo  *model.TableInfo
    // contains filtered or unexported fields
}

AnalyzeColumnsTask is used for analyze columns.

type AnalyzeIndexTask Uses

type AnalyzeIndexTask struct {
    IndexInfo *model.IndexInfo
    TblInfo   *model.TableInfo
    // contains filtered or unexported fields
}

AnalyzeIndexTask is used for analyze index.

type BatchPointGetPlan Uses

type BatchPointGetPlan struct {
    TblInfo          *model.TableInfo
    IndexInfo        *model.IndexInfo
    Handles          []int64
    HandleParams     []*driver.ParamMarkerExpr
    IndexValues      [][]types.Datum
    IndexValueParams [][]*driver.ParamMarkerExpr
    // contains filtered or unexported fields
}

BatchPointGetPlan represents a physical plan which contains a bunch of keys reference the same table and use the same `unique key`

func (*BatchPointGetPlan) Children Uses

func (p *BatchPointGetPlan) Children() []PhysicalPlan

Children gets all the children.

func (*BatchPointGetPlan) ExplainInfo Uses

func (p *BatchPointGetPlan) ExplainInfo() string

ExplainInfo returns operator information to be explained.

func (*BatchPointGetPlan) ExplainNormalizedInfo Uses

func (p *BatchPointGetPlan) ExplainNormalizedInfo() string

ExplainNormalizedInfo returns normalized operator information to be explained.

func (*BatchPointGetPlan) GetChildReqProps Uses

func (p *BatchPointGetPlan) GetChildReqProps(idx int) *property.PhysicalProperty

GetChildReqProps gets the required property by child index.

func (BatchPointGetPlan) Init Uses

func (p BatchPointGetPlan) Init(ctx sessionctx.Context, stats *property.StatsInfo, schema *expression.Schema, names []*types.FieldName) *BatchPointGetPlan

Init initializes BatchPointGetPlan.

func (*BatchPointGetPlan) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*BatchPointGetPlan) ResolveIndices Uses

func (p *BatchPointGetPlan) ResolveIndices() error

ResolveIndices resolves the indices for columns. After doing this, the columns can evaluate the rows by their indices.

func (*BatchPointGetPlan) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*BatchPointGetPlan) SetChild Uses

func (p *BatchPointGetPlan) SetChild(i int, child PhysicalPlan)

SetChild sets a specific child for the plan.

func (*BatchPointGetPlan) SetChildren Uses

func (p *BatchPointGetPlan) SetChildren(...PhysicalPlan)

SetChildren sets the children for the plan.

func (*BatchPointGetPlan) SetOutputNames Uses

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

SetOutputNames sets the outputting name by the given slice.

func (*BatchPointGetPlan) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

func (*BatchPointGetPlan) StatsCount Uses

func (p *BatchPointGetPlan) StatsCount() float64

StatsCount will return the the RowCount of property.StatsInfo for this plan.

func (*BatchPointGetPlan) ToPB Uses

func (p *BatchPointGetPlan) ToPB(ctx sessionctx.Context) (*tipb.Executor, error)

ToPB converts physical plan to tipb executor.

type BlockHintProcessor Uses

type BlockHintProcessor struct {
    QbNameMap map[string]int                    // Map from query block name to select stmt offset.
    QbHints   map[int][]*ast.TableOptimizerHint // Group all hints at same query block.
    Ctx       sessionctx.Context
    // contains filtered or unexported fields
}

BlockHintProcessor processes hints at different level of sql statement.

func (*BlockHintProcessor) Enter Uses

func (p *BlockHintProcessor) Enter(in ast.Node) (ast.Node, bool)

Enter implements Visitor interface.

func (*BlockHintProcessor) Leave Uses

func (p *BlockHintProcessor) Leave(in ast.Node) (ast.Node, bool)

Leave implements Visitor interface.

func (*BlockHintProcessor) MaxSelectStmtOffset Uses

func (p *BlockHintProcessor) MaxSelectStmtOffset() int

MaxSelectStmtOffset returns the current stmt offset.

type ByItems Uses

type ByItems struct {
    Expr expression.Expression
    Desc bool
}

ByItems wraps a "by" item.

func (*ByItems) Clone Uses

func (by *ByItems) Clone() *ByItems

Clone makes a copy of ByItems.

func (*ByItems) String Uses

func (by *ByItems) String() string

String implements fmt.Stringer interface.

type CachedPrepareStmt Uses

type CachedPrepareStmt struct {
    PreparedAst *ast.Prepared
    VisitInfos  []visitInfo
    ColumnInfos interface{}
    Executor    interface{}
}

CachedPrepareStmt store prepared ast from PrepareExec and other related fields

type CancelDDLJobs Uses

type CancelDDLJobs struct {
    JobIDs []int64
    // contains filtered or unexported fields
}

CancelDDLJobs represents a cancel DDL jobs plan.

func (*CancelDDLJobs) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*CancelDDLJobs) ResolveIndices Uses

func (p *CancelDDLJobs) ResolveIndices() (err error)

func (*CancelDDLJobs) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*CancelDDLJobs) SetOutputNames Uses

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

func (*CancelDDLJobs) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type Change Uses

type Change struct {
    *ast.ChangeStmt
    // contains filtered or unexported fields
}

Change represents a change plan.

func (*Change) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*Change) ResolveIndices Uses

func (p *Change) ResolveIndices() (err error)

func (*Change) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*Change) SetOutputNames Uses

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

func (*Change) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type CheckIndex Uses

type CheckIndex struct {
    IndexLookUpReader *PhysicalIndexLookUpReader
    DBName            string
    IdxName           string
    // contains filtered or unexported fields
}

CheckIndex is used for checking index data, built from the 'admin check index' statement.

func (*CheckIndex) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*CheckIndex) ResolveIndices Uses

func (p *CheckIndex) ResolveIndices() (err error)

func (*CheckIndex) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*CheckIndex) SetOutputNames Uses

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

func (*CheckIndex) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type CheckIndexRange Uses

type CheckIndexRange struct {
    Table     *ast.TableName
    IndexName string

    HandleRanges []ast.HandleRange
    // contains filtered or unexported fields
}

CheckIndexRange is used for checking index data, output the index values that handle within begin and end.

func (*CheckIndexRange) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*CheckIndexRange) ResolveIndices Uses

func (p *CheckIndexRange) ResolveIndices() (err error)

func (*CheckIndexRange) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*CheckIndexRange) SetOutputNames Uses

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

func (*CheckIndexRange) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type CheckTable Uses

type CheckTable struct {
    DBName             string
    Table              table.Table
    IndexInfos         []*model.IndexInfo
    IndexLookUpReaders []*PhysicalIndexLookUpReader
    // contains filtered or unexported fields
}

CheckTable is used for checking table data, built from the 'admin check table' statement.

func (*CheckTable) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*CheckTable) ResolveIndices Uses

func (p *CheckTable) ResolveIndices() (err error)

func (*CheckTable) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*CheckTable) SetOutputNames Uses

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

func (*CheckTable) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type ChecksumTable Uses

type ChecksumTable struct {
    Tables []*ast.TableName
    // contains filtered or unexported fields
}

ChecksumTable is used for calculating table checksum, built from the `admin checksum table` statement.

func (*ChecksumTable) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*ChecksumTable) ResolveIndices Uses

func (p *ChecksumTable) ResolveIndices() (err error)

func (*ChecksumTable) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*ChecksumTable) SetOutputNames Uses

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

func (*ChecksumTable) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type CleanupIndex Uses

type CleanupIndex struct {
    Table     *ast.TableName
    IndexName string
    // contains filtered or unexported fields
}

CleanupIndex is used to delete dangling index data.

func (*CleanupIndex) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*CleanupIndex) ResolveIndices Uses

func (p *CleanupIndex) ResolveIndices() (err error)

func (*CleanupIndex) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*CleanupIndex) SetOutputNames Uses

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

func (*CleanupIndex) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type ClusterLogTableExtractor Uses

type ClusterLogTableExtractor struct {

    // SkipRequest means the where clause always false, we don't need to request any component
    SkipRequest bool

    // NodeTypes represents all components types we should send request to.
    // e.g:
    // 1. SELECT * FROM cluster_log WHERE type='tikv'
    // 2. SELECT * FROM cluster_log WHERE type in ('tikv', 'tidb')
    NodeTypes set.StringSet

    // Addresses represents all components addresses we should send request to.
    // e.g:
    // 1. SELECT * FROM cluster_log WHERE address='192.168.1.7:2379'
    // 2. SELECT * FROM cluster_log WHERE address in ('192.168.1.7:2379', '192.168.1.9:2379')
    Addresses set.StringSet

    // StartTime represents the beginning time of log message
    // e.g: SELECT * FROM cluster_log WHERE time>'2019-10-10 10:10:10.999'
    StartTime int64
    // EndTime represents the ending time of log message
    // e.g: SELECT * FROM cluster_log WHERE time<'2019-10-11 10:10:10.999'
    EndTime int64
    // Pattern is used to filter the log message
    // e.g:
    // 1. SELECT * FROM cluster_log WHERE message like '%gc%'
    // 2. SELECT * FROM cluster_log WHERE message regexp '.*'
    Patterns  []string
    LogLevels set.StringSet
    // contains filtered or unexported fields
}

ClusterLogTableExtractor is used to extract some predicates of `cluster_config`

func (*ClusterLogTableExtractor) Extract Uses

func (e *ClusterLogTableExtractor) Extract(
    ctx sessionctx.Context,
    schema *expression.Schema,
    names []*types.FieldName,
    predicates []expression.Expression,
) []expression.Expression

Extract implements the MemTablePredicateExtractor Extract interface

type ClusterTableExtractor Uses

type ClusterTableExtractor struct {

    // SkipRequest means the where clause always false, we don't need to request any component
    SkipRequest bool

    // NodeTypes represents all components types we should send request to.
    // e.g:
    // 1. SELECT * FROM cluster_config WHERE type='tikv'
    // 2. SELECT * FROM cluster_config WHERE type in ('tikv', 'tidb')
    NodeTypes set.StringSet

    // Addresses represents all components addresses we should send request to.
    // e.g:
    // 1. SELECT * FROM cluster_config WHERE address='192.168.1.7:2379'
    // 2. SELECT * FROM cluster_config WHERE type in ('192.168.1.7:2379', '192.168.1.9:2379')
    Addresses set.StringSet
    // contains filtered or unexported fields
}

ClusterTableExtractor is used to extract some predicates of cluster table.

func (*ClusterTableExtractor) Extract Uses

func (e *ClusterTableExtractor) Extract(_ sessionctx.Context,
    schema *expression.Schema,
    names []*types.FieldName,
    predicates []expression.Expression,
) []expression.Expression

Extract implements the MemTablePredicateExtractor Extract interface

type ColWithCmpFuncManager Uses

type ColWithCmpFuncManager struct {
    TargetCol *expression.Column

    OpType []string

    TmpConstant []*expression.Constant
    // contains filtered or unexported fields
}

ColWithCmpFuncManager is used in index join to handle the column with compare functions(>=, >, <, <=). It stores the compare functions and build ranges in execution phase.

func (*ColWithCmpFuncManager) BuildRangesByRow Uses

func (cwc *ColWithCmpFuncManager) BuildRangesByRow(ctx sessionctx.Context, row chunk.Row) ([]*ranger.Range, error)

BuildRangesByRow will build range of the given row. It will eval each function's arg then call BuildRange.

func (*ColWithCmpFuncManager) CompareRow Uses

func (cwc *ColWithCmpFuncManager) CompareRow(lhs, rhs chunk.Row) int

CompareRow compares the rows for deduplicate.

func (*ColWithCmpFuncManager) String Uses

func (cwc *ColWithCmpFuncManager) String() string

String implements Stringer interface.

type DDL Uses

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

DDL represents a DDL statement plan.

func (*DDL) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*DDL) ResolveIndices Uses

func (p *DDL) ResolveIndices() (err error)

func (*DDL) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*DDL) SetOutputNames Uses

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

func (*DDL) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type DataSource Uses

type DataSource struct {
    Columns []*model.ColumnInfo
    DBName  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
    // TblColHists contains the Histogram of all original table columns,
    // it is converted from statisticTable, and used for IO/network cost estimating.
    TblColHists *statistics.HistColl
    // contains filtered or unexported fields
}

DataSource represents a tableScan without condition push down.

func (*DataSource) BuildKeyInfo Uses

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

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*DataSource) Convert2Gathers Uses

func (ds *DataSource) Convert2Gathers() (gathers []LogicalPlan)

Convert2Gathers builds logical TiKVSingleGathers from DataSource.

func (*DataSource) DeriveStats Uses

func (ds *DataSource) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (*DataSource) ExplainInfo Uses

func (p *DataSource) ExplainInfo() string

ExplainInfo implements Plan interface.

func (DataSource) Init Uses

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

Init initializes DataSource.

func (*DataSource) OutputNames Uses

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

func (*DataSource) PredicatePushDown Uses

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*DataSource) PreparePossibleProperties Uses

func (ds *DataSource) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column

PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.

func (*DataSource) PruneColumns Uses

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

PruneColumns implements LogicalPlan interface.

func (*DataSource) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*DataSource) SetOutputNames Uses

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

func (*DataSource) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

func (*DataSource) TableInfo Uses

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

TableInfo returns the *TableInfo of data source.

type Deallocate Uses

type Deallocate struct {
    Name string
    // contains filtered or unexported fields
}

Deallocate represents deallocate plan.

func (*Deallocate) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*Deallocate) ResolveIndices Uses

func (p *Deallocate) ResolveIndices() (err error)

func (*Deallocate) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*Deallocate) SetOutputNames Uses

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

func (*Deallocate) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type Delete Uses

type Delete struct {
    IsMultiTable bool

    SelectPlan PhysicalPlan

    TblColPosInfos TblColPosInfoSlice
    // contains filtered or unexported fields
}

Delete represents a delete plan.

func (Delete) Init Uses

func (p Delete) Init(ctx sessionctx.Context) *Delete

Init initializes Delete.

func (*Delete) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*Delete) ResolveIndices Uses

func (p *Delete) ResolveIndices() (err error)

func (*Delete) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*Delete) SetOutputNames Uses

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

func (*Delete) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type ErrExprLoc Uses

type ErrExprLoc struct {
    Offset int
    Loc    string
}

ErrExprLoc is for generate the ErrFieldNotInGroupBy error info

type Execute Uses

type Execute struct {
    Name          string
    UsingVars     []expression.Expression
    PrepareParams []types.Datum
    ExecID        uint32
    Stmt          ast.StmtNode
    StmtType      string
    Plan          Plan
    // contains filtered or unexported fields
}

Execute represents prepare plan.

func (*Execute) OptimizePreparedPlan Uses

func (e *Execute) OptimizePreparedPlan(ctx context.Context, sctx sessionctx.Context, is infoschema.InfoSchema) error

OptimizePreparedPlan optimizes the prepared statement.

func (*Execute) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*Execute) ResolveIndices Uses

func (p *Execute) ResolveIndices() (err error)

func (*Execute) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*Execute) SetOutputNames Uses

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

func (*Execute) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type Explain Uses

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 Uses

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

OutputNames returns the outputting names of each column.

func (*Explain) RenderResult Uses

func (e *Explain) RenderResult() error

RenderResult renders the explain result as specified format.

func (*Explain) ResolveIndices Uses

func (p *Explain) ResolveIndices() (err error)

func (*Explain) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*Explain) SetOutputNames Uses

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

func (*Explain) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type FrameBound Uses

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 IndexAdvise Uses

type IndexAdvise struct {
    IsLocal     bool
    Path        string
    MaxMinutes  uint64
    MaxIndexNum *ast.MaxIndexNumClause
    LinesInfo   *ast.LinesClause
    // contains filtered or unexported fields
}

IndexAdvise represents a index advise plan.

func (*IndexAdvise) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*IndexAdvise) ResolveIndices Uses

func (p *IndexAdvise) ResolveIndices() (err error)

func (*IndexAdvise) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*IndexAdvise) SetOutputNames Uses

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

func (*IndexAdvise) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type Insert Uses

type Insert struct {
    Table table.Table

    Columns []*ast.ColumnName
    Lists   [][]expression.Expression
    SetList []*expression.Assignment

    OnDuplicate        []*expression.Assignment
    Schema4OnDuplicate *expression.Schema

    GenCols InsertGeneratedColumns

    SelectPlan PhysicalPlan

    IsReplace bool

    // NeedFillDefaultValue is true when expr in value list reference other column.
    NeedFillDefaultValue bool

    AllAssignmentsAreConstant bool
    // contains filtered or unexported fields
}

Insert represents an insert plan.

func (Insert) Init Uses

func (p Insert) Init(ctx sessionctx.Context) *Insert

Init initializes Insert.

func (*Insert) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*Insert) ResolveIndices Uses

func (p *Insert) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*Insert) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*Insert) SetOutputNames Uses

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

func (*Insert) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type InsertGeneratedColumns Uses

type InsertGeneratedColumns struct {
    Columns      []*ast.ColumnName
    Exprs        []expression.Expression
    OnDuplicates []*expression.Assignment
}

InsertGeneratedColumns is for completing generated columns in Insert. We resolve generation expressions in plan, and eval those in executor.

type InspectionResultTableExtractor Uses

type InspectionResultTableExtractor struct {

    // SkipInspection means the where clause always false, we don't need to request any component
    SkipInspection bool
    // Rules represents rules applied to, and we should apply all inspection rules if there is no rules specified
    // e.g: SELECT * FROM inspection_result WHERE rule in ('ddl', 'config')
    Rules set.StringSet
    // Items represents items applied to, and we should apply all inspection item if there is no rules specified
    // e.g: SELECT * FROM inspection_result WHERE item in ('ddl.lease', 'raftstore.threadpool')
    Items set.StringSet
    // contains filtered or unexported fields
}

InspectionResultTableExtractor is used to extract some predicates of `inspection_result`

func (*InspectionResultTableExtractor) Extract Uses

func (e *InspectionResultTableExtractor) Extract(
    ctx sessionctx.Context,
    schema *expression.Schema,
    names []*types.FieldName,
    predicates []expression.Expression,
) (remained []expression.Expression)

Extract implements the MemTablePredicateExtractor Extract interface

type JoinType Uses

type JoinType int

JoinType contains CrossJoin, InnerJoin, LeftOuterJoin, RightOuterJoin, FullOuterJoin, SemiJoin.

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 Uses

func (tp JoinType) IsOuterJoin() bool

IsOuterJoin returns if this joiner is a outer joiner

func (JoinType) String Uses

func (tp JoinType) String() string

type LoadData Uses

type LoadData struct {
    IsLocal     bool
    OnDuplicate ast.OnDuplicateKeyHandlingType
    Path        string
    Table       *ast.TableName
    Columns     []*ast.ColumnName
    FieldsInfo  *ast.FieldsClause
    LinesInfo   *ast.LinesClause
    IgnoreLines uint64

    GenCols InsertGeneratedColumns
    // contains filtered or unexported fields
}

LoadData represents a loaddata plan.

func (*LoadData) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*LoadData) ResolveIndices Uses

func (p *LoadData) ResolveIndices() (err error)

func (*LoadData) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*LoadData) SetOutputNames Uses

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

func (*LoadData) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type LoadStats Uses

type LoadStats struct {
    Path string
    // contains filtered or unexported fields
}

LoadStats represents a load stats plan.

func (*LoadStats) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*LoadStats) ResolveIndices Uses

func (p *LoadStats) ResolveIndices() (err error)

func (*LoadStats) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*LoadStats) SetOutputNames Uses

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

func (*LoadStats) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type LogicalAggregation Uses

type LogicalAggregation struct {
    AggFuncs     []*aggregation.AggFuncDesc
    GroupByItems []expression.Expression
    // contains filtered or unexported fields
}

LogicalAggregation represents an aggregate plan.

func (*LogicalAggregation) BuildKeyInfo Uses

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

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalAggregation) CopyAggHints Uses

func (la *LogicalAggregation) CopyAggHints(agg *LogicalAggregation)

CopyAggHints copies the aggHints from another LogicalAggregation.

func (*LogicalAggregation) DeriveStats Uses

func (la *LogicalAggregation) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (*LogicalAggregation) ExplainInfo Uses

func (p *LogicalAggregation) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*LogicalAggregation) GetGroupByCols Uses

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 Uses

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

Init initializes LogicalAggregation.

func (*LogicalAggregation) IsPartialModeAgg Uses

func (la *LogicalAggregation) IsPartialModeAgg() bool

IsPartialModeAgg returns if all of the AggFuncs are partialMode.

func (*LogicalAggregation) OutputNames Uses

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

func (*LogicalAggregation) PredicatePushDown Uses

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalAggregation) PreparePossibleProperties Uses

func (la *LogicalAggregation) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column

PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.

func (*LogicalAggregation) PruneColumns Uses

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

PruneColumns implements LogicalPlan interface.

func (*LogicalAggregation) ResetHintIfConflicted Uses

func (la *LogicalAggregation) ResetHintIfConflicted() (preferHash bool, preferStream bool)

ResetHintIfConflicted resets the aggHints.preferAggType if they are conflicted, and returns the two preferAggType hints.

func (*LogicalAggregation) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*LogicalAggregation) SetOutputNames Uses

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

func (*LogicalAggregation) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type LogicalApply Uses

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) DeriveStats Uses

func (la *LogicalApply) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (*LogicalApply) ExplainInfo Uses

func (p *LogicalApply) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*LogicalApply) GetHashJoin Uses

func (la *LogicalApply) GetHashJoin(prop *property.PhysicalProperty) *PhysicalHashJoin

GetHashJoin is public for cascades planner.

func (LogicalApply) Init Uses

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

Init initializes LogicalApply.

func (*LogicalApply) OutputNames Uses

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

func (*LogicalApply) PruneColumns Uses

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

PruneColumns implements LogicalPlan interface.

func (*LogicalApply) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*LogicalApply) SetOutputNames Uses

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

func (*LogicalApply) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type LogicalIndexScan Uses

type LogicalIndexScan struct {

    // DataSource should be read-only here.
    Source       *DataSource
    IsDoubleRead bool

    EqCondCount int
    AccessConds expression.CNFExprs
    Ranges      []*ranger.Range

    Index          *model.IndexInfo
    Columns        []*model.ColumnInfo
    FullIdxCols    []*expression.Column
    FullIdxColLens []int
    IdxCols        []*expression.Column
    IdxColLens     []int
    // contains filtered or unexported fields
}

LogicalIndexScan is the logical index scan operator for TiKV.

func (*LogicalIndexScan) BuildKeyInfo Uses

func (is *LogicalIndexScan) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalIndexScan) DeriveStats Uses

func (is *LogicalIndexScan) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (*property.StatsInfo, error)

DeriveStats implements LogicalPlan DeriveStats interface.

func (*LogicalIndexScan) ExplainInfo Uses

func (p *LogicalIndexScan) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*LogicalIndexScan) GetPhysicalIndexScan Uses

func (s *LogicalIndexScan) GetPhysicalIndexScan(schema *expression.Schema, stats *property.StatsInfo) *PhysicalIndexScan

GetPhysicalIndexScan returns PhysicalIndexScan for the logical IndexScan.

func (LogicalIndexScan) Init Uses

func (is LogicalIndexScan) Init(ctx sessionctx.Context, offset int) *LogicalIndexScan

Init initializes LogicalIndexScan.

func (*LogicalIndexScan) MatchIndexProp Uses

func (p *LogicalIndexScan) MatchIndexProp(prop *property.PhysicalProperty) (match bool)

MatchIndexProp checks if the indexScan can match the required property.

func (*LogicalIndexScan) OutputNames Uses

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

func (*LogicalIndexScan) PreparePossibleProperties Uses

func (is *LogicalIndexScan) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column

PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.

func (*LogicalIndexScan) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*LogicalIndexScan) SetOutputNames Uses

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

func (*LogicalIndexScan) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type LogicalJoin Uses

type LogicalJoin struct {
    JoinType JoinType

    StraightJoin bool

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

    // 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
}

LogicalJoin is the logical join plan.

func (*LogicalJoin) AttachOnConds Uses

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 Uses

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

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalJoin) DeriveStats Uses

func (p *LogicalJoin) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface. If the type of join is SemiJoin, the selectivity of it will be same as selection's. If the type of join is LeftOuterSemiJoin, it will not add or remove any row. The last column is a boolean value, whose Cardinality should be two. If the type of join is inner/outer join, the output of join(s, t) should be N(s) * N(t) / (V(s.key) * V(t.key)) * Min(s.key, t.key). N(s) stands for the number of rows in relation s. V(s.key) means the Cardinality of join key in s. This is a quite simple strategy: We assume every bucket of relation which will participate join has the same number of rows, and apply cross join for every matched bucket.

func (*LogicalJoin) ExplainInfo Uses

func (p *LogicalJoin) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*LogicalJoin) ExtractOnCondition Uses

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) GetJoinKeys Uses

func (p *LogicalJoin) GetJoinKeys() (leftKeys, rightKeys []*expression.Column)

GetJoinKeys extracts join keys(columns) from EqualConditions.

func (*LogicalJoin) GetMergeJoin Uses

func (p *LogicalJoin) GetMergeJoin(prop *property.PhysicalProperty, schema *expression.Schema) []PhysicalPlan

GetMergeJoin convert the logical join to physical merge join based on the physical property.

func (LogicalJoin) Init Uses

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

Init initializes LogicalJoin.

func (*LogicalJoin) OutputNames Uses

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

func (*LogicalJoin) PredicatePushDown Uses

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalJoin) PreparePossibleProperties Uses

func (p *LogicalJoin) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column

PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.

func (*LogicalJoin) PruneColumns Uses

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

PruneColumns implements LogicalPlan interface.

func (*LogicalJoin) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*LogicalJoin) SetOutputNames Uses

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

func (*LogicalJoin) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type LogicalLimit Uses

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

LogicalLimit represents offset and limit plan.

func (*LogicalLimit) BuildKeyInfo Uses

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

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalLimit) Children Uses

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

Children implements LogicalPlan Children interface.

func (*LogicalLimit) DeriveStats Uses

func (p *LogicalLimit) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (*LogicalLimit) ExplainInfo Uses

func (p *LogicalLimit) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*LogicalLimit) HashCode Uses

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

HashCode implements LogicalPlan interface.

func (LogicalLimit) Init Uses

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

Init initializes LogicalLimit.

func (*LogicalLimit) MaxOneRow Uses

func (p *LogicalLimit) MaxOneRow() bool

func (*LogicalLimit) OutputNames Uses

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

func (*LogicalLimit) PredicatePushDown Uses

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalLimit) PreparePossibleProperties Uses

func (p *LogicalLimit) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column

PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.

func (*LogicalLimit) PruneColumns Uses

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

PruneColumns implements LogicalPlan interface.

func (*LogicalLimit) Schema Uses

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

Schema implements Plan Schema interface.

func (*LogicalLimit) SetChild Uses

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

SetChild implements LogicalPlan SetChild interface.

func (*LogicalLimit) SetChildren Uses

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

SetChildren implements LogicalPlan SetChildren interface.

func (*LogicalLimit) SetOutputNames Uses

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

type LogicalLock Uses

type LogicalLock struct {
    Lock ast.SelectLockType
    // contains filtered or unexported fields
}

LogicalLock represents a select lock plan.

func (*LogicalLock) BuildKeyInfo Uses

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

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalLock) Children Uses

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

Children implements LogicalPlan Children interface.

func (*LogicalLock) DeriveStats Uses

func (p *LogicalLock) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (*LogicalLock) ExplainInfo Uses

func (p *LogicalLock) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*LogicalLock) HashCode Uses

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

HashCode implements LogicalPlan interface.

func (LogicalLock) Init Uses

func (p LogicalLock) Init(ctx sessionctx.Context) *LogicalLock

Init initializes LogicalLock.

func (*LogicalLock) MaxOneRow Uses

func (p *LogicalLock) MaxOneRow() bool

func (*LogicalLock) OutputNames Uses

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

func (*LogicalLock) PredicatePushDown Uses

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

PredicatePushDown implements LogicalPlan interface.

func (*LogicalLock) PreparePossibleProperties Uses

func (p *LogicalLock) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column

PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.

func (*LogicalLock) PruneColumns Uses

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

PruneColumns implements LogicalPlan interface.

func (*LogicalLock) Schema Uses

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

Schema implements Plan Schema interface.

func (*LogicalLock) SetChild Uses

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

SetChild implements LogicalPlan SetChild interface.

func (*LogicalLock) SetChildren Uses

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

SetChildren implements LogicalPlan SetChildren interface.

func (*LogicalLock) SetOutputNames Uses

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

type LogicalMaxOneRow Uses

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

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

func (*LogicalMaxOneRow) BuildKeyInfo Uses

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

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalMaxOneRow) Children Uses

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

Children implements LogicalPlan Children interface.

func (*LogicalMaxOneRow) DeriveStats Uses

func (p *LogicalMaxOneRow) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (*LogicalMaxOneRow) ExplainInfo Uses

func (p *LogicalMaxOneRow) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*LogicalMaxOneRow) HashCode Uses

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

HashCode implements LogicalPlan interface.

func (LogicalMaxOneRow) Init Uses

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

Init initializes LogicalMaxOneRow.

func (*LogicalMaxOneRow) MaxOneRow Uses

func (p *LogicalMaxOneRow) MaxOneRow() bool

func (*LogicalMaxOneRow) OutputNames Uses

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

func (*LogicalMaxOneRow) PredicatePushDown Uses

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalMaxOneRow) PreparePossibleProperties Uses

func (p *LogicalMaxOneRow) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column

PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.

func (*LogicalMaxOneRow) PruneColumns Uses

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

PruneColumns implements LogicalPlan interface.

func (*LogicalMaxOneRow) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*LogicalMaxOneRow) SetChild Uses

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

SetChild implements LogicalPlan SetChild interface.

func (*LogicalMaxOneRow) SetChildren Uses

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

SetChildren implements LogicalPlan SetChildren interface.

func (*LogicalMaxOneRow) SetOutputNames Uses

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

type LogicalMemTable Uses

type LogicalMemTable struct {
    Extractor MemTablePredicateExtractor
    // contains filtered or unexported fields
}

LogicalMemTable represents a memory table or virtual table Some memory tables wants to take the ownership of some predications e.g SELECT * FROM cluster_log WHERE type='tikv' AND address='192.16.5.32' Assume that the table `cluster_log` is a memory table, which is used to retrieve logs from remote components. In the above situation we should send log search request to the target TiKV (192.16.5.32) directly instead of requesting all cluster components log search gRPC interface to retrieve log message and filtering them in TiDB node.

func (*LogicalMemTable) BuildKeyInfo Uses

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

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalMemTable) DeriveStats Uses

func (p *LogicalMemTable) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (LogicalMemTable) Init Uses

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

Init initializes LogicalMemTable.

func (*LogicalMemTable) OutputNames Uses

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

func (*LogicalMemTable) PredicatePushDown Uses

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalMemTable) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*LogicalMemTable) SetOutputNames Uses

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

func (*LogicalMemTable) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type LogicalPlan Uses

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.
    // Because this method is also used in cascades planner, we cannot use
    // things like `p.schema` or `p.children` inside it. We should use the `selfSchema`
    // and `childSchema` instead.
    BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)

    // DeriveStats derives statistic info for current plan node given child stats.
    // We need selfSchema, childSchema here because it makes this method can be used in
    // cascades planner, where LogicalPlan might not record its children or schema.
    DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (*property.StatsInfo, error)

    // PreparePossibleProperties is only used for join and aggregation. Like group by a,b,c, all permutation of (a,b,c) is
    // valid, but the ordered indices in leaf plan is limited. So we can get all possible order properties by a pre-walking.
    PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column

    // MaxOneRow means whether this operator only returns max one row.
    MaxOneRow() bool

    // 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)
    // contains filtered or unexported methods
}

LogicalPlan is a tree of logical operators. We can do a lot of logical optimizations to it, like predicate pushdown and column pruning.

func Conds2TableDual Uses

func Conds2TableDual(p LogicalPlan, conds []expression.Expression) LogicalPlan

Conds2TableDual builds a LogicalTableDual if cond is constant false or null.

type LogicalProjection Uses

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
}

LogicalProjection represents a select fields plan.

func (*LogicalProjection) BuildKeyInfo Uses

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

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalProjection) DeriveStats Uses

func (p *LogicalProjection) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (*LogicalProjection) ExplainInfo Uses

func (p *LogicalProjection) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*LogicalProjection) HashCode Uses

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

HashCode implements LogicalPlan interface.

func (LogicalProjection) Init Uses

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

Init initializes LogicalProjection.

func (*LogicalProjection) OutputNames Uses

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

func (*LogicalProjection) PredicatePushDown Uses

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalProjection) PreparePossibleProperties Uses

func (p *LogicalProjection) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column

PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.

func (*LogicalProjection) PruneColumns Uses

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

PruneColumns implements LogicalPlan interface. If any expression has SetVar function or Sleep function, we do not prune it.

func (*LogicalProjection) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*LogicalProjection) SetOutputNames Uses

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

func (*LogicalProjection) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

func (*LogicalProjection) TryToGetChildProp Uses

func (p *LogicalProjection) TryToGetChildProp(prop *property.PhysicalProperty) (*property.PhysicalProperty, bool)

TryToGetChildProp will check if this sort property can be pushed or not. When a sort column will be replaced by scalar function, we refuse it. When a sort column will be replaced by a constant, we just remove it.

type LogicalSelection Uses

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
    // contains filtered or unexported fields
}

LogicalSelection represents a where or having predicate.

func (*LogicalSelection) BuildKeyInfo Uses

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

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalSelection) Children Uses

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

Children implements LogicalPlan Children interface.

func (*LogicalSelection) DeriveStats Uses

func (p *LogicalSelection) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (*LogicalSelection) ExplainInfo Uses

func (p *LogicalSelection) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*LogicalSelection) HashCode Uses

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

HashCode implements LogicalPlan interface.

func (LogicalSelection) Init Uses

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

Init initializes LogicalSelection.

func (*LogicalSelection) MaxOneRow Uses

func (p *LogicalSelection) MaxOneRow() bool

func (*LogicalSelection) OutputNames Uses

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

func (*LogicalSelection) PredicatePushDown Uses

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalSelection) PreparePossibleProperties Uses

func (p *LogicalSelection) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column

PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.

func (*LogicalSelection) PruneColumns Uses

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

PruneColumns implements LogicalPlan interface.

func (*LogicalSelection) Schema Uses

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

Schema implements Plan Schema interface.

func (*LogicalSelection) SetChild Uses

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

SetChild implements LogicalPlan SetChild interface.

func (*LogicalSelection) SetChildren Uses

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

SetChildren implements LogicalPlan SetChildren interface.

func (*LogicalSelection) SetOutputNames Uses

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

type LogicalShow Uses

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

LogicalShow represents a show plan.

func (*LogicalShow) BuildKeyInfo Uses

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

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalShow) DeriveStats Uses

func (p *LogicalShow) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (LogicalShow) Init Uses

func (p LogicalShow) Init(ctx sessionctx.Context) *LogicalShow

Init initializes LogicalShow.

func (*LogicalShow) OutputNames Uses

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

func (*LogicalShow) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*LogicalShow) SetOutputNames Uses

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

func (*LogicalShow) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type LogicalShowDDLJobs Uses

type LogicalShowDDLJobs struct {
    JobNumber int64
    // contains filtered or unexported fields
}

LogicalShowDDLJobs is for showing DDL job list.

func (*LogicalShowDDLJobs) BuildKeyInfo Uses

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

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalShowDDLJobs) DeriveStats Uses

func (p *LogicalShowDDLJobs) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (LogicalShowDDLJobs) Init Uses

func (p LogicalShowDDLJobs) Init(ctx sessionctx.Context) *LogicalShowDDLJobs

Init initializes LogicalShowDDLJobs.

func (*LogicalShowDDLJobs) OutputNames Uses

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

func (*LogicalShowDDLJobs) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*LogicalShowDDLJobs) SetOutputNames Uses

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

func (*LogicalShowDDLJobs) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type LogicalSort Uses

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

LogicalSort stands for the order by plan.

func (*LogicalSort) BuildKeyInfo Uses

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

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalSort) Children Uses

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

Children implements LogicalPlan Children interface.

func (*LogicalSort) DeriveStats Uses

func (p *LogicalSort) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (*LogicalSort) ExplainInfo Uses

func (p *LogicalSort) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*LogicalSort) HashCode Uses

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

HashCode implements LogicalPlan interface.

func (LogicalSort) Init Uses

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

Init initializes LogicalSort.

func (*LogicalSort) MaxOneRow Uses

func (p *LogicalSort) MaxOneRow() bool

func (*LogicalSort) OutputNames Uses

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

func (*LogicalSort) PredicatePushDown Uses

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

PredicatePushDown implements LogicalPlan interface.

func (*LogicalSort) PreparePossibleProperties Uses

func (p *LogicalSort) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column

PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.

func (*LogicalSort) PruneColumns Uses

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 Uses

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

Schema implements Plan Schema interface.

func (*LogicalSort) SetChild Uses

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

SetChild implements LogicalPlan SetChild interface.

func (*LogicalSort) SetChildren Uses

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

SetChildren implements LogicalPlan SetChildren interface.

func (*LogicalSort) SetOutputNames Uses

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

type LogicalTableDual Uses

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

LogicalTableDual represents a dual table plan.

func (*LogicalTableDual) BuildKeyInfo Uses

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

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalTableDual) DeriveStats Uses

func (p *LogicalTableDual) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (*LogicalTableDual) ExplainInfo Uses

func (p *LogicalTableDual) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*LogicalTableDual) HashCode Uses

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

HashCode implements LogicalPlan interface.

func (LogicalTableDual) Init Uses

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

Init initializes LogicalTableDual.

func (*LogicalTableDual) OutputNames Uses

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

func (*LogicalTableDual) PredicatePushDown Uses

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalTableDual) PruneColumns Uses

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

PruneColumns implements LogicalPlan interface.

func (*LogicalTableDual) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*LogicalTableDual) SetOutputNames Uses

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

func (*LogicalTableDual) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type LogicalTableScan Uses

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

LogicalTableScan is the logical table scan operator for TiKV.

func (*LogicalTableScan) BuildKeyInfo Uses

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

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalTableScan) DeriveStats Uses

func (ts *LogicalTableScan) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (_ *property.StatsInfo, err error)

DeriveStats implements LogicalPlan DeriveStats interface.

func (*LogicalTableScan) ExplainInfo Uses

func (p *LogicalTableScan) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*LogicalTableScan) GetPhysicalScan Uses

func (s *LogicalTableScan) GetPhysicalScan(schema *expression.Schema, stats *property.StatsInfo) *PhysicalTableScan

GetPhysicalScan returns PhysicalTableScan for the LogicalTableScan.

func (LogicalTableScan) Init Uses

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

Init initializes LogicalTableScan.

func (*LogicalTableScan) OutputNames Uses

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

func (*LogicalTableScan) PreparePossibleProperties Uses

func (ts *LogicalTableScan) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column

PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.

func (*LogicalTableScan) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*LogicalTableScan) SetOutputNames Uses

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

func (*LogicalTableScan) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type LogicalTopN Uses

type LogicalTopN struct {
    ByItems []*ByItems
    Offset  uint64
    Count   uint64
    // contains filtered or unexported fields
}

LogicalTopN represents a top-n plan.

func (*LogicalTopN) BuildKeyInfo Uses

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

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalTopN) Children Uses

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

Children implements LogicalPlan Children interface.

func (*LogicalTopN) DeriveStats Uses

func (lt *LogicalTopN) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (*LogicalTopN) ExplainInfo Uses

func (p *LogicalTopN) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*LogicalTopN) HashCode Uses

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

HashCode implements LogicalPlan interface.

func (LogicalTopN) Init Uses

func (lt LogicalTopN) Init(ctx sessionctx.Context, offset int) *LogicalTopN

Init initializes LogicalTopN.

func (*LogicalTopN) MaxOneRow Uses

func (p *LogicalTopN) MaxOneRow() bool

func (*LogicalTopN) OutputNames Uses

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

func (*LogicalTopN) PredicatePushDown Uses

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

PredicatePushDown implements LogicalPlan interface.

func (*LogicalTopN) PreparePossibleProperties Uses

func (p *LogicalTopN) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column

PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.

func (*LogicalTopN) PruneColumns Uses

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

PruneColumns implements LogicalPlan interface.

func (*LogicalTopN) Schema Uses

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

Schema implements Plan Schema interface.

func (*LogicalTopN) SetChild Uses

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

SetChild implements LogicalPlan SetChild interface.

func (*LogicalTopN) SetChildren Uses

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

SetChildren implements LogicalPlan SetChildren interface.

func (*LogicalTopN) SetOutputNames Uses

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

type LogicalUnionAll Uses

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

LogicalUnionAll represents LogicalUnionAll plan.

func (*LogicalUnionAll) BuildKeyInfo Uses

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

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalUnionAll) DeriveStats Uses

func (p *LogicalUnionAll) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (LogicalUnionAll) Init Uses

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

Init initializes LogicalUnionAll.

func (*LogicalUnionAll) OutputNames Uses

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

func (*LogicalUnionAll) PredicatePushDown Uses

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalUnionAll) PruneColumns Uses

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

PruneColumns implements LogicalPlan interface.

func (*LogicalUnionAll) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*LogicalUnionAll) SetOutputNames Uses

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

func (*LogicalUnionAll) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type LogicalUnionScan Uses

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

LogicalUnionScan is only used in non read-only txn.

func (*LogicalUnionScan) BuildKeyInfo Uses

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

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalUnionScan) Children Uses

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

Children implements LogicalPlan Children interface.

func (*LogicalUnionScan) DeriveStats Uses

func (p *LogicalUnionScan) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (*LogicalUnionScan) ExplainInfo Uses

func (p *LogicalUnionScan) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*LogicalUnionScan) HashCode Uses

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

HashCode implements LogicalPlan interface.

func (LogicalUnionScan) Init Uses

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

Init initializes LogicalUnionScan.

func (*LogicalUnionScan) MaxOneRow Uses

func (p *LogicalUnionScan) MaxOneRow() bool

func (*LogicalUnionScan) OutputNames Uses

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

func (*LogicalUnionScan) PredicatePushDown Uses

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalUnionScan) PreparePossibleProperties Uses

func (p *LogicalUnionScan) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column

PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.

func (*LogicalUnionScan) PruneColumns Uses

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

PruneColumns implements LogicalPlan interface.

func (*LogicalUnionScan) Schema Uses

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

Schema implements Plan Schema interface.

func (*LogicalUnionScan) SetChild Uses

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

SetChild implements LogicalPlan SetChild interface.

func (*LogicalUnionScan) SetChildren Uses

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

SetChildren implements LogicalPlan SetChildren interface.

func (*LogicalUnionScan) SetOutputNames Uses

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

type LogicalWindow Uses

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 Uses

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

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*LogicalWindow) DeriveStats Uses

func (p *LogicalWindow) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema) (*property.StatsInfo, error)

DeriveStats implement LogicalPlan DeriveStats interface.

func (*LogicalWindow) GetPartitionByCols Uses

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

GetPartitionByCols extracts 'partition by' columns from the Window.

func (*LogicalWindow) GetWindowResultColumns Uses

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

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

func (LogicalWindow) Init Uses

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

Init initializes LogicalWindow.

func (*LogicalWindow) OutputNames Uses

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

func (*LogicalWindow) PredicatePushDown Uses

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

PredicatePushDown implements LogicalPlan PredicatePushDown interface.

func (*LogicalWindow) PreparePossibleProperties Uses

func (p *LogicalWindow) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column

PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.

func (*LogicalWindow) PruneColumns Uses

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

PruneColumns implements LogicalPlan interface.

func (*LogicalWindow) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*LogicalWindow) SetOutputNames Uses

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

func (*LogicalWindow) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type MemTablePredicateExtractor Uses

type MemTablePredicateExtractor interface {
    // Extracts predicates which can be pushed down and returns the remained predicates
    Extract(sessionctx.Context, *expression.Schema, []*types.FieldName, []expression.Expression) (remained []expression.Expression)
}

MemTablePredicateExtractor is used to extract some predicates from `WHERE` clause and push the predicates down to the data retrieving on reading memory table stage.

e.g: SELECT * FROM cluster_config WHERE type='tikv' AND address='192.168.1.9:2379' We must request all components in the cluster via HTTP API for retrieving configurations and filter them by `type/address` columns.

The purpose of defining a `MemTablePredicateExtractor` is to optimize this 1. Define a `ClusterConfigTablePredicateExtractor` 2. Extract the `type/address` columns on the logic optimizing stage and save them via fields. 3. Passing the extractor to the `ClusterReaderExecExec` executor 4. Executor sends requests to the target components instead of all of the components

type MetricTableExtractor Uses

type MetricTableExtractor struct {

    // SkipRequest means the where clause always false, we don't need to request any component
    SkipRequest bool
    // StartTime represents the beginning time of metric data.
    StartTime time.Time
    // EndTime represents the ending time of metric data.
    EndTime time.Time
    // LabelConditions represents the label conditions of metric data.
    LabelConditions map[string]set.StringSet
    Quantiles       []float64
    // contains filtered or unexported fields
}

MetricTableExtractor is used to extract some predicates of metric_schema tables.

func (*MetricTableExtractor) Extract Uses

func (e *MetricTableExtractor) Extract(
    ctx sessionctx.Context,
    schema *expression.Schema,
    names []*types.FieldName,
    predicates []expression.Expression,
) []expression.Expression

Extract implements the MemTablePredicateExtractor Extract interface

type NominalSort Uses

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

NominalSort asks sort properties for its child. It is a fake operator that will not appear in final physical operator tree.

func (*NominalSort) Children Uses

func (p *NominalSort) Children() []PhysicalPlan

Children implements PhysicalPlan Children interface.

func (*NominalSort) ExplainInfo Uses

func (p *NominalSort) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*NominalSort) ExplainNormalizedInfo Uses

func (p *NominalSort) ExplainNormalizedInfo() string

ExplainInfo implements Plan interface.

func (*NominalSort) GetChildReqProps Uses

func (p *NominalSort) GetChildReqProps(idx int) *property.PhysicalProperty

func (NominalSort) Init Uses

func (p NominalSort) Init(ctx sessionctx.Context, offset int, props ...*property.PhysicalProperty) *NominalSort

Init initializes NominalSort.

func (*NominalSort) ResolveIndices Uses

func (p *NominalSort) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*NominalSort) Schema Uses

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

Schema implements Plan Schema interface.

func (*NominalSort) SetChild Uses

func (p *NominalSort) SetChild(i int, child PhysicalPlan)

SetChild implements PhysicalPlan SetChild interface.

func (*NominalSort) SetChildren Uses

func (p *NominalSort) SetChildren(children ...PhysicalPlan)

SetChildren implements PhysicalPlan SetChildren interface.

func (*NominalSort) StatsCount Uses

func (p *NominalSort) StatsCount() float64

func (*NominalSort) ToPB Uses

func (p *NominalSort) ToPB(_ sessionctx.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PBPlanBuilder Uses

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

PBPlanBuilder uses to build physical plan from dag protocol buffers.

func NewPBPlanBuilder Uses

func NewPBPlanBuilder(sctx sessionctx.Context, is infoschema.InfoSchema) *PBPlanBuilder

NewPBPlanBuilder creates a new pb plan builder.

func (*PBPlanBuilder) Build Uses

func (b *PBPlanBuilder) Build(executors []*tipb.Executor) (p PhysicalPlan, err error)

Build builds physical plan from dag protocol buffers.

type PSTMTPlanCacheValue Uses

type PSTMTPlanCacheValue struct {
    Plan        Plan
    OutPutNames []*types.FieldName
}

PSTMTPlanCacheValue stores the cached Statement and StmtNode.

func NewPSTMTPlanCacheValue Uses

func NewPSTMTPlanCacheValue(plan Plan, names []*types.FieldName) *PSTMTPlanCacheValue

NewPSTMTPlanCacheValue creates a SQLCacheValue.

type PartitionSplitterType Uses

type PartitionSplitterType int

PartitionSplitterType is the type of `Shuffle` executor splitter, which splits data source into partitions.

type PhysicalApply Uses

type PhysicalApply struct {
    PhysicalHashJoin

    OuterSchema []*expression.CorrelatedColumn
}

PhysicalApply represents apply plan, only used for subquery.

func (*PhysicalApply) GetCost Uses

func (p *PhysicalApply) GetCost(lCount, rCount, lCost, rCost float64) float64

GetCost computes the cost of apply operator.

func (PhysicalApply) Init Uses

func (p PhysicalApply) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalApply

Init initializes PhysicalApply.

func (*PhysicalApply) ResolveIndices Uses

func (p *PhysicalApply) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

type PhysicalHashAgg Uses

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

PhysicalHashAgg is hash operator of aggregate.

func NewPhysicalHashAgg Uses

func NewPhysicalHashAgg(la *LogicalAggregation, newStats *property.StatsInfo, prop *property.PhysicalProperty) *PhysicalHashAgg

NewPhysicalHashAgg creates a new PhysicalHashAgg from a LogicalAggregation.

func (*PhysicalHashAgg) ExplainInfo Uses

func (p *PhysicalHashAgg) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalHashAgg) ExplainNormalizedInfo Uses

func (p *PhysicalHashAgg) ExplainNormalizedInfo() string

ExplainNormalizedInfo implements Plan interface.

func (*PhysicalHashAgg) GetCost Uses

func (p *PhysicalHashAgg) GetCost(inputRows float64, isRoot bool) float64

GetCost computes the cost of hash aggregation considering CPU/memory.

func (PhysicalHashAgg) Init Uses

func (base PhysicalHashAgg) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int) *basePhysicalAgg

Init initializes basePhysicalAgg.

func (*PhysicalHashAgg) ResolveIndices Uses

func (p *PhysicalHashAgg) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalHashAgg) ToPB Uses

func (p *PhysicalHashAgg) ToPB(ctx sessionctx.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalHashJoin Uses

type PhysicalHashJoin struct {
    Concurrency     uint
    EqualConditions []*expression.ScalarFunction

    // use the outer table to build a hash table when the outer table is smaller.
    UseOuterToBuild bool
    // contains filtered or unexported fields
}

PhysicalHashJoin represents hash join implementation of LogicalJoin.

func NewPhysicalHashJoin Uses

func NewPhysicalHashJoin(p *LogicalJoin, innerIdx int, useOuterToBuild bool, newStats *property.StatsInfo, prop ...*property.PhysicalProperty) *PhysicalHashJoin

NewPhysicalHashJoin creates a new PhysicalHashJoin from LogicalJoin.

func (*PhysicalHashJoin) ExplainInfo Uses

func (p *PhysicalHashJoin) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalHashJoin) ExplainNormalizedInfo Uses

func (p *PhysicalHashJoin) ExplainNormalizedInfo() string

ExplainNormalizedInfo implements Plan interface.

func (*PhysicalHashJoin) GetCost Uses

func (p *PhysicalHashJoin) GetCost(lCnt, rCnt float64) float64

GetCost computes cost of hash join operator itself.

func (PhysicalHashJoin) Init Uses

func (p PhysicalHashJoin) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalHashJoin

Init initializes PhysicalHashJoin.

func (*PhysicalHashJoin) ResolveIndices Uses

func (p *PhysicalHashJoin) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

type PhysicalIndexHashJoin Uses

type PhysicalIndexHashJoin struct {
    PhysicalIndexJoin
    // KeepOuterOrder indicates whether keeping the output result order as the
    // outer side.
    KeepOuterOrder bool
}

PhysicalIndexHashJoin represents the plan of index look up hash join.

func (*PhysicalIndexHashJoin) GetCost Uses

func (p *PhysicalIndexHashJoin) GetCost(outerTask, innerTask task) float64

GetCost computes the cost of index merge join operator and its children.

func (PhysicalIndexHashJoin) Init Uses

func (p PhysicalIndexHashJoin) Init(ctx sessionctx.Context) *PhysicalIndexHashJoin

Init initializes PhysicalIndexHashJoin.

type PhysicalIndexJoin Uses

type PhysicalIndexJoin struct {

    // Ranges stores the IndexRanges when the inner plan is index scan.
    Ranges []*ranger.Range
    // KeyOff2IdxOff maps the offsets in join key to the offsets in the index.
    KeyOff2IdxOff []int
    // IdxColLens stores the length of each index column.
    IdxColLens []int
    // CompareFilters stores the filters for last column if those filters need to be evaluated during execution.
    // e.g. select * from t, t1 where t.a = t1.a and t.b > t1.b and t.b < t1.b+10
    //      If there's index(t.a, t.b). All the filters can be used to construct index range but t.b > t1.b and t.b < t1.b=10
    //      need to be evaluated after we fetch the data of t1.
    // This struct stores them and evaluate them to ranges.
    CompareFilters *ColWithCmpFuncManager
    // contains filtered or unexported fields
}

PhysicalIndexJoin represents the plan of index look up join.

func (*PhysicalIndexJoin) ExplainInfo Uses

func (p *PhysicalIndexJoin) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalIndexJoin) ExplainNormalizedInfo Uses

func (p *PhysicalIndexJoin) ExplainNormalizedInfo() string

ExplainNormalizedInfo implements Plan interface.

func (*PhysicalIndexJoin) GetCost Uses

func (p *PhysicalIndexJoin) GetCost(outerTask, innerTask task) float64

GetCost computes the cost of index join operator and its children.

func (PhysicalIndexJoin) Init Uses

func (p PhysicalIndexJoin) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalIndexJoin

Init initializes PhysicalIndexJoin.

func (*PhysicalIndexJoin) ResolveIndices Uses

func (p *PhysicalIndexJoin) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

type PhysicalIndexLookUpReader Uses

type PhysicalIndexLookUpReader struct {

    // IndexPlans flats the indexPlan to construct executor pb.
    IndexPlans []PhysicalPlan
    // TablePlans flats the tablePlan to construct executor pb.
    TablePlans []PhysicalPlan

    ExtraHandleCol *expression.Column
    // PushedLimit is used to avoid unnecessary table scan tasks of IndexLookUpReader.
    PushedLimit *PushedDownLimit
    // contains filtered or unexported fields
}

PhysicalIndexLookUpReader is the index look up reader in tidb. It's used in case of double reading.

func (*PhysicalIndexLookUpReader) ExplainInfo Uses

func (p *PhysicalIndexLookUpReader) ExplainInfo() string

ExplainInfo implements Plan interface.

func (PhysicalIndexLookUpReader) Init Uses

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

Init initializes PhysicalIndexLookUpReader.

func (*PhysicalIndexLookUpReader) ResolveIndices Uses

func (p *PhysicalIndexLookUpReader) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalIndexLookUpReader) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*PhysicalIndexLookUpReader) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type PhysicalIndexMergeJoin Uses

type PhysicalIndexMergeJoin struct {
    PhysicalIndexJoin

    // KeyOff2KeyOffOrderByIdx maps the offsets in join keys to the offsets in join keys order by index.
    KeyOff2KeyOffOrderByIdx []int
    // CompareFuncs store the compare functions for outer join keys and inner join key.
    CompareFuncs []expression.CompareFunc
    // OuterCompareFuncs store the compare functions for outer join keys and outer join
    // keys, it's for outer rows sort's convenience.
    OuterCompareFuncs []expression.CompareFunc
    // NeedOuterSort means whether outer rows should be sorted to build range.
    NeedOuterSort bool
    // Desc means whether inner child keep desc order.
    Desc bool
}

PhysicalIndexMergeJoin represents the plan of index look up merge join.

func (*PhysicalIndexMergeJoin) GetCost Uses

func (p *PhysicalIndexMergeJoin) GetCost(outerTask, innerTask task) float64

GetCost computes the cost of index merge join operator and its children.

func (PhysicalIndexMergeJoin) Init Uses

func (p PhysicalIndexMergeJoin) Init(ctx sessionctx.Context) *PhysicalIndexMergeJoin

Init initializes PhysicalIndexMergeJoin.

type PhysicalIndexMergeReader Uses

type PhysicalIndexMergeReader struct {

    // PartialPlans flats the partialPlans to construct executor pb.
    PartialPlans [][]PhysicalPlan
    // TablePlans flats the tablePlan to construct executor pb.
    TablePlans []PhysicalPlan
    // contains filtered or unexported fields
}

PhysicalIndexMergeReader is the reader using multiple indexes in tidb.

func (*PhysicalIndexMergeReader) ExplainInfo Uses

func (p *PhysicalIndexMergeReader) ExplainInfo() string

ExplainInfo implements Plan interface.

func (PhysicalIndexMergeReader) Init Uses

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

Init initializes PhysicalIndexMergeReader.

func (*PhysicalIndexMergeReader) ResolveIndices Uses

func (p *PhysicalIndexMergeReader) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalIndexMergeReader) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*PhysicalIndexMergeReader) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type PhysicalIndexReader Uses

type PhysicalIndexReader struct {

    // IndexPlans flats the indexPlan to construct executor pb.
    IndexPlans []PhysicalPlan

    // OutputColumns represents the columns that index reader should return.
    OutputColumns []*expression.Column
    // contains filtered or unexported fields
}

PhysicalIndexReader is the index reader in tidb.

func (*PhysicalIndexReader) ExplainInfo Uses

func (p *PhysicalIndexReader) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalIndexReader) ExplainNormalizedInfo Uses

func (p *PhysicalIndexReader) ExplainNormalizedInfo() string

ExplainNormalizedInfo implements Plan interface.

func (PhysicalIndexReader) Init Uses

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

Init initializes PhysicalIndexReader.

func (*PhysicalIndexReader) ResolveIndices Uses

func (p *PhysicalIndexReader) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalIndexReader) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*PhysicalIndexReader) SetChildren Uses

func (p *PhysicalIndexReader) SetChildren(children ...PhysicalPlan)

SetChildren overrides PhysicalPlan SetChildren interface.

func (*PhysicalIndexReader) SetSchema Uses

func (p *PhysicalIndexReader) SetSchema(_ *expression.Schema)

SetSchema overrides PhysicalPlan SetSchema interface.

type PhysicalIndexScan Uses

type PhysicalIndexScan struct {

    // AccessCondition is used to calculate range.
    AccessCondition []expression.Expression

    Table      *model.TableInfo
    Index      *model.IndexInfo
    IdxCols    []*expression.Column
    IdxColLens []int
    Ranges     []*ranger.Range
    Columns    []*model.ColumnInfo
    DBName     model.CIStr

    TableAsName *model.CIStr

    // Hist is the histogram when the query was issued.
    // It is used for query feedback.
    Hist *statistics.Histogram

    GenExprs map[model.TableColumnID]expression.Expression

    Desc      bool
    KeepOrder bool
    // DoubleRead means if the index executor will read kv two times.
    // If the query requires the columns that don't belong to index, DoubleRead will be true.
    DoubleRead bool
    // contains filtered or unexported fields
}

PhysicalIndexScan represents an index scan plan.

func (*PhysicalIndexScan) ExplainInfo Uses

func (p *PhysicalIndexScan) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalIndexScan) ExplainNormalizedInfo Uses

func (p *PhysicalIndexScan) ExplainNormalizedInfo() string

ExplainNormalizedInfo implements Plan interface.

func (PhysicalIndexScan) Init Uses

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

Init initializes PhysicalIndexScan.

func (*PhysicalIndexScan) IsPartition Uses

func (p *PhysicalIndexScan) IsPartition() (bool, int64)

IsPartition returns true and partition ID if it works on a partition.

func (*PhysicalIndexScan) IsPointGetByUniqueKey Uses

func (p *PhysicalIndexScan) IsPointGetByUniqueKey(sc *stmtctx.StatementContext) bool

IsPointGetByUniqueKey checks whether is a point get by unique key.

func (*PhysicalIndexScan) ResolveIndices Uses

func (p *PhysicalIndexScan) ResolveIndices() (err error)

func (*PhysicalIndexScan) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*PhysicalIndexScan) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

func (*PhysicalIndexScan) ToPB Uses

func (p *PhysicalIndexScan) ToPB(ctx sessionctx.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalLimit Uses

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

PhysicalLimit is the physical operator of Limit.

func (*PhysicalLimit) Children Uses

func (p *PhysicalLimit) Children() []PhysicalPlan

Children implements PhysicalPlan Children interface.

func (*PhysicalLimit) ExplainInfo Uses

func (p *PhysicalLimit) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalLimit) ExplainNormalizedInfo Uses

func (p *PhysicalLimit) ExplainNormalizedInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalLimit) GetChildReqProps Uses

func (p *PhysicalLimit) GetChildReqProps(idx int) *property.PhysicalProperty

func (PhysicalLimit) Init Uses

func (p PhysicalLimit) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalLimit

Init initializes PhysicalLimit.

func (*PhysicalLimit) ResolveIndices Uses

func (p *PhysicalLimit) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalLimit) Schema Uses

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

Schema implements Plan Schema interface.

func (*PhysicalLimit) SetChild Uses

func (p *PhysicalLimit) SetChild(i int, child PhysicalPlan)

SetChild implements PhysicalPlan SetChild interface.

func (*PhysicalLimit) SetChildren Uses

func (p *PhysicalLimit) SetChildren(children ...PhysicalPlan)

SetChildren implements PhysicalPlan SetChildren interface.

func (*PhysicalLimit) StatsCount Uses

func (p *PhysicalLimit) StatsCount() float64

func (*PhysicalLimit) ToPB Uses

func (p *PhysicalLimit) ToPB(ctx sessionctx.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalLock Uses

type PhysicalLock struct {
    Lock ast.SelectLockType

    TblID2Handle map[int64][]*expression.Column
    // contains filtered or unexported fields
}

PhysicalLock is the physical operator of lock, which is used for `select ... for update` clause.

func (*PhysicalLock) Children Uses

func (p *PhysicalLock) Children() []PhysicalPlan

Children implements PhysicalPlan Children interface.

func (*PhysicalLock) ExplainInfo Uses

func (p *PhysicalLock) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalLock) ExplainNormalizedInfo Uses

func (p *PhysicalLock) ExplainNormalizedInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalLock) GetChildReqProps Uses

func (p *PhysicalLock) GetChildReqProps(idx int) *property.PhysicalProperty

func (PhysicalLock) Init Uses

func (p PhysicalLock) Init(ctx sessionctx.Context, stats *property.StatsInfo, props ...*property.PhysicalProperty) *PhysicalLock

Init initializes PhysicalLock.

func (*PhysicalLock) ResolveIndices Uses

func (p *PhysicalLock) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalLock) Schema Uses

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

Schema implements Plan Schema interface.

func (*PhysicalLock) SetChild Uses

func (p *PhysicalLock) SetChild(i int, child PhysicalPlan)

SetChild implements PhysicalPlan SetChild interface.

func (*PhysicalLock) SetChildren Uses

func (p *PhysicalLock) SetChildren(children ...PhysicalPlan)

SetChildren implements PhysicalPlan SetChildren interface.

func (*PhysicalLock) StatsCount Uses

func (p *PhysicalLock) StatsCount() float64

func (*PhysicalLock) ToPB Uses

func (p *PhysicalLock) ToPB(_ sessionctx.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalMaxOneRow Uses

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

PhysicalMaxOneRow is the physical operator of maxOneRow.

func (*PhysicalMaxOneRow) Children Uses

func (p *PhysicalMaxOneRow) Children() []PhysicalPlan

Children implements PhysicalPlan Children interface.

func (*PhysicalMaxOneRow) ExplainInfo Uses

func (p *PhysicalMaxOneRow) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalMaxOneRow) ExplainNormalizedInfo Uses

func (p *PhysicalMaxOneRow) ExplainNormalizedInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalMaxOneRow) GetChildReqProps Uses

func (p *PhysicalMaxOneRow) GetChildReqProps(idx int) *property.PhysicalProperty

func (PhysicalMaxOneRow) Init Uses

func (p PhysicalMaxOneRow) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalMaxOneRow

Init initializes PhysicalMaxOneRow.

func (*PhysicalMaxOneRow) ResolveIndices Uses

func (p *PhysicalMaxOneRow) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalMaxOneRow) Schema Uses

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

Schema implements Plan Schema interface.

func (*PhysicalMaxOneRow) SetChild Uses

func (p *PhysicalMaxOneRow) SetChild(i int, child PhysicalPlan)

SetChild implements PhysicalPlan SetChild interface.

func (*PhysicalMaxOneRow) SetChildren Uses

func (p *PhysicalMaxOneRow) SetChildren(children ...PhysicalPlan)

SetChildren implements PhysicalPlan SetChildren interface.

func (*PhysicalMaxOneRow) StatsCount Uses

func (p *PhysicalMaxOneRow) StatsCount() float64

func (*PhysicalMaxOneRow) ToPB Uses

func (p *PhysicalMaxOneRow) ToPB(_ sessionctx.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalMemTable Uses

type PhysicalMemTable struct {
    DBName    model.CIStr
    Table     *model.TableInfo
    Columns   []*model.ColumnInfo
    Extractor MemTablePredicateExtractor
    // contains filtered or unexported fields
}

PhysicalMemTable reads memory table.

func (*PhysicalMemTable) ExplainInfo Uses

func (p *PhysicalMemTable) ExplainInfo() string

ExplainInfo implements Plan interface.

func (PhysicalMemTable) Init Uses

func (p PhysicalMemTable) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int) *PhysicalMemTable

Init initializes PhysicalMemTable.

func (*PhysicalMemTable) ResolveIndices Uses

func (p *PhysicalMemTable) ResolveIndices() (err error)

func (*PhysicalMemTable) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*PhysicalMemTable) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type PhysicalMergeJoin Uses

type PhysicalMergeJoin struct {
    CompareFuncs []expression.CompareFunc
    // Desc means whether inner child keep desc order.
    Desc bool
    // contains filtered or unexported fields
}

PhysicalMergeJoin represents merge join implementation of LogicalJoin.

func BuildMergeJoinPlan Uses

func BuildMergeJoinPlan(ctx sessionctx.Context, joinType JoinType, leftKeys, rightKeys []*expression.Column) *PhysicalMergeJoin

BuildMergeJoinPlan builds a PhysicalMergeJoin from the given fields. Currently, it is only used for test purpose.

func (*PhysicalMergeJoin) ExplainInfo Uses

func (p *PhysicalMergeJoin) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalMergeJoin) ExplainNormalizedInfo Uses

func (p *PhysicalMergeJoin) ExplainNormalizedInfo() string

ExplainNormalizedInfo implements Plan interface.

func (*PhysicalMergeJoin) GetCost Uses

func (p *PhysicalMergeJoin) GetCost(lCnt, rCnt float64) float64

GetCost computes cost of merge join operator itself.

func (PhysicalMergeJoin) Init Uses

func (p PhysicalMergeJoin) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int) *PhysicalMergeJoin

Init initializes PhysicalMergeJoin.

func (*PhysicalMergeJoin) ResolveIndices Uses

func (p *PhysicalMergeJoin) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

type PhysicalPlan Uses

type PhysicalPlan interface {
    Plan

    // ToPB converts physical plan to tipb executor.
    ToPB(ctx sessionctx.Context) (*tipb.Executor, error)

    // getChildReqProps gets the required property by child index.
    GetChildReqProps(idx int) *property.PhysicalProperty

    // StatsCount returns the count of property.StatsInfo for this plan.
    StatsCount() float64

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

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

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

    // ResolveIndices resolves the indices for columns. After doing this, the columns can evaluate the rows by their indices.
    ResolveIndices() error

    // Stats returns the StatsInfo of the plan.
    Stats() *property.StatsInfo

    // ExplainNormalizedInfo returns operator normalized information for generating digest.
    ExplainNormalizedInfo() string
    // contains filtered or unexported methods
}

PhysicalPlan is a tree of the physical operators.

func DoOptimize Uses

func DoOptimize(ctx context.Context, flag uint64, logic LogicalPlan) (PhysicalPlan, float64, error)

DoOptimize optimizes a logical plan to a physical plan.

func InjectProjBelowAgg Uses

func InjectProjBelowAgg(aggPlan PhysicalPlan, aggFuncs []*aggregation.AggFuncDesc, groupByItems []expression.Expression) PhysicalPlan

InjectProjBelowAgg injects a ProjOperator below AggOperator. If all the args of `aggFuncs`, and all the item of `groupByItems` are columns or constants, we do not need to build the `proj`.

func InjectProjBelowSort Uses

func InjectProjBelowSort(p PhysicalPlan, orderByItems []*ByItems) PhysicalPlan

InjectProjBelowSort extracts the ScalarFunctions of `orderByItems` into a PhysicalProjection and injects it below PhysicalTopN/PhysicalSort. The schema of PhysicalSort and PhysicalTopN are the same as the schema of their children. When a projection is injected as the child of PhysicalSort and PhysicalTopN, some extra columns will be added into the schema of the Projection, thus we need to add another Projection upon them to prune the redundant columns.

type PhysicalProjection Uses

type PhysicalProjection struct {
    Exprs                []expression.Expression
    CalculateNoDelay     bool
    AvoidColumnEvaluator bool
    // contains filtered or unexported fields
}

PhysicalProjection is the physical operator of projection.

func (*PhysicalProjection) ExplainInfo Uses

func (p *PhysicalProjection) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalProjection) ExplainNormalizedInfo Uses

func (p *PhysicalProjection) ExplainNormalizedInfo() string

ExplainNormalizedInfo implements Plan interface.

func (*PhysicalProjection) GetCost Uses

func (p *PhysicalProjection) GetCost(count float64) float64

GetCost computes the cost of projection operator itself.

func (PhysicalProjection) Init Uses

func (p PhysicalProjection) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalProjection

Init initializes PhysicalProjection.

func (*PhysicalProjection) ResolveIndices Uses

func (p *PhysicalProjection) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalProjection) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*PhysicalProjection) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type PhysicalSelection Uses

type PhysicalSelection struct {
    Conditions []expression.Expression
    // contains filtered or unexported fields
}

PhysicalSelection represents a filter.

func (*PhysicalSelection) Children Uses

func (p *PhysicalSelection) Children() []PhysicalPlan

Children implements PhysicalPlan Children interface.

func (*PhysicalSelection) ExplainInfo Uses

func (p *PhysicalSelection) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalSelection) ExplainNormalizedInfo Uses

func (p *PhysicalSelection) ExplainNormalizedInfo() string

ExplainNormalizedInfo implements Plan interface.

func (*PhysicalSelection) GetChildReqProps Uses

func (p *PhysicalSelection) GetChildReqProps(idx int) *property.PhysicalProperty

func (PhysicalSelection) Init Uses

func (p PhysicalSelection) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalSelection

Init initializes PhysicalSelection.

func (*PhysicalSelection) ResolveIndices Uses

func (p *PhysicalSelection) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalSelection) Schema Uses

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

Schema implements Plan Schema interface.

func (*PhysicalSelection) SetChild Uses

func (p *PhysicalSelection) SetChild(i int, child PhysicalPlan)

SetChild implements PhysicalPlan SetChild interface.

func (*PhysicalSelection) SetChildren Uses

func (p *PhysicalSelection) SetChildren(children ...PhysicalPlan)

SetChildren implements PhysicalPlan SetChildren interface.

func (*PhysicalSelection) StatsCount Uses

func (p *PhysicalSelection) StatsCount() float64

func (*PhysicalSelection) ToPB Uses

func (p *PhysicalSelection) ToPB(ctx sessionctx.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalShow Uses

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

PhysicalShow represents a show plan.

func (PhysicalShow) Init Uses

func (p PhysicalShow) Init(ctx sessionctx.Context) *PhysicalShow

Init initializes PhysicalShow.

func (*PhysicalShow) ResolveIndices Uses

func (p *PhysicalShow) ResolveIndices() (err error)

func (*PhysicalShow) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*PhysicalShow) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type PhysicalShowDDLJobs Uses

type PhysicalShowDDLJobs struct {
    JobNumber int64
    // contains filtered or unexported fields
}

PhysicalShowDDLJobs is for showing DDL job list.

func (PhysicalShowDDLJobs) Init Uses

func (p PhysicalShowDDLJobs) Init(ctx sessionctx.Context) *PhysicalShowDDLJobs

Init initializes PhysicalShowDDLJobs.

func (*PhysicalShowDDLJobs) ResolveIndices Uses

func (p *PhysicalShowDDLJobs) ResolveIndices() (err error)

func (*PhysicalShowDDLJobs) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*PhysicalShowDDLJobs) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type PhysicalShuffle Uses

type PhysicalShuffle struct {
    Concurrency int
    Tail        PhysicalPlan
    DataSource  PhysicalPlan

    SplitterType PartitionSplitterType
    HashByItems  []expression.Expression
    // contains filtered or unexported fields
}

PhysicalShuffle represents a shuffle plan. `Tail` and `DataSource` are the last plan within and the first plan following the "shuffle", respectively,

to build the child executors chain.

Take `Window` operator for example:

Shuffle -> Window -> Sort -> DataSource, will be separated into:
  ==> Shuffle: for main thread
  ==> Window -> Sort(:Tail) -> shuffleWorker: for workers
  ==> DataSource: for `fetchDataAndSplit` thread

func (*PhysicalShuffle) Children Uses

func (p *PhysicalShuffle) Children() []PhysicalPlan

Children implements PhysicalPlan Children interface.

func (*PhysicalShuffle) ExplainInfo Uses

func (p *PhysicalShuffle) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalShuffle) ExplainNormalizedInfo Uses

func (p *PhysicalShuffle) ExplainNormalizedInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalShuffle) GetChildReqProps Uses

func (p *PhysicalShuffle) GetChildReqProps(idx int) *property.PhysicalProperty

func (PhysicalShuffle) Init Uses

func (p PhysicalShuffle) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalShuffle

Init initializes PhysicalShuffle.

func (*PhysicalShuffle) ResolveIndices Uses

func (p *PhysicalShuffle) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalShuffle) Schema Uses

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

Schema implements Plan Schema interface.

func (*PhysicalShuffle) SetChild Uses

func (p *PhysicalShuffle) SetChild(i int, child PhysicalPlan)

SetChild implements PhysicalPlan SetChild interface.

func (*PhysicalShuffle) SetChildren Uses

func (p *PhysicalShuffle) SetChildren(children ...PhysicalPlan)

SetChildren implements PhysicalPlan SetChildren interface.

func (*PhysicalShuffle) StatsCount Uses

func (p *PhysicalShuffle) StatsCount() float64

func (*PhysicalShuffle) ToPB Uses

func (p *PhysicalShuffle) ToPB(_ sessionctx.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalShuffleDataSourceStub Uses

type PhysicalShuffleDataSourceStub struct {

    // Worker points to `executor.shuffleWorker`.
    Worker unsafe.Pointer
    // contains filtered or unexported fields
}

PhysicalShuffleDataSourceStub represents a data source stub of `PhysicalShuffle`, and actually, is executed by `executor.shuffleWorker`.

func (PhysicalShuffleDataSourceStub) Init Uses

func (p PhysicalShuffleDataSourceStub) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalShuffleDataSourceStub

Init initializes PhysicalShuffleDataSourceStub.

func (*PhysicalShuffleDataSourceStub) ResolveIndices Uses

func (p *PhysicalShuffleDataSourceStub) ResolveIndices() (err error)

func (*PhysicalShuffleDataSourceStub) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*PhysicalShuffleDataSourceStub) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type PhysicalSort Uses

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

PhysicalSort is the physical operator of sort, which implements a memory sort.

func (*PhysicalSort) Children Uses

func (p *PhysicalSort) Children() []PhysicalPlan

Children implements PhysicalPlan Children interface.

func (*PhysicalSort) ExplainInfo Uses

func (p *PhysicalSort) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalSort) ExplainNormalizedInfo Uses

func (p *PhysicalSort) ExplainNormalizedInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalSort) GetChildReqProps Uses

func (p *PhysicalSort) GetChildReqProps(idx int) *property.PhysicalProperty

func (*PhysicalSort) GetCost Uses

func (p *PhysicalSort) GetCost(count float64) float64

GetCost computes the cost of in memory sort.

func (PhysicalSort) Init Uses

func (p PhysicalSort) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalSort

Init initializes PhysicalSort.

func (*PhysicalSort) ResolveIndices Uses

func (p *PhysicalSort) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalSort) Schema Uses

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

Schema implements Plan Schema interface.

func (*PhysicalSort) SetChild Uses

func (p *PhysicalSort) SetChild(i int, child PhysicalPlan)

SetChild implements PhysicalPlan SetChild interface.

func (*PhysicalSort) SetChildren Uses

func (p *PhysicalSort) SetChildren(children ...PhysicalPlan)

SetChildren implements PhysicalPlan SetChildren interface.

func (*PhysicalSort) StatsCount Uses

func (p *PhysicalSort) StatsCount() float64

func (*PhysicalSort) ToPB Uses

func (p *PhysicalSort) ToPB(_ sessionctx.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalStreamAgg Uses

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

PhysicalStreamAgg is stream operator of aggregate.

func (*PhysicalStreamAgg) ExplainInfo Uses

func (p *PhysicalStreamAgg) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalStreamAgg) ExplainNormalizedInfo Uses

func (p *PhysicalStreamAgg) ExplainNormalizedInfo() string

ExplainNormalizedInfo implements Plan interface.

func (*PhysicalStreamAgg) GetCost Uses

func (p *PhysicalStreamAgg) GetCost(inputRows float64, isRoot bool) float64

GetCost computes cost of stream aggregation considering CPU/memory.

func (PhysicalStreamAgg) Init Uses

func (base PhysicalStreamAgg) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int) *basePhysicalAgg

Init initializes basePhysicalAgg.

func (*PhysicalStreamAgg) ResolveIndices Uses

func (p *PhysicalStreamAgg) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalStreamAgg) ToPB Uses

func (p *PhysicalStreamAgg) ToPB(ctx sessionctx.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalTableDual Uses

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

PhysicalTableDual is the physical operator of dual.

func (*PhysicalTableDual) ExplainInfo Uses

func (p *PhysicalTableDual) ExplainInfo() string

ExplainInfo implements Plan interface.

func (PhysicalTableDual) Init Uses

func (p PhysicalTableDual) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int) *PhysicalTableDual

Init initializes PhysicalTableDual.

func (*PhysicalTableDual) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*PhysicalTableDual) ResolveIndices Uses

func (p *PhysicalTableDual) ResolveIndices() (err error)

func (*PhysicalTableDual) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*PhysicalTableDual) SetOutputNames Uses

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

SetOutputNames sets the outputting name by the given slice.

func (*PhysicalTableDual) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type PhysicalTableReader Uses

type PhysicalTableReader struct {

    // TablePlans flats the tablePlan to construct executor pb.
    TablePlans []PhysicalPlan

    // StoreType indicates table read from which type of store.
    StoreType kv.StoreType
    // contains filtered or unexported fields
}

PhysicalTableReader is the table reader in tidb.

func (*PhysicalTableReader) ExplainInfo Uses

func (p *PhysicalTableReader) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalTableReader) ExplainNormalizedInfo Uses

func (p *PhysicalTableReader) ExplainNormalizedInfo() string

ExplainNormalizedInfo implements Plan interface.

func (PhysicalTableReader) Init Uses

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

Init initializes PhysicalTableReader.

func (*PhysicalTableReader) ResolveIndices Uses

func (p *PhysicalTableReader) ResolveIndices() error

ResolveIndices implements Plan interface.

func (*PhysicalTableReader) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*PhysicalTableReader) SetChildren Uses

func (p *PhysicalTableReader) SetChildren(children ...PhysicalPlan)

SetChildren overrides PhysicalPlan SetChildren interface.

func (*PhysicalTableReader) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type PhysicalTableScan Uses

type PhysicalTableScan struct {

    // AccessCondition is used to calculate range.
    AccessCondition []expression.Expression

    Table   *model.TableInfo
    Columns []*model.ColumnInfo
    DBName  model.CIStr
    Ranges  []*ranger.Range

    TableAsName *model.CIStr

    // Hist is the histogram when the query was issued.
    // It is used for query feedback.
    Hist *statistics.Histogram

    // HandleIdx is the index of handle, which is only used for admin check table.
    HandleIdx int

    StoreType kv.StoreType

    // KeepOrder is true, if sort data by scanning pkcol,
    KeepOrder bool
    Desc      bool
    // contains filtered or unexported fields
}

PhysicalTableScan represents a table scan plan.

func (*PhysicalTableScan) ExpandVirtualColumn Uses

func (ts *PhysicalTableScan) ExpandVirtualColumn()

ExpandVirtualColumn expands the virtual column's dependent columns to ts's schema and column.

func (*PhysicalTableScan) ExplainInfo Uses

func (p *PhysicalTableScan) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalTableScan) ExplainNormalizedInfo Uses

func (p *PhysicalTableScan) ExplainNormalizedInfo() string

ExplainNormalizedInfo implements Plan interface.

func (PhysicalTableScan) Init Uses

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

Init initializes PhysicalTableScan.

func (*PhysicalTableScan) IsPartition Uses

func (ts *PhysicalTableScan) IsPartition() (bool, int64)

IsPartition returns true and partition ID if it's actually a partition.

func (*PhysicalTableScan) ResolveIndices Uses

func (p *PhysicalTableScan) ResolveIndices() (err error)

func (*PhysicalTableScan) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*PhysicalTableScan) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

func (*PhysicalTableScan) ToPB Uses

func (p *PhysicalTableScan) ToPB(ctx sessionctx.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalTopN Uses

type PhysicalTopN struct {
    ByItems []*ByItems
    Offset  uint64
    Count   uint64
    // contains filtered or unexported fields
}

PhysicalTopN is the physical operator of topN.

func (*PhysicalTopN) Children Uses

func (p *PhysicalTopN) Children() []PhysicalPlan

Children implements PhysicalPlan Children interface.

func (*PhysicalTopN) ExplainInfo Uses

func (p *PhysicalTopN) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalTopN) ExplainNormalizedInfo Uses

func (p *PhysicalTopN) ExplainNormalizedInfo() string

ExplainNormalizedInfo implements Plan interface.

func (*PhysicalTopN) GetChildReqProps Uses

func (p *PhysicalTopN) GetChildReqProps(idx int) *property.PhysicalProperty

func (*PhysicalTopN) GetCost Uses

func (p *PhysicalTopN) GetCost(count float64, isRoot bool) float64

GetCost computes cost of TopN operator itself.

func (PhysicalTopN) Init Uses

func (p PhysicalTopN) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalTopN

Init initializes PhysicalTopN.

func (*PhysicalTopN) ResolveIndices Uses

func (p *PhysicalTopN) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalTopN) Schema Uses

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

Schema implements Plan Schema interface.

func (*PhysicalTopN) SetChild Uses

func (p *PhysicalTopN) SetChild(i int, child PhysicalPlan)

SetChild implements PhysicalPlan SetChild interface.

func (*PhysicalTopN) SetChildren Uses

func (p *PhysicalTopN) SetChildren(children ...PhysicalPlan)

SetChildren implements PhysicalPlan SetChildren interface.

func (*PhysicalTopN) StatsCount Uses

func (p *PhysicalTopN) StatsCount() float64

func (*PhysicalTopN) ToPB Uses

func (p *PhysicalTopN) ToPB(ctx sessionctx.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalUnionAll Uses

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

PhysicalUnionAll is the physical operator of UnionAll.

func (PhysicalUnionAll) Init Uses

func (p PhysicalUnionAll) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalUnionAll

Init initializes PhysicalUnionAll.

func (*PhysicalUnionAll) ResolveIndices Uses

func (p *PhysicalUnionAll) ResolveIndices() (err error)

func (*PhysicalUnionAll) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*PhysicalUnionAll) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type PhysicalUnionScan Uses

type PhysicalUnionScan struct {
    Conditions []expression.Expression

    HandleCol *expression.Column
    // contains filtered or unexported fields
}

PhysicalUnionScan represents a union scan operator.

func (*PhysicalUnionScan) Children Uses

func (p *PhysicalUnionScan) Children() []PhysicalPlan

Children implements PhysicalPlan Children interface.

func (*PhysicalUnionScan) ExplainInfo Uses

func (p *PhysicalUnionScan) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalUnionScan) ExplainNormalizedInfo Uses

func (p *PhysicalUnionScan) ExplainNormalizedInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalUnionScan) GetChildReqProps Uses

func (p *PhysicalUnionScan) GetChildReqProps(idx int) *property.PhysicalProperty

func (PhysicalUnionScan) Init Uses

func (p PhysicalUnionScan) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalUnionScan

Init initializes PhysicalUnionScan.

func (*PhysicalUnionScan) ResolveIndices Uses

func (p *PhysicalUnionScan) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalUnionScan) Schema Uses

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

Schema implements Plan Schema interface.

func (*PhysicalUnionScan) SetChild Uses

func (p *PhysicalUnionScan) SetChild(i int, child PhysicalPlan)

SetChild implements PhysicalPlan SetChild interface.

func (*PhysicalUnionScan) SetChildren Uses

func (p *PhysicalUnionScan) SetChildren(children ...PhysicalPlan)

SetChildren implements PhysicalPlan SetChildren interface.

func (*PhysicalUnionScan) StatsCount Uses

func (p *PhysicalUnionScan) StatsCount() float64

func (*PhysicalUnionScan) ToPB Uses

func (p *PhysicalUnionScan) ToPB(_ sessionctx.Context) (*tipb.Executor, error)

ToPB implements PhysicalPlan ToPB interface.

type PhysicalWindow Uses

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

PhysicalWindow is the physical operator of window function.

func (*PhysicalWindow) ExplainInfo Uses

func (p *PhysicalWindow) ExplainInfo() string

ExplainInfo implements Plan interface.

func (PhysicalWindow) Init Uses

func (p PhysicalWindow) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalWindow

Init initializes PhysicalWindow.

func (*PhysicalWindow) ResolveIndices Uses

func (p *PhysicalWindow) ResolveIndices() (err error)

ResolveIndices implements Plan interface.

func (*PhysicalWindow) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*PhysicalWindow) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type Plan Uses

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
}

Plan is the description of an execution flow. It is created from ast.Node first, then optimized by the optimizer, finally used by the executor to create a Cursor which executes the statement.

func BuildLogicalPlan Uses

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.

func TryFastPlan Uses

func TryFastPlan(ctx sessionctx.Context, node ast.Node) Plan

TryFastPlan tries to use the PointGetPlan for the query.

type PlanBuilder Uses

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

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

func NewPlanBuilder Uses

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

NewPlanBuilder creates a new PlanBuilder.

func (*PlanBuilder) Build Uses

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

Build builds the ast node to a Plan.

func (*PlanBuilder) BuildDataSourceFromView Uses

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) GetDBTableInfo Uses

func (b *PlanBuilder) GetDBTableInfo() []stmtctx.TableEntry

GetDBTableInfo gets the accessed dbs and tables info.

func (*PlanBuilder) GetOptFlag Uses

func (b *PlanBuilder) GetOptFlag() uint64

GetOptFlag gets the optFlag of the PlanBuilder.

func (*PlanBuilder) GetVisitInfo Uses

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

GetVisitInfo gets the visitInfo of the PlanBuilder.

func (*PlanBuilder) TableHints Uses

func (b *PlanBuilder) TableHints() *tableHintInfo

TableHints returns the *tableHintInfo of PlanBuilder.

type PointGetPlan Uses

type PointGetPlan struct {
    TblInfo          *model.TableInfo
    IndexInfo        *model.IndexInfo
    PartitionInfo    *model.PartitionDefinition
    Handle           int64
    HandleParam      *driver.ParamMarkerExpr
    IndexValues      []types.Datum
    IndexValueParams []*driver.ParamMarkerExpr

    UnsignedHandle bool
    IsTableDual    bool
    Lock           bool
    IsForUpdate    bool

    LockWaitTime int64
    // contains filtered or unexported fields
}

PointGetPlan is a fast plan for simple point get. When we detect that the statement has a unique equal access condition, this plan is used. This plan is much faster to build and to execute because it avoid the optimization and coprocessor cost.

func (*PointGetPlan) Children Uses

func (p *PointGetPlan) Children() []PhysicalPlan

Children gets all the children.

func (*PointGetPlan) ExplainID Uses

func (p *PointGetPlan) ExplainID() fmt.Stringer

func (*PointGetPlan) ExplainInfo Uses

func (p *PointGetPlan) ExplainInfo() string

ExplainInfo returns operator information to be explained.

func (*PointGetPlan) ExplainNormalizedInfo Uses

func (p *PointGetPlan) ExplainNormalizedInfo() string

ExplainNormalizedInfo returns normalized operator information to be explained.

func (*PointGetPlan) GetChildReqProps Uses

func (p *PointGetPlan) GetChildReqProps(idx int) *property.PhysicalProperty

GetChildReqProps gets the required property by child index.

func (*PointGetPlan) ID Uses

func (p *PointGetPlan) ID() int

ID implements Plan ID interface.

func (*PointGetPlan) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*PointGetPlan) ResolveIndices Uses

func (p *PointGetPlan) ResolveIndices() error

ResolveIndices resolves the indices for columns. After doing this, the columns can evaluate the rows by their indices.

func (*PointGetPlan) SCtx Uses

func (p *PointGetPlan) SCtx() sessionctx.Context

Context implements Plan Context interface.

func (*PointGetPlan) Schema Uses

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

Schema implements the Plan interface.

func (*PointGetPlan) SelectBlockOffset Uses

func (p *PointGetPlan) SelectBlockOffset() int

func (*PointGetPlan) SetChild Uses

func (p *PointGetPlan) SetChild(i int, child PhysicalPlan)

SetChild sets a specific child for the plan.

func (*PointGetPlan) SetChildren Uses

func (p *PointGetPlan) SetChildren(...PhysicalPlan)

SetChildren sets the children for the plan.

func (*PointGetPlan) SetOutputNames Uses

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

SetOutputNames sets the outputting name by the given slice.

func (*PointGetPlan) Stats Uses

func (p *PointGetPlan) Stats() *property.StatsInfo

Stats implements Plan Stats interface.

func (*PointGetPlan) StatsCount Uses

func (p *PointGetPlan) StatsCount() float64

StatsCount will return the the RowCount of property.StatsInfo for this plan.

func (*PointGetPlan) TP Uses

func (p *PointGetPlan) TP() string

TP implements Plan interface.

func (*PointGetPlan) ToPB Uses

func (p *PointGetPlan) ToPB(ctx sessionctx.Context) (*tipb.Executor, error)

ToPB converts physical plan to tipb executor.

type Prepare Uses

type Prepare struct {
    Name    string
    SQLText string
    // contains filtered or unexported fields
}

Prepare represents prepare plan.

func (*Prepare) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*Prepare) ResolveIndices Uses

func (p *Prepare) ResolveIndices() (err error)

func (*Prepare) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*Prepare) SetOutputNames Uses

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

func (*Prepare) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type PreprocessOpt Uses

type PreprocessOpt func(*preprocessor)

PreprocessOpt presents optional parameters to `Preprocess` method.

type PushedDownLimit Uses

type PushedDownLimit struct {
    Offset uint64
    Count  uint64
}

PushedDownLimit is the limit operator pushed down into PhysicalIndexLookUpReader.

type RecoverIndex Uses

type RecoverIndex struct {
    Table     *ast.TableName
    IndexName string
    // contains filtered or unexported fields
}

RecoverIndex is used for backfilling corrupted index data.

func (*RecoverIndex) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*RecoverIndex) ResolveIndices Uses

func (p *RecoverIndex) ResolveIndices() (err error)

func (*RecoverIndex) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*RecoverIndex) SetOutputNames Uses

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

func (*RecoverIndex) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type ReloadExprPushdownBlacklist Uses

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

ReloadExprPushdownBlacklist reloads the data from expr_pushdown_blacklist table.

func (*ReloadExprPushdownBlacklist) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*ReloadExprPushdownBlacklist) ResolveIndices Uses

func (p *ReloadExprPushdownBlacklist) ResolveIndices() (err error)

func (*ReloadExprPushdownBlacklist) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*ReloadExprPushdownBlacklist) SetOutputNames Uses

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

func (*ReloadExprPushdownBlacklist) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type ReloadOptRuleBlacklist Uses

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

ReloadOptRuleBlacklist reloads the data from opt_rule_blacklist table.

func (*ReloadOptRuleBlacklist) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*ReloadOptRuleBlacklist) ResolveIndices Uses

func (p *ReloadOptRuleBlacklist) ResolveIndices() (err error)

func (*ReloadOptRuleBlacklist) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*ReloadOptRuleBlacklist) SetOutputNames Uses

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

func (*ReloadOptRuleBlacklist) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type SQLBindOpType Uses

type SQLBindOpType int

SQLBindOpType repreents the SQL bind type

const (
    // OpSQLBindCreate represents the operation to create a SQL bind.
    OpSQLBindCreate SQLBindOpType = iota
    // OpSQLBindDrop represents the operation to drop a SQL bind.
    OpSQLBindDrop
    // OpFlushBindings is used to flush plan bindings.
    OpFlushBindings
    // OpCaptureBindings is used to capture plan bindings.
    OpCaptureBindings
    // OpEvolveBindings is used to evolve plan binding.
    OpEvolveBindings
)

type SQLBindPlan Uses

type SQLBindPlan struct {
    SQLBindOp    SQLBindOpType
    NormdOrigSQL string
    BindSQL      string
    IsGlobal     bool
    BindStmt     ast.StmtNode
    Db           string
    Charset      string
    Collation    string
    // contains filtered or unexported fields
}

SQLBindPlan represents a plan for SQL bind.

func (*SQLBindPlan) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*SQLBindPlan) ResolveIndices Uses

func (p *SQLBindPlan) ResolveIndices() (err error)

func (*SQLBindPlan) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*SQLBindPlan) SetOutputNames Uses

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

func (*SQLBindPlan) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type Set Uses

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

Set represents a plan for set stmt.

func (*Set) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*Set) ResolveIndices Uses

func (p *Set) ResolveIndices() (err error)

func (*Set) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*Set) SetOutputNames Uses

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

func (*Set) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type ShowContents Uses

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 ShowDDL Uses

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

ShowDDL is for showing DDL information.

func (*ShowDDL) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*ShowDDL) ResolveIndices Uses

func (p *ShowDDL) ResolveIndices() (err error)

func (*ShowDDL) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*ShowDDL) SetOutputNames Uses

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

func (*ShowDDL) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type ShowDDLJobQueries Uses

type ShowDDLJobQueries struct {
    JobIDs []int64
    // contains filtered or unexported fields
}

ShowDDLJobQueries is for showing DDL job queries sql.

func (*ShowDDLJobQueries) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*ShowDDLJobQueries) ResolveIndices Uses

func (p *ShowDDLJobQueries) ResolveIndices() (err error)

func (*ShowDDLJobQueries) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*ShowDDLJobQueries) SetOutputNames Uses

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

func (*ShowDDLJobQueries) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type ShowNextRowID Uses

type ShowNextRowID struct {
    TableName *ast.TableName
    // contains filtered or unexported fields
}

ShowNextRowID is for showing the next global row ID.

func (*ShowNextRowID) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*ShowNextRowID) ResolveIndices Uses

func (p *ShowNextRowID) ResolveIndices() (err error)

func (*ShowNextRowID) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*ShowNextRowID) SetOutputNames Uses

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

func (*ShowNextRowID) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type ShowSlow Uses

type ShowSlow struct {
    *ast.ShowSlow
    // contains filtered or unexported fields
}

ShowSlow is for showing slow queries.

func (*ShowSlow) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*ShowSlow) ResolveIndices Uses

func (p *ShowSlow) ResolveIndices() (err error)

func (*ShowSlow) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*ShowSlow) SetOutputNames Uses

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

func (*ShowSlow) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type Simple Uses

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 Uses

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

OutputNames returns the outputting names of each column.

func (*Simple) ResolveIndices Uses

func (p *Simple) ResolveIndices() (err error)

func (*Simple) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*Simple) SetOutputNames Uses

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

func (*Simple) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type SplitRegion Uses

type SplitRegion struct {
    TableInfo      *model.TableInfo
    PartitionNames []model.CIStr
    IndexInfo      *model.IndexInfo
    Lower          []types.Datum
    Upper          []types.Datum
    Num            int
    ValueLists     [][]types.Datum
    // contains filtered or unexported fields
}

SplitRegion represents a split regions plan.

func (*SplitRegion) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*SplitRegion) ResolveIndices Uses

func (p *SplitRegion) ResolveIndices() (err error)

func (*SplitRegion) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*SplitRegion) SetOutputNames Uses

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

func (*SplitRegion) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type SplitRegionStatus Uses

type SplitRegionStatus struct {
    Table     table.Table
    IndexInfo *model.IndexInfo
    // contains filtered or unexported fields
}

SplitRegionStatus represents a split regions status plan.

func (*SplitRegionStatus) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*SplitRegionStatus) ResolveIndices Uses

func (p *SplitRegionStatus) ResolveIndices() (err error)

func (*SplitRegionStatus) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*SplitRegionStatus) SetOutputNames Uses

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

func (*SplitRegionStatus) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type TblColPosInfo Uses

type TblColPosInfo struct {
    TblID int64
    // Start and End represent the ordinal range [Start, End) of the consecutive columns.
    Start, End int
    // HandleOrdinal represents the ordinal of the handle column.
    HandleOrdinal int
}

TblColPosInfo represents an mapper from column index to handle index.

type TblColPosInfoSlice Uses

type TblColPosInfoSlice []TblColPosInfo

TblColPosInfoSlice attaches the methods of sort.Interface to []TblColPosInfos sorting in increasing order.

func (TblColPosInfoSlice) FindHandle Uses

func (c TblColPosInfoSlice) FindHandle(colOrdinal int) (int, bool)

FindHandle finds the ordinal of the corresponding handle column.

func (TblColPosInfoSlice) Len Uses

func (c TblColPosInfoSlice) Len() int

Len implements sort.Interface#Len.

func (TblColPosInfoSlice) Less Uses

func (c TblColPosInfoSlice) Less(i, j int) bool

Less implements sort.Interface#Less.

func (TblColPosInfoSlice) Swap Uses

func (c TblColPosInfoSlice) Swap(i, j int)

Swap implements sort.Interface#Swap.

type TiKVSingleGather Uses

type TiKVSingleGather struct {
    Source *DataSource
    // IsIndexGather marks if this TiKVSingleGather gathers tuples from an IndexScan.
    // in implementation phase, we need this flag to determine whether to generate
    // PhysicalTableReader or PhysicalIndexReader.
    IsIndexGather bool
    Index         *model.IndexInfo
    // contains filtered or unexported fields
}

TiKVSingleGather is a leaf logical operator of TiDB layer to gather tuples from TiKV regions.

func (*TiKVSingleGather) BuildKeyInfo Uses

func (tg *TiKVSingleGather) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (*TiKVSingleGather) ExplainInfo Uses

func (p *TiKVSingleGather) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*TiKVSingleGather) GetPhysicalIndexReader Uses

func (sg *TiKVSingleGather) GetPhysicalIndexReader(schema *expression.Schema, stats *property.StatsInfo, props ...*property.PhysicalProperty) *PhysicalIndexReader

GetPhysicalIndexReader returns PhysicalIndexReader for logical TiKVSingleGather.

func (*TiKVSingleGather) GetPhysicalTableReader Uses

func (sg *TiKVSingleGather) GetPhysicalTableReader(schema *expression.Schema, stats *property.StatsInfo, props ...*property.PhysicalProperty) *PhysicalTableReader

GetPhysicalTableReader returns PhysicalTableReader for logical TiKVSingleGather.

func (TiKVSingleGather) Init Uses

func (sg TiKVSingleGather) Init(ctx sessionctx.Context, offset int) *TiKVSingleGather

Init initializes TiKVSingleGather.

func (*TiKVSingleGather) OutputNames Uses

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

func (*TiKVSingleGather) PreparePossibleProperties Uses

func (p *TiKVSingleGather) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column

PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.

func (*TiKVSingleGather) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*TiKVSingleGather) SetOutputNames Uses

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

func (*TiKVSingleGather) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type Trace Uses

type Trace struct {
    StmtNode ast.StmtNode
    Format   string
    // contains filtered or unexported fields
}

Trace represents a trace plan.

func (*Trace) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*Trace) ResolveIndices Uses

func (p *Trace) ResolveIndices() (err error)

func (*Trace) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*Trace) SetOutputNames Uses

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

func (*Trace) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type Update Uses

type Update struct {
    OrderedList []*expression.Assignment

    AllAssignmentsAreConstant bool

    SelectPlan PhysicalPlan

    TblColPosInfos TblColPosInfoSlice
    // contains filtered or unexported fields
}

Update represents Update plan.

func (Update) Init Uses

func (p Update) Init(ctx sessionctx.Context) *Update

Init initializes Update.

func (*Update) OutputNames Uses

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

OutputNames returns the outputting names of each column.