Documentation ¶
Index ¶
- type Group
- func (g *Group) Equals(other any) bool
- func (g *Group) Exists(e *GroupExpression) bool
- func (g *Group) GetFirstElem(operand pattern.Operand) *list.Element
- func (g *Group) GetGroupID() GroupID
- func (g *Group) GetLogicalExpressions() *list.List
- func (g *Group) Hash64(h base.Hasher)
- func (g *Group) Insert(e *GroupExpression) bool
- func (g *Group) String(w util.StrBufferWriter)
- type GroupExpression
- type GroupID
- type GroupIDGenerator
- type Memo
- func (m *Memo) CopyIn(target *Group, lp base.LogicalPlan) *GroupExpression
- func (m *Memo) GetGroupID2Group() map[GroupID]*list.Element
- func (m *Memo) GetGroups() *list.List
- func (m *Memo) GetHasher() base2.Hasher
- func (m *Memo) GetRootGroup() *Group
- func (m *Memo) Init(plan base.LogicalPlan) *GroupExpression
- func (m *Memo) NewGroup() *Group
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Group ¶
type Group struct { // Operand2FirstExpr is used to locate to the first same type logical expression // in list above instead of traverse them all. Operand2FirstExpr map[pattern.Operand]*list.Element // 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) Exists ¶
func (g *Group) Exists(e *GroupExpression) bool
Exists checks whether a Group expression existed in a Group.
func (*Group) GetFirstElem ¶
GetFirstElem returns the first Group expression which matches the Operand. Return a nil pointer if there isn't.
func (*Group) GetLogicalExpressions ¶
GetLogicalExpressions gets the logical expressions list.
func (*Group) Insert ¶
func (g *Group) Insert(e *GroupExpression) bool
Insert adds a GroupExpression to the Group.
func (*Group) String ¶
func (g *Group) String(w util.StrBufferWriter)
String implements fmt.Stringer interface.
type GroupExpression ¶
type GroupExpression struct { // LogicalPlan is internal logical expression stands for this groupExpr. // Define it in the header element can make GE as Logical Plan implementor. base.LogicalPlan // inputs stores the Groups that this GroupExpression based on. Inputs []*Group // 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) GetGroup ¶
func (e *GroupExpression) GetGroup() *Group
GetGroup returns the Group that this GroupExpression belongs to.
func (*GroupExpression) GetHash64 ¶
func (e *GroupExpression) GetHash64() uint64
GetHash64 returns the cached hash64 of the GroupExpression.
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) String ¶
func (e *GroupExpression) String(w util.StrBufferWriter)
String implements the fmt.Stringer interface.
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 (*Memo) CopyIn ¶
func (m *Memo) CopyIn(target *Group, lp base.LogicalPlan) *GroupExpression
CopyIn copies a logical plan into the memo with format as GroupExpression.
func (*Memo) GetGroupID2Group ¶
GetGroupID2Group gets the map from group id to group.
func (*Memo) GetRootGroup ¶
GetRootGroup gets the root group of the memo.
func (*Memo) Init ¶
func (m *Memo) Init(plan base.LogicalPlan) *GroupExpression
Init initializes the memo with a logical plan, converting logical plan tree format into group tree.