planner

package
v1.14.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ILLEGAL sourceType = iota
	STREAM
	SCANTABLE
	LOOKUPTABLE
)

Variables

This section is empty.

Functions

func GetExplainInfoFromLogicalPlan

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

func Plan

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

func PlanByGraph

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

PlanByGraph returns a topo.Topo object by a graph

func PlanSQLWithSourcesAndSinks

func PlanSQLWithSourcesAndSinks(rule *api.Rule, mockSourcesProp map[string]map[string]any, sinks []*node.SinkNode) (*topo.Topo, error)

PlanSQLWithSourcesAndSinks For test only

func Transform

func Transform(op node.UnOperation, name string, options *api.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 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
	// 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"`
}

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 SourcePropsForSplit

type SourcePropsForSplit struct {
	Decompression string `json:"decompression"`
	SelId         string `json:"connectionSelector"`
}

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