Documentation ¶
Index ¶
- Constants
- Variables
- func ExprsHasSideEffects(exprs []expression.Expression) bool
- func HasMaxOneRow(p LogicalPlan, childMaxOneRow []bool) bool
- func InPrepare(p *preprocessor)
- func Preprocess(ctx sessionctx.Context, node ast.Node, preprocessOpt ...PreprocessOpt) error
- func TypeStringToPhysicalID(tp string) int
- type AggregateFuncExtractor
- type CommonHandleCols
- type DSToScans
- type EliminateOuterJoinBelowAggregation
- type EliminateOuterJoinBelowProjection
- type EliminateProjection
- type EliminateSingleMaxMin
- type Enforcer
- type ErrExprLoc
- type ExploreMark
- type ExprColumnMap
- type ExprIter
- type Group
- func (g *Group) BuildKeyInfo()
- func (g *Group) Delete(e *GroupExpr)
- func (g *Group) DeleteAll()
- func (g *Group) Exists(e *GroupExpr) bool
- func (g *Group) FingerPrint() string
- func (g *Group) GetFirstElem(operand Operand) *list.Element
- func (g *Group) GetImpl(prop *property.PhysicalProperty) Implementation
- func (g *Group) Insert(e *GroupExpr) bool
- func (g *Group) InsertImpl(prop *property.PhysicalProperty, impl Implementation)
- type GroupExpr
- type HandleCols
- type ImplHashAgg
- type ImplIndexScan
- type ImplLimit
- type ImplProjection
- type ImplSelection
- type ImplSort
- type ImplTableScan
- type ImplTopN
- type ImplTopNAsLimit
- type ImplUnionAll
- type Implementation
- type ImplementationRule
- type IndexScanImpl
- func (impl *IndexScanImpl) AttachChildren(children ...Implementation) Implementation
- func (impl *IndexScanImpl) CalcCost(outCount float64, children ...Implementation) float64
- func (impl *IndexScanImpl) GetCost() float64
- func (impl *IndexScanImpl) GetCostLimit(costLimit float64, children ...Implementation) float64
- func (impl *IndexScanImpl) GetPlan() PhysicalPlan
- func (impl *IndexScanImpl) ScaleCostLimit(costLimit float64) float64
- func (impl *IndexScanImpl) SetCost(cost float64)
- type InjectProjectionBelowAgg
- type InjectProjectionBelowTopN
- type IntHandleCols
- type JoinType
- type LimitImpl
- func (impl *LimitImpl) AttachChildren(children ...Implementation) Implementation
- func (impl *LimitImpl) CalcCost(outCount float64, children ...Implementation) float64
- func (impl *LimitImpl) GetCost() float64
- func (impl *LimitImpl) GetCostLimit(costLimit float64, children ...Implementation) float64
- func (impl *LimitImpl) GetPlan() PhysicalPlan
- func (impl *LimitImpl) ScaleCostLimit(costLimit float64) float64
- func (impl *LimitImpl) SetCost(cost float64)
- type LogicalAggregation
- func (la *LogicalAggregation) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
- func (la *LogicalAggregation) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, ...) (*property.StatsInfo, error)
- func (la *LogicalAggregation) ExtractColGroups(_ [][]*expression.Column) [][]*expression.Column
- func (la *LogicalAggregation) GetGroupByCols() []*expression.Column
- func (la *LogicalAggregation) GetUsedCols() (usedCols []*expression.Column)
- func (la *LogicalAggregation) HasDistinct() bool
- func (la LogicalAggregation) Init(ctx sessionctx.Context, offset int) *LogicalAggregation
- func (la *LogicalAggregation) IsCompleteModeAgg() bool
- func (la *LogicalAggregation) IsPartialModeAgg() bool
- func (s *LogicalAggregation) OutputNames() types.NameSlice
- func (la *LogicalAggregation) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column
- func (la *LogicalAggregation) PruneColumns(parentUsedCols []*expression.Column) error
- func (s *LogicalAggregation) Schema() *expression.Schema
- func (s *LogicalAggregation) SetOutputNames(names types.NameSlice)
- func (s *LogicalAggregation) SetSchema(schema *expression.Schema)
- func (p *LogicalAggregation) String() string
- type LogicalDataSource
- func (ds *LogicalDataSource) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
- func (ds *LogicalDataSource) Convert2Scans() (scans []LogicalPlan)
- func (ds *LogicalDataSource) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, ...) (*property.StatsInfo, error)
- func (ds LogicalDataSource) Init(ctx sessionctx.Context, offset int) *LogicalDataSource
- func (s *LogicalDataSource) OutputNames() types.NameSlice
- func (ds *LogicalDataSource) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column
- func (ds *LogicalDataSource) PruneColumns(parentUsedCols []*expression.Column) error
- func (s *LogicalDataSource) Schema() *expression.Schema
- func (s *LogicalDataSource) SetOutputNames(names types.NameSlice)
- func (s *LogicalDataSource) SetSchema(schema *expression.Schema)
- func (p *LogicalDataSource) String() string
- func (ds *LogicalDataSource) TableInfo() *model.TableInfo
- type LogicalIndexScan
- func (is *LogicalIndexScan) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
- func (is *LogicalIndexScan) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, ...) (*property.StatsInfo, error)
- func (s *LogicalIndexScan) GetPhysicalIndexScan(schema *expression.Schema, stats *property.StatsInfo) *PhysicalIndexScan
- func (is LogicalIndexScan) Init(ctx sessionctx.Context, offset int) *LogicalIndexScan
- func (p *LogicalIndexScan) MatchIndexProp(prop *property.PhysicalProperty) (match bool)
- func (s *LogicalIndexScan) OutputNames() types.NameSlice
- func (is *LogicalIndexScan) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column
- func (s *LogicalIndexScan) Schema() *expression.Schema
- func (s *LogicalIndexScan) SetOutputNames(names types.NameSlice)
- func (s *LogicalIndexScan) SetSchema(schema *expression.Schema)
- func (p *LogicalIndexScan) String() string
- type LogicalJoin
- func (p *LogicalJoin) AppendJoinConds(eq []*expression.ScalarFunction, left, right, other []expression.Expression)
- func (p *LogicalJoin) AttachOnConds(onConds []expression.Expression)
- func (p *LogicalJoin) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
- func (p *LogicalJoin) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, ...) (*property.StatsInfo, error)
- func (p *LogicalJoin) ExtractColGroups(colGroups [][]*expression.Column) [][]*expression.Column
- func (p *LogicalJoin) ExtractJoinKeys(childIdx int) *expression.Schema
- func (p *LogicalJoin) ExtractOnCondition(conditions []expression.Expression, leftSchema *expression.Schema, ...) (eqCond []*expression.ScalarFunction, leftCond []expression.Expression, ...)
- func (p *LogicalJoin) GetJoinKeys() (leftKeys, rightKeys []*expression.Column, isNullEQ []bool, hasNullEQ bool)
- func (p LogicalJoin) Init(ctx sessionctx.Context, offset int) *LogicalJoin
- func (s *LogicalJoin) OutputNames() types.NameSlice
- func (p *LogicalJoin) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column
- func (p *LogicalJoin) PruneColumns(parentUsedCols []*expression.Column) error
- func (s *LogicalJoin) Schema() *expression.Schema
- func (s *LogicalJoin) SetOutputNames(names types.NameSlice)
- func (s *LogicalJoin) SetSchema(schema *expression.Schema)
- func (p *LogicalJoin) Shallow() *LogicalJoin
- func (p *LogicalJoin) String() string
- type LogicalLimit
- func (p *LogicalLimit) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
- func (p *LogicalLimit) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, ...) (*property.StatsInfo, error)
- func (p *LogicalLimit) HashCode() []byte
- func (p LogicalLimit) Init(ctx sessionctx.Context, offset int) *LogicalLimit
- func (s *LogicalLimit) OutputNames() types.NameSlice
- func (p *LogicalLimit) PruneColumns(parentUsedCols []*expression.Column) error
- func (s *LogicalLimit) Schema() *expression.Schema
- func (s *LogicalLimit) SetOutputNames(names types.NameSlice)
- func (s *LogicalLimit) SetSchema(schema *expression.Schema)
- func (p *LogicalLimit) String() string
- type LogicalPlan
- type LogicalProjection
- func (p *LogicalProjection) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
- func (p *LogicalProjection) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, ...) (*property.StatsInfo, error)
- func (p *LogicalProjection) ExtractColGroups(colGroups [][]*expression.Column) [][]*expression.Column
- func (p *LogicalProjection) GetUsedCols() (usedCols []*expression.Column)
- func (p *LogicalProjection) HashCode() []byte
- func (p LogicalProjection) Init(ctx sessionctx.Context, offset int) *LogicalProjection
- func (s *LogicalProjection) OutputNames() types.NameSlice
- func (p *LogicalProjection) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column
- func (p *LogicalProjection) PruneColumns(parentUsedCols []*expression.Column) error
- func (s *LogicalProjection) Schema() *expression.Schema
- func (s *LogicalProjection) SetOutputNames(names types.NameSlice)
- func (s *LogicalProjection) SetSchema(schema *expression.Schema)
- func (p *LogicalProjection) String() string
- func (p *LogicalProjection) TryToGetChildProp(prop *property.PhysicalProperty) (*property.PhysicalProperty, bool)
- type LogicalSelection
- func (p *LogicalSelection) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
- func (p *LogicalSelection) Children() []LogicalPlan
- func (p *LogicalSelection) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, ...) (*property.StatsInfo, error)
- func (p *LogicalSelection) Dump() string
- func (p *LogicalSelection) ExtractColGroups(_ [][]*expression.Column) [][]*expression.Column
- func (p *LogicalSelection) HashCode() []byte
- func (p LogicalSelection) Init(ctx sessionctx.Context, offset int) *LogicalSelection
- func (p *LogicalSelection) MaxOneRow() bool
- func (p *LogicalSelection) OutputNames() types.NameSlice
- func (p *LogicalSelection) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column
- func (p *LogicalSelection) PruneColumns(parentUsedCols []*expression.Column) error
- func (p *LogicalSelection) Schema() *expression.Schema
- func (p *LogicalSelection) SetChild(i int, child LogicalPlan)
- func (p *LogicalSelection) SetChildren(children ...LogicalPlan)
- func (p *LogicalSelection) SetOutputNames(names types.NameSlice)
- func (p *LogicalSelection) String() string
- type LogicalSort
- func (p *LogicalSort) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
- func (p *LogicalSort) Children() []LogicalPlan
- func (p *LogicalSort) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, ...) (*property.StatsInfo, error)
- func (p *LogicalSort) Dump() string
- func (p *LogicalSort) ExtractColGroups(_ [][]*expression.Column) [][]*expression.Column
- func (p *LogicalSort) HashCode() []byte
- func (ls LogicalSort) Init(ctx sessionctx.Context, offset int) *LogicalSort
- func (p *LogicalSort) MaxOneRow() bool
- func (p *LogicalSort) OutputNames() types.NameSlice
- func (p *LogicalSort) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column
- func (ls *LogicalSort) PruneColumns(parentUsedCols []*expression.Column) error
- func (p *LogicalSort) Schema() *expression.Schema
- func (p *LogicalSort) SetChild(i int, child LogicalPlan)
- func (p *LogicalSort) SetChildren(children ...LogicalPlan)
- func (p *LogicalSort) SetOutputNames(names types.NameSlice)
- func (p *LogicalSort) String() string
- type LogicalTableDual
- func (p *LogicalTableDual) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
- func (p *LogicalTableDual) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, ...) (*property.StatsInfo, error)
- func (p *LogicalTableDual) HashCode() []byte
- func (p LogicalTableDual) Init(ctx sessionctx.Context, offset int) *LogicalTableDual
- func (s *LogicalTableDual) OutputNames() types.NameSlice
- func (p *LogicalTableDual) PruneColumns(parentUsedCols []*expression.Column) error
- func (s *LogicalTableDual) Schema() *expression.Schema
- func (s *LogicalTableDual) SetOutputNames(names types.NameSlice)
- func (s *LogicalTableDual) SetSchema(schema *expression.Schema)
- func (p *LogicalTableDual) String() string
- type LogicalTableScan
- func (ts *LogicalTableScan) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
- func (ts *LogicalTableScan) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, ...) (_ *property.StatsInfo, err error)
- func (s *LogicalTableScan) GetPhysicalScan(schema *expression.Schema, stats *property.StatsInfo) *PhysicalTableScan
- func (ts LogicalTableScan) Init(ctx sessionctx.Context, offset int) *LogicalTableScan
- func (s *LogicalTableScan) OutputNames() types.NameSlice
- func (ts *LogicalTableScan) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column
- func (s *LogicalTableScan) Schema() *expression.Schema
- func (s *LogicalTableScan) SetOutputNames(names types.NameSlice)
- func (s *LogicalTableScan) SetSchema(schema *expression.Schema)
- func (p *LogicalTableScan) String() string
- type LogicalTopN
- func (p *LogicalTopN) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
- func (p *LogicalTopN) Children() []LogicalPlan
- func (lt *LogicalTopN) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, ...) (*property.StatsInfo, error)
- func (p *LogicalTopN) Dump() string
- func (p *LogicalTopN) ExtractColGroups(_ [][]*expression.Column) [][]*expression.Column
- func (p *LogicalTopN) HashCode() []byte
- func (lt LogicalTopN) Init(ctx sessionctx.Context, offset int) *LogicalTopN
- func (p *LogicalTopN) MaxOneRow() bool
- func (p *LogicalTopN) OutputNames() types.NameSlice
- func (p *LogicalTopN) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column
- func (lt *LogicalTopN) PruneColumns(parentUsedCols []*expression.Column) error
- func (p *LogicalTopN) Schema() *expression.Schema
- func (p *LogicalTopN) SetChild(i int, child LogicalPlan)
- func (p *LogicalTopN) SetChildren(children ...LogicalPlan)
- func (p *LogicalTopN) SetOutputNames(names types.NameSlice)
- func (p *LogicalTopN) String() string
- type LogicalUnionAll
- func (p *LogicalUnionAll) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
- func (p *LogicalUnionAll) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, ...) (*property.StatsInfo, error)
- func (p LogicalUnionAll) Init(ctx sessionctx.Context, offset int) *LogicalUnionAll
- func (s *LogicalUnionAll) OutputNames() types.NameSlice
- func (p *LogicalUnionAll) PruneColumns(parentUsedCols []*expression.Column) error
- func (s *LogicalUnionAll) Schema() *expression.Schema
- func (s *LogicalUnionAll) SetOutputNames(names types.NameSlice)
- func (s *LogicalUnionAll) SetSchema(schema *expression.Schema)
- func (p *LogicalUnionAll) String() string
- type MergeAdjacentLimit
- type MergeAdjacentProjection
- type MergeAdjacentSelection
- type MergeAdjacentTopN
- type MergeAggregationProjection
- type NominalSort
- func (p *NominalSort) Children() []PhysicalPlan
- func (p *NominalSort) Cost() float64
- func (p *NominalSort) GetChildReqProps(idx int) *property.PhysicalProperty
- func (p NominalSort) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, ...) *NominalSort
- func (p *NominalSort) ResolveIndices() (err error)
- func (p *NominalSort) Schema() *expression.Schema
- func (p *NominalSort) SetChild(i int, child PhysicalPlan)
- func (p *NominalSort) SetChildren(children ...PhysicalPlan)
- func (p *NominalSort) SetCost(cost float64)
- func (p *NominalSort) StatsCount() float64
- type NominalSortImpl
- func (impl *NominalSortImpl) AttachChildren(children ...Implementation) Implementation
- func (impl *NominalSortImpl) CalcCost(outCount float64, children ...Implementation) float64
- func (impl *NominalSortImpl) GetCost() float64
- func (impl *NominalSortImpl) GetCostLimit(costLimit float64, children ...Implementation) float64
- func (impl *NominalSortImpl) GetPlan() PhysicalPlan
- func (impl *NominalSortImpl) ScaleCostLimit(costLimit float64) float64
- func (impl *NominalSortImpl) SetCost(cost float64)
- type Operand
- type Optimizer
- func (opt *Optimizer) FindBestPlan(sctx sessionctx.Context, logical LogicalPlan) (p PhysicalPlan, cost float64, err error)
- func (opt *Optimizer) GetImplementationRules(node LogicalPlan) []ImplementationRule
- func (opt *Optimizer) ResetImplementationRules(rules map[Operand][]ImplementationRule) *Optimizer
- func (opt *Optimizer) ResetTransformationRules(ruleBatches ...TransformationRuleBatch) *Optimizer
- type OrderEnforcer
- type Pattern
- type PhysicalHashAgg
- type PhysicalIndexScan
- type PhysicalLimit
- type PhysicalPlan
- type PhysicalProjection
- func (p *PhysicalProjection) GetCost(count float64) float64
- func (p PhysicalProjection) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, ...) *PhysicalProjection
- func (p *PhysicalProjection) ResolveIndices() (err error)
- func (s *PhysicalProjection) Schema() *expression.Schema
- func (s *PhysicalProjection) SetSchema(schema *expression.Schema)
- type PhysicalSelection
- func (p *PhysicalSelection) Children() []PhysicalPlan
- func (p *PhysicalSelection) Cost() float64
- func (p *PhysicalSelection) GetChildReqProps(idx int) *property.PhysicalProperty
- func (p PhysicalSelection) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, ...) *PhysicalSelection
- func (p *PhysicalSelection) ResolveIndices() (err error)
- func (p *PhysicalSelection) Schema() *expression.Schema
- func (p *PhysicalSelection) SetChild(i int, child PhysicalPlan)
- func (p *PhysicalSelection) SetChildren(children ...PhysicalPlan)
- func (p *PhysicalSelection) SetCost(cost float64)
- func (p *PhysicalSelection) StatsCount() float64
- type PhysicalSort
- func (p *PhysicalSort) Children() []PhysicalPlan
- func (p *PhysicalSort) Cost() float64
- func (p *PhysicalSort) GetChildReqProps(idx int) *property.PhysicalProperty
- func (p *PhysicalSort) GetCost(count float64, schema *expression.Schema) float64
- func (p PhysicalSort) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, ...) *PhysicalSort
- func (p *PhysicalSort) ResolveIndices() (err error)
- func (p *PhysicalSort) Schema() *expression.Schema
- func (p *PhysicalSort) SetChild(i int, child PhysicalPlan)
- func (p *PhysicalSort) SetChildren(children ...PhysicalPlan)
- func (p *PhysicalSort) SetCost(cost float64)
- func (p *PhysicalSort) StatsCount() float64
- type PhysicalTableDual
- func (p PhysicalTableDual) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int) *PhysicalTableDual
- func (p *PhysicalTableDual) OutputNames() types.NameSlice
- func (p *PhysicalTableDual) ResolveIndices() (err error)
- func (s *PhysicalTableDual) Schema() *expression.Schema
- func (p *PhysicalTableDual) SetOutputNames(names types.NameSlice)
- func (s *PhysicalTableDual) SetSchema(schema *expression.Schema)
- type PhysicalTableScan
- type PhysicalTopN
- func (p *PhysicalTopN) Children() []PhysicalPlan
- func (p *PhysicalTopN) Cost() float64
- func (p *PhysicalTopN) GetChildReqProps(idx int) *property.PhysicalProperty
- func (p *PhysicalTopN) GetCost(count float64, isRoot bool) float64
- func (p PhysicalTopN) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, ...) *PhysicalTopN
- func (p *PhysicalTopN) ResolveIndices() (err error)
- func (p *PhysicalTopN) Schema() *expression.Schema
- func (p *PhysicalTopN) SetChild(i int, child PhysicalPlan)
- func (p *PhysicalTopN) SetChildren(children ...PhysicalPlan)
- func (p *PhysicalTopN) SetCost(cost float64)
- func (p *PhysicalTopN) StatsCount() float64
- type PhysicalUnionAll
- type PhysicalUnionScan
- func (p *PhysicalUnionScan) Children() []PhysicalPlan
- func (p *PhysicalUnionScan) Cost() float64
- func (p *PhysicalUnionScan) GetChildReqProps(idx int) *property.PhysicalProperty
- func (p PhysicalUnionScan) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, ...) *PhysicalUnionScan
- func (p *PhysicalUnionScan) ResolveIndices() (err error)
- func (p *PhysicalUnionScan) Schema() *expression.Schema
- func (p *PhysicalUnionScan) SetChild(i int, child PhysicalPlan)
- func (p *PhysicalUnionScan) SetChildren(children ...PhysicalPlan)
- func (p *PhysicalUnionScan) SetCost(cost float64)
- func (p *PhysicalUnionScan) StatsCount() float64
- type Plan
- type PlanBuilder
- type PreprocessOpt
- type PreprocessorReturn
- type ProjectionImpl
- func (impl *ProjectionImpl) AttachChildren(children ...Implementation) Implementation
- func (impl *ProjectionImpl) CalcCost(outCount float64, children ...Implementation) float64
- func (impl *ProjectionImpl) GetCost() float64
- func (impl *ProjectionImpl) GetCostLimit(costLimit float64, children ...Implementation) float64
- func (impl *ProjectionImpl) GetPlan() PhysicalPlan
- func (impl *ProjectionImpl) ScaleCostLimit(costLimit float64) float64
- func (impl *ProjectionImpl) SetCost(cost float64)
- type PushLimitDownOuterJoin
- type PushLimitDownProjection
- type PushLimitDownUnionAll
- type PushSelDownAggregation
- type PushSelDownIndexScan
- type PushSelDownJoin
- type PushSelDownProjection
- type PushSelDownSort
- type PushSelDownTableScan
- type PushSelDownUnionAll
- type PushTopNDownOuterJoin
- type PushTopNDownProjection
- type PushTopNDownUnionAll
- type SortImpl
- func (impl *SortImpl) AttachChildren(children ...Implementation) Implementation
- func (impl *SortImpl) CalcCost(outCount float64, children ...Implementation) float64
- func (impl *SortImpl) GetCost() float64
- func (impl *SortImpl) GetCostLimit(costLimit float64, children ...Implementation) float64
- func (impl *SortImpl) GetPlan() PhysicalPlan
- func (impl *SortImpl) ScaleCostLimit(costLimit float64) float64
- func (impl *SortImpl) SetCost(cost float64)
- type TableScanImpl
- func (impl *TableScanImpl) AttachChildren(children ...Implementation) Implementation
- func (impl *TableScanImpl) CalcCost(outCount float64, children ...Implementation) float64
- func (impl *TableScanImpl) GetCost() float64
- func (impl *TableScanImpl) GetCostLimit(costLimit float64, children ...Implementation) float64
- func (impl *TableScanImpl) GetPlan() PhysicalPlan
- func (impl *TableScanImpl) ScaleCostLimit(costLimit float64) float64
- func (impl *TableScanImpl) SetCost(cost float64)
- type TblColPosInfo
- type TblColPosInfoSlice
- type TiDBHashAggImpl
- func (agg *TiDBHashAggImpl) AttachChildren(children ...Implementation) Implementation
- func (agg *TiDBHashAggImpl) CalcCost(outCount float64, children ...Implementation) float64
- func (impl *TiDBHashAggImpl) GetCost() float64
- func (impl *TiDBHashAggImpl) GetCostLimit(costLimit float64, children ...Implementation) float64
- func (impl *TiDBHashAggImpl) GetPlan() PhysicalPlan
- func (impl *TiDBHashAggImpl) ScaleCostLimit(costLimit float64) float64
- func (impl *TiDBHashAggImpl) SetCost(cost float64)
- type TiDBSelectionImpl
- func (impl *TiDBSelectionImpl) AttachChildren(children ...Implementation) Implementation
- func (sel *TiDBSelectionImpl) CalcCost(outCount float64, children ...Implementation) float64
- func (impl *TiDBSelectionImpl) GetCost() float64
- func (impl *TiDBSelectionImpl) GetCostLimit(costLimit float64, children ...Implementation) float64
- func (impl *TiDBSelectionImpl) GetPlan() PhysicalPlan
- func (impl *TiDBSelectionImpl) ScaleCostLimit(costLimit float64) float64
- func (impl *TiDBSelectionImpl) SetCost(cost float64)
- type TiDBTopNImpl
- func (impl *TiDBTopNImpl) AttachChildren(children ...Implementation) Implementation
- func (impl *TiDBTopNImpl) CalcCost(outCount float64, children ...Implementation) float64
- func (impl *TiDBTopNImpl) GetCost() float64
- func (impl *TiDBTopNImpl) GetCostLimit(costLimit float64, children ...Implementation) float64
- func (impl *TiDBTopNImpl) GetPlan() PhysicalPlan
- func (impl *TiDBTopNImpl) ScaleCostLimit(costLimit float64) float64
- func (impl *TiDBTopNImpl) SetCost(cost float64)
- type TransformAggToProj
- type TransformAggregateCaseToSelection
- type TransformJoinCondToSel
- type TransformLimitToTableDual
- type TransformLimitToTopN
- type Transformation
- func NewRuleDSToScans() Transformation
- func NewRuleEliminateOuterJoinBelowAggregation() Transformation
- func NewRuleEliminateOuterJoinBelowProjection() Transformation
- func NewRuleEliminateProjection() Transformation
- func NewRuleEliminateSingleMaxMin() Transformation
- func NewRuleInjectProjectionBelowAgg() Transformation
- func NewRuleInjectProjectionBelowTopN() Transformation
- func NewRuleMergeAdjacentLimit() Transformation
- func NewRuleMergeAdjacentProjection() Transformation
- func NewRuleMergeAdjacentSelection() Transformation
- func NewRuleMergeAdjacentTopN() Transformation
- func NewRuleMergeAggregationProjection() Transformation
- func NewRulePushLimitDownOuterJoin() Transformation
- func NewRulePushLimitDownProjection() Transformation
- func NewRulePushLimitDownUnionAll() Transformation
- func NewRulePushSelDownAggregation() Transformation
- func NewRulePushSelDownIndexScan() Transformation
- func NewRulePushSelDownJoin() Transformation
- func NewRulePushSelDownProjection() Transformation
- func NewRulePushSelDownSort() Transformation
- func NewRulePushSelDownTableScan() Transformation
- func NewRulePushSelDownUnionAll() Transformation
- func NewRulePushTopNDownOuterJoin() Transformation
- func NewRulePushTopNDownProjection() Transformation
- func NewRulePushTopNDownUnionAll() Transformation
- func NewRuleTransformAggToProj() Transformation
- func NewRuleTransformAggregateCaseToSelection() Transformation
- func NewRuleTransformJoinCondToSel() Transformation
- func NewRuleTransformLimitToTableDual() Transformation
- func NewRuleTransformLimitToTopN() Transformation
- type TransformationRuleBatch
- type UnionAllImpl
- func (impl *UnionAllImpl) AttachChildren(children ...Implementation) Implementation
- func (impl *UnionAllImpl) CalcCost(outCount float64, children ...Implementation) float64
- func (impl *UnionAllImpl) GetCost() float64
- func (impl *UnionAllImpl) GetCostLimit(costLimit float64, children ...Implementation) float64
- func (impl *UnionAllImpl) GetPlan() PhysicalPlan
- func (impl *UnionAllImpl) ScaleCostLimit(costLimit float64) float64
- func (impl *UnionAllImpl) SetCost(cost float64)
Constants ¶
const ( // TypeSel is the type of Selection. TypeSel = "Selection" // TypeSet is the type of Set. TypeSet = "Set" // TypeProj is the type of Projection. TypeProj = "Projection" // TypeAgg is the type of Aggregation. TypeAgg = "Aggregation" // TypeHashAgg is the type of HashAgg. TypeHashAgg = "HashAgg" // TypeJoin is the type of Join. TypeJoin = "Join" // TypeUnion is the type of Union. TypeUnion = "Union" // TypeTableScan is the type of TableScan. TypeTableScan = "TableScan" // TypeUnionScan is the type of UnionScan. TypeUnionScan = "UnionScan" // TypeIdxScan is the type of IndexScan. TypeIdxScan = "IndexScan" // TypeSort is the type of Sort. TypeSort = "Sort" // TypeTopN is the type of TopN. TypeTopN = "TopN" // TypeLimit is the type of Limit. TypeLimit = "Limit" // TypeHashJoin is the type of hash join. TypeHashJoin = "HashJoin" // TypeMergeJoin is the type of merge join. TypeMergeJoin = "MergeJoin" // TypeIndexJoin is the type of index look up join. TypeIndexJoin = "IndexJoin" // TypeIndexMergeJoin is the type of index look up merge join. TypeIndexMergeJoin = "IndexMergeJoin" // TypeIndexHashJoin is the type of index nested loop hash join. TypeIndexHashJoin = "IndexHashJoin" // TypeMaxOneRow is the type of MaxOneRow. TypeMaxOneRow = "MaxOneRow" // TypeExists is the type of Exists. TypeExists = "Exists" // TypeDual is the type of TableDual. TypeDual = "TableDual" // TypeTableReader is the type of TableReader. TypeTableReader = "TableReader" // TypeIndexReader is the type of IndexReader. TypeIndexReader = "IndexReader" // TypeIndexMerge is the type of IndexMergeReader TypeIndexMerge = "IndexMerge" // TypePointGet is the type of PointGetPlan. TypePointGet = "Point_Get" // TypeDataSource is the type of DataSource. TypeDataSource = "DataSource" // TypeTableFullScan is the type of TableFullScan. TypeTableFullScan = "TableFullScan" // TypeTableRangeScan is the type of TableRangeScan. TypeTableRangeScan = "TableRangeScan" // TypeTableRowIDScan is the type of TableRowIDScan. TypeTableRowIDScan = "TableRowIDScan" // TypeIndexFullScan is the type of IndexFullScan. TypeIndexFullScan = "IndexFullScan" // TypeIndexRangeScan is the type of IndexRangeScan. TypeIndexRangeScan = "IndexRangeScan" )
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 ( // TypeInvalid for unexpected types. TypeInvalid byte = iota // TypeSelect for SelectStmt. TypeSelect )
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 Batch1 = TransformationRuleBatch{ OperandSelection: { NewRulePushSelDownSort(), NewRulePushSelDownProjection(), NewRulePushSelDownAggregation(), NewRulePushSelDownJoin(), NewRulePushSelDownUnionAll(), NewRuleMergeAdjacentSelection(), }, OperandAggregation: { NewRuleMergeAggregationProjection(), NewRuleEliminateSingleMaxMin(), NewRuleEliminateOuterJoinBelowAggregation(), NewRuleTransformAggregateCaseToSelection(), NewRuleTransformAggToProj(), }, OperandLimit: { NewRuleTransformLimitToTopN(), NewRulePushLimitDownProjection(), NewRulePushLimitDownUnionAll(), NewRulePushLimitDownOuterJoin(), NewRuleMergeAdjacentLimit(), NewRuleTransformLimitToTableDual(), }, OperandProjection: { NewRuleEliminateProjection(), NewRuleMergeAdjacentProjection(), NewRuleEliminateOuterJoinBelowProjection(), }, OperandTopN: { NewRulePushTopNDownProjection(), NewRulePushTopNDownOuterJoin(), NewRulePushTopNDownUnionAll(), NewRuleMergeAdjacentTopN(), }, OperandJoin: { NewRuleTransformJoinCondToSel(), }, }
var Batch2 = TransformationRuleBatch{ OperandDataSource: { NewRuleDSToScans(), }, OperandSelection: { NewRulePushSelDownTableScan(), NewRulePushSelDownIndexScan(), NewRuleMergeAdjacentSelection(), }, }
var PostTransformationBatch = TransformationRuleBatch{ OperandProjection: { NewRuleEliminateProjection(), NewRuleMergeAdjacentProjection(), }, OperandAggregation: { NewRuleInjectProjectionBelowAgg(), }, OperandTopN: { NewRuleInjectProjectionBelowTopN(), }, }
PostTransformationBatch does the transformation which is related to the constraints of the execution engine of TiDB. For example, TopN/Sort only support `order by` columns in TiDB layer, as for scalar functions, we need to inject a Projection for them below the TopN/Sort.
var PullQueryBatch = []TransformationRuleBatch{ Batch1, Batch2, PostTransformationBatch, }
var PushQueryBatch = []TransformationRuleBatch{ Batch1, PushQueryBatch2, PostTransformationBatch, }
var PushQueryBatch2 = TransformationRuleBatch{ OperandDataSource: { NewRuleDSToScans(), }, OperandSelection: { NewRuleMergeAdjacentSelection(), }, }
Functions ¶
func ExprsHasSideEffects ¶
func ExprsHasSideEffects(exprs []expression.Expression) bool
ExprsHasSideEffects checks if any of the expressions has side effects.
func HasMaxOneRow ¶
func HasMaxOneRow(p LogicalPlan, childMaxOneRow []bool) bool
HasMaxOneRow returns if the LogicalPlan will output at most one row.
func InPrepare ¶
func InPrepare(p *preprocessor)
InPrepare is a PreprocessOpt that indicates preprocess is executing under prepare statement.
func Preprocess ¶
func Preprocess(ctx sessionctx.Context, node ast.Node, preprocessOpt ...PreprocessOpt) error
Preprocess resolves table names of the node, and checks some statements validation. preprocessReturn used to extract the infoschema for the tableName and the timestamp from the asof clause.
func TypeStringToPhysicalID ¶
TypeStringToPhysicalID converts the plan type string to plan id.
Types ¶
type AggregateFuncExtractor ¶
type AggregateFuncExtractor struct { // AggFuncs is the collected AggregateFuncExprs. AggFuncs []*ast.AggregateFuncExpr // contains filtered or unexported fields }
AggregateFuncExtractor visits Expr tree. It collects AggregateFuncExpr from AST Node.
type CommonHandleCols ¶
type CommonHandleCols struct {
// contains filtered or unexported fields
}
CommonHandleCols implements the kv.HandleCols interface.
func NewCommonHandleCols ¶
func NewCommonHandleCols(sc *stmtctx.StatementContext, tblInfo *model.TableInfo, idxInfo *model.IndexInfo, tableColumns []*expression.Column) *CommonHandleCols
NewCommonHandleCols creates a new CommonHandleCols.
func (*CommonHandleCols) GetCol ¶
func (cb *CommonHandleCols) GetCol(idx int) *expression.Column
GetCol implements the kv.HandleCols interface.
func (*CommonHandleCols) IsInt ¶
func (cb *CommonHandleCols) IsInt() bool
IsInt implements the kv.HandleCols interface.
func (*CommonHandleCols) NumCols ¶
func (cb *CommonHandleCols) NumCols() int
NumCols implements the kv.HandleCols interface.
func (*CommonHandleCols) ResolveIndices ¶
func (cb *CommonHandleCols) ResolveIndices(schema *expression.Schema) (HandleCols, error)
ResolveIndices implements the kv.HandleCols interface.
func (*CommonHandleCols) String ¶
func (cb *CommonHandleCols) String() string
String implements the kv.HandleCols interface.
type DSToScans ¶
type DSToScans struct {
// contains filtered or unexported fields
}
func (*DSToScans) GetPattern ¶
func (r *DSToScans) GetPattern() *Pattern
GetPattern implements Transformation Interface.
type EliminateOuterJoinBelowAggregation ¶
type EliminateOuterJoinBelowAggregation struct {
// contains filtered or unexported fields
}
EliminateOuterJoinBelowAggregation eliminate the outer join which below aggregation.
func (*EliminateOuterJoinBelowAggregation) GetPattern ¶
func (r *EliminateOuterJoinBelowAggregation) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*EliminateOuterJoinBelowAggregation) Match ¶
func (r *EliminateOuterJoinBelowAggregation) Match(expr *ExprIter) bool
Match implements Transformation interface.
func (*EliminateOuterJoinBelowAggregation) OnTransform ¶
func (r *EliminateOuterJoinBelowAggregation) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. This rule tries to eliminate outer join which below aggregation.
type EliminateOuterJoinBelowProjection ¶
type EliminateOuterJoinBelowProjection struct {
// contains filtered or unexported fields
}
EliminateOuterJoinBelowProjection eliminate the outer join which below projection.
func (*EliminateOuterJoinBelowProjection) GetPattern ¶
func (r *EliminateOuterJoinBelowProjection) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*EliminateOuterJoinBelowProjection) Match ¶
func (r *EliminateOuterJoinBelowProjection) Match(expr *ExprIter) bool
Match implements Transformation interface.
func (*EliminateOuterJoinBelowProjection) OnTransform ¶
func (r *EliminateOuterJoinBelowProjection) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. This rule tries to eliminate outer join which below projection.
type EliminateProjection ¶
type EliminateProjection struct {
// contains filtered or unexported fields
}
EliminateProjection eliminates the projection.
func (*EliminateProjection) GetPattern ¶
func (r *EliminateProjection) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*EliminateProjection) OnTransform ¶
func (r *EliminateProjection) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. This rule tries to eliminate the projection whose output columns are the same with its child.
type EliminateSingleMaxMin ¶
type EliminateSingleMaxMin struct {
// contains filtered or unexported fields
}
EliminateSingleMaxMin tries to convert a single max/min to Limit+Sort operators.
func (*EliminateSingleMaxMin) GetPattern ¶
func (r *EliminateSingleMaxMin) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*EliminateSingleMaxMin) Match ¶
func (r *EliminateSingleMaxMin) Match(expr *ExprIter) bool
Match implements Transformation interface.
func (*EliminateSingleMaxMin) OnTransform ¶
func (r *EliminateSingleMaxMin) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. It will transform `max/min->X` to `max/min->top1->sel->X`.
type Enforcer ¶
type Enforcer interface { // NewProperty generates relaxed property with the help of enforcer. NewProperty(prop *property.PhysicalProperty) (newProp *property.PhysicalProperty) // OnEnforce adds physical operators on top of child implementation to satisfy // required physical property. OnEnforce(reqProp *property.PhysicalProperty, child Implementation) (impl Implementation) // GetEnforceCost calculates cost of enforcing required physical property. GetEnforceCost(g *Group) float64 }
Enforcer defines the interface for enforcer rules.
func GetEnforcerRules ¶
func GetEnforcerRules(g *Group, prop *property.PhysicalProperty) (enforcers []Enforcer)
GetEnforcerRules gets all candidate enforcer rules based on required physical property.
type ErrExprLoc ¶
ErrExprLoc is for generate the ErrFieldNotInGroupBy error info
type ExploreMark ¶
type ExploreMark int
ExploreMark is uses to mark whether a Group or GroupExpr has been fully explored by a transformation rule batch.
func (*ExploreMark) Explored ¶
func (m *ExploreMark) Explored(round int) bool
Explored returns whether the roundth bit has been set.
func (*ExploreMark) SetExplored ¶
func (m *ExploreMark) SetExplored(round int)
SetExplored sets the roundth bit.
func (*ExploreMark) SetUnexplored ¶
func (m *ExploreMark) SetUnexplored(round int)
SetUnexplored unsets the roundth bit.
type ExprColumnMap ¶
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 ExprIter ¶
type ExprIter struct { // Group and Element solely identify a Group expression. *Group *list.Element // Pattern describes the node of pattern tree. // The Operand type of the Group expression and the EngineType of the Group // must be matched with it. *Pattern // Children is used to iterate the child expressions. Children []*ExprIter // contains filtered or unexported fields }
ExprIter enumerates all the equivalent expressions in the Group according to the expression pattern.
func NewExprIterFromGroupElem ¶
NewExprIterFromGroupElem creates the iterator on the Group Element.
func (*ExprIter) Matched ¶
Matched returns whether the iterator founds a Group expression matches the pattern.
type Group ¶
type Group struct { Equivalents *list.List FirstExpr map[Operand]*list.Element Fingerprints map[string]*list.Element ImplMap map[string]Implementation Prop *property.LogicalProperty SelfFingerprint string // ExploreMark is uses to mark whether this Group has been explored // by a transformation rule batch in a certain round. ExploreMark // contains filtered or unexported fields }
Group is short for expression Group, which is used to store all the logically equivalent expressions. It's a set of GroupExpr.
func Convert2Group ¶
func Convert2Group(node LogicalPlan) *Group
Convert2Group converts a logical plan to a Group.
func NewGroupWithSchema ¶
func NewGroupWithSchema(e *GroupExpr, s *expression.Schema) *Group
NewGroupWithSchema creates a new Group with given schema.
func (*Group) BuildKeyInfo ¶
func (g *Group) BuildKeyInfo()
BuildKeyInfo recursively builds UniqueKey and MaxOneRow info in the LogicalProperty.
func (*Group) DeleteAll ¶
func (g *Group) DeleteAll()
DeleteAll deletes all of the GroupExprs in the Group.
func (*Group) FingerPrint ¶
FingerPrint returns the unique fingerprint of the Group.
func (*Group) GetFirstElem ¶
GetFirstElem returns the first Group expression which matches the Operand. Return a nil pointer if there isn't.
func (*Group) GetImpl ¶
func (g *Group) GetImpl(prop *property.PhysicalProperty) Implementation
GetImpl returns the best Implementation satisfy the physical property.
func (*Group) InsertImpl ¶
func (g *Group) InsertImpl(prop *property.PhysicalProperty, impl Implementation)
InsertImpl inserts the best Implementation satisfy the physical property.
type GroupExpr ¶
type GroupExpr struct { ExprNode LogicalPlan Children []*Group Group *Group // ExploreMark is uses to mark whether this GroupExpr has been fully // explored by a transformation rule batch in a certain round. ExploreMark // contains filtered or unexported fields }
GroupExpr is used to store all the logically equivalent expressions which have the same root operator. Different from a normal expression, the Children of a Group expression are expression Groups, not expressions. Another property of Group expression is that the child Group references will never be changed once the Group expression is created.
func Convert2GroupExpr ¶
func Convert2GroupExpr(node LogicalPlan) *GroupExpr
Convert2GroupExpr converts a logical plan to a GroupExpr.
func NewGroupExpr ¶
func NewGroupExpr(node LogicalPlan) *GroupExpr
NewGroupExpr creates a GroupExpr based on a logical plan node.
func (*GroupExpr) AddAppliedRule ¶
func (e *GroupExpr) AddAppliedRule(rule interface{})
AddAppliedRule adds a rule into the appliedRuleSet.
func (*GroupExpr) FingerPrint ¶
FingerPrint gets the unique fingerprint of the Group expression.
func (*GroupExpr) HasAppliedRule ¶
HasAppliedRule returns if the rule has been applied.
func (*GroupExpr) Schema ¶
func (e *GroupExpr) Schema() *expression.Schema
Schema gets GroupExpr's Schema.
func (*GroupExpr) SetChildren ¶
SetChildren sets Children of the GroupExpr.
type HandleCols ¶
type HandleCols interface { // 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 }
HandleCols is the interface that holds handle columns.
type ImplHashAgg ¶
type ImplHashAgg struct { }
ImplHashAgg is the implementation rule which implements LogicalAggregation to PhysicalHashAgg.
func (*ImplHashAgg) Match ¶
func (r *ImplHashAgg) Match(expr *GroupExpr, prop *property.PhysicalProperty) (matched bool)
Match implements ImplementationRule Match interface.
func (*ImplHashAgg) OnImplement ¶
func (r *ImplHashAgg) OnImplement(expr *GroupExpr, reqProp *property.PhysicalProperty) ([]Implementation, error)
OnImplement implements ImplementationRule OnImplement interface.
type ImplIndexScan ¶
type ImplIndexScan struct { }
ImplIndexScan implements IndexScan as PhysicalIndexScan.
func (*ImplIndexScan) Match ¶
func (r *ImplIndexScan) Match(expr *GroupExpr, prop *property.PhysicalProperty) (matched bool)
Match implements ImplementationRule Match interface.
func (*ImplIndexScan) OnImplement ¶
func (r *ImplIndexScan) OnImplement(expr *GroupExpr, reqProp *property.PhysicalProperty) ([]Implementation, error)
OnImplement implements ImplementationRule OnImplement interface.
type ImplLimit ¶
type ImplLimit struct { }
ImplLimit is the implementation rule which implements LogicalLimit to PhysicalLimit.
func (*ImplLimit) Match ¶
func (r *ImplLimit) Match(expr *GroupExpr, prop *property.PhysicalProperty) (matched bool)
Match implements ImplementationRule Match interface.
func (*ImplLimit) OnImplement ¶
func (r *ImplLimit) OnImplement(expr *GroupExpr, reqProp *property.PhysicalProperty) ([]Implementation, error)
OnImplement implements ImplementationRule OnImplement interface.
type ImplProjection ¶
type ImplProjection struct { }
ImplProjection implements LogicalProjection as PhysicalProjection.
func (*ImplProjection) Match ¶
func (r *ImplProjection) Match(expr *GroupExpr, prop *property.PhysicalProperty) (matched bool)
Match implements ImplementationRule Match interface.
func (*ImplProjection) OnImplement ¶
func (r *ImplProjection) OnImplement(expr *GroupExpr, reqProp *property.PhysicalProperty) ([]Implementation, error)
OnImplement implements ImplementationRule OnImplement interface.
type ImplSelection ¶
type ImplSelection struct { }
ImplSelection is the implementation rule which implements LogicalSelection to PhysicalSelection.
func (*ImplSelection) Match ¶
func (r *ImplSelection) Match(expr *GroupExpr, prop *property.PhysicalProperty) (matched bool)
Match implements ImplementationRule Match interface.
func (*ImplSelection) OnImplement ¶
func (r *ImplSelection) OnImplement(expr *GroupExpr, reqProp *property.PhysicalProperty) ([]Implementation, error)
OnImplement implements ImplementationRule OnImplement interface.
type ImplSort ¶
type ImplSort struct { }
ImplSort is the implementation rule which implements LogicalSort to PhysicalSort or NominalSort.
func (*ImplSort) Match ¶
func (r *ImplSort) Match(expr *GroupExpr, prop *property.PhysicalProperty) (matched bool)
Match implements ImplementationRule match interface.
func (*ImplSort) OnImplement ¶
func (r *ImplSort) OnImplement(expr *GroupExpr, reqProp *property.PhysicalProperty) ([]Implementation, error)
OnImplement implements ImplementationRule OnImplement interface. If all of the sort items are columns, generate a NominalSort, otherwise generate a PhysicalSort.
type ImplTableScan ¶
type ImplTableScan struct { }
ImplTableScan implements TableScan as PhysicalTableScan.
func (*ImplTableScan) Match ¶
func (r *ImplTableScan) Match(expr *GroupExpr, prop *property.PhysicalProperty) (matched bool)
Match implements ImplementationRule Match interface.
func (*ImplTableScan) OnImplement ¶
func (r *ImplTableScan) OnImplement(expr *GroupExpr, reqProp *property.PhysicalProperty) ([]Implementation, error)
OnImplement implements ImplementationRule OnImplement interface.
type ImplTopN ¶
type ImplTopN struct { }
ImplTopN is the implementation rule which implements LogicalTopN to PhysicalTopN.
func (*ImplTopN) Match ¶
func (r *ImplTopN) Match(expr *GroupExpr, prop *property.PhysicalProperty) (matched bool)
Match implements ImplementationRule Match interface.
func (*ImplTopN) OnImplement ¶
func (r *ImplTopN) OnImplement(expr *GroupExpr, reqProp *property.PhysicalProperty) ([]Implementation, error)
OnImplement implements ImplementationRule OnImplement interface.
type ImplTopNAsLimit ¶
type ImplTopNAsLimit struct { }
ImplTopNAsLimit is the implementation rule which implements LogicalTopN as PhysicalLimit with required order property.
func (*ImplTopNAsLimit) Match ¶
func (r *ImplTopNAsLimit) Match(expr *GroupExpr, prop *property.PhysicalProperty) (matched bool)
Match implements ImplementationRule Match interface.
func (*ImplTopNAsLimit) OnImplement ¶
func (r *ImplTopNAsLimit) OnImplement(expr *GroupExpr, reqProp *property.PhysicalProperty) ([]Implementation, error)
OnImplement implements ImplementationRule OnImplement interface.
type ImplUnionAll ¶
type ImplUnionAll struct { }
ImplUnionAll implements LogicalUnionAll to PhysicalUnionAll.
func (*ImplUnionAll) Match ¶
func (r *ImplUnionAll) Match(expr *GroupExpr, prop *property.PhysicalProperty) (matched bool)
Match implements ImplementationRule Match interface.
func (*ImplUnionAll) OnImplement ¶
func (r *ImplUnionAll) OnImplement(expr *GroupExpr, reqProp *property.PhysicalProperty) ([]Implementation, error)
OnImplement implements ImplementationRule OnImplement interface.
type Implementation ¶
type Implementation interface { CalcCost(outCount float64, children ...Implementation) float64 SetCost(cost float64) GetCost() float64 GetPlan() PhysicalPlan // AttachChildren is used to attach children implementations and returns it self. AttachChildren(children ...Implementation) Implementation // GetCostLimit gets the costLimit for implementing the next childGroup. GetCostLimit(costLimit float64, children ...Implementation) float64 }
Implementation defines the interface for cost of physical plan.
type ImplementationRule ¶
type ImplementationRule interface { // Match checks if current GroupExpr matches this rule under required physical property. Match(expr *GroupExpr, prop *property.PhysicalProperty) (matched bool) // OnImplement generates physical plan using this rule for current GroupExpr. Note that // childrenReqProps of generated physical plan should be set correspondingly in this function. OnImplement(expr *GroupExpr, reqProp *property.PhysicalProperty) ([]Implementation, error) }
ImplementationRule defines the interface for implementation rules.
type IndexScanImpl ¶
type IndexScanImpl struct {
// contains filtered or unexported fields
}
IndexScanImpl is the Implementation of PhysicalIndexScan.
func NewIndexScanImpl ¶
func NewIndexScanImpl(scan *PhysicalIndexScan, tblColHists *statistics.HistColl) *IndexScanImpl
NewIndexScanImpl creates a new IndexScan Implementation.
func (*IndexScanImpl) AttachChildren ¶
func (impl *IndexScanImpl) AttachChildren(children ...Implementation) Implementation
func (*IndexScanImpl) CalcCost ¶
func (impl *IndexScanImpl) CalcCost(outCount float64, children ...Implementation) float64
CalcCost implements Implementation interface.
func (*IndexScanImpl) GetCostLimit ¶
func (impl *IndexScanImpl) GetCostLimit(costLimit float64, children ...Implementation) float64
func (*IndexScanImpl) GetPlan ¶
func (impl *IndexScanImpl) GetPlan() PhysicalPlan
func (*IndexScanImpl) ScaleCostLimit ¶
type InjectProjectionBelowAgg ¶
type InjectProjectionBelowAgg struct {
// contains filtered or unexported fields
}
InjectProjectionBelowAgg injects Projection below Agg if Agg's AggFuncDesc.Args or Agg's GroupByItem contain ScalarFunctions.
func (*InjectProjectionBelowAgg) GetPattern ¶
func (r *InjectProjectionBelowAgg) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*InjectProjectionBelowAgg) Match ¶
func (r *InjectProjectionBelowAgg) Match(expr *ExprIter) bool
Match implements Transformation interface.
func (*InjectProjectionBelowAgg) OnTransform ¶
func (r *InjectProjectionBelowAgg) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. It will convert `Agg -> X` to `Agg -> Proj -> X`.
type InjectProjectionBelowTopN ¶
type InjectProjectionBelowTopN struct {
// contains filtered or unexported fields
}
InjectProjectionBelowTopN injects two Projections below and upon TopN if TopN's ByItems contain ScalarFunctions.
func (*InjectProjectionBelowTopN) GetPattern ¶
func (r *InjectProjectionBelowTopN) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*InjectProjectionBelowTopN) Match ¶
func (r *InjectProjectionBelowTopN) Match(expr *ExprIter) bool
Match implements Transformation interface.
func (*InjectProjectionBelowTopN) OnTransform ¶
func (r *InjectProjectionBelowTopN) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. It will convert `TopN -> X` to `Projection -> TopN -> Projection -> X`.
type IntHandleCols ¶
type IntHandleCols struct {
// contains filtered or unexported fields
}
IntHandleCols implements the kv.HandleCols interface.
func (*IntHandleCols) GetCol ¶
func (ib *IntHandleCols) GetCol(idx int) *expression.Column
GetCol implements the kv.HandleCols interface.
func (*IntHandleCols) IsInt ¶
func (ib *IntHandleCols) IsInt() bool
IsInt implements the kv.HandleCols interface.
func (*IntHandleCols) NumCols ¶
func (ib *IntHandleCols) NumCols() int
NumCols implements the kv.HandleCols interface.
func (*IntHandleCols) ResolveIndices ¶
func (ib *IntHandleCols) ResolveIndices(schema *expression.Schema) (HandleCols, error)
ResolveIndices implements the kv.HandleCols interface.
func (*IntHandleCols) String ¶
func (ib *IntHandleCols) String() string
String implements the kv.HandleCols interface.
type JoinType ¶
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 ¶
IsOuterJoin returns if this joiner is a outer joiner
type LimitImpl ¶
type LimitImpl struct {
// contains filtered or unexported fields
}
LimitImpl is the implementation of PhysicalLimit. Since PhysicalLimit on different engines have the same behavior, and we don't calculate the cost of `Limit`, we only have one Implementation for it.
func NewLimitImpl ¶
func NewLimitImpl(limit *PhysicalLimit) *LimitImpl
NewLimitImpl creates a new LimitImpl.
func (*LimitImpl) AttachChildren ¶
func (impl *LimitImpl) AttachChildren(children ...Implementation) Implementation
func (*LimitImpl) CalcCost ¶
func (impl *LimitImpl) CalcCost(outCount float64, children ...Implementation) float64
func (*LimitImpl) GetCostLimit ¶
func (impl *LimitImpl) GetCostLimit(costLimit float64, children ...Implementation) float64
func (*LimitImpl) GetPlan ¶
func (impl *LimitImpl) GetPlan() PhysicalPlan
func (*LimitImpl) ScaleCostLimit ¶
type LogicalAggregation ¶
type LogicalAggregation struct { AggFuncs []*aggregation.AggFuncDesc GroupByItems []expression.Expression // contains filtered or unexported fields }
LogicalAggregation represents an aggregate plan.
func (*LogicalAggregation) BuildKeyInfo ¶
func (la *LogicalAggregation) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.
func (*LogicalAggregation) DeriveStats ¶
func (la *LogicalAggregation) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema, colGroups [][]*expression.Column) (*property.StatsInfo, error)
DeriveStats implement LogicalPlan DeriveStats interface.
func (*LogicalAggregation) ExtractColGroups ¶
func (la *LogicalAggregation) ExtractColGroups(_ [][]*expression.Column) [][]*expression.Column
ExtractColGroups implements LogicalPlan ExtractColGroups interface.
func (*LogicalAggregation) GetGroupByCols ¶
func (la *LogicalAggregation) GetGroupByCols() []*expression.Column
GetGroupByCols returns the columns that are group-by items. For example, `group by a, b, c+d` will return [a, b].
func (*LogicalAggregation) GetUsedCols ¶
func (la *LogicalAggregation) GetUsedCols() (usedCols []*expression.Column)
GetUsedCols extracts all of the Columns used by agg including GroupByItems and AggFuncs.
func (*LogicalAggregation) HasDistinct ¶
func (la *LogicalAggregation) HasDistinct() bool
HasDistinct shows whether LogicalAggregation has functions with distinct.
func (LogicalAggregation) Init ¶
func (la LogicalAggregation) Init(ctx sessionctx.Context, offset int) *LogicalAggregation
Init initializes LogicalAggregation.
func (*LogicalAggregation) IsCompleteModeAgg ¶
func (la *LogicalAggregation) IsCompleteModeAgg() bool
IsCompleteModeAgg returns if all of the AggFuncs are CompleteMode.
func (*LogicalAggregation) IsPartialModeAgg ¶
func (la *LogicalAggregation) IsPartialModeAgg() bool
IsPartialModeAgg returns if all of the AggFuncs are partialMode.
func (*LogicalAggregation) OutputNames ¶
func (*LogicalAggregation) PreparePossibleProperties ¶
func (la *LogicalAggregation) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column
PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.
func (*LogicalAggregation) PruneColumns ¶
func (la *LogicalAggregation) PruneColumns(parentUsedCols []*expression.Column) error
PruneColumns implements LogicalPlan interface.
func (*LogicalAggregation) Schema ¶
func (s *LogicalAggregation) Schema() *expression.Schema
Schema implements the Plan.Schema interface.
func (*LogicalAggregation) SetOutputNames ¶
func (*LogicalAggregation) SetSchema ¶
func (s *LogicalAggregation) SetSchema(schema *expression.Schema)
SetSchema implements the Plan.SetSchema interface.
func (*LogicalAggregation) String ¶
func (p *LogicalAggregation) String() string
type LogicalDataSource ¶
type LogicalDataSource struct { Columns []*model.ColumnInfo DBName model.CIStr TableAsName *model.CIStr // TblCols contains the original columns of table before being pruned, and it // is used for estimating table scan cost. TblCols []*expression.Column // TblColHists contains the Histogram of all original table columns, // it is converted from statisticTable, and used for IO/network cost estimating. TblColHists *statistics.HistColl // contains filtered or unexported fields }
LogicalDataSource represents a tableScan without condition push down.
func (*LogicalDataSource) BuildKeyInfo ¶
func (ds *LogicalDataSource) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.
func (*LogicalDataSource) Convert2Scans ¶
func (ds *LogicalDataSource) Convert2Scans() (scans []LogicalPlan)
func (*LogicalDataSource) DeriveStats ¶
func (ds *LogicalDataSource) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema, colGroups [][]*expression.Column) (*property.StatsInfo, error)
DeriveStats implement LogicalPlan DeriveStats interface.
func (LogicalDataSource) Init ¶
func (ds LogicalDataSource) Init(ctx sessionctx.Context, offset int) *LogicalDataSource
Init initializes LogicalDataSource.
func (*LogicalDataSource) OutputNames ¶
func (*LogicalDataSource) PreparePossibleProperties ¶
func (ds *LogicalDataSource) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column
PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.
func (*LogicalDataSource) PruneColumns ¶
func (ds *LogicalDataSource) PruneColumns(parentUsedCols []*expression.Column) error
PruneColumns implements LogicalPlan interface.
func (*LogicalDataSource) Schema ¶
func (s *LogicalDataSource) Schema() *expression.Schema
Schema implements the Plan.Schema interface.
func (*LogicalDataSource) SetOutputNames ¶
func (*LogicalDataSource) SetSchema ¶
func (s *LogicalDataSource) SetSchema(schema *expression.Schema)
SetSchema implements the Plan.SetSchema interface.
func (*LogicalDataSource) String ¶
func (p *LogicalDataSource) String() string
func (*LogicalDataSource) TableInfo ¶
func (ds *LogicalDataSource) TableInfo() *model.TableInfo
TableInfo returns the *TableInfo of data source.
type LogicalIndexScan ¶
type LogicalIndexScan struct { // LogicalDataSource should be read-only here. Source *LogicalDataSource 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 ¶
func (is *LogicalIndexScan) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.
func (*LogicalIndexScan) DeriveStats ¶
func (is *LogicalIndexScan) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema, _ [][]*expression.Column) (*property.StatsInfo, error)
DeriveStats implements LogicalPlan DeriveStats interface.
func (*LogicalIndexScan) GetPhysicalIndexScan ¶
func (s *LogicalIndexScan) GetPhysicalIndexScan(schema *expression.Schema, stats *property.StatsInfo) *PhysicalIndexScan
GetPhysicalIndexScan returns PhysicalIndexScan for the logical IndexScan.
func (LogicalIndexScan) Init ¶
func (is LogicalIndexScan) Init(ctx sessionctx.Context, offset int) *LogicalIndexScan
Init initializes LogicalIndexScan.
func (*LogicalIndexScan) MatchIndexProp ¶
func (p *LogicalIndexScan) MatchIndexProp(prop *property.PhysicalProperty) (match bool)
MatchIndexProp checks if the indexScan can match the required property.
func (*LogicalIndexScan) OutputNames ¶
func (*LogicalIndexScan) PreparePossibleProperties ¶
func (is *LogicalIndexScan) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column
PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.
func (*LogicalIndexScan) Schema ¶
func (s *LogicalIndexScan) Schema() *expression.Schema
Schema implements the Plan.Schema interface.
func (*LogicalIndexScan) SetOutputNames ¶
func (*LogicalIndexScan) SetSchema ¶
func (s *LogicalIndexScan) SetSchema(schema *expression.Schema)
SetSchema implements the Plan.SetSchema interface.
func (*LogicalIndexScan) String ¶
func (p *LogicalIndexScan) String() string
type LogicalJoin ¶
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 ¶
func (p *LogicalJoin) AppendJoinConds(eq []*expression.ScalarFunction, left, right, other []expression.Expression)
AppendJoinConds appends new join conditions.
func (*LogicalJoin) AttachOnConds ¶
func (p *LogicalJoin) AttachOnConds(onConds []expression.Expression)
AttachOnConds extracts on conditions for join and set the `EqualConditions`, `LeftConditions`, `RightConditions` and `OtherConditions` by the result of extract.
func (*LogicalJoin) BuildKeyInfo ¶
func (p *LogicalJoin) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.
func (*LogicalJoin) DeriveStats ¶
func (p *LogicalJoin) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema, colGroups [][]*expression.Column) (*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 NDV 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 NDV 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) ExtractColGroups ¶
func (p *LogicalJoin) ExtractColGroups(colGroups [][]*expression.Column) [][]*expression.Column
ExtractColGroups implements LogicalPlan ExtractColGroups interface.
func (*LogicalJoin) ExtractJoinKeys ¶
func (p *LogicalJoin) ExtractJoinKeys(childIdx int) *expression.Schema
ExtractJoinKeys extract join keys as a schema for child with childIdx.
func (*LogicalJoin) ExtractOnCondition ¶
func (p *LogicalJoin) ExtractOnCondition( conditions []expression.Expression, leftSchema *expression.Schema, rightSchema *expression.Schema, deriveLeft bool, deriveRight bool) (eqCond []*expression.ScalarFunction, leftCond []expression.Expression, rightCond []expression.Expression, otherCond []expression.Expression)
ExtractOnCondition divide conditions in CNF of join node into 4 groups. These conditions can be where conditions, join conditions, or collection of both. If deriveLeft/deriveRight is set, we would try to derive more conditions for left/right plan.
func (*LogicalJoin) GetJoinKeys ¶
func (p *LogicalJoin) GetJoinKeys() (leftKeys, rightKeys []*expression.Column, isNullEQ []bool, hasNullEQ bool)
GetJoinKeys extracts join keys(columns) from EqualConditions. It returns left join keys, right join keys and an `isNullEQ` array which means the `joinKey[i]` is a `NullEQ` function. The `hasNullEQ` means whether there is a `NullEQ` of a join key.
func (LogicalJoin) Init ¶
func (p LogicalJoin) Init(ctx sessionctx.Context, offset int) *LogicalJoin
Init initializes LogicalJoin.
func (*LogicalJoin) OutputNames ¶
func (*LogicalJoin) PreparePossibleProperties ¶
func (p *LogicalJoin) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column
PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.
func (*LogicalJoin) PruneColumns ¶
func (p *LogicalJoin) PruneColumns(parentUsedCols []*expression.Column) error
PruneColumns implements LogicalPlan interface.
func (*LogicalJoin) Schema ¶
func (s *LogicalJoin) Schema() *expression.Schema
Schema implements the Plan.Schema interface.
func (*LogicalJoin) SetOutputNames ¶
func (*LogicalJoin) SetSchema ¶
func (s *LogicalJoin) SetSchema(schema *expression.Schema)
SetSchema implements the Plan.SetSchema interface.
func (*LogicalJoin) Shallow ¶
func (p *LogicalJoin) Shallow() *LogicalJoin
Shallow shallow copies a LogicalJoin struct.
func (*LogicalJoin) String ¶
func (p *LogicalJoin) String() string
type LogicalLimit ¶
LogicalLimit represents offset and limit plan.
func (*LogicalLimit) BuildKeyInfo ¶
func (p *LogicalLimit) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.
func (*LogicalLimit) DeriveStats ¶
func (p *LogicalLimit) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema, _ [][]*expression.Column) (*property.StatsInfo, error)
DeriveStats implement LogicalPlan DeriveStats interface.
func (*LogicalLimit) HashCode ¶
func (p *LogicalLimit) HashCode() []byte
HashCode implements LogicalPlan interface.
func (LogicalLimit) Init ¶
func (p LogicalLimit) Init(ctx sessionctx.Context, offset int) *LogicalLimit
Init initializes LogicalLimit.
func (*LogicalLimit) OutputNames ¶
func (*LogicalLimit) PruneColumns ¶
func (p *LogicalLimit) PruneColumns(parentUsedCols []*expression.Column) error
PruneColumns implements LogicalPlan interface.
func (*LogicalLimit) Schema ¶
func (s *LogicalLimit) Schema() *expression.Schema
Schema implements the Plan.Schema interface.
func (*LogicalLimit) SetOutputNames ¶
func (*LogicalLimit) SetSchema ¶
func (s *LogicalLimit) SetSchema(schema *expression.Schema)
SetSchema implements the Plan.SetSchema interface.
func (*LogicalLimit) String ¶
func (p *LogicalLimit) String() string
type LogicalPlan ¶
type LogicalPlan interface { Plan // HashCode encodes a LogicalPlan to fast compare whether a LogicalPlan equals to another. // We use a strict encode method here which ensures there is no conflict. HashCode() []byte // 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, colGroups [][]*expression.Column) (*property.StatsInfo, error) // ExtractColGroups extracts column groups from child operator whose DNVs are required by the current operator. // For example, if current operator is LogicalAggregation of `Group By a, b`, we indicate the child operators to maintain // and propagate the NDV info of column group (a, b), to improve the row count estimation of current LogicalAggregation. // The parameter colGroups are column groups required by upper operators, besides from the column groups derived from // current operator, we should pass down parent colGroups to child operator as many as possible. ExtractColGroups(colGroups [][]*expression.Column) [][]*expression.Column // PreparePossibleProperties is only used for join and aggregation. Like group by a,b,c, all permutation of (a,b,c) is // valid, but the ordered indices in leaf plan is limited. So we can get all possible order properties by a pre-walking. PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column // MaxOneRow means whether this operator only returns max one row. MaxOneRow() bool // Get all the children. Children() []LogicalPlan // SetChildren sets the children for the plan. SetChildren(...LogicalPlan) // SetChild sets the ith child for the plan. SetChild(i int, child LogicalPlan) String() string Dump() string // 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.
type LogicalProjection ¶
type LogicalProjection struct { Exprs []expression.Expression // AvoidColumnEvaluator is a temporary variable which is ONLY used to avoid // building columnEvaluator for the expressions of Projection which is // built by buildProjection4Union. // This can be removed after column pool being supported. // Related issue: TiDB#8141(https://github.com/pingcap/tidb/issues/8141) AvoidColumnEvaluator bool // contains filtered or unexported fields }
LogicalProjection represents a select fields plan.
func (*LogicalProjection) BuildKeyInfo ¶
func (p *LogicalProjection) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.
func (*LogicalProjection) DeriveStats ¶
func (p *LogicalProjection) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema, colGroups [][]*expression.Column) (*property.StatsInfo, error)
DeriveStats implement LogicalPlan DeriveStats interface.
func (*LogicalProjection) ExtractColGroups ¶
func (p *LogicalProjection) ExtractColGroups(colGroups [][]*expression.Column) [][]*expression.Column
ExtractColGroups implements LogicalPlan ExtractColGroups interface.
func (*LogicalProjection) GetUsedCols ¶
func (p *LogicalProjection) GetUsedCols() (usedCols []*expression.Column)
GetUsedCols extracts all of the Columns used by proj.
func (*LogicalProjection) HashCode ¶
func (p *LogicalProjection) HashCode() []byte
HashCode implements LogicalPlan interface.
func (LogicalProjection) Init ¶
func (p LogicalProjection) Init(ctx sessionctx.Context, offset int) *LogicalProjection
Init initializes LogicalProjection.
func (*LogicalProjection) OutputNames ¶
func (*LogicalProjection) PreparePossibleProperties ¶
func (p *LogicalProjection) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column
PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.
func (*LogicalProjection) PruneColumns ¶
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 ¶
func (s *LogicalProjection) Schema() *expression.Schema
Schema implements the Plan.Schema interface.
func (*LogicalProjection) SetOutputNames ¶
func (*LogicalProjection) SetSchema ¶
func (s *LogicalProjection) SetSchema(schema *expression.Schema)
SetSchema implements the Plan.SetSchema interface.
func (*LogicalProjection) String ¶
func (p *LogicalProjection) String() string
func (*LogicalProjection) TryToGetChildProp ¶
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 ¶
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 ¶
func (p *LogicalSelection) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.
func (*LogicalSelection) Children ¶
func (p *LogicalSelection) Children() []LogicalPlan
Children implements LogicalPlan Children interface.
func (*LogicalSelection) DeriveStats ¶
func (p *LogicalSelection) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema, _ [][]*expression.Column) (*property.StatsInfo, error)
DeriveStats implement LogicalPlan DeriveStats interface.
func (*LogicalSelection) ExtractColGroups ¶
func (p *LogicalSelection) ExtractColGroups(_ [][]*expression.Column) [][]*expression.Column
ExtractColGroups implements LogicalPlan ExtractColGroups interface.
func (*LogicalSelection) HashCode ¶
func (p *LogicalSelection) HashCode() []byte
HashCode implements LogicalPlan interface.
func (LogicalSelection) Init ¶
func (p LogicalSelection) Init(ctx sessionctx.Context, offset int) *LogicalSelection
Init initializes LogicalSelection.
func (*LogicalSelection) OutputNames ¶
func (*LogicalSelection) PreparePossibleProperties ¶
func (p *LogicalSelection) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column
PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.
func (*LogicalSelection) PruneColumns ¶
func (p *LogicalSelection) PruneColumns(parentUsedCols []*expression.Column) error
PruneColumns implements LogicalPlan interface.
func (*LogicalSelection) Schema ¶
func (p *LogicalSelection) Schema() *expression.Schema
Schema implements Plan Schema interface.
func (*LogicalSelection) SetChild ¶
func (p *LogicalSelection) SetChild(i int, child LogicalPlan)
SetChild implements LogicalPlan SetChild interface.
func (*LogicalSelection) SetChildren ¶
func (p *LogicalSelection) SetChildren(children ...LogicalPlan)
SetChildren implements LogicalPlan SetChildren interface.
func (*LogicalSelection) SetOutputNames ¶
func (*LogicalSelection) String ¶
func (p *LogicalSelection) String() string
type LogicalSort ¶
LogicalSort stands for the order by plan.
func (*LogicalSort) BuildKeyInfo ¶
func (p *LogicalSort) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.
func (*LogicalSort) Children ¶
func (p *LogicalSort) Children() []LogicalPlan
Children implements LogicalPlan Children interface.
func (*LogicalSort) DeriveStats ¶
func (p *LogicalSort) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema, _ [][]*expression.Column) (*property.StatsInfo, error)
DeriveStats implement LogicalPlan DeriveStats interface.
func (*LogicalSort) ExtractColGroups ¶
func (p *LogicalSort) ExtractColGroups(_ [][]*expression.Column) [][]*expression.Column
ExtractColGroups implements LogicalPlan ExtractColGroups interface.
func (*LogicalSort) HashCode ¶
func (p *LogicalSort) HashCode() []byte
HashCode implements LogicalPlan interface.
func (LogicalSort) Init ¶
func (ls LogicalSort) Init(ctx sessionctx.Context, offset int) *LogicalSort
Init initializes LogicalSort.
func (*LogicalSort) OutputNames ¶
func (*LogicalSort) PreparePossibleProperties ¶
func (p *LogicalSort) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column
PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.
func (*LogicalSort) PruneColumns ¶
func (ls *LogicalSort) PruneColumns(parentUsedCols []*expression.Column) error
PruneColumns implements LogicalPlan interface. If any expression can view as a constant in execution stage, such as correlated column, constant, we do prune them. Note that we can't prune the expressions contain non-deterministic functions, such as rand().
func (*LogicalSort) Schema ¶
func (p *LogicalSort) Schema() *expression.Schema
Schema implements Plan Schema interface.
func (*LogicalSort) SetChild ¶
func (p *LogicalSort) SetChild(i int, child LogicalPlan)
SetChild implements LogicalPlan SetChild interface.
func (*LogicalSort) SetChildren ¶
func (p *LogicalSort) SetChildren(children ...LogicalPlan)
SetChildren implements LogicalPlan SetChildren interface.
func (*LogicalSort) SetOutputNames ¶
func (*LogicalSort) String ¶
func (p *LogicalSort) String() string
type LogicalTableDual ¶
type LogicalTableDual struct { RowCount int // contains filtered or unexported fields }
LogicalTableDual represents a dual table plan.
func (*LogicalTableDual) BuildKeyInfo ¶
func (p *LogicalTableDual) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.
func (*LogicalTableDual) DeriveStats ¶
func (p *LogicalTableDual) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema, _ [][]*expression.Column) (*property.StatsInfo, error)
DeriveStats implement LogicalPlan DeriveStats interface.
func (*LogicalTableDual) HashCode ¶
func (p *LogicalTableDual) HashCode() []byte
HashCode implements LogicalPlan interface.
func (LogicalTableDual) Init ¶
func (p LogicalTableDual) Init(ctx sessionctx.Context, offset int) *LogicalTableDual
Init initializes LogicalTableDual.
func (*LogicalTableDual) OutputNames ¶
func (*LogicalTableDual) PruneColumns ¶
func (p *LogicalTableDual) PruneColumns(parentUsedCols []*expression.Column) error
PruneColumns implements LogicalPlan interface.
func (*LogicalTableDual) Schema ¶
func (s *LogicalTableDual) Schema() *expression.Schema
Schema implements the Plan.Schema interface.
func (*LogicalTableDual) SetOutputNames ¶
func (*LogicalTableDual) SetSchema ¶
func (s *LogicalTableDual) SetSchema(schema *expression.Schema)
SetSchema implements the Plan.SetSchema interface.
func (*LogicalTableDual) String ¶
func (p *LogicalTableDual) String() string
type LogicalTableScan ¶
type LogicalTableScan struct { Source *LogicalDataSource 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 ¶
func (ts *LogicalTableScan) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.
func (*LogicalTableScan) DeriveStats ¶
func (ts *LogicalTableScan) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema, _ [][]*expression.Column) (_ *property.StatsInfo, err error)
DeriveStats implements LogicalPlan DeriveStats interface.
func (*LogicalTableScan) GetPhysicalScan ¶
func (s *LogicalTableScan) GetPhysicalScan(schema *expression.Schema, stats *property.StatsInfo) *PhysicalTableScan
GetPhysicalScan returns PhysicalTableScan for the LogicalTableScan.
func (LogicalTableScan) Init ¶
func (ts LogicalTableScan) Init(ctx sessionctx.Context, offset int) *LogicalTableScan
Init initializes LogicalTableScan.
func (*LogicalTableScan) OutputNames ¶
func (*LogicalTableScan) PreparePossibleProperties ¶
func (ts *LogicalTableScan) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column
PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.
func (*LogicalTableScan) Schema ¶
func (s *LogicalTableScan) Schema() *expression.Schema
Schema implements the Plan.Schema interface.
func (*LogicalTableScan) SetOutputNames ¶
func (*LogicalTableScan) SetSchema ¶
func (s *LogicalTableScan) SetSchema(schema *expression.Schema)
SetSchema implements the Plan.SetSchema interface.
func (*LogicalTableScan) String ¶
func (p *LogicalTableScan) String() string
type LogicalTopN ¶
type LogicalTopN struct { ByItems []*util.ByItems Offset uint64 Count uint64 // contains filtered or unexported fields }
LogicalTopN represents a top-n plan.
func (*LogicalTopN) BuildKeyInfo ¶
func (p *LogicalTopN) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.
func (*LogicalTopN) Children ¶
func (p *LogicalTopN) Children() []LogicalPlan
Children implements LogicalPlan Children interface.
func (*LogicalTopN) DeriveStats ¶
func (lt *LogicalTopN) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema, _ [][]*expression.Column) (*property.StatsInfo, error)
DeriveStats implement LogicalPlan DeriveStats interface.
func (*LogicalTopN) ExtractColGroups ¶
func (p *LogicalTopN) ExtractColGroups(_ [][]*expression.Column) [][]*expression.Column
ExtractColGroups implements LogicalPlan ExtractColGroups interface.
func (*LogicalTopN) HashCode ¶
func (p *LogicalTopN) HashCode() []byte
HashCode implements LogicalPlan interface.
func (LogicalTopN) Init ¶
func (lt LogicalTopN) Init(ctx sessionctx.Context, offset int) *LogicalTopN
Init initializes LogicalTopN.
func (*LogicalTopN) OutputNames ¶
func (*LogicalTopN) PreparePossibleProperties ¶
func (p *LogicalTopN) PreparePossibleProperties(schema *expression.Schema, childrenProperties ...[][]*expression.Column) [][]*expression.Column
PreparePossibleProperties implements LogicalPlan PreparePossibleProperties interface.
func (*LogicalTopN) PruneColumns ¶
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 ¶
func (p *LogicalTopN) Schema() *expression.Schema
Schema implements Plan Schema interface.
func (*LogicalTopN) SetChild ¶
func (p *LogicalTopN) SetChild(i int, child LogicalPlan)
SetChild implements LogicalPlan SetChild interface.
func (*LogicalTopN) SetChildren ¶
func (p *LogicalTopN) SetChildren(children ...LogicalPlan)
SetChildren implements LogicalPlan SetChildren interface.
func (*LogicalTopN) SetOutputNames ¶
func (*LogicalTopN) String ¶
func (p *LogicalTopN) String() string
type LogicalUnionAll ¶
type LogicalUnionAll struct {
// contains filtered or unexported fields
}
LogicalUnionAll represents LogicalUnionAll plan.
func (*LogicalUnionAll) BuildKeyInfo ¶
func (p *LogicalUnionAll) BuildKeyInfo(selfSchema *expression.Schema, childSchema []*expression.Schema)
BuildKeyInfo implements LogicalPlan BuildKeyInfo interface.
func (*LogicalUnionAll) DeriveStats ¶
func (p *LogicalUnionAll) DeriveStats(childStats []*property.StatsInfo, selfSchema *expression.Schema, childSchema []*expression.Schema, _ [][]*expression.Column) (*property.StatsInfo, error)
DeriveStats implement LogicalPlan DeriveStats interface.
func (LogicalUnionAll) Init ¶
func (p LogicalUnionAll) Init(ctx sessionctx.Context, offset int) *LogicalUnionAll
Init initializes LogicalUnionAll.
func (*LogicalUnionAll) OutputNames ¶
func (*LogicalUnionAll) PruneColumns ¶
func (p *LogicalUnionAll) PruneColumns(parentUsedCols []*expression.Column) error
PruneColumns implements LogicalPlan interface.
func (*LogicalUnionAll) Schema ¶
func (s *LogicalUnionAll) Schema() *expression.Schema
Schema implements the Plan.Schema interface.
func (*LogicalUnionAll) SetOutputNames ¶
func (*LogicalUnionAll) SetSchema ¶
func (s *LogicalUnionAll) SetSchema(schema *expression.Schema)
SetSchema implements the Plan.SetSchema interface.
func (*LogicalUnionAll) String ¶
func (p *LogicalUnionAll) String() string
type MergeAdjacentLimit ¶
type MergeAdjacentLimit struct {
// contains filtered or unexported fields
}
MergeAdjacentLimit merge the adjacent limit.
func (*MergeAdjacentLimit) GetPattern ¶
func (r *MergeAdjacentLimit) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*MergeAdjacentLimit) OnTransform ¶
func (r *MergeAdjacentLimit) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. This rule tries to merge adjacent limit.
type MergeAdjacentProjection ¶
type MergeAdjacentProjection struct {
// contains filtered or unexported fields
}
MergeAdjacentProjection merge the adjacent projection.
func (*MergeAdjacentProjection) GetPattern ¶
func (r *MergeAdjacentProjection) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*MergeAdjacentProjection) OnTransform ¶
func (r *MergeAdjacentProjection) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. It will transform `proj->proj->x` to `proj->x` or just keep the adjacent projections unchanged.
type MergeAdjacentSelection ¶
type MergeAdjacentSelection struct {
// contains filtered or unexported fields
}
MergeAdjacentSelection merge adjacent selection.
func (*MergeAdjacentSelection) GetPattern ¶
func (r *MergeAdjacentSelection) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*MergeAdjacentSelection) OnTransform ¶
func (r *MergeAdjacentSelection) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. This rule tries to merge adjacent selection, with no simplification.
type MergeAdjacentTopN ¶
type MergeAdjacentTopN struct {
// contains filtered or unexported fields
}
MergeAdjacentTopN merge adjacent TopN.
func (*MergeAdjacentTopN) GetPattern ¶
func (r *MergeAdjacentTopN) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*MergeAdjacentTopN) Match ¶
func (r *MergeAdjacentTopN) Match(expr *ExprIter) bool
Match implements Transformation interface.
func (*MergeAdjacentTopN) OnTransform ¶
func (r *MergeAdjacentTopN) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. This rule tries to merge adjacent TopN.
type MergeAggregationProjection ¶
type MergeAggregationProjection struct {
// contains filtered or unexported fields
}
MergeAggregationProjection merges the Projection below an Aggregation as a new Aggregation. The Projection may be regenerated in the ImplementationPhase. But this rule allows the Aggregation to match other rules, such as MergeAdjacentAggregation.
func (*MergeAggregationProjection) GetPattern ¶
func (r *MergeAggregationProjection) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*MergeAggregationProjection) Match ¶
func (r *MergeAggregationProjection) Match(old *ExprIter) bool
Match implements Transformation interface.
func (*MergeAggregationProjection) OnTransform ¶
func (r *MergeAggregationProjection) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. It will transform `Aggregation->Projection->X` to `Aggregation->X`.
type NominalSort ¶
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 // 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 ¶
func (p *NominalSort) Children() []PhysicalPlan
Children implements PhysicalPlan Children interface.
func (*NominalSort) Cost ¶
func (p *NominalSort) Cost() float64
Cost implements PhysicalPlan interface.
func (*NominalSort) GetChildReqProps ¶
func (p *NominalSort) GetChildReqProps(idx int) *property.PhysicalProperty
func (NominalSort) Init ¶
func (p NominalSort) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *NominalSort
Init initializes NominalSort.
func (*NominalSort) ResolveIndices ¶
func (p *NominalSort) ResolveIndices() (err error)
ResolveIndices implements Plan interface.
func (*NominalSort) Schema ¶
func (p *NominalSort) Schema() *expression.Schema
Schema implements Plan Schema interface.
func (*NominalSort) SetChild ¶
func (p *NominalSort) SetChild(i int, child PhysicalPlan)
SetChild implements PhysicalPlan SetChild interface.
func (*NominalSort) SetChildren ¶
func (p *NominalSort) SetChildren(children ...PhysicalPlan)
SetChildren implements PhysicalPlan SetChildren interface.
func (*NominalSort) SetCost ¶
func (p *NominalSort) SetCost(cost float64)
SetCost implements PhysicalPlan interface.
func (*NominalSort) StatsCount ¶
func (p *NominalSort) StatsCount() float64
type NominalSortImpl ¶
type NominalSortImpl struct {
// contains filtered or unexported fields
}
NominalSortImpl is the implementation of NominalSort.
func NewNominalSortImpl ¶
func NewNominalSortImpl(sort *NominalSort) *NominalSortImpl
NewNominalSortImpl creates a new NominalSort Implementation.
func (*NominalSortImpl) AttachChildren ¶
func (impl *NominalSortImpl) AttachChildren(children ...Implementation) Implementation
AttachChildren implements Implementation AttachChildren interface.
func (*NominalSortImpl) CalcCost ¶
func (impl *NominalSortImpl) CalcCost(outCount float64, children ...Implementation) float64
func (*NominalSortImpl) GetCostLimit ¶
func (impl *NominalSortImpl) GetCostLimit(costLimit float64, children ...Implementation) float64
func (*NominalSortImpl) GetPlan ¶
func (impl *NominalSortImpl) GetPlan() PhysicalPlan
func (*NominalSortImpl) ScaleCostLimit ¶
type Operand ¶
type Operand int
Operand is the node of a pattern tree, it represents a logical expression operator. Different from logical plan operator which holds the full information about an expression operator, Operand only stores the type information. An Operand may correspond to a concrete logical plan operator, or it can has special meaning, e.g, a placeholder for any logical plan operator.
const ( // OperandAny is a placeholder for any Operand. OperandAny Operand = iota // OperandJoin is the operand for LogicalJoin. OperandJoin // OperandAggregation is the operand for LogicalAggregation. OperandAggregation // OperandProjection is the operand for LogicalProjection. OperandProjection // OperandSelection is the operand for LogicalSelection. OperandSelection // OperandDataSource is the operand for LogicalDataSource. OperandDataSource // OperandUnionAll is the operand for LogicalUnionAll. OperandUnionAll // OperandSort is the operand for LogicalSort. OperandSort // OperandTopN is the operand for LogicalTopN. OperandTopN // OperandLimit is the operand for LogicalLimit. OperandLimit // OperandTableScan is the operand for TableScan. OperandTableScan // OperandIndexScan is the operand for IndexScan. OperandIndexScan // OperandUnsupported is the operand for unsupported operators. OperandUnsupported )
func GetOperand ¶
func GetOperand(p LogicalPlan) Operand
GetOperand maps logical plan operator to Operand.
type Optimizer ¶
type Optimizer struct {
// contains filtered or unexported fields
}
Optimizer is the struct for cascades optimizer.
func NewPullQueryOptimizer ¶
func NewPullQueryOptimizer() *Optimizer
func NewPushQueryOptimizer ¶
func NewPushQueryOptimizer() *Optimizer
func (*Optimizer) FindBestPlan ¶
func (opt *Optimizer) FindBestPlan(sctx sessionctx.Context, logical LogicalPlan) (p PhysicalPlan, cost float64, err error)
FindBestPlan is the optimization entrance of the cascades planner. The optimization is composed of 3 phases: preprocessing, exploration and implementation.
------------------------------------------------------------------------------ Phase 1: Preprocessing ------------------------------------------------------------------------------
The target of this phase is to preprocess the plan tree by some heuristic rules which should always be beneficial, for example Column Pruning.
------------------------------------------------------------------------------ Phase 2: Exploration ------------------------------------------------------------------------------
The target of this phase is to explore all the logically equivalent expressions by exploring all the equivalent group expressions of each group.
At the very beginning, there is only one group expression in a Group. After applying some transformation rules on certain expressions of the Group, all the equivalent expressions are found and stored in the Group. This procedure can be regarded as searching for a weak connected component in a directed graph, where nodes are expressions and directed edges are the transformation rules.
------------------------------------------------------------------------------ Phase 3: Implementation ------------------------------------------------------------------------------
The target of this phase is to search the best physical plan for a Group which satisfies a certain required physical property.
In this phase, we need to enumerate all the applicable implementation rules for each expression in each group under the required physical property. A memo structure is used for a group to reduce the repeated search on the same required physical property.
func (*Optimizer) GetImplementationRules ¶
func (opt *Optimizer) GetImplementationRules(node LogicalPlan) []ImplementationRule
GetImplementationRules gets all the candidate implementation rules of the optimizer for the logical plan node.
func (*Optimizer) ResetImplementationRules ¶
func (opt *Optimizer) ResetImplementationRules(rules map[Operand][]ImplementationRule) *Optimizer
ResetImplementationRules resets the implementationRuleMap of the optimizer, and returns the optimizer.
func (*Optimizer) ResetTransformationRules ¶
func (opt *Optimizer) ResetTransformationRules(ruleBatches ...TransformationRuleBatch) *Optimizer
ResetTransformationRules resets the transformationRuleBatches of the optimizer, and returns the optimizer.
type OrderEnforcer ¶
type OrderEnforcer struct { }
OrderEnforcer enforces order property on child implementation.
func (*OrderEnforcer) GetEnforceCost ¶
func (e *OrderEnforcer) GetEnforceCost(g *Group) float64
GetEnforceCost calculates cost of sort operator.
func (*OrderEnforcer) NewProperty ¶
func (e *OrderEnforcer) NewProperty(prop *property.PhysicalProperty) (newProp *property.PhysicalProperty)
NewProperty removes order property from required physical property.
func (*OrderEnforcer) OnEnforce ¶
func (e *OrderEnforcer) OnEnforce(reqProp *property.PhysicalProperty, child Implementation) (impl Implementation)
OnEnforce adds sort operator to satisfy required order property.
type Pattern ¶
Pattern defines the match pattern for a rule. It's a tree-like structure which is a piece of a logical expression. Each node in the Pattern tree is defined by an Operand and EngineType pair.
func BuildPattern ¶
BuildPattern builds a Pattern from Operand, EngineType and child Patterns. Used in GetPattern() of Transformation interface to generate a Pattern.
func NewPattern ¶
NewPattern creates a pattern node according to the Operand and EngineType.
func (*Pattern) Match ¶
Match checks whether the EngineTypeSet contains the given EngineType and whether the two Operands match.
func (*Pattern) MatchOperandAny ¶
MatchOperandAny checks whether the pattern's Operand is OperandAny and the EngineTypeSet contains the given EngineType.
func (*Pattern) SetChildren ¶
SetChildren sets the Children information for a pattern node.
type PhysicalHashAgg ¶
type PhysicalHashAgg struct {
// contains filtered or unexported fields
}
PhysicalHashAgg is hash operator of aggregate.
func NewPhysicalHashAgg ¶
func NewPhysicalHashAgg(la *LogicalAggregation, newStats *property.StatsInfo, prop *property.PhysicalProperty) *PhysicalHashAgg
NewPhysicalHashAgg creates a new PhysicalHashAgg from a LogicalAggregation.
func (*PhysicalHashAgg) GetCost ¶
func (p *PhysicalHashAgg) GetCost(inputRows float64, isRoot bool, isMPP bool) float64
GetCost computes the cost of hash aggregation considering CPU/memory.
func (*PhysicalHashAgg) ResolveIndices ¶
func (p *PhysicalHashAgg) ResolveIndices() (err error)
ResolveIndices implements Plan interface.
type PhysicalIndexScan ¶
type PhysicalIndexScan struct { 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 NeedCommonHandle bool // contains filtered or unexported fields }
PhysicalIndexScan represents an index scan plan.
func (PhysicalIndexScan) Init ¶
func (p PhysicalIndexScan) Init(ctx sessionctx.Context, offset int) *PhysicalIndexScan
Init initializes PhysicalIndexScan.
func (*PhysicalIndexScan) ResolveIndices ¶
func (p *PhysicalIndexScan) ResolveIndices() (err error)
func (*PhysicalIndexScan) Schema ¶
func (s *PhysicalIndexScan) Schema() *expression.Schema
Schema implements the Plan.Schema interface.
func (*PhysicalIndexScan) SetSchema ¶
func (s *PhysicalIndexScan) SetSchema(schema *expression.Schema)
SetSchema implements the Plan.SetSchema interface.
type PhysicalLimit ¶
PhysicalLimit is the physical operator of Limit.
func (PhysicalLimit) Init ¶
func (p PhysicalLimit) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalLimit
Init initializes PhysicalLimit.
func (*PhysicalLimit) ResolveIndices ¶
func (p *PhysicalLimit) ResolveIndices() (err error)
func (*PhysicalLimit) Schema ¶
func (s *PhysicalLimit) Schema() *expression.Schema
Schema implements the Plan.Schema interface.
func (*PhysicalLimit) SetSchema ¶
func (s *PhysicalLimit) SetSchema(schema *expression.Schema)
SetSchema implements the Plan.SetSchema interface.
type PhysicalPlan ¶
type PhysicalPlan interface { Plan // getChildReqProps gets the required property by child index. GetChildReqProps(idx int) *property.PhysicalProperty // StatsCount returns the count of property.StatsInfo for this plan. StatsCount() float64 // Get all the children. Children() []PhysicalPlan // SetChildren sets the children for the plan. SetChildren(...PhysicalPlan) // SetChild sets the ith child for the plan. SetChild(i int, child PhysicalPlan) // ResolveIndices resolves the indices for columns. After doing this, the columns can evaluate the rows by their indices. ResolveIndices() error // Stats returns the StatsInfo of the plan. Stats() *property.StatsInfo // Cost returns the estimated cost of the subplan. Cost() float64 // SetCost set the cost of the subplan. SetCost(cost float64) }
PhysicalPlan is a tree of the physical operators.
type PhysicalProjection ¶
type PhysicalProjection struct { Exprs []expression.Expression AvoidColumnEvaluator bool // contains filtered or unexported fields }
PhysicalProjection is the physical operator of projection.
func (*PhysicalProjection) GetCost ¶
func (p *PhysicalProjection) GetCost(count float64) float64
GetCost computes the cost of projection operator itself.
func (PhysicalProjection) Init ¶
func (p PhysicalProjection) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalProjection
Init initializes PhysicalProjection.
func (*PhysicalProjection) ResolveIndices ¶
func (p *PhysicalProjection) ResolveIndices() (err error)
ResolveIndices implements Plan interface.
func (*PhysicalProjection) Schema ¶
func (s *PhysicalProjection) Schema() *expression.Schema
Schema implements the Plan.Schema interface.
func (*PhysicalProjection) SetSchema ¶
func (s *PhysicalProjection) SetSchema(schema *expression.Schema)
SetSchema implements the Plan.SetSchema interface.
type PhysicalSelection ¶
type PhysicalSelection struct { Conditions []expression.Expression // contains filtered or unexported fields }
PhysicalSelection represents a filter.
func (*PhysicalSelection) Children ¶
func (p *PhysicalSelection) Children() []PhysicalPlan
Children implements PhysicalPlan Children interface.
func (*PhysicalSelection) Cost ¶
func (p *PhysicalSelection) Cost() float64
Cost implements PhysicalPlan interface.
func (*PhysicalSelection) GetChildReqProps ¶
func (p *PhysicalSelection) GetChildReqProps(idx int) *property.PhysicalProperty
func (PhysicalSelection) Init ¶
func (p PhysicalSelection) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalSelection
Init initializes PhysicalSelection.
func (*PhysicalSelection) ResolveIndices ¶
func (p *PhysicalSelection) ResolveIndices() (err error)
ResolveIndices implements Plan interface.
func (*PhysicalSelection) Schema ¶
func (p *PhysicalSelection) Schema() *expression.Schema
Schema implements Plan Schema interface.
func (*PhysicalSelection) SetChild ¶
func (p *PhysicalSelection) SetChild(i int, child PhysicalPlan)
SetChild implements PhysicalPlan SetChild interface.
func (*PhysicalSelection) SetChildren ¶
func (p *PhysicalSelection) SetChildren(children ...PhysicalPlan)
SetChildren implements PhysicalPlan SetChildren interface.
func (*PhysicalSelection) SetCost ¶
func (p *PhysicalSelection) SetCost(cost float64)
SetCost implements PhysicalPlan interface.
func (*PhysicalSelection) StatsCount ¶
func (p *PhysicalSelection) StatsCount() float64
type PhysicalSort ¶
PhysicalSort is the physical operator of sort, which implements a memory sort.
func (*PhysicalSort) Children ¶
func (p *PhysicalSort) Children() []PhysicalPlan
Children implements PhysicalPlan Children interface.
func (*PhysicalSort) Cost ¶
func (p *PhysicalSort) Cost() float64
Cost implements PhysicalPlan interface.
func (*PhysicalSort) GetChildReqProps ¶
func (p *PhysicalSort) GetChildReqProps(idx int) *property.PhysicalProperty
func (*PhysicalSort) GetCost ¶
func (p *PhysicalSort) GetCost(count float64, schema *expression.Schema) float64
GetCost computes the cost of in memory sort.
func (PhysicalSort) Init ¶
func (p PhysicalSort) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalSort
Init initializes PhysicalSort.
func (*PhysicalSort) ResolveIndices ¶
func (p *PhysicalSort) ResolveIndices() (err error)
ResolveIndices implements Plan interface.
func (*PhysicalSort) Schema ¶
func (p *PhysicalSort) Schema() *expression.Schema
Schema implements Plan Schema interface.
func (*PhysicalSort) SetChild ¶
func (p *PhysicalSort) SetChild(i int, child PhysicalPlan)
SetChild implements PhysicalPlan SetChild interface.
func (*PhysicalSort) SetChildren ¶
func (p *PhysicalSort) SetChildren(children ...PhysicalPlan)
SetChildren implements PhysicalPlan SetChildren interface.
func (*PhysicalSort) SetCost ¶
func (p *PhysicalSort) SetCost(cost float64)
SetCost implements PhysicalPlan interface.
func (*PhysicalSort) StatsCount ¶
func (p *PhysicalSort) StatsCount() float64
type PhysicalTableDual ¶
type PhysicalTableDual struct { RowCount int // contains filtered or unexported fields }
PhysicalTableDual is the physical operator of dual.
func (PhysicalTableDual) Init ¶
func (p PhysicalTableDual) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int) *PhysicalTableDual
Init initializes PhysicalTableDual.
func (*PhysicalTableDual) OutputNames ¶
func (p *PhysicalTableDual) OutputNames() types.NameSlice
OutputNames returns the outputting names of each column.
func (*PhysicalTableDual) ResolveIndices ¶
func (p *PhysicalTableDual) ResolveIndices() (err error)
func (*PhysicalTableDual) Schema ¶
func (s *PhysicalTableDual) Schema() *expression.Schema
Schema implements the Plan.Schema interface.
func (*PhysicalTableDual) SetOutputNames ¶
func (p *PhysicalTableDual) SetOutputNames(names types.NameSlice)
SetOutputNames sets the outputting name by the given slice.
func (*PhysicalTableDual) SetSchema ¶
func (s *PhysicalTableDual) SetSchema(schema *expression.Schema)
SetSchema implements the Plan.SetSchema interface.
type PhysicalTableScan ¶
type PhysicalTableScan struct { // AccessCondition is used to calculate range. AccessCondition []expression.Expression Table *model.TableInfo Columns []*model.ColumnInfo DBName model.CIStr Ranges []*ranger.Range PkCols []*expression.Column 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 HandleCols HandleCols IsGlobalRead bool // 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) Init ¶
func (p PhysicalTableScan) Init(ctx sessionctx.Context, offset int) *PhysicalTableScan
Init initializes PhysicalTableScan.
func (*PhysicalTableScan) ResolveIndices ¶
func (p *PhysicalTableScan) ResolveIndices() (err error)
func (*PhysicalTableScan) Schema ¶
func (s *PhysicalTableScan) Schema() *expression.Schema
Schema implements the Plan.Schema interface.
func (*PhysicalTableScan) SetSchema ¶
func (s *PhysicalTableScan) SetSchema(schema *expression.Schema)
SetSchema implements the Plan.SetSchema interface.
type PhysicalTopN ¶
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 ¶
func (p *PhysicalTopN) Children() []PhysicalPlan
Children implements PhysicalPlan Children interface.
func (*PhysicalTopN) Cost ¶
func (p *PhysicalTopN) Cost() float64
Cost implements PhysicalPlan interface.
func (*PhysicalTopN) GetChildReqProps ¶
func (p *PhysicalTopN) GetChildReqProps(idx int) *property.PhysicalProperty
func (*PhysicalTopN) GetCost ¶
func (p *PhysicalTopN) GetCost(count float64, isRoot bool) float64
GetCost computes cost of TopN operator itself.
func (PhysicalTopN) Init ¶
func (p PhysicalTopN) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalTopN
Init initializes PhysicalTopN.
func (*PhysicalTopN) ResolveIndices ¶
func (p *PhysicalTopN) ResolveIndices() (err error)
ResolveIndices implements Plan interface.
func (*PhysicalTopN) Schema ¶
func (p *PhysicalTopN) Schema() *expression.Schema
Schema implements Plan Schema interface.
func (*PhysicalTopN) SetChild ¶
func (p *PhysicalTopN) SetChild(i int, child PhysicalPlan)
SetChild implements PhysicalPlan SetChild interface.
func (*PhysicalTopN) SetChildren ¶
func (p *PhysicalTopN) SetChildren(children ...PhysicalPlan)
SetChildren implements PhysicalPlan SetChildren interface.
func (*PhysicalTopN) SetCost ¶
func (p *PhysicalTopN) SetCost(cost float64)
SetCost implements PhysicalPlan interface.
func (*PhysicalTopN) StatsCount ¶
func (p *PhysicalTopN) StatsCount() float64
type PhysicalUnionAll ¶
type PhysicalUnionAll struct {
// contains filtered or unexported fields
}
PhysicalUnionAll is the physical operator of UnionAll.
func (PhysicalUnionAll) Init ¶
func (p PhysicalUnionAll) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalUnionAll
Init initializes PhysicalUnionAll.
func (*PhysicalUnionAll) ResolveIndices ¶
func (p *PhysicalUnionAll) ResolveIndices() (err error)
func (*PhysicalUnionAll) Schema ¶
func (s *PhysicalUnionAll) Schema() *expression.Schema
Schema implements the Plan.Schema interface.
func (*PhysicalUnionAll) SetSchema ¶
func (s *PhysicalUnionAll) SetSchema(schema *expression.Schema)
SetSchema implements the Plan.SetSchema interface.
type PhysicalUnionScan ¶
type PhysicalUnionScan struct { Conditions []expression.Expression HandleCols HandleCols // contains filtered or unexported fields }
PhysicalUnionScan represents a union scan operator.
func (*PhysicalUnionScan) Children ¶
func (p *PhysicalUnionScan) Children() []PhysicalPlan
Children implements PhysicalPlan Children interface.
func (*PhysicalUnionScan) Cost ¶
func (p *PhysicalUnionScan) Cost() float64
Cost implements PhysicalPlan interface.
func (*PhysicalUnionScan) GetChildReqProps ¶
func (p *PhysicalUnionScan) GetChildReqProps(idx int) *property.PhysicalProperty
func (PhysicalUnionScan) Init ¶
func (p PhysicalUnionScan) Init(ctx sessionctx.Context, stats *property.StatsInfo, offset int, props ...*property.PhysicalProperty) *PhysicalUnionScan
Init initializes PhysicalUnionScan.
func (*PhysicalUnionScan) ResolveIndices ¶
func (p *PhysicalUnionScan) ResolveIndices() (err error)
ResolveIndices implements Plan interface.
func (*PhysicalUnionScan) Schema ¶
func (p *PhysicalUnionScan) Schema() *expression.Schema
Schema implements Plan Schema interface.
func (*PhysicalUnionScan) SetChild ¶
func (p *PhysicalUnionScan) SetChild(i int, child PhysicalPlan)
SetChild implements PhysicalPlan SetChild interface.
func (*PhysicalUnionScan) SetChildren ¶
func (p *PhysicalUnionScan) SetChildren(children ...PhysicalPlan)
SetChildren implements PhysicalPlan SetChildren interface.
func (*PhysicalUnionScan) SetCost ¶
func (p *PhysicalUnionScan) SetCost(cost float64)
SetCost implements PhysicalPlan interface.
func (*PhysicalUnionScan) StatsCount ¶
func (p *PhysicalUnionScan) StatsCount() float64
type Plan ¶
type Plan interface { // Get the schema. Schema() *expression.Schema // Get the ID. ID() int SCtx() sessionctx.Context // OutputNames returns the outputting names of each column. OutputNames() types.NameSlice // SetOutputNames sets the outputting name by the given slice. SetOutputNames(names types.NameSlice) SelectBlockOffset() int // contains filtered or unexported methods }
Plan is the description of an execution flow. It is created from ast.Node first, then optimized by the optimizer, finally used by the executor to create a Cursor which executes the statement.
type PlanBuilder ¶
type PlanBuilder struct {
// contains filtered or unexported fields
}
PlanBuilder builds Plan from an ast.Node. It just builds the ast node straightforwardly.
func NewPlanBuilder ¶
func NewPlanBuilder(sctx sessionctx.Context, is infoschema.InfoSchema) *PlanBuilder
NewPlanBuilder creates a new PlanBuilder. Return the original PlannerSelectBlockAsName as well, callers decide if PlannerSelectBlockAsName should be restored after using this builder.
func (*PlanBuilder) Build ¶
func (b *PlanBuilder) Build(node ast.Node) (Plan, error)
Build builds the ast node to a Plan.
func (*PlanBuilder) GetOptFlag ¶
func (b *PlanBuilder) GetOptFlag() uint64
GetOptFlag gets the optFlag of the PlanBuilder.
type PreprocessOpt ¶
type PreprocessOpt func(*preprocessor)
PreprocessOpt presents optional parameters to `Preprocess` method.
type PreprocessorReturn ¶
type PreprocessorReturn struct { ExplicitStaleness bool SnapshotTSEvaluator func(sessionctx.Context) (uint64, error) // LastSnapshotTS is the last evaluated snapshotTS if any // otherwise it defaults to zero LastSnapshotTS uint64 InfoSchema infoschema.InfoSchema TxnScope string // contains filtered or unexported fields }
PreprocessorReturn is used to retain information obtained in the preprocessor.
type ProjectionImpl ¶
type ProjectionImpl struct {
// contains filtered or unexported fields
}
ProjectionImpl is the implementation of PhysicalProjection.
func NewProjectionImpl ¶
func NewProjectionImpl(proj *PhysicalProjection) *ProjectionImpl
NewProjectionImpl creates a new projection Implementation.
func (*ProjectionImpl) AttachChildren ¶
func (impl *ProjectionImpl) AttachChildren(children ...Implementation) Implementation
func (*ProjectionImpl) CalcCost ¶
func (impl *ProjectionImpl) CalcCost(outCount float64, children ...Implementation) float64
CalcCost implements Implementation CalcCost interface.
func (*ProjectionImpl) GetCostLimit ¶
func (impl *ProjectionImpl) GetCostLimit(costLimit float64, children ...Implementation) float64
func (*ProjectionImpl) GetPlan ¶
func (impl *ProjectionImpl) GetPlan() PhysicalPlan
func (*ProjectionImpl) ScaleCostLimit ¶
type PushLimitDownOuterJoin ¶
type PushLimitDownOuterJoin struct {
// contains filtered or unexported fields
}
PushLimitDownOuterJoin pushes Limit through Join.
func (*PushLimitDownOuterJoin) GetPattern ¶
func (r *PushLimitDownOuterJoin) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*PushLimitDownOuterJoin) Match ¶
func (r *PushLimitDownOuterJoin) Match(expr *ExprIter) bool
Match implements Transformation interface.
func (*PushLimitDownOuterJoin) OnTransform ¶
func (r *PushLimitDownOuterJoin) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. This rule tries to pushes the Limit through outer Join.
type PushLimitDownProjection ¶
type PushLimitDownProjection struct {
// contains filtered or unexported fields
}
PushLimitDownProjection pushes Limit to Projection.
func (*PushLimitDownProjection) GetPattern ¶
func (r *PushLimitDownProjection) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*PushLimitDownProjection) Match ¶
func (r *PushLimitDownProjection) Match(expr *ExprIter) bool
Match implements Transformation interface.
func (*PushLimitDownProjection) OnTransform ¶
func (r *PushLimitDownProjection) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. This rule tries to pushes the Limit through Projection.
type PushLimitDownUnionAll ¶
type PushLimitDownUnionAll struct {
// contains filtered or unexported fields
}
PushLimitDownUnionAll pushes limit to union all.
func (*PushLimitDownUnionAll) GetPattern ¶
func (r *PushLimitDownUnionAll) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*PushLimitDownUnionAll) Match ¶
func (r *PushLimitDownUnionAll) Match(expr *ExprIter) bool
Match implements Transformation interface. Use appliedRuleSet in GroupExpr to avoid re-apply rules.
func (*PushLimitDownUnionAll) OnTransform ¶
func (r *PushLimitDownUnionAll) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. It will transform `Limit->UnionAll->X` to `Limit->UnionAll->Limit->X`.
type PushSelDownAggregation ¶
type PushSelDownAggregation struct {
// contains filtered or unexported fields
}
PushSelDownAggregation pushes Selection down to the child of Aggregation.
func (*PushSelDownAggregation) GetPattern ¶
func (r *PushSelDownAggregation) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*PushSelDownAggregation) OnTransform ¶
func (r *PushSelDownAggregation) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. It will transform `sel->agg->x` to `agg->sel->x` or `sel->agg->sel->x` or just keep the selection unchanged.
type PushSelDownIndexScan ¶
type PushSelDownIndexScan struct {
// contains filtered or unexported fields
}
PushSelDownIndexScan pushes a Selection down to IndexScan.
func (*PushSelDownIndexScan) GetPattern ¶
func (r *PushSelDownIndexScan) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*PushSelDownIndexScan) OnTransform ¶
func (r *PushSelDownIndexScan) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. It will transform `Selection -> IndexScan` to:
`IndexScan(with a new access range)` or `Selection -> IndexScan(with a new access range)` or just keep the two GroupExprs unchanged.
type PushSelDownJoin ¶
type PushSelDownJoin struct {
// contains filtered or unexported fields
}
PushSelDownJoin pushes Selection through Join.
func (*PushSelDownJoin) GetPattern ¶
func (r *PushSelDownJoin) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*PushSelDownJoin) Match ¶
func (r *PushSelDownJoin) Match(expr *ExprIter) bool
Match implements Transformation interface.
func (*PushSelDownJoin) OnTransform ¶
func (r *PushSelDownJoin) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. This rule tries to pushes the Selection through Join. Besides, this rule fulfills the `XXXConditions` field of Join.
type PushSelDownProjection ¶
type PushSelDownProjection struct {
// contains filtered or unexported fields
}
PushSelDownProjection pushes the Selection down to the child of Projection.
func (*PushSelDownProjection) GetPattern ¶
func (r *PushSelDownProjection) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*PushSelDownProjection) OnTransform ¶
func (r *PushSelDownProjection) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. It will transform `selection -> projection -> x` to 1. `projection -> selection -> x` or 2. `selection -> projection -> selection -> x` or 3. just keep unchanged.
type PushSelDownSort ¶
type PushSelDownSort struct {
// contains filtered or unexported fields
}
PushSelDownSort pushes the Selection down to the child of Sort.
func (*PushSelDownSort) GetPattern ¶
func (r *PushSelDownSort) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*PushSelDownSort) OnTransform ¶
func (r *PushSelDownSort) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. It will transform `sel->sort->x` to `sort->sel->x`.
type PushSelDownTableScan ¶
type PushSelDownTableScan struct {
// contains filtered or unexported fields
}
PushSelDownTableScan pushes the selection down to TableScan.
func (*PushSelDownTableScan) GetPattern ¶
func (r *PushSelDownTableScan) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*PushSelDownTableScan) OnTransform ¶
func (r *PushSelDownTableScan) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface.
It transforms `sel -> ts` to one of the following new exprs: 1. `newSel -> newTS` 2. `newTS`
Filters of the old `sel` operator are removed if they are used to calculate the key ranges of the `ts` operator.
type PushSelDownUnionAll ¶
type PushSelDownUnionAll struct {
// contains filtered or unexported fields
}
PushSelDownUnionAll pushes selection through union all.
func (*PushSelDownUnionAll) GetPattern ¶
func (r *PushSelDownUnionAll) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*PushSelDownUnionAll) OnTransform ¶
func (r *PushSelDownUnionAll) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. It will transform `Selection->UnionAll->x` to `UnionAll->Selection->x`.
type PushTopNDownOuterJoin ¶
type PushTopNDownOuterJoin struct {
// contains filtered or unexported fields
}
PushTopNDownOuterJoin pushes topN to outer join.
func (*PushTopNDownOuterJoin) GetPattern ¶
func (r *PushTopNDownOuterJoin) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*PushTopNDownOuterJoin) Match ¶
func (r *PushTopNDownOuterJoin) Match(expr *ExprIter) bool
Match implements Transformation interface. Use appliedRuleSet in GroupExpr to avoid re-apply rules.
func (*PushTopNDownOuterJoin) OnTransform ¶
func (r *PushTopNDownOuterJoin) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. This rule will transform `TopN->OuterJoin->(OuterChild, InnerChild)` to `TopN->OuterJoin->(TopN->OuterChild, InnerChild)`
type PushTopNDownProjection ¶
type PushTopNDownProjection struct {
// contains filtered or unexported fields
}
PushTopNDownProjection pushes TopN to Projection.
func (*PushTopNDownProjection) GetPattern ¶
func (r *PushTopNDownProjection) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*PushTopNDownProjection) Match ¶
func (r *PushTopNDownProjection) Match(expr *ExprIter) bool
Match implements Transformation interface.
func (*PushTopNDownProjection) OnTransform ¶
func (r *PushTopNDownProjection) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. This rule tries to pushes the TopN through Projection.
type PushTopNDownUnionAll ¶
type PushTopNDownUnionAll struct {
// contains filtered or unexported fields
}
PushTopNDownUnionAll pushes topN to union all.
func (*PushTopNDownUnionAll) GetPattern ¶
func (r *PushTopNDownUnionAll) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*PushTopNDownUnionAll) Match ¶
func (r *PushTopNDownUnionAll) Match(expr *ExprIter) bool
Match implements Transformation interface. Use appliedRuleSet in GroupExpr to avoid re-apply rules.
func (*PushTopNDownUnionAll) OnTransform ¶
func (r *PushTopNDownUnionAll) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. It will transform `TopN->UnionAll->X` to `TopN->UnionAll->TopN->X`.
type SortImpl ¶
type SortImpl struct {
// contains filtered or unexported fields
}
SortImpl implementation of PhysicalSort.
func NewSortImpl ¶
func NewSortImpl(sort *PhysicalSort) *SortImpl
NewSortImpl creates a new sort Implementation.
func (*SortImpl) AttachChildren ¶
func (impl *SortImpl) AttachChildren(children ...Implementation) Implementation
AttachChildren implements Implementation AttachChildren interface.
func (*SortImpl) CalcCost ¶
func (impl *SortImpl) CalcCost(outCount float64, children ...Implementation) float64
CalcCost calculates the cost of the sort Implementation.
func (*SortImpl) GetCostLimit ¶
func (impl *SortImpl) GetCostLimit(costLimit float64, children ...Implementation) float64
func (*SortImpl) GetPlan ¶
func (impl *SortImpl) GetPlan() PhysicalPlan
func (*SortImpl) ScaleCostLimit ¶
type TableScanImpl ¶
type TableScanImpl struct {
// contains filtered or unexported fields
}
TableScanImpl implementation of PhysicalTableScan.
func NewTableScanImpl ¶
func NewTableScanImpl(ts *PhysicalTableScan, cols []*expression.Column, hists *statistics.HistColl) *TableScanImpl
NewTableScanImpl creates a new table scan Implementation.
func (*TableScanImpl) AttachChildren ¶
func (impl *TableScanImpl) AttachChildren(children ...Implementation) Implementation
func (*TableScanImpl) CalcCost ¶
func (impl *TableScanImpl) CalcCost(outCount float64, children ...Implementation) float64
CalcCost calculates the cost of the table scan Implementation.
func (*TableScanImpl) GetCostLimit ¶
func (impl *TableScanImpl) GetCostLimit(costLimit float64, children ...Implementation) float64
func (*TableScanImpl) GetPlan ¶
func (impl *TableScanImpl) GetPlan() PhysicalPlan
func (*TableScanImpl) ScaleCostLimit ¶
type TblColPosInfo ¶
type TblColPosInfo struct { TblID int64 // Start and End represent the ordinal range [Start, End) of the consecutive columns. Start, End int // HandleOrdinal represents the ordinal of the handle column. HandleCols HandleCols }
TblColPosInfo represents an mapper from column index to handle index.
type TblColPosInfoSlice ¶
type TblColPosInfoSlice []TblColPosInfo
TblColPosInfoSlice attaches the methods of sort.Interface to []TblColPosInfos sorting in increasing order.
func (TblColPosInfoSlice) FindTblIdx ¶
func (c TblColPosInfoSlice) FindTblIdx(colOrdinal int) (int, bool)
FindTblIdx finds the ordinal of the corresponding access column.
func (TblColPosInfoSlice) Len ¶
func (c TblColPosInfoSlice) Len() int
Len implements sort.Interface#Len.
func (TblColPosInfoSlice) Less ¶
func (c TblColPosInfoSlice) Less(i, j int) bool
Less implements sort.Interface#Less.
func (TblColPosInfoSlice) Swap ¶
func (c TblColPosInfoSlice) Swap(i, j int)
Swap implements sort.Interface#Swap.
type TiDBHashAggImpl ¶
type TiDBHashAggImpl struct {
// contains filtered or unexported fields
}
TiDBHashAggImpl is the implementation of PhysicalHashAgg in TiDB layer.
func NewTiDBHashAggImpl ¶
func NewTiDBHashAggImpl(agg *PhysicalHashAgg) *TiDBHashAggImpl
NewTiDBHashAggImpl creates a new TiDBHashAggImpl.
func (*TiDBHashAggImpl) AttachChildren ¶
func (agg *TiDBHashAggImpl) AttachChildren(children ...Implementation) Implementation
AttachChildren implements Implementation AttachChildren interface.
func (*TiDBHashAggImpl) CalcCost ¶
func (agg *TiDBHashAggImpl) CalcCost(outCount float64, children ...Implementation) float64
CalcCost implements Implementation CalcCost interface.
func (*TiDBHashAggImpl) GetCostLimit ¶
func (impl *TiDBHashAggImpl) GetCostLimit(costLimit float64, children ...Implementation) float64
func (*TiDBHashAggImpl) GetPlan ¶
func (impl *TiDBHashAggImpl) GetPlan() PhysicalPlan
func (*TiDBHashAggImpl) ScaleCostLimit ¶
type TiDBSelectionImpl ¶
type TiDBSelectionImpl struct {
// contains filtered or unexported fields
}
TiDBSelectionImpl is the implementation of PhysicalSelection in TiDB layer.
func NewTiDBSelectionImpl ¶
func NewTiDBSelectionImpl(sel *PhysicalSelection) *TiDBSelectionImpl
NewTiDBSelectionImpl creates a new TiDBSelectionImpl.
func (*TiDBSelectionImpl) AttachChildren ¶
func (impl *TiDBSelectionImpl) AttachChildren(children ...Implementation) Implementation
func (*TiDBSelectionImpl) CalcCost ¶
func (sel *TiDBSelectionImpl) CalcCost(outCount float64, children ...Implementation) float64
CalcCost implements Implementation CalcCost interface.
func (*TiDBSelectionImpl) GetCostLimit ¶
func (impl *TiDBSelectionImpl) GetCostLimit(costLimit float64, children ...Implementation) float64
func (*TiDBSelectionImpl) GetPlan ¶
func (impl *TiDBSelectionImpl) GetPlan() PhysicalPlan
func (*TiDBSelectionImpl) ScaleCostLimit ¶
type TiDBTopNImpl ¶
type TiDBTopNImpl struct {
// contains filtered or unexported fields
}
TiDBTopNImpl is the implementation of PhysicalTopN in TiDB layer.
func NewTiDBTopNImpl ¶
func NewTiDBTopNImpl(topN *PhysicalTopN) *TiDBTopNImpl
NewTiDBTopNImpl creates a new TiDBTopNImpl.
func (*TiDBTopNImpl) AttachChildren ¶
func (impl *TiDBTopNImpl) AttachChildren(children ...Implementation) Implementation
func (*TiDBTopNImpl) CalcCost ¶
func (impl *TiDBTopNImpl) CalcCost(outCount float64, children ...Implementation) float64
CalcCost implements Implementation CalcCost interface.
func (*TiDBTopNImpl) GetCostLimit ¶
func (impl *TiDBTopNImpl) GetCostLimit(costLimit float64, children ...Implementation) float64
func (*TiDBTopNImpl) GetPlan ¶
func (impl *TiDBTopNImpl) GetPlan() PhysicalPlan
func (*TiDBTopNImpl) ScaleCostLimit ¶
type TransformAggToProj ¶
type TransformAggToProj struct {
// contains filtered or unexported fields
}
TransformAggToProj convert Agg to Proj.
func (*TransformAggToProj) GetPattern ¶
func (r *TransformAggToProj) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*TransformAggToProj) Match ¶
func (r *TransformAggToProj) Match(expr *ExprIter) bool
Match implements Transformation interface.
func (*TransformAggToProj) OnTransform ¶
func (r *TransformAggToProj) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. This rule tries to convert agg to proj.
type TransformAggregateCaseToSelection ¶
type TransformAggregateCaseToSelection struct {
// contains filtered or unexported fields
}
TransformAggregateCaseToSelection convert Agg(case when) to Agg->Selection.
func (*TransformAggregateCaseToSelection) GetPattern ¶
func (r *TransformAggregateCaseToSelection) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*TransformAggregateCaseToSelection) Match ¶
func (r *TransformAggregateCaseToSelection) Match(expr *ExprIter) bool
Match implements Transformation interface.
func (*TransformAggregateCaseToSelection) OnTransform ¶
func (r *TransformAggregateCaseToSelection) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. This rule tries to convert Agg(case when) to Agg->Selection.
type TransformJoinCondToSel ¶
type TransformJoinCondToSel struct {
// contains filtered or unexported fields
}
TransformJoinCondToSel convert Join(len(cond) > 0) to Join-->(Sel, Sel).
func (*TransformJoinCondToSel) GetPattern ¶
func (r *TransformJoinCondToSel) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*TransformJoinCondToSel) Match ¶
func (r *TransformJoinCondToSel) Match(expr *ExprIter) bool
Match implements Transformation interface.
func (*TransformJoinCondToSel) OnTransform ¶
func (r *TransformJoinCondToSel) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. This rule tries to transform Join conditions to Selection. Besides, this rule fulfills the `XXXConditions` field of Join.
type TransformLimitToTableDual ¶
type TransformLimitToTableDual struct {
// contains filtered or unexported fields
}
TransformLimitToTableDual convert limit to TableDual.
func (*TransformLimitToTableDual) GetPattern ¶
func (r *TransformLimitToTableDual) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*TransformLimitToTableDual) Match ¶
func (r *TransformLimitToTableDual) Match(expr *ExprIter) bool
Match implements Transformation interface.
func (*TransformLimitToTableDual) OnTransform ¶
func (r *TransformLimitToTableDual) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. This rule tries to convert limit to tableDual.
type TransformLimitToTopN ¶
type TransformLimitToTopN struct {
// contains filtered or unexported fields
}
TransformLimitToTopN transforms Limit+Sort to TopN.
func (*TransformLimitToTopN) GetPattern ¶
func (r *TransformLimitToTopN) GetPattern() *Pattern
GetPattern implements Transformation Interface.
func (*TransformLimitToTopN) OnTransform ¶
func (r *TransformLimitToTopN) OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error)
OnTransform implements Transformation interface. This rule will transform `Limit -> Sort -> x` to `TopN -> x`.
type Transformation ¶
type Transformation interface { // GetPattern gets the cached pattern of the rule. GetPattern() *Pattern // Match is used to check whether the GroupExpr satisfies all the requirements of the transformation rule. // // The pattern only identifies the operator type, some transformation rules also need // detailed information for certain plan operators to decide whether it is applicable. Match(expr *ExprIter) bool // OnTransform does the real work of the optimization rule. // // newExprs indicates the new GroupExprs generated by the transformationrule. Multiple GroupExprs may be // returned, e.g, EnumeratePath would convert LogicalDataSource to several possible assess paths. // // eraseOld indicates that the returned GroupExpr must be better than the old one, so we can remove it from Group. // // eraseAll indicates that the returned GroupExpr must be better than all other candidates in the Group, e.g, we can // prune all other access paths if we found the filter is constantly false. OnTransform(old *ExprIter) (newExprs []*GroupExpr, eraseOld bool, eraseAll bool, err error) }
Transformation defines the interface for the transformation rules.
func NewRuleDSToScans ¶
func NewRuleDSToScans() Transformation
func NewRuleEliminateOuterJoinBelowAggregation ¶
func NewRuleEliminateOuterJoinBelowAggregation() Transformation
NewRuleEliminateOuterJoinBelowAggregation creates a new Transformation EliminateOuterJoinBelowAggregation. The pattern of this rule is `Aggregation->Join->X`.
func NewRuleEliminateOuterJoinBelowProjection ¶
func NewRuleEliminateOuterJoinBelowProjection() Transformation
NewRuleEliminateOuterJoinBelowProjection creates a new Transformation EliminateOuterJoinBelowProjection. The pattern of this rule is `Projection->Join->X`.
func NewRuleEliminateProjection ¶
func NewRuleEliminateProjection() Transformation
NewRuleEliminateProjection creates a new Transformation EliminateProjection. The pattern of this rule is `Projection -> Any`.
func NewRuleEliminateSingleMaxMin ¶
func NewRuleEliminateSingleMaxMin() Transformation
NewRuleEliminateSingleMaxMin creates a new Transformation EliminateSingleMaxMin. The pattern of this rule is `max/min->X`.
func NewRuleInjectProjectionBelowAgg ¶
func NewRuleInjectProjectionBelowAgg() Transformation
NewRuleInjectProjectionBelowAgg creates a new Transformation NewRuleInjectProjectionBelowAgg. It will extract the ScalarFunctions of `AggFuncDesc` and `GroupByItems` into a Projection and injects it below Agg. The reason why we need this rule is that, AggExecutor in TiDB does not support ScalarFunction as `AggFuncDesc.Arg` and `GroupByItem`. So we have to use a Projection to calculate the ScalarFunctions in advance. The pattern of this rule is: a single Aggregation.
func NewRuleInjectProjectionBelowTopN ¶
func NewRuleInjectProjectionBelowTopN() Transformation
NewRuleInjectProjectionBelowTopN creates a new Transformation InjectProjectionBelowTopN. It will extract the ScalarFunctions of `ByItems` into a Projection and injects it below TopN. When a Projection is injected as the child of TopN, we need to add another Projection upon TopN to prune the extra Columns. The reason why we need this rule is that, TopNExecutor in TiDB does not support ScalarFunction as `ByItem`. So we have to use a Projection to calculate the ScalarFunctions in advance. The pattern of this rule is: a single TopN
func NewRuleMergeAdjacentLimit ¶
func NewRuleMergeAdjacentLimit() Transformation
NewRuleMergeAdjacentLimit creates a new Transformation MergeAdjacentLimit. The pattern of this rule is `Limit->Limit->X`.
func NewRuleMergeAdjacentProjection ¶
func NewRuleMergeAdjacentProjection() Transformation
NewRuleMergeAdjacentProjection creates a new Transformation MergeAdjacentProjection. The pattern of this rule is `Projection -> Projection`.
func NewRuleMergeAdjacentSelection ¶
func NewRuleMergeAdjacentSelection() Transformation
NewRuleMergeAdjacentSelection creates a new Transformation MergeAdjacentSelection. The pattern of this rule is `Selection->Selection->X`.
func NewRuleMergeAdjacentTopN ¶
func NewRuleMergeAdjacentTopN() Transformation
NewRuleMergeAdjacentTopN creates a new Transformation MergeAdjacentTopN. The pattern of this rule is `TopN->TopN->X`.
func NewRuleMergeAggregationProjection ¶
func NewRuleMergeAggregationProjection() Transformation
NewRuleMergeAggregationProjection creates a new Transformation MergeAggregationProjection. The pattern of this rule is: `Aggregation -> Projection`.
func NewRulePushLimitDownOuterJoin ¶
func NewRulePushLimitDownOuterJoin() Transformation
NewRulePushLimitDownOuterJoin creates a new Transformation PushLimitDownOuterJoin. The pattern of this rule is `Limit -> Join`.
func NewRulePushLimitDownProjection ¶
func NewRulePushLimitDownProjection() Transformation
NewRulePushLimitDownProjection creates a new Transformation. The pattern of this rule is `Limit->Projection->X` to `Projection->Limit->X`.
func NewRulePushLimitDownUnionAll ¶
func NewRulePushLimitDownUnionAll() Transformation
NewRulePushLimitDownUnionAll creates a new Transformation PushLimitDownUnionAll. The pattern of this rule is `Limit->UnionAll->X`.
func NewRulePushSelDownAggregation ¶
func NewRulePushSelDownAggregation() Transformation
NewRulePushSelDownAggregation creates a new Transformation PushSelDownAggregation. The pattern of this rule is `Selection -> Aggregation`.
func NewRulePushSelDownIndexScan ¶
func NewRulePushSelDownIndexScan() Transformation
NewRulePushSelDownIndexScan creates a new Transformation PushSelDownIndexScan. The pattern of this rule is `Selection -> IndexScan`.
func NewRulePushSelDownJoin ¶
func NewRulePushSelDownJoin() Transformation
NewRulePushSelDownJoin creates a new Transformation PushSelDownJoin. The pattern of this rule is `Selection -> Join`.
func NewRulePushSelDownProjection ¶
func NewRulePushSelDownProjection() Transformation
NewRulePushSelDownProjection creates a new Transformation PushSelDownProjection. The pattern of this rule is: `Selection -> Projection`.
func NewRulePushSelDownSort ¶
func NewRulePushSelDownSort() Transformation
NewRulePushSelDownSort creates a new Transformation PushSelDownSort. The pattern of this rule is: `Selection -> Sort`.
func NewRulePushSelDownTableScan ¶
func NewRulePushSelDownTableScan() Transformation
NewRulePushSelDownTableScan creates a new Transformation PushSelDownTableScan. The pattern of this rule is: `Selection -> TableScan`
func NewRulePushSelDownUnionAll ¶
func NewRulePushSelDownUnionAll() Transformation
NewRulePushSelDownUnionAll creates a new Transformation PushSelDownUnionAll. The pattern of this rule is `Selection -> UnionAll`.
func NewRulePushTopNDownOuterJoin ¶
func NewRulePushTopNDownOuterJoin() Transformation
NewRulePushTopNDownOuterJoin creates a new Transformation PushTopNDownOuterJoin. The pattern of this rule is: `TopN -> Join`.
func NewRulePushTopNDownProjection ¶
func NewRulePushTopNDownProjection() Transformation
NewRulePushTopNDownProjection creates a new Transformation PushTopNDownProjection. The pattern of this rule is `TopN->Projection->X` to `Projection->TopN->X`.
func NewRulePushTopNDownUnionAll ¶
func NewRulePushTopNDownUnionAll() Transformation
NewRulePushTopNDownUnionAll creates a new Transformation PushTopNDownUnionAll. The pattern of this rule is `TopN->UnionAll->X`.
func NewRuleTransformAggToProj ¶
func NewRuleTransformAggToProj() Transformation
NewRuleTransformAggToProj creates a new Transformation TransformAggToProj. The pattern of this rule is `Agg`.
func NewRuleTransformAggregateCaseToSelection ¶
func NewRuleTransformAggregateCaseToSelection() Transformation
NewRuleTransformAggregateCaseToSelection creates a new Transformation TransformAggregateCaseToSelection. The pattern of this rule is `Agg->X`.
func NewRuleTransformJoinCondToSel ¶
func NewRuleTransformJoinCondToSel() Transformation
NewRuleTransformJoinCondToSel creates a new Transformation TransformJoinCondToSel. The pattern of this rule is: `Join`.
func NewRuleTransformLimitToTableDual ¶
func NewRuleTransformLimitToTableDual() Transformation
NewRuleTransformLimitToTableDual creates a new Transformation TransformLimitToTableDual. The pattern of this rule is `Limit->X`.
func NewRuleTransformLimitToTopN ¶
func NewRuleTransformLimitToTopN() Transformation
NewRuleTransformLimitToTopN creates a new Transformation TransformLimitToTopN. The pattern of this rule is `Limit -> Sort`.
type TransformationRuleBatch ¶
type TransformationRuleBatch map[Operand][]Transformation
TransformationRuleBatch is a batch of transformation rules.
type UnionAllImpl ¶
type UnionAllImpl struct {
// contains filtered or unexported fields
}
UnionAllImpl is the implementation of PhysicalUnionAll.
func NewUnionAllImpl ¶
func NewUnionAllImpl(union *PhysicalUnionAll) *UnionAllImpl
NewUnionAllImpl creates a new UnionAllImpl.
func (*UnionAllImpl) AttachChildren ¶
func (impl *UnionAllImpl) AttachChildren(children ...Implementation) Implementation
func (*UnionAllImpl) CalcCost ¶
func (impl *UnionAllImpl) CalcCost(outCount float64, children ...Implementation) float64
CalcCost implements Implementation CalcCost interface.
func (*UnionAllImpl) GetCostLimit ¶
func (impl *UnionAllImpl) GetCostLimit(costLimit float64, children ...Implementation) float64
GetCostLimit implements Implementation interface.
func (*UnionAllImpl) GetPlan ¶
func (impl *UnionAllImpl) GetPlan() PhysicalPlan
func (*UnionAllImpl) ScaleCostLimit ¶
Source Files ¶
- base.go
- constants.go
- datasource.go
- enforcer_rules.go
- expr_iterator.go
- expression_rewriter.go
- group.go
- group_expr.go
- handle_cols.go
- id.go
- implementation.go
- implementation_rules.go
- logical_aggregation.go
- logical_datasource.go
- logical_indexscan.go
- logical_join.go
- logical_limit.go
- logical_plan_builder.go
- logical_plans.go
- logical_projection.go
- logical_schemaproducer.go
- logical_selection.go
- logical_sort.go
- logical_tabledual.go
- logical_tablescan.go
- logical_topn.go
- logical_unionall.go
- nominal_sort.go
- optimize.go
- pattern.go
- physical_hashagg.go
- physical_indexscan.go
- physical_limit.go
- physical_projection.go
- physical_schemaproducer.go
- physical_selection.go
- physical_sort.go
- physical_tabledual.go
- physical_tablescan.go
- physical_topn.go
- physical_unionall.go
- physical_unionscan.go
- plan.go
- planbuilder.go
- preprocess.go
- simple_plans.go
- sort.go
- stats.go
- transformation_rules.go
- util.go