Documentation ¶
Index ¶
- Constants
- Variables
- func CardMemoGroups(g *ExprGroup)
- func DescribeStats(r RelExpr) *sql.DescribeStats
- func DfsRel(grp *ExprGroup, cb func(rel RelExpr) error) error
- func FormatExpr(r exprType) string
- func NewJoinOrderBuilder(memo *Memo) *joinOrderBuilder
- func TableIdForSource(id GroupId) sql.TableId
- 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 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
- func (r *EmptyTable) Children() []*ExprGroup
- func (s EmptyTable) Indexes() []*Index
- func (r *EmptyTable) Name() string
- func (r *EmptyTable) OutputCols() sql.Schema
- func (s EmptyTable) SetIndexes(indexes []*Index)
- func (r *EmptyTable) String() string
- func (r *EmptyTable) TableId() sql.TableId
- func (r *EmptyTable) TableIdNode() plan.TableIdNode
- 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 GroupId
- 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 Hint
- type HintType
- type Index
- type IndexScan
- func (r *IndexScan) Children() []*ExprGroup
- func (s IndexScan) Indexes() []*Index
- func (r *IndexScan) Name() string
- func (r *IndexScan) OutputCols() sql.Schema
- func (s IndexScan) SetIndexes(indexes []*Index)
- func (r *IndexScan) String() string
- func (r *IndexScan) TableId() sql.TableId
- func (r *IndexScan) TableIdNode() plan.TableIdNode
- 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 JSONTable
- func (r *JSONTable) Children() []*ExprGroup
- func (s JSONTable) Indexes() []*Index
- func (r *JSONTable) Name() string
- func (r *JSONTable) OutputCols() sql.Schema
- func (s JSONTable) SetIndexes(indexes []*Index)
- func (r *JSONTable) String() string
- func (r *JSONTable) TableId() sql.TableId
- func (r *JSONTable) TableIdNode() plan.TableIdNode
- 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 LateralJoin
- func (r LateralJoin) Cost() float64
- func (r LateralJoin) Distinct() distinctOp
- func (r LateralJoin) Group() *ExprGroup
- func (r *LateralJoin) JoinPrivate() *JoinBase
- func (r LateralJoin) Next() RelExpr
- func (r LateralJoin) SetCost(c float64)
- func (r LateralJoin) SetDistinct(d distinctOp)
- func (r LateralJoin) SetGroup(g *ExprGroup)
- func (r LateralJoin) SetNext(rel RelExpr)
- func (r *LateralJoin) String() string
- 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 LookupJoin
- func (r *LookupJoin) Children() []*ExprGroup
- 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 Max1Row
- func (r *Max1Row) Children() []*ExprGroup
- func (r Max1Row) Cost() float64
- func (r Max1Row) Distinct() distinctOp
- func (r Max1Row) Group() *ExprGroup
- func (r Max1Row) Next() RelExpr
- func (r Max1Row) SetCost(c float64)
- func (r Max1Row) SetDistinct(d distinctOp)
- func (r Max1Row) SetGroup(g *ExprGroup)
- func (r Max1Row) SetNext(rel RelExpr)
- func (r *Max1Row) String() string
- type Memo
- func (m *Memo) ApplyHint(hint Hint)
- func (m *Memo) BestRootPlan(ctx *sql.Context) (sql.Node, error)
- func (m *Memo) HandleErr(err error)
- func (m *Memo) MemoizeConcatLookupJoin(grp, left, right *ExprGroup, op plan.JoinType, filter []sql.Expression, ...) *ExprGroup
- func (m *Memo) MemoizeFilter(grp, child *ExprGroup, filters []sql.Expression) *ExprGroup
- func (m *Memo) MemoizeHashJoin(grp *ExprGroup, join *JoinBase, toExpr, fromExpr []sql.Expression) *ExprGroup
- func (m *Memo) MemoizeIndexScan(grp *ExprGroup, ita *plan.IndexedTableAccess, alias string, index *Index, ...) *ExprGroup
- func (m *Memo) MemoizeInnerJoin(grp, left, right *ExprGroup, op plan.JoinType, filter []sql.Expression) *ExprGroup
- func (m *Memo) MemoizeLeftJoin(grp, left, right *ExprGroup, op plan.JoinType, filter []sql.Expression) *ExprGroup
- func (m *Memo) MemoizeLookupJoin(grp, left, right *ExprGroup, op plan.JoinType, filter []sql.Expression, ...) *ExprGroup
- func (m *Memo) MemoizeMax1Row(grp, child *ExprGroup) *ExprGroup
- func (m *Memo) MemoizeMergeJoin(grp, left, right *ExprGroup, lIdx, rIdx *IndexScan, op plan.JoinType, ...) *ExprGroup
- func (m *Memo) MemoizeProject(grp, child *ExprGroup, projections []sql.Expression) *ExprGroup
- func (m *Memo) MemoizeRangeHeapJoin(grp, left, right *ExprGroup, op plan.JoinType, filter []sql.Expression, ...) *ExprGroup
- func (m *Memo) NewExprGroup(rel exprType) *ExprGroup
- func (m *Memo) OptimizeRoot() error
- func (m *Memo) Root() *ExprGroup
- func (m *Memo) StatsProvider() sql.StatsProvider
- func (m *Memo) String() string
- func (m *Memo) WithJoinOp(op HintType, left, right string)
- func (m *Memo) WithJoinOrder(tables []string)
- type MemoErr
- 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 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 RangeHeap
- type RangeHeapJoin
- func (r RangeHeapJoin) Cost() float64
- func (r RangeHeapJoin) Distinct() distinctOp
- func (r RangeHeapJoin) Group() *ExprGroup
- func (r *RangeHeapJoin) JoinPrivate() *JoinBase
- func (r RangeHeapJoin) Next() RelExpr
- func (r RangeHeapJoin) SetCost(c float64)
- func (r RangeHeapJoin) SetDistinct(d distinctOp)
- func (r RangeHeapJoin) SetGroup(g *ExprGroup)
- func (r RangeHeapJoin) SetNext(rel RelExpr)
- func (r *RangeHeapJoin) 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() sql.TableId
- func (r *RecursiveCte) TableIdNode() plan.TableIdNode
- 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() sql.TableId
- func (r *RecursiveTable) TableIdNode() plan.TableIdNode
- type RelExpr
- 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 SetOp
- func (r *SetOp) Children() []*ExprGroup
- func (s SetOp) Indexes() []*Index
- func (r *SetOp) Name() string
- func (r *SetOp) OutputCols() sql.Schema
- func (s SetOp) SetIndexes(indexes []*Index)
- func (r *SetOp) String() string
- func (r *SetOp) TableId() sql.TableId
- func (r *SetOp) TableIdNode() plan.TableIdNode
- 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() sql.TableId
- func (r *SubqueryAlias) TableIdNode() plan.TableIdNode
- type TableAlias
- func (r *TableAlias) Children() []*ExprGroup
- func (s TableAlias) Indexes() []*Index
- func (r *TableAlias) Name() string
- func (r *TableAlias) OutputCols() sql.Schema
- func (s TableAlias) SetIndexes(indexes []*Index)
- func (r *TableAlias) String() string
- func (r *TableAlias) TableId() sql.TableId
- func (r *TableAlias) TableIdNode() plan.TableIdNode
- type TableAndColumn
- type TableFunc
- func (r *TableFunc) Children() []*ExprGroup
- func (s TableFunc) Indexes() []*Index
- func (r *TableFunc) Name() string
- func (r *TableFunc) OutputCols() sql.Schema
- func (s TableFunc) SetIndexes(indexes []*Index)
- func (r *TableFunc) String() string
- func (r *TableFunc) TableId() sql.TableId
- func (r *TableFunc) TableIdNode() plan.TableIdNode
- type TableId
- type TableScan
- func (r *TableScan) Children() []*ExprGroup
- func (s TableScan) Indexes() []*Index
- func (r *TableScan) Name() string
- func (r *TableScan) OutputCols() sql.Schema
- func (s TableScan) SetIndexes(indexes []*Index)
- func (r *TableScan) String() string
- func (r *TableScan) TableId() sql.TableId
- func (r *TableScan) TableIdNode() plan.TableIdNode
- type Values
- func (r *Values) Children() []*ExprGroup
- func (s Values) Indexes() []*Index
- func (r *Values) Name() string
- func (r *Values) OutputCols() sql.Schema
- func (s Values) SetIndexes(indexes []*Index)
- func (r *Values) String() string
- func (r *Values) TableId() sql.TableId
- func (r *Values) TableIdNode() plan.TableIdNode
Constants ¶
const ( NoDistinctOp distinctOp SortedDistinctOp HashDistinctOp )
Variables ¶
var ErrUnsupportedReorderNode = errors.New("unsupported join reorder node")
var HaltErr = errors.New("halt dfs")
Functions ¶
func CardMemoGroups ¶
func CardMemoGroups(g *ExprGroup)
func DescribeStats ¶
func DescribeStats(r RelExpr) *sql.DescribeStats
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 FormatExpr ¶
func FormatExpr(r exprType) string
func NewJoinOrderBuilder ¶
func NewJoinOrderBuilder(memo *Memo) *joinOrderBuilder
func TableIdForSource ¶
Types ¶
type AntiJoin ¶
type AntiJoin struct {
*JoinBase
}
func (*AntiJoin) JoinPrivate ¶
func (AntiJoin) SetDistinct ¶
func (r AntiJoin) SetDistinct(d distinctOp)
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.StatsProvider) (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
func NewRangeHeapBiasedCoster ¶
func NewRangeHeapBiasedCoster() 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() sql.TableId
func (*EmptyTable) TableIdNode ¶
func (r *EmptyTable) TableIdNode() plan.TableIdNode
type ExecBuilder ¶
type ExecBuilder struct{}
func NewExecBuilder ¶
func NewExecBuilder() *ExecBuilder
type ExprGroup ¶
type ExprGroup struct { RelProps *relProps 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.
type Filter ¶
type Filter struct { Child *ExprGroup Filters []sql.Expression // 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 ¶
type HashJoin struct { *JoinBase RightAttrs []sql.Expression LeftAttrs []sql.Expression }
func (*HashJoin) JoinPrivate ¶
func (HashJoin) SetDistinct ¶
func (r HashJoin) SetDistinct(d distinctOp)
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 HintTypeLeftDeep // LEFT_DEEP )
TODO implement NO_ICP and JOIN_FIXED_ORDER
type IndexScan ¶
type IndexScan struct { Table *plan.IndexedTableAccess Index *Index Alias string Stats sql.Statistic // contains filtered or unexported fields }
func (*IndexScan) OutputCols ¶
func (IndexScan) SetIndexes ¶
func (s IndexScan) SetIndexes(indexes []*Index)
func (*IndexScan) TableIdNode ¶
func (r *IndexScan) TableIdNode() plan.TableIdNode
type InnerJoin ¶
type InnerJoin struct {
*JoinBase
}
func (*InnerJoin) JoinPrivate ¶
func (InnerJoin) SetDistinct ¶
func (r InnerJoin) SetDistinct(d distinctOp)
type JSONTable ¶
func (*JSONTable) OutputCols ¶
func (JSONTable) SetIndexes ¶
func (s JSONTable) SetIndexes(indexes []*Index)
func (*JSONTable) TableIdNode ¶
func (r *JSONTable) TableIdNode() plan.TableIdNode
type JoinBase ¶
type JoinBase struct { Op plan.JoinType Filter []sql.Expression 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 LateralJoin ¶
type LateralJoin struct {
*JoinBase
}
func (*LateralJoin) JoinPrivate ¶
func (r *LateralJoin) JoinPrivate() *JoinBase
func (LateralJoin) SetDistinct ¶
func (r LateralJoin) SetDistinct(d distinctOp)
func (*LateralJoin) String ¶
func (r *LateralJoin) String() string
type LeftJoin ¶
type LeftJoin struct {
*JoinBase
}
func (*LeftJoin) JoinPrivate ¶
func (LeftJoin) SetDistinct ¶
func (r LeftJoin) SetDistinct(d distinctOp)
type LookupJoin ¶
func (*LookupJoin) Children ¶
func (r *LookupJoin) Children() []*ExprGroup
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 { Child *ExprGroup // contains filtered or unexported fields }
func (Max1Row) SetDistinct ¶
func (r Max1Row) SetDistinct(d distinctOp)
type Memo ¶
type Memo struct { 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) MemoizeConcatLookupJoin ¶
func (m *Memo) MemoizeConcatLookupJoin(grp, left, right *ExprGroup, op plan.JoinType, filter []sql.Expression, lookups []*IndexScan) *ExprGroup
MemoizeConcatLookupJoin creates a lookup join over a set of disjunctions. If a LOOKUP_JOIN simulates x = v1, a concat lookup performs x in (v1, v2, v3, ...)
func (*Memo) MemoizeFilter ¶
func (m *Memo) MemoizeFilter(grp, child *ExprGroup, filters []sql.Expression) *ExprGroup
func (*Memo) MemoizeHashJoin ¶
func (*Memo) MemoizeIndexScan ¶
func (m *Memo) MemoizeIndexScan(grp *ExprGroup, ita *plan.IndexedTableAccess, alias string, index *Index, stat sql.Statistic) *ExprGroup
MemoizeIndexScan creates a source node that uses a specific index to access data. IndexScans are either static and read a specific set of ranges, or dynamic and use a lookup template that is iteratively bound and executed during LOOKUP_JOINs.
func (*Memo) MemoizeInnerJoin ¶
func (*Memo) MemoizeLeftJoin ¶
func (*Memo) MemoizeLookupJoin ¶
func (*Memo) MemoizeMax1Row ¶
func (*Memo) MemoizeMergeJoin ¶
func (*Memo) MemoizeProject ¶
func (m *Memo) MemoizeProject(grp, child *ExprGroup, projections []sql.Expression) *ExprGroup
func (*Memo) MemoizeRangeHeapJoin ¶
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) StatsProvider ¶
func (m *Memo) StatsProvider() sql.StatsProvider
func (*Memo) WithJoinOp ¶
func (*Memo) WithJoinOrder ¶
type MergeJoin ¶
type MergeJoin struct { *JoinBase InnerScan *IndexScan OuterScan *IndexScan SwapCmp bool Injective bool CmpCnt int }
func (*MergeJoin) JoinPrivate ¶
func (MergeJoin) SetDistinct ¶
func (r MergeJoin) SetDistinct(d distinctOp)
type Project ¶
type Project struct { Child *ExprGroup Projections []sql.Expression // contains filtered or unexported fields }
func (Project) SetDistinct ¶
func (r Project) SetDistinct(d distinctOp)
type RangeHeap ¶
type RangeHeap struct { ValueIndex *IndexScan ValueExpr sql.Expression MinIndex *IndexScan MinExpr sql.Expression ValueCol *expression.GetField MinColRef *expression.GetField MaxColRef *expression.GetField RangeClosedOnLowerBound bool RangeClosedOnUpperBound bool Parent *JoinBase }
RangeHeap contains all the information necessary to construct a RangeHeap join. Because both sides of the join can be implemented either by an index or a sorted node, we require that exactly one of ValueIndex and ValueExpr is non-nil, and exactly one of MinIndex and MinExpr is non-nil. If the index is non-nil, we will use it to construct a plan.IndexedTableAccess. Otherwise we use the expression to construct a plan.Sort.
type RangeHeapJoin ¶
func (*RangeHeapJoin) JoinPrivate ¶
func (r *RangeHeapJoin) JoinPrivate() *JoinBase
func (RangeHeapJoin) SetDistinct ¶
func (r RangeHeapJoin) SetDistinct(d distinctOp)
func (*RangeHeapJoin) String ¶
func (r *RangeHeapJoin) String() string
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() sql.TableId
func (*RecursiveCte) TableIdNode ¶
func (r *RecursiveCte) TableIdNode() plan.TableIdNode
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() sql.TableId
func (*RecursiveTable) TableIdNode ¶
func (r *RecursiveTable) TableIdNode() plan.TableIdNode
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 SemiJoin ¶
type SemiJoin struct {
*JoinBase
}
func (*SemiJoin) JoinPrivate ¶
func (SemiJoin) SetDistinct ¶
func (r SemiJoin) SetDistinct(d distinctOp)
type SetOp ¶
func (*SetOp) OutputCols ¶
func (SetOp) SetIndexes ¶
func (s SetOp) SetIndexes(indexes []*Index)
func (*SetOp) TableIdNode ¶
func (r *SetOp) TableIdNode() plan.TableIdNode
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() sql.TableId Indexes() []*Index SetIndexes(indexes []*Index) TableIdNode() plan.TableIdNode }
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() sql.TableId
func (*SubqueryAlias) TableIdNode ¶
func (r *SubqueryAlias) TableIdNode() plan.TableIdNode
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() sql.TableId
func (*TableAlias) TableIdNode ¶
func (r *TableAlias) TableIdNode() plan.TableIdNode
type TableAndColumn ¶
type TableAndColumn struct {
// contains filtered or unexported fields
}
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)
func (*TableFunc) TableIdNode ¶
func (r *TableFunc) TableIdNode() plan.TableIdNode
type TableScan ¶
type TableScan struct { Table plan.TableIdNode // contains filtered or unexported fields }
func (*TableScan) OutputCols ¶
func (TableScan) SetIndexes ¶
func (s TableScan) SetIndexes(indexes []*Index)
func (*TableScan) TableIdNode ¶
func (r *TableScan) TableIdNode() plan.TableIdNode
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)
func (*Values) TableIdNode ¶
func (r *Values) TableIdNode() plan.TableIdNode