Documentation
¶
Index ¶
- Constants
- Variables
- func DfsRel(grp *ExprGroup, cb func(rel RelExpr) error) error
- func DfsScalar(e ScalarExpr, cb func(e ScalarExpr) error) error
- func FormatExpr(r exprType) string
- func NewJoinOrderBuilder(memo *Memo) *joinOrderBuilder
- func ScalarToSqlCol(e *ExprGroup) *sql.Column
- type And
- type AntiJoin
- func (r AntiJoin) Cost() float64
- func (r AntiJoin) Distinct() distinctOp
- func (r AntiJoin) Group() *ExprGroup
- func (r *AntiJoin) JoinPrivate() *JoinBase
- func (r AntiJoin) Next() RelExpr
- func (r AntiJoin) SetCost(c float64)
- func (r AntiJoin) SetDistinct(d distinctOp)
- func (r AntiJoin) SetGroup(g *ExprGroup)
- func (r AntiJoin) SetNext(rel RelExpr)
- func (r *AntiJoin) String() string
- type ArithType
- type Arithmetic
- type Bindvar
- type Carder
- type ColRef
- type ConcatJoin
- func (r ConcatJoin) Cost() float64
- func (r ConcatJoin) Distinct() distinctOp
- func (r ConcatJoin) Group() *ExprGroup
- func (r *ConcatJoin) JoinPrivate() *JoinBase
- func (r ConcatJoin) Next() RelExpr
- func (r ConcatJoin) SetCost(c float64)
- func (r ConcatJoin) SetDistinct(d distinctOp)
- func (r ConcatJoin) SetGroup(g *ExprGroup)
- func (r ConcatJoin) SetNext(rel RelExpr)
- func (r *ConcatJoin) String() string
- type Coster
- type CrossJoin
- func (r CrossJoin) Cost() float64
- func (r CrossJoin) Distinct() distinctOp
- func (r CrossJoin) Group() *ExprGroup
- func (r *CrossJoin) JoinPrivate() *JoinBase
- func (r CrossJoin) Next() RelExpr
- func (r CrossJoin) SetCost(c float64)
- func (r CrossJoin) SetDistinct(d distinctOp)
- func (r CrossJoin) SetGroup(g *ExprGroup)
- func (r CrossJoin) SetNext(rel RelExpr)
- func (r *CrossJoin) String() string
- type Distinct
- func (r *Distinct) Children() []*ExprGroup
- func (r Distinct) Cost() float64
- func (r Distinct) Distinct() distinctOp
- func (r Distinct) Group() *ExprGroup
- func (r Distinct) Next() RelExpr
- func (r Distinct) SetCost(c float64)
- func (r Distinct) SetDistinct(d distinctOp)
- func (r Distinct) SetGroup(g *ExprGroup)
- func (r Distinct) SetNext(rel RelExpr)
- func (r *Distinct) String() string
- type EmptyTable
- type Equal
- type ExecBuilder
- type ExprGroup
- type Filter
- func (r *Filter) Children() []*ExprGroup
- func (r Filter) Cost() float64
- func (r Filter) Distinct() distinctOp
- func (r Filter) Group() *ExprGroup
- func (r Filter) Next() RelExpr
- func (r Filter) SetCost(c float64)
- func (r Filter) SetDistinct(d distinctOp)
- func (r Filter) SetGroup(g *ExprGroup)
- func (r Filter) SetNext(rel RelExpr)
- func (r *Filter) String() string
- type FullOuterJoin
- func (r FullOuterJoin) Cost() float64
- func (r FullOuterJoin) Distinct() distinctOp
- func (r FullOuterJoin) Group() *ExprGroup
- func (r *FullOuterJoin) JoinPrivate() *JoinBase
- func (r FullOuterJoin) Next() RelExpr
- func (r FullOuterJoin) SetCost(c float64)
- func (r FullOuterJoin) SetDistinct(d distinctOp)
- func (r FullOuterJoin) SetGroup(g *ExprGroup)
- func (r FullOuterJoin) SetNext(rel RelExpr)
- func (r *FullOuterJoin) String() string
- type Geq
- type GroupId
- type Gt
- type HashJoin
- func (r HashJoin) Cost() float64
- func (r HashJoin) Distinct() distinctOp
- func (r HashJoin) Group() *ExprGroup
- func (r *HashJoin) JoinPrivate() *JoinBase
- func (r HashJoin) Next() RelExpr
- func (r HashJoin) SetCost(c float64)
- func (r HashJoin) SetDistinct(d distinctOp)
- func (r HashJoin) SetGroup(g *ExprGroup)
- func (r HashJoin) SetNext(rel RelExpr)
- func (r *HashJoin) String() string
- type Hidden
- type Hint
- type HintType
- type InTuple
- type Index
- type IndexScan
- type InnerJoin
- func (r InnerJoin) Cost() float64
- func (r InnerJoin) Distinct() distinctOp
- func (r InnerJoin) Group() *ExprGroup
- func (r *InnerJoin) JoinPrivate() *JoinBase
- func (r InnerJoin) Next() RelExpr
- func (r InnerJoin) SetCost(c float64)
- func (r InnerJoin) SetDistinct(d distinctOp)
- func (r InnerJoin) SetGroup(g *ExprGroup)
- func (r InnerJoin) SetNext(rel RelExpr)
- func (r *InnerJoin) String() string
- type IsNull
- type JoinBase
- func (r *JoinBase) Children() []*ExprGroup
- func (r *JoinBase) Copy() *JoinBase
- func (r JoinBase) Cost() float64
- func (r JoinBase) Distinct() distinctOp
- func (r JoinBase) Group() *ExprGroup
- func (r *JoinBase) JoinPrivate() *JoinBase
- func (r JoinBase) Next() RelExpr
- func (r JoinBase) SetCost(c float64)
- func (r JoinBase) SetDistinct(d distinctOp)
- func (r JoinBase) SetGroup(g *ExprGroup)
- func (r JoinBase) SetNext(rel RelExpr)
- type JoinRel
- type LeftJoin
- func (r LeftJoin) Cost() float64
- func (r LeftJoin) Distinct() distinctOp
- func (r LeftJoin) Group() *ExprGroup
- func (r *LeftJoin) JoinPrivate() *JoinBase
- func (r LeftJoin) Next() RelExpr
- func (r LeftJoin) SetCost(c float64)
- func (r LeftJoin) SetDistinct(d distinctOp)
- func (r LeftJoin) SetGroup(g *ExprGroup)
- func (r LeftJoin) SetNext(rel RelExpr)
- func (r *LeftJoin) String() string
- type Leq
- type Literal
- type Lookup
- type LookupJoin
- func (r LookupJoin) Cost() float64
- func (r LookupJoin) Distinct() distinctOp
- func (r LookupJoin) Group() *ExprGroup
- func (r *LookupJoin) JoinPrivate() *JoinBase
- func (r LookupJoin) Next() RelExpr
- func (r LookupJoin) SetCost(c float64)
- func (r LookupJoin) SetDistinct(d distinctOp)
- func (r LookupJoin) SetGroup(g *ExprGroup)
- func (r LookupJoin) SetNext(rel RelExpr)
- func (r *LookupJoin) String() string
- type Lt
- type Max1Row
- type Memo
- func (m *Memo) ApplyHint(hint Hint)
- func (m *Memo) BestRootPlan() (sql.Node, error)
- func (m *Memo) MemoizeColRef(e *expression.GetField) *ExprGroup
- func (m *Memo) MemoizeFilter(grp, child *ExprGroup, filters []*ExprGroup) *ExprGroup
- func (m *Memo) MemoizeInnerJoin(grp, left, right *ExprGroup, op plan.JoinType, filter []ScalarExpr) *ExprGroup
- func (m *Memo) MemoizeIsNull(child sql.Expression) *ExprGroup
- func (m *Memo) MemoizeLeftJoin(grp, left, right *ExprGroup, op plan.JoinType, filter []ScalarExpr) *ExprGroup
- func (m *Memo) MemoizeLookupJoin(grp, left, right *ExprGroup, op plan.JoinType, filter []ScalarExpr, ...) *ExprGroup
- func (m *Memo) MemoizeMergeJoin(grp, left, right *ExprGroup, lIdx, rIdx *IndexScan, op plan.JoinType, ...) *ExprGroup
- func (m *Memo) MemoizeProject(grp, child *ExprGroup, projections []*ExprGroup) *ExprGroup
- func (m *Memo) MemoizeScalar(e sql.Expression) *ExprGroup
- func (m *Memo) NewExprGroup(rel exprType) *ExprGroup
- func (m *Memo) OptimizeRoot() error
- func (m *Memo) PreexistingScalar(e ScalarExpr) *ExprGroup
- func (m *Memo) Root() *ExprGroup
- func (m *Memo) String() string
- func (m *Memo) WithJoinOp(op HintType, left, right string)
- func (m *Memo) WithJoinOrder(tables []string)
- type MergeJoin
- func (r MergeJoin) Cost() float64
- func (r MergeJoin) Distinct() distinctOp
- func (r MergeJoin) Group() *ExprGroup
- func (r *MergeJoin) JoinPrivate() *JoinBase
- func (r MergeJoin) Next() RelExpr
- func (r MergeJoin) SetCost(c float64)
- func (r MergeJoin) SetDistinct(d distinctOp)
- func (r MergeJoin) SetGroup(g *ExprGroup)
- func (r MergeJoin) SetNext(rel RelExpr)
- func (r *MergeJoin) String() string
- type Not
- type NullSafeEq
- type Or
- type Project
- func (r *Project) Children() []*ExprGroup
- func (r Project) Cost() float64
- func (r Project) Distinct() distinctOp
- func (r Project) Group() *ExprGroup
- func (r Project) Next() RelExpr
- func (r Project) SetCost(c float64)
- func (r Project) SetDistinct(d distinctOp)
- func (r Project) SetGroup(g *ExprGroup)
- func (r Project) SetNext(rel RelExpr)
- func (r *Project) String() string
- type RecursiveCte
- func (r *RecursiveCte) Children() []*ExprGroup
- func (s RecursiveCte) Indexes() []*Index
- func (r *RecursiveCte) Name() string
- func (r *RecursiveCte) OutputCols() sql.Schema
- func (s RecursiveCte) SetIndexes(indexes []*Index)
- func (r *RecursiveCte) String() string
- func (r *RecursiveCte) TableId() TableId
- type RecursiveTable
- func (r *RecursiveTable) Children() []*ExprGroup
- func (s RecursiveTable) Indexes() []*Index
- func (r *RecursiveTable) Name() string
- func (r *RecursiveTable) OutputCols() sql.Schema
- func (s RecursiveTable) SetIndexes(indexes []*Index)
- func (r *RecursiveTable) String() string
- func (r *RecursiveTable) TableId() TableId
- type Regexp
- type RelExpr
- type ScalarExpr
- type ScalarExprId
- type SemiJoin
- func (r SemiJoin) Cost() float64
- func (r SemiJoin) Distinct() distinctOp
- func (r SemiJoin) Group() *ExprGroup
- func (r *SemiJoin) JoinPrivate() *JoinBase
- func (r SemiJoin) Next() RelExpr
- func (r SemiJoin) SetCost(c float64)
- func (r SemiJoin) SetDistinct(d distinctOp)
- func (r SemiJoin) SetGroup(g *ExprGroup)
- func (r SemiJoin) SetNext(rel RelExpr)
- func (r *SemiJoin) String() string
- type SourceRel
- type SubqueryAlias
- func (r *SubqueryAlias) Children() []*ExprGroup
- func (s SubqueryAlias) Indexes() []*Index
- func (r *SubqueryAlias) Name() string
- func (r *SubqueryAlias) OutputCols() sql.Schema
- func (s SubqueryAlias) SetIndexes(indexes []*Index)
- func (r *SubqueryAlias) String() string
- func (r *SubqueryAlias) TableId() TableId
- type TableAlias
- type TableFunc
- type TableId
- type TableScan
- type Tuple
- type Values
Constants ¶
const ( SortedDistinctOp distinctOp HashDistinctOp )
Variables ¶
var HaltErr = errors.New("halt dfs")
Functions ¶
func DfsRel ¶
DfsRel runs a callback |cb| on all execution plans in the memo expression group. An expression group is defined by 1) a set of child expression groups that serve as logical inputs to this operator, and 2) a set of logically equivalent plans for executing this expression group's operator. We recursively walk to expression group leaves, and then traverse every execution plan in leaf groups before working upwards back to the root group. Returning a HaltErr short circuits the walk.
func DfsScalar ¶
func DfsScalar(e ScalarExpr, cb func(e ScalarExpr) error) error
DfsScalar walks scalar expression memo groups. Returning a HaltErr short circuits the walk.
func FormatExpr ¶
func FormatExpr(r exprType) string
func NewJoinOrderBuilder ¶
func NewJoinOrderBuilder(memo *Memo) *joinOrderBuilder
func ScalarToSqlCol ¶
Types ¶
type AntiJoin ¶
type AntiJoin struct {
*JoinBase
}
func (*AntiJoin) JoinPrivate ¶
func (AntiJoin) SetDistinct ¶
func (r AntiJoin) SetDistinct(d distinctOp)
type Arithmetic ¶
type Arithmetic struct { Left *ExprGroup Right *ExprGroup Op ArithType // contains filtered or unexported fields }
func (*Arithmetic) Children ¶
func (r *Arithmetic) Children() []*ExprGroup
func (*Arithmetic) ExprId ¶
func (r *Arithmetic) ExprId() ScalarExprId
func (*Arithmetic) String ¶
func (r *Arithmetic) String() string
type Carder ¶
type Carder interface { // EstimateCard returns the estimate row count outputs for a relational // expression. Cardinality is an expression group property. EstimateCard(*sql.Context, RelExpr, sql.StatsReader) (float64, error) }
Carder types can estimate the cardinality (row count) of relational expressions.
func NewDefaultCarder ¶
func NewDefaultCarder() Carder
type ColRef ¶
type ColRef struct { Col sql.ColumnId Table GroupId Gf *expression.GetField // contains filtered or unexported fields }
func (*ColRef) ExprId ¶
func (r *ColRef) ExprId() ScalarExprId
type ConcatJoin ¶
func (*ConcatJoin) JoinPrivate ¶
func (r *ConcatJoin) JoinPrivate() *JoinBase
func (ConcatJoin) SetDistinct ¶
func (r ConcatJoin) SetDistinct(d distinctOp)
func (*ConcatJoin) String ¶
func (r *ConcatJoin) String() string
type Coster ¶
type Coster interface { // EstimateCost cost returns the incremental CPU and memory cost for an // operator, or an error. Cost is dependent on physical operator type, // and the cardinality of inputs. EstimateCost(*sql.Context, RelExpr, sql.StatsReader) (float64, error) }
Coster types can estimate the CPU and memory cost of physical execution operators.
func NewDefaultCoster ¶
func NewDefaultCoster() Coster
func NewHashBiasedCoster ¶
func NewHashBiasedCoster() Coster
func NewInnerBiasedCoster ¶
func NewInnerBiasedCoster() Coster
func NewLookupBiasedCoster ¶
func NewLookupBiasedCoster() Coster
func NewMergeBiasedCoster ¶
func NewMergeBiasedCoster() Coster
func NewPartialBiasedCoster ¶
func NewPartialBiasedCoster() Coster
type CrossJoin ¶
type CrossJoin struct {
*JoinBase
}
func (*CrossJoin) JoinPrivate ¶
func (CrossJoin) SetDistinct ¶
func (r CrossJoin) SetDistinct(d distinctOp)
type Distinct ¶
type Distinct struct { Child *ExprGroup // contains filtered or unexported fields }
func (Distinct) SetDistinct ¶
func (r Distinct) SetDistinct(d distinctOp)
type EmptyTable ¶
type EmptyTable struct { Table *plan.EmptyTable // contains filtered or unexported fields }
func (*EmptyTable) Children ¶
func (r *EmptyTable) Children() []*ExprGroup
func (*EmptyTable) Name ¶
func (r *EmptyTable) Name() string
func (*EmptyTable) OutputCols ¶
func (r *EmptyTable) OutputCols() sql.Schema
func (EmptyTable) SetIndexes ¶
func (s EmptyTable) SetIndexes(indexes []*Index)
func (*EmptyTable) String ¶
func (r *EmptyTable) String() string
func (*EmptyTable) TableId ¶
func (r *EmptyTable) TableId() TableId
type ExecBuilder ¶
type ExecBuilder struct{}
func NewExecBuilder ¶
func NewExecBuilder() *ExecBuilder
type ExprGroup ¶
type ExprGroup struct { RelProps *relProps Scalar ScalarExpr First RelExpr Best RelExpr Id GroupId Cost float64 Done bool HintOk bool // contains filtered or unexported fields }
ExprGroup is a linked list of plans that return the same result set defined by row count and schema.
func (*ExprGroup) Prepend ¶
Prepend adds a new plan to an expression group at the beginning of the list, to avoid recursive exploration steps (like adding indexed joins).
func (*ExprGroup) ScalarProps ¶
func (e *ExprGroup) ScalarProps() *scalarProps
type Filter ¶
type Filter struct { Child *ExprGroup Filters []*ExprGroup // contains filtered or unexported fields }
func (Filter) SetDistinct ¶
func (r Filter) SetDistinct(d distinctOp)
type FullOuterJoin ¶
type FullOuterJoin struct {
*JoinBase
}
func (*FullOuterJoin) JoinPrivate ¶
func (r *FullOuterJoin) JoinPrivate() *JoinBase
func (FullOuterJoin) SetDistinct ¶
func (r FullOuterJoin) SetDistinct(d distinctOp)
func (*FullOuterJoin) String ¶
func (r *FullOuterJoin) String() string
type HashJoin ¶
func (*HashJoin) JoinPrivate ¶
func (HashJoin) SetDistinct ¶
func (r HashJoin) SetDistinct(d distinctOp)
type Hidden ¶
type Hidden struct { E sql.Expression Cols sql.ColSet Tables sql.FastIntSet // contains filtered or unexported fields }
func (*Hidden) ExprId ¶
func (r *Hidden) ExprId() ScalarExprId
type Hint ¶
func ExtractJoinHint ¶
type HintType ¶
type HintType uint8
const ( HintTypeUnknown HintType = iota // HintTypeJoinOrder // JOIN_ORDER HintTypeJoinFixedOrder // JOIN_FIXED_ORDER HintTypeMergeJoin // MERGE_JOIN HintTypeLookupJoin // LOOKUP_JOIN HintTypeHashJoin // HASH_JOIN HintTypeSemiJoin // SEMI_JOIN HintTypeAntiJoin // ANTI_JOIN HintTypeInnerJoin // INNER_JOIN HintTypeLeftOuterLookupJoin // LEFT_OUTER_LOOKUP_JOIN HintTypeNoIndexConditionPushDown // NO_ICP )
TODO implement NO_ICP and JOIN_FIXED_ORDER
type InnerJoin ¶
type InnerJoin struct {
*JoinBase
}
func (*InnerJoin) JoinPrivate ¶
func (InnerJoin) SetDistinct ¶
func (r InnerJoin) SetDistinct(d distinctOp)
type IsNull ¶
type IsNull struct { Child *ExprGroup // contains filtered or unexported fields }
func (*IsNull) ExprId ¶
func (r *IsNull) ExprId() ScalarExprId
type JoinBase ¶
type JoinBase struct { Op plan.JoinType Filter []ScalarExpr Left *ExprGroup Right *ExprGroup // contains filtered or unexported fields }
func (*JoinBase) Copy ¶
Copy creates a JoinBase with the same underlying join expression. note: it is important to Copy the base node to avoid cyclical relExpr references in the ExprGroup linked list.
func (*JoinBase) JoinPrivate ¶
func (JoinBase) SetDistinct ¶
func (r JoinBase) SetDistinct(d distinctOp)
type JoinRel ¶
JoinRel represents a plan.JoinNode or plan.CrossJoin. See plan.JoinType for the full list.
type LeftJoin ¶
type LeftJoin struct {
*JoinBase
}
func (*LeftJoin) JoinPrivate ¶
func (LeftJoin) SetDistinct ¶
func (r LeftJoin) SetDistinct(d distinctOp)
type Lookup ¶
type Lookup struct { Index *Index KeyExprs []ScalarExpr Nullmask []bool Parent *JoinBase }
type LookupJoin ¶
func (*LookupJoin) JoinPrivate ¶
func (r *LookupJoin) JoinPrivate() *JoinBase
func (LookupJoin) SetDistinct ¶
func (r LookupJoin) SetDistinct(d distinctOp)
func (*LookupJoin) String ¶
func (r *LookupJoin) String() string
type Max1Row ¶
type Max1Row struct { Table sql.NameableNode // contains filtered or unexported fields }
func (*Max1Row) OutputCols ¶
func (Max1Row) SetIndexes ¶
func (s Max1Row) SetIndexes(indexes []*Index)
type Memo ¶
type Memo struct { Columns map[string]sql.ColumnId Ctx *sql.Context TableProps *tableProps // contains filtered or unexported fields }
Memo collects a forest of query plans structured by logical and physical equivalency. Logically equivalent plans, represented by an exprGroup, produce the same rows (possibly unordered) and schema. Physical plans are stored in a linked list within an expression group.
func (*Memo) MemoizeColRef ¶
func (m *Memo) MemoizeColRef(e *expression.GetField) *ExprGroup
func (*Memo) MemoizeFilter ¶
func (*Memo) MemoizeInnerJoin ¶
func (*Memo) MemoizeIsNull ¶
func (m *Memo) MemoizeIsNull(child sql.Expression) *ExprGroup
func (*Memo) MemoizeLeftJoin ¶
func (*Memo) MemoizeLookupJoin ¶
func (*Memo) MemoizeMergeJoin ¶
func (*Memo) MemoizeProject ¶
func (*Memo) MemoizeScalar ¶
func (m *Memo) MemoizeScalar(e sql.Expression) *ExprGroup
func (*Memo) NewExprGroup ¶
newExprGroup creates a new logical expression group to encapsulate the action of a SQL clause. TODO: this is supposed to deduplicate logically equivalent table scans and scalar expressions, replacing references with a pointer. Currently a hacky format to quickly support memoizing join trees.
func (*Memo) OptimizeRoot ¶
OptimizeRoot finds the implementation for the root expression that has the lowest cost.
func (*Memo) PreexistingScalar ¶
func (m *Memo) PreexistingScalar(e ScalarExpr) *ExprGroup
func (*Memo) WithJoinOp ¶
func (*Memo) WithJoinOrder ¶
type MergeJoin ¶
func (*MergeJoin) JoinPrivate ¶
func (MergeJoin) SetDistinct ¶
func (r MergeJoin) SetDistinct(d distinctOp)
type Not ¶
type Not struct { Child *ExprGroup // contains filtered or unexported fields }
func (*Not) ExprId ¶
func (r *Not) ExprId() ScalarExprId
type NullSafeEq ¶
type NullSafeEq struct { Left *ExprGroup Right *ExprGroup // contains filtered or unexported fields }
func (*NullSafeEq) Children ¶
func (r *NullSafeEq) Children() []*ExprGroup
func (*NullSafeEq) ExprId ¶
func (r *NullSafeEq) ExprId() ScalarExprId
func (*NullSafeEq) String ¶
func (r *NullSafeEq) String() string
type Project ¶
type Project struct { Child *ExprGroup Projections []*ExprGroup // contains filtered or unexported fields }
func (Project) SetDistinct ¶
func (r Project) SetDistinct(d distinctOp)
type RecursiveCte ¶
type RecursiveCte struct { Table *plan.RecursiveCte // contains filtered or unexported fields }
func (*RecursiveCte) Children ¶
func (r *RecursiveCte) Children() []*ExprGroup
func (*RecursiveCte) Name ¶
func (r *RecursiveCte) Name() string
func (*RecursiveCte) OutputCols ¶
func (r *RecursiveCte) OutputCols() sql.Schema
func (RecursiveCte) SetIndexes ¶
func (s RecursiveCte) SetIndexes(indexes []*Index)
func (*RecursiveCte) String ¶
func (r *RecursiveCte) String() string
func (*RecursiveCte) TableId ¶
func (r *RecursiveCte) TableId() TableId
type RecursiveTable ¶
type RecursiveTable struct { Table *plan.RecursiveTable // contains filtered or unexported fields }
func (*RecursiveTable) Children ¶
func (r *RecursiveTable) Children() []*ExprGroup
func (*RecursiveTable) Name ¶
func (r *RecursiveTable) Name() string
func (*RecursiveTable) OutputCols ¶
func (r *RecursiveTable) OutputCols() sql.Schema
func (RecursiveTable) SetIndexes ¶
func (s RecursiveTable) SetIndexes(indexes []*Index)
func (*RecursiveTable) String ¶
func (r *RecursiveTable) String() string
func (*RecursiveTable) TableId ¶
func (r *RecursiveTable) TableId() TableId
type RelExpr ¶
type RelExpr interface { fmt.Stringer Next() RelExpr SetNext(RelExpr) SetCost(c float64) Cost() float64 Distinct() distinctOp SetDistinct(distinctOp) // contains filtered or unexported methods }
RelExpr wraps a sql.Node for use as a ExprGroup linked list node. TODO: we need relExprs for every sql.Node and sql.Expression
type ScalarExpr ¶
type ScalarExpr interface { fmt.Stringer ExprId() ScalarExprId // contains filtered or unexported methods }
ScalarExpr is a sql.Expression equivalent. Both ScalarExpr and RelExpr are embedded in Memo as *ExprGroup. ScalarExpr will only have one implementation. todo: do we need scalar expressions in the memo? or could they be ref'd out
func SplitConjunction ¶
func SplitConjunction(e ScalarExpr) []ScalarExpr
splitConjunction_memo breaks AND expressions into their left and right parts, recursively
func SplitDisjunction ¶
func SplitDisjunction(e *Or) []ScalarExpr
splitDisjunction breaks OR expressions into their left and right parts, recursively
type ScalarExprId ¶
type ScalarExprId uint8
const ( ScalarExprUnknown ScalarExprId = iota ScalarExprEqual ScalarExprNot ScalarExprColRef ScalarExprLiteral ScalarExprOr ScalarExprAnd ScalarExprInTuple ScalarExprLt ScalarExprLeq ScalarExprGt ScalarExprGeq ScalarExprNullSafeEq ScalarExprRegexp ScalarExprArithmetic ScalarExprBindvar ScalarExprIsNull ScalarExprTuple ScalarExprHidden )
type SemiJoin ¶
type SemiJoin struct {
*JoinBase
}
func (*SemiJoin) JoinPrivate ¶
func (SemiJoin) SetDistinct ¶
func (r SemiJoin) SetDistinct(d distinctOp)
type SourceRel ¶
type SourceRel interface { RelExpr // outputCols retuns the output schema of this data source. // TODO: this is more useful as a relExpr property, but we need // this to fix up expression indexes currently OutputCols() sql.Schema Name() string TableId() TableId Indexes() []*Index SetIndexes(indexes []*Index) }
SourceRel represents a data source, like a tableScan, subqueryAlias, or list of values.
type SubqueryAlias ¶
type SubqueryAlias struct { Table *plan.SubqueryAlias // contains filtered or unexported fields }
func (*SubqueryAlias) Children ¶
func (r *SubqueryAlias) Children() []*ExprGroup
func (*SubqueryAlias) Name ¶
func (r *SubqueryAlias) Name() string
func (*SubqueryAlias) OutputCols ¶
func (r *SubqueryAlias) OutputCols() sql.Schema
func (SubqueryAlias) SetIndexes ¶
func (s SubqueryAlias) SetIndexes(indexes []*Index)
func (*SubqueryAlias) String ¶
func (r *SubqueryAlias) String() string
func (*SubqueryAlias) TableId ¶
func (r *SubqueryAlias) TableId() TableId
type TableAlias ¶
type TableAlias struct { Table *plan.TableAlias // contains filtered or unexported fields }
func (*TableAlias) Children ¶
func (r *TableAlias) Children() []*ExprGroup
func (*TableAlias) Name ¶
func (r *TableAlias) Name() string
func (*TableAlias) OutputCols ¶
func (r *TableAlias) OutputCols() sql.Schema
func (TableAlias) SetIndexes ¶
func (s TableAlias) SetIndexes(indexes []*Index)
func (*TableAlias) String ¶
func (r *TableAlias) String() string
func (*TableAlias) TableId ¶
func (r *TableAlias) TableId() TableId
type TableFunc ¶
type TableFunc struct { Table sql.TableFunction // contains filtered or unexported fields }
func (*TableFunc) OutputCols ¶
func (TableFunc) SetIndexes ¶
func (s TableFunc) SetIndexes(indexes []*Index)
type TableScan ¶
type TableScan struct { Table *plan.ResolvedTable // contains filtered or unexported fields }
func (*TableScan) OutputCols ¶
func (TableScan) SetIndexes ¶
func (s TableScan) SetIndexes(indexes []*Index)
type Tuple ¶
type Tuple struct { Values []*ExprGroup // contains filtered or unexported fields }
func (*Tuple) ExprId ¶
func (r *Tuple) ExprId() ScalarExprId
type Values ¶
type Values struct { Table *plan.ValueDerivedTable // contains filtered or unexported fields }
func (*Values) OutputCols ¶
func (Values) SetIndexes ¶
func (s Values) SetIndexes(indexes []*Index)