property

package
v3.1.0-fork Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	Col  *expression.Column
	Desc bool
}

Item wraps the column and its order.

func ItemsFromCols

func ItemsFromCols(cols []*expression.Column, desc bool) []Item

ItemsFromCols builds property items from columns.

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 PhysicalProperty

type PhysicalProperty struct {
	Items []Item

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

	// whether need to enforce property.
	Enforced bool
	// 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() (bool, bool)

AllSameOrder checks if all the items have same order.

func (*PhysicalProperty) Clone

func (p *PhysicalProperty) Clone() *PhysicalProperty

Clone returns a copy of PhysicalProperty. Currently, this function is only used to build new required property for children plan in `exhaustPhysicalPlans`, so we don't copy `Enforced` field because if `Enforced` is true, the `Items` must be empty now, this makes `Enforced` meaningless for children nodes.

func (*PhysicalProperty) HashCode

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

HashCode calculates hash code for a PhysicalProperty object.

func (*PhysicalProperty) IsEmpty

func (p *PhysicalProperty) IsEmpty() bool

IsEmpty checks whether the order property is empty.

func (*PhysicalProperty) IsPrefix

func (p *PhysicalProperty) IsPrefix(prop *PhysicalProperty) bool

IsPrefix checks whether the order property is the prefix of another.

func (*PhysicalProperty) String

func (p *PhysicalProperty) String() string

String implements fmt.Stringer interface. Just for test.

type StatsInfo

type StatsInfo struct {
	RowCount float64

	// Column.UniqueID -> Cardinality
	Cardinality 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
}

StatsInfo stores the basic information of statistics for the plan's output. It is used for cost estimation.

func (*StatsInfo) Count

func (s *StatsInfo) Count() int64

Count gets the RowCount in the StatsInfo.

func (*StatsInfo) Scale

func (s *StatsInfo) Scale(factor float64) *StatsInfo

Scale receives a selectivity and multiplies it with RowCount and Cardinality.

func (*StatsInfo) ScaleByExpectCnt

func (s *StatsInfo) ScaleByExpectCnt(expectCnt float64) *StatsInfo

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.

func (*StatsInfo) String

func (s *StatsInfo) String() string

String implements fmt.Stringer interface.

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

	// CopDoubleReadTaskType stands for the a IndexLookup tasks executed in the
	// coprocessor layer.
	CopDoubleReadTaskType
)

func (TaskType) String

func (t TaskType) String() string

String implements fmt.Stringer interface.

Jump to

Keyboard shortcuts

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