ops

package
v0.18.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToTree added in v0.17.0

func ToTree(op Operator) string

ToTree returns the operator as ascii tree. Should only be used for debugging

Types

type Operator

type Operator interface {
	// Clone will return a copy of this operator, protected so changed to the original will not impact the clone
	Clone(inputs []Operator) Operator

	// Inputs returns the inputs for this operator
	Inputs() []Operator

	// SetInputs changes the inputs for this op
	SetInputs([]Operator)

	// AddPredicate is used to push predicates. It pushed it as far down as is possible in the tree.
	// If we encounter a join and the predicate depends on both sides of the join, the predicate will be split into two parts,
	// where data is fetched from the LHS of the join to be used in the evaluation on the RHS
	// TODO: we should remove this and replace it with rewriters
	AddPredicate(ctx *plancontext.PlanningContext, expr sqlparser.Expr) (Operator, error)

	AddColumn(ctx *plancontext.PlanningContext, reuseExisting bool, addToGroupBy bool, expr *sqlparser.AliasedExpr) (int, error)

	FindCol(ctx *plancontext.PlanningContext, expr sqlparser.Expr, underRoute bool) (int, error)

	GetColumns(ctx *plancontext.PlanningContext) ([]*sqlparser.AliasedExpr, error)
	GetSelectExprs(ctx *plancontext.PlanningContext) (sqlparser.SelectExprs, error)

	ShortDescription() string

	GetOrdering() ([]OrderBy, error)
}

Operator forms the tree of operators, representing the declarative query provided. The operator tree is no actually runnable, it's an intermediate representation used while query planning The mental model are operators that pull data from each other, the root being the full query output, and the leaves are most often `Route`s, representing communication with one or more shards. We want to push down as much work as possible under these Routes

type OrderBy added in v0.17.0

type OrderBy struct {
	Inner *sqlparser.Order

	// See GroupBy#SimplifiedExpr for more details about this
	SimplifiedExpr sqlparser.Expr
}

OrderBy contains the expression to used in order by and also if ordering is needed at VTGate level then what the weight_string function expression to be sent down for evaluation.

func (OrderBy) Map added in v0.18.0

func (ob OrderBy) Map(mappingFunc func(sqlparser.Expr) sqlparser.Expr) OrderBy

Map takes in a mapping function and applies it to both the expression in OrderBy.

Jump to

Keyboard shortcuts

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