memo

package
v1.1.0-beta.0...-2761fe0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

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

Group is basic infra to store all the logically equivalent expressions for one logical operator in current context.

func NewGroup

func NewGroup(prop *property.LogicalProperty) *Group

NewGroup creates a new Group with given logical prop.

func (*Group) Equals

func (g *Group) Equals(other any) bool

Equals implements the HashEquals.<1st> interface.

func (*Group) Exists

func (g *Group) Exists(hash64u uint64) bool

Exists checks whether a Group expression existed in a Group.

func (*Group) Hash64

func (g *Group) Hash64(h base.Hasher)

Hash64 implements the HashEquals.<0th> interface.

func (*Group) Insert

func (g *Group) Insert(e *GroupExpression) bool

Insert adds a GroupExpression to the Group.

type GroupExpression

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

GroupExpression is a single expression from the equivalent list classes inside a group. it is a node in the expression tree, while it takes groups as inputs. This kind of loose coupling between Group and GroupExpression is the key to the success of the memory compact of representing a forest.

func NewGroupExpression

func NewGroupExpression(lp base.LogicalPlan, inputs []*Group) *GroupExpression

NewGroupExpression creates a new GroupExpression with the given logical plan and children.

func (*GroupExpression) Equals

func (e *GroupExpression) Equals(other any) bool

Equals implements the Equals interface.

func (*GroupExpression) Hash64

func (e *GroupExpression) Hash64(h base2.Hasher)

Hash64 implements the Hash64 interface.

func (*GroupExpression) Init

func (e *GroupExpression) Init(h base2.Hasher)

Init initializes the GroupExpression with the given group and hasher.

func (*GroupExpression) Sum64

func (e *GroupExpression) Sum64() uint64

Sum64 returns the cached hash64 of the GroupExpression.

type GroupID

type GroupID uint64

GroupID is the unique id for a group.

type GroupIDGenerator

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

GroupIDGenerator is used to generate group id.

func (*GroupIDGenerator) NextGroupID

func (gi *GroupIDGenerator) NextGroupID() GroupID

NextGroupID generates the next group id. It is not thread-safe, since memo optimizing is also in one thread.

type Memo

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

Memo is the main structure of the memo package.

func NewMemo

func NewMemo(ctx sessionctx.Context) *Memo

NewMemo creates a new memo.

func (*Memo) CopyIn

func (m *Memo) CopyIn(target *Group, lp base.LogicalPlan) (*GroupExpression, bool)

CopyIn copies a logical plan into the memo with format as GroupExpression.

func (*Memo) NewGroup

func (m *Memo) NewGroup() *Group

NewGroup creates a new group.

Jump to

Keyboard shortcuts

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