semantics

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Gen4NotSupportedF

func Gen4NotSupportedF(format string, args ...interface{}) error

Gen4NotSupportedF returns a common error for shortcomings in the gen4 planner

Types

type FakeSI added in v0.11.0

type FakeSI struct {
	Tables map[string]*vindexes.Table
}

FakeSI is a fake SchemaInformation for testing

func (*FakeSI) FindTableOrVindex added in v0.11.0

FindTableOrVindex implements the SchemaInformation interface

type SchemaInformation added in v0.11.0

type SchemaInformation interface {
	FindTableOrVindex(tablename sqlparser.TableName) (*vindexes.Table, vindexes.Vindex, string, topodatapb.TabletType, key.Destination, error)
}

SchemaInformation is used tp provide table information from Vschema.

type SemTable

type SemTable struct {
	Tables []*TableInfo
	// ProjectionErr stores the error that we got during the semantic analysis of the SelectExprs.
	// This is only a real error if we are unable to plan the query as a single route
	ProjectionErr error
	// contains filtered or unexported fields
}

SemTable contains semantic analysis information about the query.

func Analyze added in v0.11.0

func Analyze(statement sqlparser.Statement, currentDb string, si SchemaInformation) (*SemTable, error)

Analyze analyzes the parsed query.

func NewSemTable

func NewSemTable() *SemTable

NewSemTable creates a new empty SemTable

func (*SemTable) AddExprs added in v0.11.0

func (st *SemTable) AddExprs(tbl *sqlparser.AliasedTableExpr, cols sqlparser.SelectExprs)

AddExprs adds new select exprs to the SemTable.

func (*SemTable) Dependencies

func (st *SemTable) Dependencies(expr sqlparser.Expr) TableSet

Dependencies return the table dependencies of the expression.

func (*SemTable) GetSelectTables added in v0.11.0

func (st *SemTable) GetSelectTables(node *sqlparser.Select) []*TableInfo

GetSelectTables returns the table in the select.

func (*SemTable) TableInfoFor added in v0.11.0

func (st *SemTable) TableInfoFor(id TableSet) (*TableInfo, error)

TableInfoFor returns the table info for the table set. It should contains only single table.

func (*SemTable) TableSetFor

func (st *SemTable) TableSetFor(t *sqlparser.AliasedTableExpr) TableSet

TableSetFor returns the bitmask for this particular tableshoe

type TableInfo added in v0.11.0

type TableInfo struct {
	ASTNode *sqlparser.AliasedTableExpr
	Table   *vindexes.Table
	// contains filtered or unexported fields
}

TableInfo contains the alias table expr and vindex table

type TableSet

type TableSet uint64 // we can only join 64 tables with this underlying data type

TableSet is how a set of tables is expressed. Tables get unique bits assigned in the order that they are encountered during semantic analysis

func (TableSet) Constituents

func (ts TableSet) Constituents() (result []TableSet)

Constituents returns an slice with all the individual tables in their own TableSet identifier

func (TableSet) IsOverlapping

func (ts TableSet) IsOverlapping(b TableSet) bool

IsOverlapping returns true if at least one table exists in both sets

func (TableSet) IsSolvedBy

func (ts TableSet) IsSolvedBy(b TableSet) bool

IsSolvedBy returns true if all of `ts` is contained in `b`

func (TableSet) Merge

func (ts TableSet) Merge(other TableSet) TableSet

Merge creates a TableSet that contains both inputs

func (TableSet) NumberOfTables

func (ts TableSet) NumberOfTables() int

NumberOfTables returns the number of bits set

func (TableSet) TableOffset added in v0.11.0

func (ts TableSet) TableOffset() int

TableOffset returns the offset in the Tables array from TableSet

Jump to

Keyboard shortcuts

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