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
- Variables
- func BuildColName(rcs []*resultColumn, index int) (*sqlparser.ColName, error)
- func BuildFromStmt(query string, stmt sqlparser.Statement, vschema ContextVSchema, ...) (*engine.Plan, error)
- func First(input logicalPlan) logicalPlan
- func ResultFromNumber(rcs []*resultColumn, val *sqlparser.Literal) (int, error)
- func TestBuilder(query string, vschema ContextVSchema) (*engine.Plan, error)
- type ContextVSchema
Constants ¶
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" )
Error messages for CreateView queries
Variables ¶
var ErrPlanNotSupported = errors.New("plan building not supported")
ErrPlanNotSupported is an error for plan building not supported
Functions ¶
func BuildColName ¶
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 First ¶ added in v0.9.0
func First(input logicalPlan) logicalPlan
First returns the first logical plan of the tree, which is usually the left most leaf.
func ResultFromNumber ¶
ResultFromNumber returns the result column index based on the column order expression.
func TestBuilder ¶ added in v0.9.0
func TestBuilder(query string, vschema ContextVSchema) (*engine.Plan, error)
TestBuilder builds a plan for a query based on the specified vschema. This method is only used from tests
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 KeyspaceExists(keyspace string) bool AllKeyspace() ([]*vindexes.Keyspace, error) }
ContextVSchema defines the interface for this package to fetch info about tables.
Source Files ¶
- builder.go
- bypass.go
- concatenate.go
- ddl.go
- delete.go
- distinct.go
- dml.go
- doc.go
- explain.go
- expr.go
- expression_converter.go
- filtering.go
- from.go
- grouping.go
- insert.go
- join.go
- jointab.go
- limit.go
- locktables.go
- logical_plan.go
- memory_sort.go
- merge_sort.go
- ordered_aggregate.go
- ordering.go
- other_read.go
- postprocess.go
- primitive_builder.go
- project.go
- pullout_subquery.go
- route.go
- select.go
- set.go
- show.go
- sql_calc_found_rows.go
- subquery.go
- symtab.go
- system_tables.go
- system_variables.go
- union.go
- update.go
- use.go
- vindex_func.go