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 handle_cols.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_generate_column_substitute.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 = "merge_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"
    // HintTimeRange is a hint to specify the time range for metrics summary tables
    HintTimeRange = "time_range"
    // HintIgnorePlanCache is a hint to enforce ignoring plan cache
    HintIgnorePlanCache = "ignore_plan_cache"
)
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 MetricTableTimeFormat = "2006-01-02 15:04:05.999"

MetricTableTimeFormat is the time format for metric table explain and format.

const (
    // PartitionHashSplitterType is the splitter splits by hash.
    PartitionHashSplitterType = iota
)
const PointPlanKey = stringutil.StringerStr("pointPlanKey")

PointPlanKey is used to get point plan that is pre-built for multi-statement query.

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 = 100
    // PreparedPlanCacheMemoryGuardRatio stores the global config "prepared-plan-cache-memory-guard-ratio".
    PreparedPlanCacheMemoryGuardRatio = 0.1
    // PreparedPlanCacheMaxMemory stores the max memory size defined in the global config "performance-server-memory-quota".
    PreparedPlanCacheMaxMemory = *atomic2.NewUint64(math.MaxUint64)
)
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])
    ErrNoSuchTable                     = terror.ClassOptimizer.New(mysql.ErrNoSuchTable, mysql.MySQLErrName[mysql.ErrNoSuchTable])
    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 EvalSubqueryFirstRow func(ctx context.Context, p PhysicalPlan, is infoschema.InfoSchema, sctx sessionctx.Context) (row []types.Datum, err error)

EvalSubqueryFirstRow evaluates incorrelated subqueries once, and get first row.

var ForceUseOuterBuild4Test = false

ForceUseOuterBuild4Test is a test option to control forcing use outer input as build. TODO: use hint and remove this variable

var ForcedHashLeftJoin4Test = false

ForcedHashLeftJoin4Test is a test option to force using HashLeftJoin TODO: use hint and remove this variable

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 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, is infoschema.InfoSchema) bool

Cacheable checks whether the input ast is cacheable. Handle "ignore_plan_cache()" hint If there are multiple hints, only one will take effect

func CheckAggCanPushCop Uses

func CheckAggCanPushCop(sctx sessionctx.Context, aggFuncs []*aggregation.AggFuncDesc, groupByItems []expression.Expression, storeType kv.StoreType) 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 ExpandVirtualColumn Uses

func ExpandVirtualColumn(columns []*model.ColumnInfo, schema *expression.Schema,
    colsInfo []*model.ColumnInfo) []*model.ColumnInfo

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

func ExprsHasSideEffects Uses

func ExprsHasSideEffects(exprs []expression.Expression) bool

ExprsHasSideEffects checks if any of the expressions has side effects.

func ExtractCorColumnsBySchema Uses

func ExtractCorColumnsBySchema(corCols []*expression.CorrelatedColumn, schema *expression.Schema, resolveIndex bool) []*expression.CorrelatedColumn

ExtractCorColumnsBySchema only extracts the correlated columns that match the specified schema. e.g. If the correlated columns from plan are [t1.a, t2.a, t3.a] and specified schema is [t2.a, t2.b, t2.c], only [t2.a] is returned.

func ExtractCorColumnsBySchema4PhysicalPlan Uses

func ExtractCorColumnsBySchema4PhysicalPlan(p PhysicalPlan, schema *expression.Schema) []*expression.CorrelatedColumn

ExtractCorColumnsBySchema4PhysicalPlan only extracts the correlated columns that match the specified schema. e.g. If the correlated columns from plan are [t1.a, t2.a, t3.a] and specified schema is [t2.a, t2.b, t2.c], only [t2.a] is returned.

func ExtractCorrelatedCols4LogicalPlan Uses

func ExtractCorrelatedCols4LogicalPlan(p LogicalPlan) []*expression.CorrelatedColumn

ExtractCorrelatedCols4LogicalPlan recursively extracts all of the correlated columns from a plan tree by calling LogicalPlan.ExtractCorrelatedCols.

func ExtractCorrelatedCols4PhysicalPlan Uses

func ExtractCorrelatedCols4PhysicalPlan(p PhysicalPlan) []*expression.CorrelatedColumn

ExtractCorrelatedCols4PhysicalPlan recursively extracts all of the correlated columns from a plan tree by calling PhysicalPlan.ExtractCorrelatedCols.

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) []*ast.TableOptimizerHint

GenHintsFromPhysicalPlan generates hints from physical plan.

func GetDupAgnosticAggCols Uses

func GetDupAgnosticAggCols(
    p LogicalPlan,
    oldAggCols []*expression.Column,
) (isAgg bool, newAggCols []*expression.Column)

GetDupAgnosticAggCols checks whether a LogicalPlan is LogicalAggregation. It extracts all the columns from the duplicate agnostic aggregate functions. The returned column set is nil if not all the aggregate functions are duplicate agnostic. Only the following functions are considered to be duplicate agnostic:

1. MAX(arg)
2. MIN(arg)
3. FIRST_ROW(arg)
4. Other agg functions with DISTINCT flag, like SUM(DISTINCT arg)

func GetExplainRowsForPlan Uses

func GetExplainRowsForPlan(plan Plan) (rows [][]string)

GetExplainRowsForPlan get explain rows for plan.

func GetPropByOrderByItems Uses

func GetPropByOrderByItems(items []*util.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 GetPropByOrderByItemsContainScalarFunc Uses

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

GetPropByOrderByItemsContainScalarFunc 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 or some special scalar functions.

func GetStatsInfo Uses

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

GetStatsInfo gets the statistics info from a physical plan tree.

func GetUpdateColumns Uses

func GetUpdateColumns(ctx sessionctx.Context, orderedList []*expression.Assignment, schemaLen int) ([]bool, error)

GetUpdateColumns gets the columns of updated lists.

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

func IsColsAllFromOuterTable(cols []*expression.Column, outerUniqueIDs set.Int64Set) bool

IsColsAllFromOuterTable check whether the cols all from outer plan

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 []*util.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,
    funcMap map[*aggregation.AggFuncDesc]*aggregation.AggFuncDesc) []*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, isolationReadEngines map[kv.StoreType]struct{})

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

func SplitSelCondsWithVirtualColumn Uses

func SplitSelCondsWithVirtualColumn(conds []expression.Expression) ([]expression.Expression, []expression.Expression)

SplitSelCondsWithVirtualColumn filter the select conditions which contain virtual column

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.

func TryAddExtraLimit Uses

func TryAddExtraLimit(ctx sessionctx.Context, node ast.StmtNode) ast.StmtNode

TryAddExtraLimit trys to add an extra limit for SELECT or UNION statement when sql_select_limit is set.

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

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

AdminResetTelemetryID regenerates a new telemetry tracking ID.

func (*AdminResetTelemetryID) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*AdminResetTelemetryID) ResolveIndices Uses

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

func (*AdminResetTelemetryID) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*AdminResetTelemetryID) SetOutputNames Uses

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

func (*AdminResetTelemetryID) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type AdminShowTelemetry Uses

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

AdminShowTelemetry displays telemetry status including tracking ID, status and so on.

func (*AdminShowTelemetry) OutputNames Uses

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

OutputNames returns the outputting names of each column.

func (*AdminShowTelemetry) ResolveIndices Uses

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

func (*AdminShowTelemetry) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*AdminShowTelemetry) SetOutputNames Uses

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

func (*AdminShowTelemetry) SetSchema Uses

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

SetSchema implements the Plan.SetSchema interface.

type AggInfo Uses

type AggInfo struct {
    AggFuncs     []*aggregation.AggFuncDesc
    GroupByItems []expression.Expression
    Schema       *expression.Schema
}

AggInfo stores the information of an Aggregation.

func BuildFinalModeAggregation Uses

func BuildFinalModeAggregation(
    sctx sessionctx.Context, original *AggInfo, partialIsCop bool) (partial, final *AggInfo, funcMap map[*aggregation.AggFuncDesc]*aggregation.AggFuncDesc)

BuildFinalModeAggregation splits either LogicalAggregation or PhysicalAggregation to finalAgg and partial1Agg, returns the information of partial and final agg. partialIsCop means whether partial agg is a cop task.

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          []kv.Handle
    HandleParams     []*driver.ParamMarkerExpr
    IndexValues      [][]types.Datum
    IndexValueParams [][]*driver.ParamMarkerExpr
    PartitionColPos  int
    KeepOrder        bool
    Desc             bool
    Lock             bool
    LockWaitTime     int64
    Columns          []*model.ColumnInfo
    // 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) AccessObject Uses

func (p *BatchPointGetPlan) AccessObject() string

AccessObject implements physicalScan interface.

func (*BatchPointGetPlan) Children Uses

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

Children gets all the children.

func (*BatchPointGetPlan) Clone Uses

func (p *BatchPointGetPlan) Clone() (PhysicalPlan, error)

Clone implements PhysicalPlan interface.

func (*BatchPointGetPlan) ExplainInfo Uses

func (p *BatchPointGetPlan) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*BatchPointGetPlan) ExplainNormalizedInfo Uses

func (p *BatchPointGetPlan) ExplainNormalizedInfo() string

ExplainNormalizedInfo implements Plan interface.

func (*BatchPointGetPlan) ExtractCorrelatedCols Uses

func (p *BatchPointGetPlan) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements PhysicalPlan interface.

func (*BatchPointGetPlan) GetChildReqProps Uses

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

GetChildReqProps gets the required property by child index.

func (*BatchPointGetPlan) GetCost Uses

func (p *BatchPointGetPlan) GetCost(cols []*expression.Column) float64

GetCost returns cost of the PointGetPlan.

func (BatchPointGetPlan) Init Uses

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

Init initializes BatchPointGetPlan.

func (*BatchPointGetPlan) OperatorInfo Uses

func (p *BatchPointGetPlan) OperatorInfo(normalized bool) string

OperatorInfo implements dataAccesser interface.

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

type CachedPrepareStmt struct {
    PreparedAst    *ast.Prepared
    VisitInfos     []visitInfo
    ColumnInfos    interface{}
    Executor       interface{}
    NormalizedSQL  string
    NormalizedPlan string
    SQLDigest      string
    PlanDigest     string
}

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 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
    CheckIndex         bool
    // 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

    // Instances represents all components instances we should send request to.
    // e.g:
    // 1. SELECT * FROM cluster_log WHERE instance='192.168.1.7:2379'
    // 2. SELECT * FROM cluster_log WHERE instance in ('192.168.1.7:2379', '192.168.1.9:2379')
    Instances 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

    // Instances represents all components instances we should send request to.
    // e.g:
    // 1. SELECT * FROM cluster_config WHERE instance='192.168.1.7:2379'
    // 2. SELECT * FROM cluster_config WHERE type in ('192.168.1.7:2379', '192.168.1.9:2379')
    Instances 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 CommonHandleCols Uses

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

CommonHandleCols implements the kv.HandleCols interface.

func NewCommonHandleCols Uses

func NewCommonHandleCols(sc *stmtctx.StatementContext, tblInfo *model.TableInfo, idxInfo *model.IndexInfo,
    tableColumns []*expression.Column) *CommonHandleCols

NewCommonHandleCols creates a new CommonHandleCols.

func (*CommonHandleCols) BuildHandle Uses

func (cb *CommonHandleCols) BuildHandle(row chunk.Row) (kv.Handle, error)

BuildHandle implements the kv.HandleCols interface.

func (*CommonHandleCols) BuildHandleByDatums Uses

func (cb *CommonHandleCols) BuildHandleByDatums(row []types.Datum) (kv.Handle, error)

BuildHandleByDatums implements the kv.HandleCols interface.

func (*CommonHandleCols) Compare Uses

func (cb *CommonHandleCols) Compare(a, b []types.Datum) (int, error)

Compare implements the kv.HandleCols interface.

func (*CommonHandleCols) GetCol Uses

func (cb *CommonHandleCols) GetCol(idx int) *expression.Column

GetCol implements the kv.HandleCols interface.

func (*CommonHandleCols) IsInt Uses

func (cb *CommonHandleCols) IsInt() bool

IsInt implements the kv.HandleCols interface.

func (*CommonHandleCols) NumCols Uses

func (cb *CommonHandleCols) NumCols() int

NumCols implements the kv.HandleCols interface.

func (*CommonHandleCols) ResolveIndices Uses

func (cb *CommonHandleCols) ResolveIndices(schema *expression.Schema) (HandleCols, error)

ResolveIndices implements the kv.HandleCols interface.

func (*CommonHandleCols) String Uses

func (cb *CommonHandleCols) String() string

String implements the kv.HandleCols 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 {
    IndexHints []indexHintInfo

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

func (ds *DataSource) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements LogicalPlan 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 ExprColumnMap Uses

type ExprColumnMap map[expression.Expression]*expression.Column

ExprColumnMap is used to store all expressions of indexed generated columns in a table, and map them to the generated columns, thus we can substitute the expression in a query to an indexed generated column.

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

type HandleCols interface {
    // BuildHandle builds a Handle from a row.
    BuildHandle(row chunk.Row) (kv.Handle, error)
    // BuildHandleByDatums builds a Handle from a datum slice.
    BuildHandleByDatums(row []types.Datum) (kv.Handle, error)
    // ResolveIndices resolves handle column indices.
    ResolveIndices(schema *expression.Schema) (HandleCols, error)
    // IsInt returns if the HandleCols is a single tnt column.
    IsInt() bool
    // String implements the fmt.Stringer interface.
    String() string
    // GetCol gets the column by idx.
    GetCol(idx int) *expression.Column
    // NumCols returns the number of columns.
    NumCols() int
    // Compare compares two datum rows by handle order.
    Compare(a, b []types.Datum) (int, error)
}

HandleCols is the interface that holds handle columns.

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(
    _ sessionctx.Context,
    schema *expression.Schema,
    names []*types.FieldName,
    predicates []expression.Expression,
) (remained []expression.Expression)

Extract implements the MemTablePredicateExtractor Extract interface

type InspectionRuleTableExtractor Uses

type InspectionRuleTableExtractor struct {
    SkipRequest bool
    Types       set.StringSet
    // contains filtered or unexported fields
}

InspectionRuleTableExtractor is used to extract some predicates of `inspection_rules`

func (*InspectionRuleTableExtractor) Extract Uses

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

Extract implements the MemTablePredicateExtractor Extract interface

type InspectionSummaryTableExtractor Uses

type InspectionSummaryTableExtractor 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_summary WHERE rule in ('ddl', 'config')
    Rules       set.StringSet
    MetricNames set.StringSet
    Quantiles   []float64
    // contains filtered or unexported fields
}

InspectionSummaryTableExtractor is used to extract some predicates of `inspection_summary`

func (*InspectionSummaryTableExtractor) Extract Uses

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

Extract implements the MemTablePredicateExtractor Extract interface

type IntHandleCols Uses

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

IntHandleCols implements the kv.HandleCols interface.

func (*IntHandleCols) BuildHandle Uses

func (ib *IntHandleCols) BuildHandle(row chunk.Row) (kv.Handle, error)

BuildHandle implements the kv.HandleCols interface.

func (*IntHandleCols) BuildHandleByDatums Uses

func (ib *IntHandleCols) BuildHandleByDatums(row []types.Datum) (kv.Handle, error)

BuildHandleByDatums implements the kv.HandleCols interface.

func (*IntHandleCols) Compare Uses

func (ib *IntHandleCols) Compare(a, b []types.Datum) (int, error)

Compare implements the kv.HandleCols interface.

func (*IntHandleCols) GetCol Uses

func (ib *IntHandleCols) GetCol(idx int) *expression.Column

GetCol implements the kv.HandleCols interface.

func (*IntHandleCols) IsInt Uses

func (ib *IntHandleCols) IsInt() bool

IsInt implements the kv.HandleCols interface.

func (*IntHandleCols) NumCols Uses

func (ib *IntHandleCols) NumCols() int

NumCols implements the kv.HandleCols interface.

func (*IntHandleCols) ResolveIndices Uses

func (ib *IntHandleCols) ResolveIndices(schema *expression.Schema) (HandleCols, error)

ResolveIndices implements the kv.HandleCols interface.

func (*IntHandleCols) String Uses

func (ib *IntHandleCols) String() string

String implements the kv.HandleCols 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) ExtractCorrelatedCols Uses

func (la *LogicalAggregation) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements LogicalPlan 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) GetUsedCols Uses

func (la *LogicalAggregation) GetUsedCols() (usedCols []*expression.Column)

GetUsedCols extracts all of the Columns used by agg including GroupByItems and AggFuncs.

func (*LogicalAggregation) HasDistinct Uses

func (la *LogicalAggregation) HasDistinct() bool

HasDistinct shows whether LogicalAggregation has functions with distinct.

func (LogicalAggregation) Init Uses

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

Init initializes LogicalAggregation.

func (*LogicalAggregation) IsCompleteModeAgg Uses

func (la *LogicalAggregation) IsCompleteModeAgg() bool

IsCompleteModeAgg returns if all of the AggFuncs are CompleteMode.

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

func (la *LogicalApply) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements LogicalPlan 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) AppendJoinConds Uses

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

AppendJoinConds appends new join conditions.

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

func (p *LogicalJoin) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements LogicalPlan interface.

func (*LogicalJoin) ExtractJoinKeys Uses

func (p *LogicalJoin) ExtractJoinKeys(childIdx int) *expression.Schema

ExtractJoinKeys extract join keys as a schema for child with childIdx.

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, statsInfo *property.StatsInfo, leftStatsInfo *property.StatsInfo, rightStatsInfo *property.StatsInfo) []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.

func (*LogicalJoin) Shallow Uses

func (p *LogicalJoin) Shallow() *LogicalJoin

Shallow shallow copies a LogicalJoin struct.

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

func (p *LogicalLimit) ExtractCorrelatedCols() []*expression.CorrelatedColumn

func (*LogicalLimit) GetlogicalTS4TaskMap Uses

func (p *LogicalLimit) GetlogicalTS4TaskMap() uint64

GetlogicalTS4TaskMap get the logical TimeStamp now to help rollback the TaskMap changes after that.

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

func (p *LogicalLock) ExtractCorrelatedCols() []*expression.CorrelatedColumn

func (*LogicalLock) GetlogicalTS4TaskMap Uses

func (p *LogicalLock) GetlogicalTS4TaskMap() uint64

GetlogicalTS4TaskMap get the logical TimeStamp now to help rollback the TaskMap changes after that.

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

func (p *LogicalMaxOneRow) ExtractCorrelatedCols() []*expression.CorrelatedColumn

func (*LogicalMaxOneRow) GetlogicalTS4TaskMap Uses

func (p *LogicalMaxOneRow) GetlogicalTS4TaskMap() uint64

GetlogicalTS4TaskMap get the logical TimeStamp now to help rollback the TaskMap changes after that.

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
    DBName    model.CIStr
    TableInfo *model.TableInfo
    // QueryTimeRange is used to specify the time range for metrics summary tables and inspection tables
    // e.g: select /*+ time_range('2020-02-02 12:10:00', '2020-02-02 13:00:00') */ from metrics_summary;
    //      select /*+ time_range('2020-02-02 12:10:00', '2020-02-02 13:00:00') */ from metrics_summary_by_label;
    //      select /*+ time_range('2020-02-02 12:10:00', '2020-02-02 13:00:00') */ from inspection_summary;
    //      select /*+ time_range('2020-02-02 12:10:00', '2020-02-02 13:00:00') */ from inspection_result;
    QueryTimeRange QueryTimeRange
    // 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 LogicalPartitionUnionAll Uses

type LogicalPartitionUnionAll struct {
    LogicalUnionAll
}

LogicalPartitionUnionAll represents the LogicalUnionAll plan is for partition table.

func (*LogicalPartitionUnionAll) BuildKeyInfo Uses

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

BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.

func (LogicalPartitionUnionAll) Init Uses

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

Init initializes LogicalPartitionUnionAll.

func (*LogicalPartitionUnionAll) OutputNames Uses

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

func (*LogicalPartitionUnionAll) Schema Uses

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

Schema implements the Plan.Schema interface.

func (*LogicalPartitionUnionAll) SetOutputNames Uses

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

func (*LogicalPartitionUnionAll) SetSchema Uses

func (s *LogicalPartitionUnionAll) 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

    // ExtractCorrelatedCols extracts correlated columns inside the LogicalPlan.
    ExtractCorrelatedCols() []*expression.CorrelatedColumn

    // 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 ConvertAggToProj Uses

func ConvertAggToProj(agg *LogicalAggregation, schema *expression.Schema) (bool, *LogicalProjection)

ConvertAggToProj convert aggregation to projection.

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

func (p *LogicalProjection) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements LogicalPlan interface.

func (*LogicalProjection) GetUsedCols Uses

func (p *LogicalProjection) GetUsedCols() (usedCols []*expression.Column)

GetUsedCols extracts all of the Columns used by proj.

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

func (p *LogicalSelection) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements LogicalPlan interface.

func (*LogicalSelection) GetlogicalTS4TaskMap Uses

func (p *LogicalSelection) GetlogicalTS4TaskMap() uint64

GetlogicalTS4TaskMap get the logical TimeStamp now to help rollback the TaskMap changes after that.

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 []*util.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) ExtractCorrelatedCols Uses

func (ls *LogicalSort) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements LogicalPlan interface.

func (*LogicalSort) GetlogicalTS4TaskMap Uses

func (p *LogicalSort) GetlogicalTS4TaskMap() uint64

GetlogicalTS4TaskMap get the logical TimeStamp now to help rollback the TaskMap changes after that.

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
    HandleCols  HandleCols
    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 []*util.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) ExtractCorrelatedCols Uses

func (lt *LogicalTopN) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements LogicalPlan interface.

func (*LogicalTopN) GetlogicalTS4TaskMap Uses

func (p *LogicalTopN) GetlogicalTS4TaskMap() uint64

GetlogicalTS4TaskMap get the logical TimeStamp now to help rollback the TaskMap changes after that.

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 (lt *LogicalTopN) 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 (*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) ExtractCorrelatedCols Uses

func (p *LogicalUnionScan) ExtractCorrelatedCols() []*expression.CorrelatedColumn

func (*LogicalUnionScan) GetlogicalTS4TaskMap Uses

func (p *LogicalUnionScan) GetlogicalTS4TaskMap() uint64

GetlogicalTS4TaskMap get the logical TimeStamp now to help rollback the TaskMap changes after that.

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

func (p *LogicalWindow) ExtractCorrelatedCols() []*expression.CorrelatedColumn

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

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 instance='192.168.1.9:2379' We must request all components in the cluster via HTTP API for retrieving configurations and filter them by `type/instance` columns.

The purpose of defining a `MemTablePredicateExtractor` is to optimize this 1. Define a `ClusterConfigTablePredicateExtractor` 2. Extract the `type/instance` 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 MetricSummaryTableExtractor Uses

type MetricSummaryTableExtractor struct {

    // SkipRequest means the where clause always false, we don't need to request any component
    SkipRequest  bool
    MetricsNames set.StringSet
    Quantiles    []float64
    // contains filtered or unexported fields
}

MetricSummaryTableExtractor is used to extract some predicates of metrics_schema tables.

func (*MetricSummaryTableExtractor) Extract Uses

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

Extract implements the MemTablePredicateExtractor Extract interface

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 metrics_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

func (*MetricTableExtractor) GetMetricTablePromQL Uses

func (e *MetricTableExtractor) GetMetricTablePromQL(sctx sessionctx.Context, lowerTableName string) string

GetMetricTablePromQL uses to get the promQL of metric table.

type NominalSort Uses

type NominalSort struct {

    // These two fields are used to switch ScalarFunctions to Constants. For these
    // NominalSorts, we need to converted to Projections check if the ScalarFunctions
    // are out of bounds. (issue #11653)
    ByItems    []*util.ByItems
    OnlyColumn bool
    // 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. It will be eliminated or converted to Projection.

func (*NominalSort) Children Uses

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

Children implements PhysicalPlan Children interface.

func (*NominalSort) Clone Uses

func (p *NominalSort) Clone() (PhysicalPlan, error)

Clone implements PhysicalPlan 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) ExtractCorrelatedCols Uses

func (p *NominalSort) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements PhysicalPlan interface.

func (*NominalSort) GetChildReqProps Uses

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

func (NominalSort) Init Uses

func (p NominalSort) Init(ctx sessionctx.Context, stats *property.StatsInfo, 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
    TblInfo2UnionScan map[*model.TableInfo]bool
}

PSTMTPlanCacheValue stores the cached Statement and StmtNode.

func NewPSTMTPlanCacheValue Uses

func NewPSTMTPlanCacheValue(plan Plan, names []*types.FieldName, srcMap map[*model.TableInfo]bool) *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

    CanUseCache bool
    OuterSchema []*expression.CorrelatedColumn
}

PhysicalApply represents apply plan, only used for subquery.

func (*PhysicalApply) ExtractCorrelatedCols Uses

func (la *PhysicalApply) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements PhysicalPlan interface.

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

func (p *PhysicalHashAgg) Clone() (PhysicalPlan, error)

Clone implements PhysicalPlan interface.

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

func (p *PhysicalHashAgg) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements PhysicalPlan 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) Clone Uses

func (p *PhysicalHashJoin) Clone() (PhysicalPlan, error)

Clone implements PhysicalPlan interface.

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

func (p *PhysicalHashJoin) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements PhysicalPlan 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) ExtractCorrelatedCols Uses

func (p *PhysicalIndexHashJoin) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements PhysicalPlan interface.

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

func (p *PhysicalIndexJoin) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements PhysicalPlan 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

    CommonHandleCols []*expression.Column
    // contains filtered or unexported fields
}

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

func (*PhysicalIndexLookUpReader) Clone Uses

func (p *PhysicalIndexLookUpReader) Clone() (PhysicalPlan, error)

Clone implements PhysicalPlan interface.

func (*PhysicalIndexLookUpReader) ExplainInfo Uses

func (p *PhysicalIndexLookUpReader) ExplainInfo() string

ExplainInfo implements Plan interface.

func (*PhysicalIndexLookUpReader) ExtractCorrelatedCols Uses

func (p *PhysicalIndexLookUpReader) ExtractCorrelatedCols() (corCols []*expression.CorrelatedColumn)

ExtractCorrelatedCols implements PhysicalPlan 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) ExtractCorrelatedCols Uses

func (p *PhysicalIndexMergeJoin) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements PhysicalPlan interface.

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

func (p *PhysicalIndexMergeReader) ExtractCorrelatedCols() (corCols []*expression.CorrelatedColumn)

ExtractCorrelatedCols implements PhysicalPlan 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) Clone Uses

func (p *PhysicalIndexReader) Clone() (PhysicalPlan, error)

Clone implements PhysicalPlan interface.

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

func (p *PhysicalIndexReader) ExtractCorrelatedCols() (corCols []*expression.CorrelatedColumn)

ExtractCorrelatedCols implements PhysicalPlan 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

    NeedCommonHandle bool
    // contains filtered or unexported fields
}

PhysicalIndexScan represents an index scan plan.

func (*PhysicalIndexScan) AccessObject Uses

func (p *PhysicalIndexScan) AccessObject() string

AccessObject implements dataAccesser interface.

func (*PhysicalIndexScan) Clone Uses

func (p *PhysicalIndexScan) Clone() (PhysicalPlan, error)

Clone implements PhysicalPlan interface.

func (*PhysicalIndexScan) ExplainID Uses

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

ExplainID overrides the ExplainID in order to match different range.

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

func (p *PhysicalIndexScan) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements PhysicalPlan 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) OperatorInfo Uses

func (p *PhysicalIndexScan) OperatorInfo(normalized bool) string

OperatorInfo implements dataAccesser interface.

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

func (p *PhysicalLimit) Clone() (PhysicalPlan, error)

Clone implements PhysicalPlan 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) ExtractCorrelatedCols Uses

func (p *PhysicalLimit) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements PhysicalPlan 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][]HandleCols
    PartitionedTable []table.PartitionedTable
    // 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) Clone Uses

func (p *PhysicalLock) Clone() (PhysicalPlan, error)

Clone implements PhysicalPlan 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) ExtractCorrelatedCols Uses

func (p *PhysicalLock) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements PhysicalPlan 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) Clone Uses

func (p *PhysicalMaxOneRow) Clone() (PhysicalPlan, error)

Clone implements PhysicalPlan 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) ExtractCorrelatedCols Uses

func (p *PhysicalMaxOneRow) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements PhysicalPlan 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
    QueryTimeRange QueryTimeRange
    // contains filtered or unexported fields
}

PhysicalMemTable reads memory table.

func (*PhysicalMemTable) AccessObject Uses

func (p *PhysicalMemTable) AccessObject() string

AccessObject implements dataAccesser interface.

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

func (p *PhysicalMemTable) OperatorInfo(_ bool) string

OperatorInfo implements dataAccesser interface.

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

func (p *PhysicalMergeJoin) Clone() (PhysicalPlan, error)

Clone implements PhysicalPlan interface.

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

func (p *PhysicalMergeJoin) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements PhysicalPlan 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

    // ExtractCorrelatedCols extracts correlated columns inside the PhysicalPlan.
    ExtractCorrelatedCols() []*expression.CorrelatedColumn

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

    // Clone clones this physical plan.
    Clone() (PhysicalPlan, error)
    // contains filtered or unexported methods
}

PhysicalPlan is a tree of the physical operators.

func DoOptimize Uses

func DoOptimize(ctx context.Context, sctx sessionctx.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. So that All scalar functions in aggregation may speed up by vectorized evaluation in the `proj`. 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 []*util.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.

func TurnNominalSortIntoProj Uses

func TurnNominalSortIntoProj(p PhysicalPlan, onlyColumn bool, orderByItems []*util.ByItems) PhysicalPlan

TurnNominalSortIntoProj will turn nominal sort into two projections. This is to check if the scalar functions will overflow.

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

func (p *PhysicalProjection) Clone() (PhysicalPlan, error)

Clone implements PhysicalPlan interface.

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

func (p *PhysicalProjection) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements PhysicalPlan 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) Clone Uses

func (p *PhysicalSelection) Clone() (PhysicalPlan, error)

Clone implements PhysicalPlan 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) ExtractCorrelatedCols Uses

func (p *PhysicalSelection) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements PhysicalPlan 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) Clone Uses

func (p *PhysicalShuffle) Clone() (PhysicalPlan, error)

Clone implements PhysicalPlan 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) ExtractCorrelatedCols Uses

func (p *PhysicalShuffle) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements PhysicalPlan 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 []*util.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) Clone Uses

func (ls *PhysicalSort) Clone() (PhysicalPlan, error)

Clone implements PhysicalPlan 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) ExtractCorrelatedCols Uses

func (ls *PhysicalSort) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements PhysicalPlan interface.

func (*PhysicalSort) GetChildReqProps Uses

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

func (*PhysicalSort) GetCost Uses

func (p *PhysicalSort) GetCost(count float64, schema *expression.Schema) 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) Clone Uses

func (p *PhysicalStreamAgg) Clone() (PhysicalPlan, error)

Clone implements PhysicalPlan interface.

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

func (p *PhysicalStreamAgg) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements PhysicalPlan 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

    IsCommonHandle bool
    // contains filtered or unexported fields
}

PhysicalTableReader is the table reader in tidb.

func (*PhysicalTableReader) Clone Uses

func (p *PhysicalTableReader) Clone() (PhysicalPlan, error)

Clone implements PhysicalPlan interface.

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

func (p *PhysicalTableReader) ExtractCorrelatedCols() (corCols []*expression.CorrelatedColumn)

ExtractCorrelatedCols implements PhysicalPlan 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) AccessObject Uses

func (p *PhysicalTableScan) AccessObject() string

AccessObject implements dataAccesser interface.

func (*PhysicalTableScan) Clone Uses

func (ts *PhysicalTableScan) Clone() (PhysicalPlan, error)

Clone implements PhysicalPlan interface.

func (*PhysicalTableScan) ExplainID Uses

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

ExplainID overrides the ExplainID in order to match different range.

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

func (ts *PhysicalTableScan) ExtractCorrelatedCols() []*expression.CorrelatedColumn

ExtractCorrelatedCols implements PhysicalPlan 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) OperatorInfo Uses

func (p *PhysicalTableScan) OperatorInfo(normalized bool) string

OperatorInfo implements dataAccesser interface.

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

func (ts *PhysicalTableScan) SetIsChildOfIndexLookUp(isIsChildOfIndexLookUp bool)

SetIsChildOfIndexLookUp is to set the bool if is a child of IndexLookUpReader

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 []*util.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) Clone Uses

func (lt *PhysicalTopN) Clone() (PhysicalPlan, error)

Clone implements PhysicalPlan 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) ExtractCorrelatedCols Uses