planner

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DDLPlan

type DDLPlan struct {

	// raw query
	RawQuery string

	// mode
	ReqMode xcontext.RequestMode

	// query and backend tuple
	Querys []xcontext.QueryTuple
	// contains filtered or unexported fields
}

DDLPlan represents a CREATE, ALTER, DROP or RENAME plan

func NewDDLPlan

func NewDDLPlan(log *xlog.Log, database string, query string, node *sqlparser.DDL, router *router.Router) *DDLPlan

NewDDLPlan used to create DDLPlan

func (*DDLPlan) Build

func (p *DDLPlan) Build() error

Build used to build DDL distributed querys. sqlparser.DDL is a simple grammar ast, it just parses database and table name in the prefix. In our sql syntax in sql.y, alter will be changed to rename in case next: ALTER ignore_opt TABLE table_name RENAME to_opt table_name

{
  Change this to a rename statement
  $$ = &DDL{Action: RenameStr, Table: $4, NewName: $7}
}

func (*DDLPlan) JSON

func (p *DDLPlan) JSON() string

JSON returns the plan info.

func (*DDLPlan) Size

func (p *DDLPlan) Size() int

Size returns the memory size.

func (*DDLPlan) Type

func (p *DDLPlan) Type() PlanType

Type returns the type of the plan.

type DeletePlan

type DeletePlan struct {

	// raw query
	RawQuery string

	// mode
	ReqMode xcontext.RequestMode

	// query and backend tuple
	Querys []xcontext.QueryTuple
	// contains filtered or unexported fields
}

DeletePlan represents delete plan

func NewDeletePlan

func NewDeletePlan(log *xlog.Log, database string, query string, node *sqlparser.Delete, router *router.Router) *DeletePlan

NewDeletePlan used to create DeletePlan

func (*DeletePlan) Build

func (p *DeletePlan) Build() error

Build used to build distributed querys.

func (*DeletePlan) JSON

func (p *DeletePlan) JSON() string

JSON returns the plan info.

func (*DeletePlan) Size

func (p *DeletePlan) Size() int

Size returns the memory size.

func (*DeletePlan) Type

func (p *DeletePlan) Type() PlanType

Type returns the type of the plan.

type InsertPlan

type InsertPlan struct {

	// raw query
	RawQuery string

	// type
	Typ PlanType

	// mode
	ReqMode xcontext.RequestMode

	// query and backend tuple
	Querys []xcontext.QueryTuple
	// contains filtered or unexported fields
}

InsertPlan represents insertion plan

func NewInsertPlan

func NewInsertPlan(log *xlog.Log, database string, query string, node *sqlparser.Insert, router *router.Router) *InsertPlan

NewInsertPlan used to create InsertPlan

func (*InsertPlan) Build

func (p *InsertPlan) Build() error

Build used to build distributed querys.

func (*InsertPlan) JSON

func (p *InsertPlan) JSON() string

JSON returns the plan info.

func (*InsertPlan) Size

func (p *InsertPlan) Size() int

Size returns the memory size.

func (*InsertPlan) Type

func (p *InsertPlan) Type() PlanType

Type returns the type of the plan.

type OthersPlan added in v1.0.6

type OthersPlan struct {

	// raw query
	RawQuery string

	// mode
	ReqMode xcontext.RequestMode

	// query and backend tuple
	Querys []xcontext.QueryTuple
	// contains filtered or unexported fields
}

OthersPlan -- represents a special plan.

func NewOthersPlan added in v1.0.6

func NewOthersPlan(log *xlog.Log, database string, query string, node sqlparser.Statement, router *router.Router) *OthersPlan

NewOthersPlan -- used to create OthersPlan.

func (*OthersPlan) Build added in v1.0.6

func (p *OthersPlan) Build() error

Build used to build distributed querys.

func (*OthersPlan) JSON added in v1.0.6

func (p *OthersPlan) JSON() string

JSON returns the plan info.

func (*OthersPlan) Size added in v1.0.6

func (p *OthersPlan) Size() int

Size returns the memory size.

func (*OthersPlan) Type added in v1.0.6

func (p *OthersPlan) Type() PlanType

Type returns the type of the plan.

type Plan

type Plan interface {
	Build() error
	Type() PlanType
	JSON() string
	Size() int
}

Plan interface.

type PlanTree

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

PlanTree is a container for all plans

func NewPlanTree

func NewPlanTree() *PlanTree

NewPlanTree creates the new plan tree.

func (*PlanTree) Add

func (pt *PlanTree) Add(plan Plan) error

Add used to add new plan to the tree.

func (*PlanTree) Build

func (pt *PlanTree) Build() error

Build used to build plans(we won't build sub-plans in this plan).

func (*PlanTree) Plans

func (pt *PlanTree) Plans() []Plan

Plans returns all the plans of the tree.

func (*PlanTree) Size

func (pt *PlanTree) Size() int

Size used to measure the memory usage for this plantree.

type PlanType

type PlanType string

PlanType type.

const (
	// PlanTypeDDL enum.
	PlanTypeDDL PlanType = "PlanTypeDDL"

	// PlanTypeInsert enum.
	PlanTypeInsert PlanType = "PlanTypeInsert"

	// PlanTypeDelete enum.
	PlanTypeDelete PlanType = "PlanTypeDelete"

	// PlanTypeUpdate enum.
	PlanTypeUpdate PlanType = "PlanTypeUpdate"

	// PlanTypeSelect enum.
	PlanTypeSelect PlanType = "PlanTypeSelect"

	// PlanTypeUnion enum.
	PlanTypeUnion PlanType = "PlanTypeUnion"

	// PlanTypeOthers enum.
	PlanTypeOthers PlanType = "PlanTypeOthers"
)

type SelectPlan

type SelectPlan struct {

	// raw query
	RawQuery string

	Root builder.PlanNode
	// contains filtered or unexported fields
}

SelectPlan represents select plan.

func NewSelectPlan

func NewSelectPlan(log *xlog.Log, database string, query string, node *sqlparser.Select, router *router.Router) *SelectPlan

NewSelectPlan used to create SelectPlan.

func (*SelectPlan) Build

func (p *SelectPlan) Build() error

Build used to build distributed querys. For now, we don't support subquery in select.

func (*SelectPlan) JSON

func (p *SelectPlan) JSON() string

JSON returns the plan info.

func (*SelectPlan) Size

func (p *SelectPlan) Size() int

Size returns the memory size.

func (*SelectPlan) Type

func (p *SelectPlan) Type() PlanType

Type returns the type of the plan.

type UnionPlan added in v1.0.7

type UnionPlan struct {

	// raw query
	RawQuery string

	Root builder.PlanNode
	// contains filtered or unexported fields
}

UnionPlan represents union plan.

func NewUnionPlan added in v1.0.7

func NewUnionPlan(log *xlog.Log, database string, query string, node *sqlparser.Union, router *router.Router) *UnionPlan

NewUnionPlan used to create SelectPlan.

func (*UnionPlan) Build added in v1.0.7

func (p *UnionPlan) Build() error

Build used to build distributed querys.

func (*UnionPlan) JSON added in v1.0.7

func (p *UnionPlan) JSON() string

JSON returns the plan info.

func (*UnionPlan) Size added in v1.0.7

func (p *UnionPlan) Size() int

Size returns the memory size.

func (*UnionPlan) Type added in v1.0.7

func (p *UnionPlan) Type() PlanType

Type returns the type of the plan.

type UpdatePlan

type UpdatePlan struct {

	// raw query
	RawQuery string

	// mode
	ReqMode xcontext.RequestMode

	// query and backend tuple
	Querys []xcontext.QueryTuple
	// contains filtered or unexported fields
}

UpdatePlan represents update plan.

func NewUpdatePlan

func NewUpdatePlan(log *xlog.Log, database string, query string, node *sqlparser.Update, router *router.Router) *UpdatePlan

NewUpdatePlan used to create UpdatePlan

func (*UpdatePlan) Build

func (p *UpdatePlan) Build() error

Build used to build distributed querys.

func (*UpdatePlan) JSON

func (p *UpdatePlan) JSON() string

JSON returns the plan info.

func (*UpdatePlan) Size

func (p *UpdatePlan) Size() int

Size returns the memory size.

func (*UpdatePlan) Type

func (p *UpdatePlan) Type() PlanType

Type returns the type of the plan.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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