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

package property

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


Package Files

logical_property.go physical_property.go stats_info.go task_type.go

type Item Uses

type Item struct {
    Col  *expression.Column
    Desc bool

Item wraps the column and its order.

func ItemsFromCols Uses

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

ItemsFromCols builds property items from columns.

type LogicalProperty Uses

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 Uses

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 Uses

func NewPhysicalProperty(taskTp TaskType, cols []*expression.Column, desc bool, expectCnt float64, enforced bool) *PhysicalProperty

NewPhysicalProperty builds property from columns.

func (*PhysicalProperty) AllColsFromSchema Uses

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 Uses

func (p *PhysicalProperty) AllSameOrder() (bool, bool)

AllSameOrder checks if all the items have same order.

func (*PhysicalProperty) Clone Uses

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 Uses

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

HashCode calculates hash code for a PhysicalProperty object.

func (*PhysicalProperty) IsEmpty Uses

func (p *PhysicalProperty) IsEmpty() bool

IsEmpty checks whether the order property is empty.

func (*PhysicalProperty) IsPrefix Uses

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

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

func (*PhysicalProperty) String Uses

func (p *PhysicalProperty) String() string

String implements fmt.Stringer interface. Just for test.

type StatsInfo Uses

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 Uses

func (s *StatsInfo) Count() int64

Count gets the RowCount in the StatsInfo.

func (*StatsInfo) Scale Uses

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

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

func (*StatsInfo) ScaleByExpectCnt Uses

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 Uses

func (s *StatsInfo) String() string

String implements fmt.Stringer interface.

type TaskType Uses

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.

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

func (TaskType) String Uses

func (t TaskType) String() string

String implements fmt.Stringer interface.

Package property imports 4 packages (graph) and is imported by 22 packages. Updated 2020-02-28. Refresh now. Tools for package owners.