cascades

package
v0.0.0-...-3633c1a Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindBestPlan

func FindBestPlan(sctx sessionctx.Context, logical plannercore.LogicalPlan) (plannercore.Plan, error)

FindBestPlan is the optimization entrance of the cascades planner. The optimization is composed of 2 phases: exploration and implementation.

Types

type Enforcer

type Enforcer interface {
	// NewProperty generates relaxed property with the help of enforcer.
	NewProperty(prop *property.PhysicalProperty) (newProp *property.PhysicalProperty)
	// OnEnforce adds physical operators on top of child implementation to satisfy
	// required physical property.
	OnEnforce(reqProp *property.PhysicalProperty, child memo.Implementation) (impl memo.Implementation)
	// GetEnforceCost calculates cost of enforcing required physical property.
	GetEnforceCost(inputCount float64) float64
}

Enforcer defines the interface for enforcer rules.

func GetEnforcerRules

func GetEnforcerRules(prop *property.PhysicalProperty) (enforcers []Enforcer)

GetEnforcerRules gets all candidate enforcer rules based on required physical property.

type ImplementationRule

type ImplementationRule interface {
	// Match checks if current GroupExpr matches this rule under required physical property.
	Match(expr *memo.GroupExpr, prop *property.PhysicalProperty) (matched bool)
	// OnImplement generates physical plan using this rule for current GroupExpr. Note that
	// childrenReqProps of generated physical plan should be set correspondingly in this function.
	OnImplement(expr *memo.GroupExpr, reqProp *property.PhysicalProperty) (impl memo.Implementation, err error)
}

ImplementationRule defines the interface for implementation rules.

func GetImplementationRules

func GetImplementationRules(node plannercore.LogicalPlan) []ImplementationRule

GetImplementationRules gets the all the candidate implementation rules based on the logical plan node.

type OrderEnforcer

type OrderEnforcer struct {
}

OrderEnforcer enforces order property on child implementation.

func (*OrderEnforcer) GetEnforceCost

func (e *OrderEnforcer) GetEnforceCost(inputCount float64) float64

GetEnforceCost calculates cost of sort operator.

func (*OrderEnforcer) NewProperty

func (e *OrderEnforcer) NewProperty(prop *property.PhysicalProperty) (newProp *property.PhysicalProperty)

NewProperty removes order property from required physical property.

func (*OrderEnforcer) OnEnforce

func (e *OrderEnforcer) OnEnforce(reqProp *property.PhysicalProperty, child memo.Implementation) (impl memo.Implementation)

OnEnforce adds sort operator to satisfy required order property.

type Transformation

type Transformation interface {
	GetPattern() *memo.Pattern
	Match(expr *memo.ExprIter) (matched bool)
	OnTransform(old *memo.ExprIter) (new *memo.GroupExpr, eraseOld bool, err error)
}

Transformation defines the interface for the transformation rules.

func GetTransformationRules

func GetTransformationRules(node plannercore.LogicalPlan) []Transformation

GetTransformationRules gets the all the candidate transformation rules based on the logical plan node.

Jump to

Keyboard shortcuts

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