planbuilder

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: Apache-2.0 Imports: 18 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

This section is empty.

Variables

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

ErrPlanNotSupported is an error for plan building not supported

Functions

func Build

func Build(query string, vschema ContextVSchema) (*engine.Plan, error)

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

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, vschema ContextVSchema, bindVarNeeds *sqlparser.BindVarNeeds) (*engine.Plan, error)

BuildFromStmt builds a plan based on the AST provided.

func ResultFromNumber

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

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

Types

type ContextVSchema

type ContextVSchema interface {
	FindTable(tablename sqlparser.TableName) (*vindexes.Table, string, topodatapb.TabletType, key.Destination, error)
	FindTableOrVindex(tablename sqlparser.TableName) (*vindexes.Table, vindexes.Vindex, string, topodatapb.TabletType, key.Destination, error)
	DefaultKeyspace() (*vindexes.Keyspace, error)
	TargetString() string
	Destination() key.Destination
	TabletType() topodatapb.TabletType
	TargetDestination(qualifier string) (key.Destination, *vindexes.Keyspace, topodatapb.TabletType, error)
	AnyKeyspace() (*vindexes.Keyspace, error)
	FirstSortedKeyspace() (*vindexes.Keyspace, error)
	SysVarSetEnabled() bool
}

ContextVSchema defines the interface for this package to fetch info about tables.

Jump to

Keyboard shortcuts

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