ops

package
v0.17.4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToJSON added in v0.17.0

func ToJSON(op Operator) string

ToJSON is a debug only function. It can panic, so do not use this in production code

func ToTree added in v0.17.0

func ToTree(op Operator) string

Types

type OpDescription added in v0.17.0

type OpDescription struct {
	OperatorType string
	Variant      string         `json:",omitempty"`
	Other        map[string]any `json:",omitempty"`

	// This field will be filled in by the JSON producer. No need to set it manually
	Inputs []OpDescription `json:",omitempty"`
}

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
	AddPredicate(ctx *plancontext.PlanningContext, expr sqlparser.Expr) (Operator, error)

	// AddColumn tells an operator to also output an additional column specified.
	// The offset to the column is returned.
	AddColumn(ctx *plancontext.PlanningContext, expr *sqlparser.AliasedExpr, reuseExisting, addToGroupBy bool) (Operator, int, error)

	GetColumns() ([]*sqlparser.AliasedExpr, error)

	Description() OpDescription
	ShortDescription() string

	GetOrdering() ([]OrderBy, error)
}

Operator forms the tree of operators, representing the declarative query provided. While planning, the operator tree starts with logical operators, and later moves to physical operators. The difference between the two is that when we get to a physical operator, we have made decisions on in which order to do the joins, and how to split them up across shards and keyspaces. In some situation we go straight to the physical operator - when there are no options to consider, we can go straight to the end result.

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.

Jump to

Keyboard shortcuts

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