Documentation
¶
Index ¶
- Constants
- func ExplainColumnList(ctx expression.EvalContext, cols []*MPPPartitionColumn) []byte
- func GetCollateIDByNameForPartition(coll string) int32
- func GetCollateNameByIDForPartition(collateID int32) string
- func ToString(ndvs []GroupNDV) string
- type GroupNDV
- type LogicalProperty
- type MPPPartitionColumn
- func (partitionCol *MPPPartitionColumn) Clone() *MPPPartitionColumn
- func (partitionCol *MPPPartitionColumn) Equal(other *MPPPartitionColumn) bool
- func (partitionCol *MPPPartitionColumn) MemoryUsage() (sum int64)
- func (partitionCol *MPPPartitionColumn) ResolveIndices(schema *expression.Schema) (*MPPPartitionColumn, error)
- type MPPPartitionType
- type PhysicalProperty
- func (p *PhysicalProperty) AllColsFromSchema(schema *expression.Schema) bool
- func (p *PhysicalProperty) AllSameOrder() (isSame bool, desc bool)
- func (p *PhysicalProperty) CloneEssentialFields() *PhysicalProperty
- func (p *PhysicalProperty) GetAllPossibleChildTaskTypes() []TaskType
- func (p *PhysicalProperty) HashCode() []byte
- func (p *PhysicalProperty) IsFlashProp() bool
- func (p *PhysicalProperty) IsPrefix(prop *PhysicalProperty) bool
- func (p *PhysicalProperty) IsSortItemAllForPartition() bool
- func (p *PhysicalProperty) IsSortItemEmpty() bool
- func (p *PhysicalProperty) IsSubsetOf(keys []*MPPPartitionColumn) []int
- func (p *PhysicalProperty) MemoryUsage() (sum int64)
- func (p *PhysicalProperty) String() string
- type SortItem
- type StatsInfo
- type TaskType
Constants ¶
const ( NoCTEOrAllProducerCanMPP cteProducerStatus = iota SomeCTEFailedMpp AllCTECanMpp )
Constants for CTE status.
Variables ¶
This section is empty.
Functions ¶
func ExplainColumnList ¶
func ExplainColumnList(ctx expression.EvalContext, cols []*MPPPartitionColumn) []byte
ExplainColumnList generates explain information for a list of columns.
func GetCollateIDByNameForPartition ¶
GetCollateIDByNameForPartition returns collate id by collation name
func GetCollateNameByIDForPartition ¶
GetCollateNameByIDForPartition returns collate id by collation name
Types ¶
type LogicalProperty ¶
type LogicalProperty struct {
Stats *StatsInfo
Schema *expression.Schema
MaxOneRow bool
}
LogicalProperty stands for logical properties such as schema of expression, or statistics of columns in schema for output of Group. All group expressions in a group share same logical property.
type MPPPartitionColumn ¶
type MPPPartitionColumn struct {
Col *expression.Column
CollateID int32
}
MPPPartitionColumn is the column that will be used in MPP Hash Exchange
func (*MPPPartitionColumn) Clone ¶
func (partitionCol *MPPPartitionColumn) Clone() *MPPPartitionColumn
Clone makes a copy of MPPPartitionColumn.
func (*MPPPartitionColumn) Equal ¶
func (partitionCol *MPPPartitionColumn) Equal(other *MPPPartitionColumn) bool
Equal returns true if partitionCol == other
func (*MPPPartitionColumn) MemoryUsage ¶
func (partitionCol *MPPPartitionColumn) MemoryUsage() (sum int64)
MemoryUsage return the memory usage of MPPPartitionColumn
func (*MPPPartitionColumn) ResolveIndices ¶
func (partitionCol *MPPPartitionColumn) ResolveIndices(schema *expression.Schema) (*MPPPartitionColumn, error)
ResolveIndices resolve index for MPPPartitionColumn
type MPPPartitionType ¶
type MPPPartitionType int
MPPPartitionType is the way to partition during mpp data exchanging.
const ( // AnyType will not require any special partition types. AnyType MPPPartitionType = iota // BroadcastType requires current task to broadcast its data. BroadcastType // HashType requires current task to shuffle its data according to some columns. HashType // SinglePartitionType requires all the task pass the data to one node (tidb/tiflash). SinglePartitionType )
func (MPPPartitionType) ToExchangeType ¶
func (t MPPPartitionType) ToExchangeType() tipb.ExchangeType
ToExchangeType generates ExchangeType from MPPPartitionType
type PhysicalProperty ¶
type PhysicalProperty struct {
// SortItems contains the required sort attributes.
SortItems []SortItem
// TaskTp means the type of task that an operator requires.
//
// It needs to be specified because two different tasks can't be compared
// with cost directly. e.g. If a copTask takes less cost than a rootTask,
// we can't sure that we must choose the former one. Because the copTask
// must be finished and increase its cost in sometime, but we can't make
// sure the finishing time. So the best way to let the comparison fair is
// to add TaskType to required property.
TaskTp TaskType
// ExpectedCnt means this operator may be closed after fetching ExpectedCnt
// records.
ExpectedCnt float64
// indicates that whether we are allowed to add an enforcer.
CanAddEnforcer bool
// If the partition type is hash, the data should be reshuffled by partition cols.
MPPPartitionCols []*MPPPartitionColumn
// which types the exchange sender belongs to, only take effects when it's a mpp task.
MPPPartitionTp MPPPartitionType
// SortItemsForPartition means these sort only need to sort the data of one partition, instead of global.
// It is added only if it is used to sort the sharded data of the window function.
// Non-MPP tasks do not care about it.
SortItemsForPartition []SortItem
// RejectSort means rejecting the sort property from its children, but it only works for MPP tasks.
// Non-MPP tasks do not care about it.
RejectSort bool
CTEProducerStatus cteProducerStatus
VectorProp struct {
*expression.VectorHelper
TopK uint32
}
// contains filtered or unexported fields
}
PhysicalProperty stands for the required physical property by parents. It contains the orders and the task types.
func NewPhysicalProperty ¶
func NewPhysicalProperty(taskTp TaskType, cols []*expression.Column, desc bool, expectCnt float64, enforced bool) *PhysicalProperty
NewPhysicalProperty builds property from columns.
func (*PhysicalProperty) AllColsFromSchema ¶
func (p *PhysicalProperty) AllColsFromSchema(schema *expression.Schema) bool
AllColsFromSchema checks whether all the columns needed by this physical property can be found in the given schema.
func (*PhysicalProperty) AllSameOrder ¶
func (p *PhysicalProperty) AllSameOrder() (isSame bool, desc bool)
AllSameOrder checks if all the items have same order.
func (*PhysicalProperty) CloneEssentialFields ¶
func (p *PhysicalProperty) CloneEssentialFields() *PhysicalProperty
CloneEssentialFields returns a copy of PhysicalProperty. We only copy the essential fields that really indicate the property, specifically, `CanAddEnforcer` should not be included.
func (*PhysicalProperty) GetAllPossibleChildTaskTypes ¶
func (p *PhysicalProperty) GetAllPossibleChildTaskTypes() []TaskType
GetAllPossibleChildTaskTypes enumrates the possible types of tasks for children.
func (*PhysicalProperty) HashCode ¶
func (p *PhysicalProperty) HashCode() []byte
HashCode calculates hash code for a PhysicalProperty object.
func (*PhysicalProperty) IsFlashProp ¶
func (p *PhysicalProperty) IsFlashProp() bool
IsFlashProp return true if this physical property is only allowed to generate flash related task
func (*PhysicalProperty) IsPrefix ¶
func (p *PhysicalProperty) IsPrefix(prop *PhysicalProperty) bool
IsPrefix checks whether the order property is the prefix of another.
func (*PhysicalProperty) IsSortItemAllForPartition ¶
func (p *PhysicalProperty) IsSortItemAllForPartition() bool
IsSortItemAllForPartition check whether SortItems is same as SortItemsForPartition
func (*PhysicalProperty) IsSortItemEmpty ¶
func (p *PhysicalProperty) IsSortItemEmpty() bool
IsSortItemEmpty checks whether the order property is empty.
func (*PhysicalProperty) IsSubsetOf ¶
func (p *PhysicalProperty) IsSubsetOf(keys []*MPPPartitionColumn) []int
IsSubsetOf check if the keys can match the needs of partition.
func (*PhysicalProperty) MemoryUsage ¶
func (p *PhysicalProperty) MemoryUsage() (sum int64)
MemoryUsage return the memory usage of PhysicalProperty
func (*PhysicalProperty) String ¶
func (p *PhysicalProperty) String() string
String implements fmt.Stringer interface. Just for test.
type SortItem ¶
type SortItem struct {
Col *expression.Column
Desc bool
}
SortItem wraps the column and its order.
func SortItemsFromCols ¶
func SortItemsFromCols(cols []*expression.Column, desc bool) []SortItem
SortItemsFromCols builds property items from columns.
func (SortItem) MemoryUsage ¶
MemoryUsage return the memory usage of SortItem
type StatsInfo ¶
type StatsInfo struct {
RowCount float64
// Column.UniqueID -> NDV
ColNDVs map[int64]float64
HistColl *statistics.HistColl
// StatsVersion indicates the statistics version of a table.
// If the StatsInfo is calculated using the pseudo statistics on a table, StatsVersion will be PseudoVersion.
StatsVersion uint64
// GroupNDVs stores the NDV of column groups.
GroupNDVs []GroupNDV
}
StatsInfo stores the basic information of statistics for the plan's output. It is used for cost estimation.
func (*StatsInfo) GetGroupNDV4Cols ¶
func (s *StatsInfo) GetGroupNDV4Cols(cols []*expression.Column) *GroupNDV
GetGroupNDV4Cols gets the GroupNDV for the given columns.
func (*StatsInfo) ScaleByExpectCnt ¶
ScaleByExpectCnt tries to Scale StatsInfo to an expectCnt which must be smaller than the derived cnt. TODO: try to use a better way to do this.
type TaskType ¶
type TaskType int
TaskType is the type of execution task.
const ( // RootTaskType stands for the tasks that executed in the TiDB layer. RootTaskType TaskType = iota // CopSingleReadTaskType stands for the a TableScan or IndexScan tasks // executed in the coprocessor layer. CopSingleReadTaskType // CopMultiReadTaskType stands for the a IndexLookup tasks executed in the // coprocessor layer. CopMultiReadTaskType // MppTaskType stands for task that would run on Mpp nodes, currently meaning the tiflash node. MppTaskType )