planner

package
v2.0.0-alpha.11 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRetainSize = 1
	MaxRetainSize     = 9999
)
View Source
const (
	ILLEGAL sourceType = iota
	STREAM
	SCANTABLE
	LOOKUPTABLE
)

Variables

This section is empty.

Functions

func ExplainFromLogicalPlan

func ExplainFromLogicalPlan(lp LogicalPlan, ruleID string) (string, error)

func GetExplainInfoFromLogicalPlan

func GetExplainInfoFromLogicalPlan(rule *def.Rule) (string, error)

func Plan

func Plan(rule *def.Rule) (*topo.Topo, error)

func PlanByGraph

func PlanByGraph(rule *def.Rule) (*topo.Topo, error)

PlanByGraph returns a topo.Topo object by a graph

func PlanSQLWithSourcesAndSinks

func PlanSQLWithSourcesAndSinks(rule *def.Rule, mockSourcesProp map[string]map[string]any) (*topo.Topo, error)

PlanSQLWithSourcesAndSinks For test only

func PlanSinkOps

func PlanSinkOps(tp *topo.Topo, inputs []node.Emitter, cn node.CompNode)

func SinkToComp

func SinkToComp(tp *topo.Topo, sinkType string, sinkName string, props map[string]any, rule *def.Rule, streamCount int) (node.CompNode, error)

func Transform

func Transform(op node.UnOperation, name string, options *def.RuleOption) *node.UnaryOperator

Types

type AggregatePlan

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

func (*AggregatePlan) BuildExplainInfo

func (p *AggregatePlan) BuildExplainInfo()

func (*AggregatePlan) Children

func (p *AggregatePlan) Children() []LogicalPlan

func (*AggregatePlan) ChildrenID

func (p *AggregatePlan) ChildrenID() []int64

func (*AggregatePlan) Explain

func (p *AggregatePlan) Explain() string

func (*AggregatePlan) ID

func (p *AggregatePlan) ID() int64

func (AggregatePlan) Init

func (p AggregatePlan) Init() *AggregatePlan

func (*AggregatePlan) PruneColumns

func (p *AggregatePlan) PruneColumns(fields []ast.Expr) error

func (*AggregatePlan) PushDownPredicate

func (p *AggregatePlan) PushDownPredicate(condition ast.Expr) (ast.Expr, LogicalPlan)

PushDownPredicate By default, push down the predicate to the first child instead of the children as most plan cannot have multiple children

func (*AggregatePlan) SetChildren

func (p *AggregatePlan) SetChildren(children []LogicalPlan)

func (*AggregatePlan) SetID

func (p *AggregatePlan) SetID(id int64)

func (*AggregatePlan) Type

func (p *AggregatePlan) Type() string

type AnalyticFuncsPlan

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

func (*AnalyticFuncsPlan) BuildExplainInfo

func (p *AnalyticFuncsPlan) BuildExplainInfo()

func (*AnalyticFuncsPlan) Children

func (p *AnalyticFuncsPlan) Children() []LogicalPlan

func (*AnalyticFuncsPlan) ChildrenID

func (p *AnalyticFuncsPlan) ChildrenID() []int64

func (*AnalyticFuncsPlan) Explain

func (p *AnalyticFuncsPlan) Explain() string

func (*AnalyticFuncsPlan) ID

func (p *AnalyticFuncsPlan) ID() int64

func (AnalyticFuncsPlan) Init

func (*AnalyticFuncsPlan) PruneColumns

func (p *AnalyticFuncsPlan) PruneColumns(fields []ast.Expr) error

func (*AnalyticFuncsPlan) PushDownPredicate

func (p *AnalyticFuncsPlan) PushDownPredicate(condition ast.Expr) (ast.Expr, LogicalPlan)

PushDownPredicate this op must run before any filters

func (*AnalyticFuncsPlan) SetChildren

func (p *AnalyticFuncsPlan) SetChildren(children []LogicalPlan)

func (*AnalyticFuncsPlan) SetID

func (p *AnalyticFuncsPlan) SetID(id int64)

func (*AnalyticFuncsPlan) Type

func (p *AnalyticFuncsPlan) Type() string

type DataSourcePlan

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

func (*DataSourcePlan) BuildExplainInfo

func (p *DataSourcePlan) BuildExplainInfo()

func (*DataSourcePlan) BuildSchemaInfo

func (p *DataSourcePlan) BuildSchemaInfo(ruleID string)

func (*DataSourcePlan) Children

func (p *DataSourcePlan) Children() []LogicalPlan

func (*DataSourcePlan) ChildrenID

func (p *DataSourcePlan) ChildrenID() []int64

func (*DataSourcePlan) Explain

func (p *DataSourcePlan) Explain() string

func (*DataSourcePlan) ID

func (p *DataSourcePlan) ID() int64

func (DataSourcePlan) Init

func (p DataSourcePlan) Init() *DataSourcePlan

func (*DataSourcePlan) PruneColumns

func (p *DataSourcePlan) PruneColumns(fields []ast.Expr) error

func (*DataSourcePlan) PushDownPredicate

func (p *DataSourcePlan) PushDownPredicate(condition ast.Expr) (ast.Expr, LogicalPlan)

PushDownPredicate Presume no children for data source

func (*DataSourcePlan) SetChildren

func (p *DataSourcePlan) SetChildren(children []LogicalPlan)

func (*DataSourcePlan) SetID

func (p *DataSourcePlan) SetID(id int64)

func (*DataSourcePlan) Type

func (p *DataSourcePlan) Type() string

type DedupTriggerPlan

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

func (*DedupTriggerPlan) BuildExplainInfo

func (p *DedupTriggerPlan) BuildExplainInfo()

func (*DedupTriggerPlan) Children

func (p *DedupTriggerPlan) Children() []LogicalPlan

func (*DedupTriggerPlan) ChildrenID

func (p *DedupTriggerPlan) ChildrenID() []int64

func (*DedupTriggerPlan) Explain

func (p *DedupTriggerPlan) Explain() string

func (*DedupTriggerPlan) ID

func (p *DedupTriggerPlan) ID() int64

func (DedupTriggerPlan) Init

func (*DedupTriggerPlan) PruneColumns

func (p *DedupTriggerPlan) PruneColumns(fields []ast.Expr) error

func (*DedupTriggerPlan) PushDownPredicate

func (p *DedupTriggerPlan) PushDownPredicate(condition ast.Expr) (ast.Expr, LogicalPlan)

PushDownPredicate By default, push down the predicate to the first child instead of the children as most plan cannot have multiple children

func (*DedupTriggerPlan) SetChildren

func (p *DedupTriggerPlan) SetChildren(children []LogicalPlan)

func (*DedupTriggerPlan) SetID

func (p *DedupTriggerPlan) SetID(id int64)

func (*DedupTriggerPlan) Type

func (p *DedupTriggerPlan) Type() string

type ExplainInfo

type ExplainInfo interface {
	ID() int64
	Type() string
	ChildrenID() []int64
	Explain() string
	BuildExplainInfo()
	SetID(id int64)
}

type FilterPlan

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

func (*FilterPlan) BuildExplainInfo

func (p *FilterPlan) BuildExplainInfo()

func (*FilterPlan) Children

func (p *FilterPlan) Children() []LogicalPlan

func (*FilterPlan) ChildrenID

func (p *FilterPlan) ChildrenID() []int64

func (*FilterPlan) Explain

func (p *FilterPlan) Explain() string

func (*FilterPlan) ExtractStateFunc

func (p *FilterPlan) ExtractStateFunc()

func (*FilterPlan) ID

func (p *FilterPlan) ID() int64

func (FilterPlan) Init

func (p FilterPlan) Init() *FilterPlan

func (*FilterPlan) PruneColumns

func (p *FilterPlan) PruneColumns(fields []ast.Expr) error

func (*FilterPlan) PushDownPredicate

func (p *FilterPlan) PushDownPredicate(condition ast.Expr) (ast.Expr, LogicalPlan)

func (*FilterPlan) SetChildren

func (p *FilterPlan) SetChildren(children []LogicalPlan)

func (*FilterPlan) SetID

func (p *FilterPlan) SetID(id int64)

func (*FilterPlan) Type

func (p *FilterPlan) Type() string

type HavingPlan

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

func (*HavingPlan) BuildExplainInfo

func (p *HavingPlan) BuildExplainInfo()

func (*HavingPlan) Children

func (p *HavingPlan) Children() []LogicalPlan

func (*HavingPlan) ChildrenID

func (p *HavingPlan) ChildrenID() []int64

func (*HavingPlan) Explain

func (p *HavingPlan) Explain() string

func (*HavingPlan) ExtractStateFunc

func (p *HavingPlan) ExtractStateFunc()

func (*HavingPlan) ID

func (p *HavingPlan) ID() int64

func (HavingPlan) Init

func (p HavingPlan) Init() *HavingPlan

func (*HavingPlan) PruneColumns

func (p *HavingPlan) PruneColumns(fields []ast.Expr) error

func (*HavingPlan) PushDownPredicate

func (p *HavingPlan) PushDownPredicate(condition ast.Expr) (ast.Expr, LogicalPlan)

PushDownPredicate By default, push down the predicate to the first child instead of the children as most plan cannot have multiple children

func (*HavingPlan) SetChildren

func (p *HavingPlan) SetChildren(children []LogicalPlan)

func (*HavingPlan) SetID

func (p *HavingPlan) SetID(id int64)

func (*HavingPlan) Type

func (p *HavingPlan) Type() string

type JoinAlignPlan

type JoinAlignPlan struct {
	Emitters []string
	// retain size for each table emitter
	Sizes []int
	// contains filtered or unexported fields
}

func (*JoinAlignPlan) BuildExplainInfo

func (p *JoinAlignPlan) BuildExplainInfo()

func (*JoinAlignPlan) Children

func (p *JoinAlignPlan) Children() []LogicalPlan

func (*JoinAlignPlan) ChildrenID

func (p *JoinAlignPlan) ChildrenID() []int64

func (*JoinAlignPlan) Explain

func (p *JoinAlignPlan) Explain() string

func (*JoinAlignPlan) ID

func (p *JoinAlignPlan) ID() int64

func (JoinAlignPlan) Init

func (p JoinAlignPlan) Init() *JoinAlignPlan

func (*JoinAlignPlan) PruneColumns

func (p *JoinAlignPlan) PruneColumns(fields []ast.Expr) error

func (*JoinAlignPlan) PushDownPredicate

func (p *JoinAlignPlan) PushDownPredicate(condition ast.Expr) (ast.Expr, LogicalPlan)

PushDownPredicate Push down to table first, then push to window

func (*JoinAlignPlan) SetChildren

func (p *JoinAlignPlan) SetChildren(children []LogicalPlan)

func (*JoinAlignPlan) SetID

func (p *JoinAlignPlan) SetID(id int64)

func (*JoinAlignPlan) Type

func (p *JoinAlignPlan) Type() string

type JoinPlan

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

func (*JoinPlan) BuildExplainInfo

func (p *JoinPlan) BuildExplainInfo()

func (*JoinPlan) Children

func (p *JoinPlan) Children() []LogicalPlan

func (*JoinPlan) ChildrenID

func (p *JoinPlan) ChildrenID() []int64

func (*JoinPlan) Explain

func (p *JoinPlan) Explain() string

func (*JoinPlan) ID

func (p *JoinPlan) ID() int64

func (JoinPlan) Init

func (p JoinPlan) Init() *JoinPlan

func (*JoinPlan) PruneColumns

func (p *JoinPlan) PruneColumns(fields []ast.Expr) error

func (*JoinPlan) PushDownPredicate

func (p *JoinPlan) PushDownPredicate(condition ast.Expr) (ast.Expr, LogicalPlan)

func (*JoinPlan) SetChildren

func (p *JoinPlan) SetChildren(children []LogicalPlan)

func (*JoinPlan) SetID

func (p *JoinPlan) SetID(id int64)

func (*JoinPlan) Type

func (p *JoinPlan) Type() string

type LogicalPlan

type LogicalPlan interface {
	ExplainInfo
	Children() []LogicalPlan
	SetChildren(children []LogicalPlan)
	// PushDownPredicate pushes down the filter in the filter/where/on/having clauses as deeply as possible.
	// It will accept a condition that is an expression slice, and return the expressions that can't be pushed.
	// It is also return the new tree of plan as it can possibly change the tree
	PushDownPredicate(ast.Expr) (ast.Expr, LogicalPlan)
	// PruneColumns Prune the unused columns in the data source level, by pushing all needed columns down
	PruneColumns(fields []ast.Expr) error
}

type LookupPlan

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

LookupPlan is the plan for table lookup and then merged/joined

func (*LookupPlan) BuildExplainInfo

func (p *LookupPlan) BuildExplainInfo()

func (*LookupPlan) Children

func (p *LookupPlan) Children() []LogicalPlan

func (*LookupPlan) ChildrenID

func (p *LookupPlan) ChildrenID() []int64

func (*LookupPlan) Explain

func (p *LookupPlan) Explain() string

func (*LookupPlan) ID

func (p *LookupPlan) ID() int64

func (LookupPlan) Init

func (p LookupPlan) Init() *LookupPlan

Init must run validateAndExtractCondition before this func

func (*LookupPlan) PruneColumns

func (p *LookupPlan) PruneColumns(fields []ast.Expr) error

func (*LookupPlan) PushDownPredicate

func (p *LookupPlan) PushDownPredicate(condition ast.Expr) (ast.Expr, LogicalPlan)

PushDownPredicate do not deal with conditions, push down or return up

func (*LookupPlan) SetChildren

func (p *LookupPlan) SetChildren(children []LogicalPlan)

func (*LookupPlan) SetID

func (p *LookupPlan) SetID(id int64)

func (*LookupPlan) Type

func (p *LookupPlan) Type() string

type OrderPlan

type OrderPlan struct {
	SortFields ast.SortFields
	// contains filtered or unexported fields
}

func (*OrderPlan) BuildExplainInfo

func (p *OrderPlan) BuildExplainInfo()

func (*OrderPlan) Children

func (p *OrderPlan) Children() []LogicalPlan

func (*OrderPlan) ChildrenID

func (p *OrderPlan) ChildrenID() []int64

func (*OrderPlan) Explain

func (p *OrderPlan) Explain() string

func (*OrderPlan) ID

func (p *OrderPlan) ID() int64

func (OrderPlan) Init

func (p OrderPlan) Init() *OrderPlan

func (*OrderPlan) PruneColumns

func (p *OrderPlan) PruneColumns(fields []ast.Expr) error

func (*OrderPlan) PushDownPredicate

func (p *OrderPlan) PushDownPredicate(condition ast.Expr) (ast.Expr, LogicalPlan)

PushDownPredicate By default, push down the predicate to the first child instead of the children as most plan cannot have multiple children

func (*OrderPlan) SetChildren

func (p *OrderPlan) SetChildren(children []LogicalPlan)

func (*OrderPlan) SetID

func (p *OrderPlan) SetID(id int64)

func (*OrderPlan) Type

func (p *OrderPlan) Type() string

type PlanExplainInfo

type PlanExplainInfo struct {
	T        PlanType `json:"type"`
	Info     string   `json:"info"`
	ID       int64    `json:"id"`
	Children []int64  `json:"children,omitempty"`
}

type PlanType

type PlanType string
const (
	AGGREGATE     PlanType = "AggregatePlan"
	ANALYTICFUNCS PlanType = "AnalyticFuncsPlan"
	DATASOURCE    PlanType = "DataSourcePlan"
	FILTER        PlanType = "FilterPlan"
	HAVING        PlanType = "HavingPlan"
	JOINALIGN     PlanType = "JoinAlignPlan"
	JOIN          PlanType = "JoinPlan"
	LOOKUP        PlanType = "LookupPlan"
	ORDER         PlanType = "OrderPlan"
	PROJECT       PlanType = "ProjectPlan"
	PROJECTSET    PlanType = "ProjectSetPlan"
	WINDOW        PlanType = "WindowPlan"
	WINDOWFUNC    PlanType = "WindowFuncPlan"
	WATERMARK     PlanType = "WatermarkPlan"
)

type ProjectPlan

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

func (*ProjectPlan) BuildExplainInfo

func (p *ProjectPlan) BuildExplainInfo()

func (*ProjectPlan) Children

func (p *ProjectPlan) Children() []LogicalPlan

func (*ProjectPlan) ChildrenID

func (p *ProjectPlan) ChildrenID() []int64

func (*ProjectPlan) Explain

func (p *ProjectPlan) Explain() string

func (*ProjectPlan) ID

func (p *ProjectPlan) ID() int64

func (ProjectPlan) Init

func (p ProjectPlan) Init() *ProjectPlan

func (*ProjectPlan) PruneColumns

func (p *ProjectPlan) PruneColumns(fields []ast.Expr) error

func (*ProjectPlan) PushDownPredicate

func (p *ProjectPlan) PushDownPredicate(condition ast.Expr) (ast.Expr, LogicalPlan)

PushDownPredicate By default, push down the predicate to the first child instead of the children as most plan cannot have multiple children

func (*ProjectPlan) SetChildren

func (p *ProjectPlan) SetChildren(children []LogicalPlan)

func (*ProjectPlan) SetID

func (p *ProjectPlan) SetID(id int64)

func (*ProjectPlan) Type

func (p *ProjectPlan) Type() string

type ProjectSetPlan

type ProjectSetPlan struct {
	SrfMapping map[string]struct{}
	// contains filtered or unexported fields
}

func (*ProjectSetPlan) BuildExplainInfo

func (p *ProjectSetPlan) BuildExplainInfo()

func (*ProjectSetPlan) Children

func (p *ProjectSetPlan) Children() []LogicalPlan

func (*ProjectSetPlan) ChildrenID

func (p *ProjectSetPlan) ChildrenID() []int64

func (*ProjectSetPlan) Explain

func (p *ProjectSetPlan) Explain() string

func (*ProjectSetPlan) ID

func (p *ProjectSetPlan) ID() int64

func (ProjectSetPlan) Init

func (p ProjectSetPlan) Init() *ProjectSetPlan

func (*ProjectSetPlan) PruneColumns

func (p *ProjectSetPlan) PruneColumns(fields []ast.Expr) error

func (*ProjectSetPlan) PushDownPredicate

func (p *ProjectSetPlan) PushDownPredicate(condition ast.Expr) (ast.Expr, LogicalPlan)

PushDownPredicate By default, push down the predicate to the first child instead of the children as most plan cannot have multiple children

func (*ProjectSetPlan) SetChildren

func (p *ProjectSetPlan) SetChildren(children []LogicalPlan)

func (*ProjectSetPlan) SetID

func (p *ProjectSetPlan) SetID(id int64)

func (*ProjectSetPlan) Type

func (p *ProjectSetPlan) Type() string

type RuleRuntimeInfo

type RuleRuntimeInfo interface {
	BuildSchemaInfo(ruleID string)
}

type SinkCompNode

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

func (*SinkCompNode) GetName

func (s *SinkCompNode) GetName() string

func (*SinkCompNode) Nodes

func (s *SinkCompNode) Nodes() []node.TopNode

type SourcePropsForSplit

type SourcePropsForSplit struct {
	Decompression string        `json:"decompression"`
	SelId         string        `json:"connectionSelector"`
	PayloadFormat string        `json:"payloadFormat"`
	Interval      time.Duration `json:"interval"`
	// merger and mergerField should only set one
	MergeField string `json:"mergeField"`
	Merger     string `json:"merger"`
	Format     string `json:"format"`
}

type WatermarkPlan

type WatermarkPlan struct {
	Emitters      []string
	SendWatermark bool
	// contains filtered or unexported fields
}

func (*WatermarkPlan) BuildExplainInfo

func (p *WatermarkPlan) BuildExplainInfo()

func (*WatermarkPlan) Children

func (p *WatermarkPlan) Children() []LogicalPlan

func (*WatermarkPlan) ChildrenID

func (p *WatermarkPlan) ChildrenID() []int64

func (*WatermarkPlan) Explain

func (p *WatermarkPlan) Explain() string

func (*WatermarkPlan) ID

func (p *WatermarkPlan) ID() int64

func (WatermarkPlan) Init

func (p WatermarkPlan) Init() *WatermarkPlan

func (*WatermarkPlan) PruneColumns

func (p *WatermarkPlan) PruneColumns(fields []ast.Expr) error

func (*WatermarkPlan) PushDownPredicate

func (p *WatermarkPlan) PushDownPredicate(condition ast.Expr) (ast.Expr, LogicalPlan)

PushDownPredicate watermark plan can not push down predicate. It must receive all tuples to process watermark

func (*WatermarkPlan) SetChildren

func (p *WatermarkPlan) SetChildren(children []LogicalPlan)

func (*WatermarkPlan) SetID

func (p *WatermarkPlan) SetID(id int64)

func (*WatermarkPlan) Type

func (p *WatermarkPlan) Type() string

type WindowFuncPlan

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

func (*WindowFuncPlan) BuildExplainInfo

func (p *WindowFuncPlan) BuildExplainInfo()

func (*WindowFuncPlan) Children

func (p *WindowFuncPlan) Children() []LogicalPlan

func (*WindowFuncPlan) ChildrenID

func (p *WindowFuncPlan) ChildrenID() []int64

func (*WindowFuncPlan) Explain

func (p *WindowFuncPlan) Explain() string

func (*WindowFuncPlan) ID

func (p *WindowFuncPlan) ID() int64

func (WindowFuncPlan) Init

func (p WindowFuncPlan) Init() *WindowFuncPlan

func (*WindowFuncPlan) PruneColumns

func (p *WindowFuncPlan) PruneColumns(fields []ast.Expr) error

func (*WindowFuncPlan) PushDownPredicate

func (p *WindowFuncPlan) PushDownPredicate(condition ast.Expr) (ast.Expr, LogicalPlan)

PushDownPredicate By default, push down the predicate to the first child instead of the children as most plan cannot have multiple children

func (*WindowFuncPlan) SetChildren

func (p *WindowFuncPlan) SetChildren(children []LogicalPlan)

func (*WindowFuncPlan) SetID

func (p *WindowFuncPlan) SetID(id int64)

func (*WindowFuncPlan) Type

func (p *WindowFuncPlan) Type() string

type WindowPlan

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

func (*WindowPlan) BuildExplainInfo

func (p *WindowPlan) BuildExplainInfo()

func (*WindowPlan) Children

func (p *WindowPlan) Children() []LogicalPlan

func (*WindowPlan) ChildrenID

func (p *WindowPlan) ChildrenID() []int64

func (*WindowPlan) Explain

func (p *WindowPlan) Explain() string

func (*WindowPlan) ExtractStateFunc

func (p *WindowPlan) ExtractStateFunc()

func (*WindowPlan) ID

func (p *WindowPlan) ID() int64

func (WindowPlan) Init

func (p WindowPlan) Init() *WindowPlan

func (*WindowPlan) PruneColumns

func (p *WindowPlan) PruneColumns(fields []ast.Expr) error

func (*WindowPlan) PushDownPredicate

func (p *WindowPlan) PushDownPredicate(condition ast.Expr) (ast.Expr, LogicalPlan)

func (*WindowPlan) SetChildren

func (p *WindowPlan) SetChildren(children []LogicalPlan)

func (*WindowPlan) SetID

func (p *WindowPlan) SetID(id int64)

func (*WindowPlan) Type

func (p *WindowPlan) Type() string

Jump to

Keyboard shortcuts

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