planbuilder

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: Apache-2.0 Imports: 28 Imported by: 3

Documentation

Overview

Package planbuilder allows you to build execution plans that describe how to fulfill a query that may span multiple keyspaces or shards. The main entry points for this package are Build and BuildFromStmt.

Index

Constants

View Source
const (
	// V3 is also the default planner
	V3 = querypb.ExecuteOptions_V3
	// Gen4 uses the default Gen4 planner, which is the greedy planner
	Gen4 = querypb.ExecuteOptions_Gen4
	// Gen4GreedyOnly uses only the faster greedy planner
	Gen4GreedyOnly = querypb.ExecuteOptions_Gen4Greedy
	// Gen4Left2Right tries to emulate the V3 planner by only joining plans in the order they are listed in the FROM-clause
	Gen4Left2Right = querypb.ExecuteOptions_Gen4Left2Right
	// Gen4WithFallback first attempts to use the Gen4 planner, and if that fails, uses the V3 planner instead
	Gen4WithFallback = querypb.ExecuteOptions_Gen4WithFallback
	// Gen4CompareV3 executes queries on both Gen4 and V3 to compare their results.
	Gen4CompareV3 = querypb.ExecuteOptions_Gen4CompareV3
)
View Source
const (
	ViewDifferentKeyspace string = "Select query does not belong to the same keyspace as the view statement"
	ViewComplex           string = "Complex select queries are not supported in create or alter view statements"
	DifferentDestinations string = "Tables or Views specified in the query do not belong to the same destination"
)

Error messages for CreateView queries

Variables

View Source
var ErrPlanNotSupported = errors.New("plan building not supported")

ErrPlanNotSupported is an error for plan building not supported

Functions

func BuildColName

func BuildColName(rcs []*resultColumn, index int) (*sqlparser.ColName, error)

BuildColName builds a *sqlparser.ColName for the resultColumn specified by the index. The built ColName will correctly reference the resultColumn it was built from.

func BuildFromStmt

func BuildFromStmt(query string, stmt sqlparser.Statement, reservedVars *sqlparser.ReservedVars, vschema plancontext.VSchema, bindVarNeeds *sqlparser.BindVarNeeds, enableOnlineDDL, enableDirectDDL bool) (*engine.Plan, error)

BuildFromStmt builds a plan based on the AST provided.

func GetReturnType added in v0.10.0

func GetReturnType(input sqlparser.Expr) (querypb.Type, error)

GetReturnType returns the type of the select expression that MySQL will return

func ResultFromNumber

func ResultFromNumber(rcs []*resultColumn, val *sqlparser.Literal, caller string) (int, error)

ResultFromNumber returns the result column index based on the column order expression.

func TestBuilder added in v0.9.0

func TestBuilder(query string, vschema plancontext.VSchema, keyspace string) (*engine.Plan, error)

TestBuilder builds a plan for a query based on the specified vschema. This method is only used from tests

Types

type UnsupportedSupplyWeightString added in v0.10.0

type UnsupportedSupplyWeightString struct {
	Type string
}

UnsupportedSupplyWeightString represents the error where the supplying a weight string is not supported

func (UnsupportedSupplyWeightString) Error added in v0.10.0

Error function implements the error interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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