plans

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AbstractPlanNode

type AbstractPlanNode struct {
	// contains filtered or unexported fields
}

*

  • AbstractPlanNode represents all the possible types of plan nodes in our system.
  • Plan nodes are modeled as trees, so each plan node can have a variable number of children.
  • Per the Volcano model, the plan node receives the tuples of its children.
  • The ordering of the children may matter.

func (*AbstractPlanNode) GetChildAt

func (p *AbstractPlanNode) GetChildAt(childIndex uint32) Plan

func (*AbstractPlanNode) GetChildren

func (p *AbstractPlanNode) GetChildren() []Plan

func (*AbstractPlanNode) OutputSchema

func (p *AbstractPlanNode) OutputSchema() *schema.Schema

type AggregateKey

type AggregateKey struct {
	Group_bys_ []*types.Value
}

type AggregateValue

type AggregateValue struct {
	Aggregates_ []*types.Value
}

type AggregationPlanNode

type AggregationPlanNode struct {
	*AbstractPlanNode
	// contains filtered or unexported fields
}

*

  • AggregationPlanNode represents the various SQL aggregation functions.
  • For example, COUNT(), SUM(), MIN() and MAX().
  • To simplfiy this project, AggregationPlanNode must always have exactly one child.

func NewAggregationPlanNode

func NewAggregationPlanNode(output_schema *schema.Schema, child Plan, having expression.Expression,
	group_bys []expression.Expression,
	aggregates []expression.Expression, agg_types []AggregationType) *AggregationPlanNode

*

  • Creates a new AggregationPlanNode.
  • @param output_schema the output format of this plan node
  • @param child the child plan to aggregate data over
  • @param having the having clause of the aggregation
  • @param group_bys the group by clause of the aggregation
  • @param aggregates the expressions that we are aggregating
  • @param agg_types the types that we are aggregating

func (*AggregationPlanNode) GetAggregateAt

func (p *AggregationPlanNode) GetAggregateAt(idx uint32) expression.Expression

* @return the idx'th aggregate expression

func (*AggregationPlanNode) GetAggregateTypes

func (p *AggregationPlanNode) GetAggregateTypes() []AggregationType

* @return the aggregate types

func (*AggregationPlanNode) GetAggregates

func (p *AggregationPlanNode) GetAggregates() []expression.Expression

* @return the aggregate expressions

func (*AggregationPlanNode) GetChildAt

func (p *AggregationPlanNode) GetChildAt(childIndex uint32) Plan

func (*AggregationPlanNode) GetChildPlan

func (p *AggregationPlanNode) GetChildPlan() Plan

* @return the child of this aggregation plan node

func (*AggregationPlanNode) GetChildren

func (p *AggregationPlanNode) GetChildren() []Plan

func (*AggregationPlanNode) GetGroupByAt

func (p *AggregationPlanNode) GetGroupByAt(idx uint32) expression.Expression

* @return the idx'th group by expression

func (*AggregationPlanNode) GetGroupBys

func (p *AggregationPlanNode) GetGroupBys() []expression.Expression

* @return the group by expressions

func (*AggregationPlanNode) GetHaving

func (p *AggregationPlanNode) GetHaving() expression.Expression

* @return the having clause

func (*AggregationPlanNode) GetTableOID added in v0.0.2

func (p *AggregationPlanNode) GetTableOID() uint32

func (*AggregationPlanNode) GetType

func (p *AggregationPlanNode) GetType() PlanType

type AggregationType

type AggregationType int32

/** AggregationType enumerates all the possible aggregation functions in our system. */

const (
	COUNT_AGGREGATE AggregationType = iota
	SUM_AGGREGATE
	MIN_AGGREGATE
	MAX_AGGREGATE
)

* The type of the log record.

type DeletePlanNode

type DeletePlanNode struct {
	*AbstractPlanNode
}

*

  • DeletePlanNode identifies a table and conditions specify record to be deleted.

func (*DeletePlanNode) GetTableOID

func (p *DeletePlanNode) GetTableOID() uint32

func (*DeletePlanNode) GetType

func (p *DeletePlanNode) GetType() PlanType

type FilterPlanNode

type FilterPlanNode struct {
	*AbstractPlanNode
	// contains filtered or unexported fields
}

func (*FilterPlanNode) GetPredicate

func (p *FilterPlanNode) GetPredicate() expression.Expression

func (*FilterPlanNode) GetSelectColumns

func (p *FilterPlanNode) GetSelectColumns() *schema.Schema

func (*FilterPlanNode) GetTableOID added in v0.0.2

func (p *FilterPlanNode) GetTableOID() uint32

func (*FilterPlanNode) GetType

func (p *FilterPlanNode) GetType() PlanType

type HashJoinPlanNode

type HashJoinPlanNode struct {
	*AbstractPlanNode
	// contains filtered or unexported fields
}

*

  • HashJoinPlanNode is used to represent performing a hash join between two children plan nodes.
  • By convention, the left child (index 0) is used to build the hash table,
  • and the right child (index 1) is used in probing the hash table.

func NewHashJoinPlanNode

func NewHashJoinPlanNode(output_schema *schema.Schema, children []Plan,
	onPredicate expression.Expression, left_hash_keys []expression.Expression,
	right_hash_keys []expression.Expression) *HashJoinPlanNode

func (*HashJoinPlanNode) GetLeftKeyAt

func (p *HashJoinPlanNode) GetLeftKeyAt(idx uint32) expression.Expression

* @return the left key at the given index

func (*HashJoinPlanNode) GetLeftKeys

func (p *HashJoinPlanNode) GetLeftKeys() []expression.Expression

* @return the left keys

func (*HashJoinPlanNode) GetLeftPlan

func (p *HashJoinPlanNode) GetLeftPlan() Plan

* @return the left plan node of the hash join, by convention this is used to build the table

func (*HashJoinPlanNode) GetRightKeyAt

func (p *HashJoinPlanNode) GetRightKeyAt(idx uint32) expression.Expression

* @return the right key at the given index

func (*HashJoinPlanNode) GetRightKeys

func (p *HashJoinPlanNode) GetRightKeys() []expression.Expression

* @return the right keys

func (*HashJoinPlanNode) GetRightPlan

func (p *HashJoinPlanNode) GetRightPlan() Plan

* @return the right plan node of the hash join

func (*HashJoinPlanNode) GetTableOID added in v0.0.2

func (p *HashJoinPlanNode) GetTableOID() uint32

can not be used

func (*HashJoinPlanNode) GetType

func (p *HashJoinPlanNode) GetType() PlanType

func (*HashJoinPlanNode) OnPredicate

func (p *HashJoinPlanNode) OnPredicate() expression.Expression

* @return the onPredicate to be used in the hash join

type InsertPlanNode

type InsertPlanNode struct {
	*AbstractPlanNode
	// contains filtered or unexported fields
}

*

  • InsertPlanNode identifies a table that should be inserted into.
  • The values to be inserted are either embedded into the InsertPlanNode itself, i.e. a "raw insert",
  • or will come from the child of the InsertPlanNode. To simplify the assignment, InsertPlanNode has at most one child.

func (*InsertPlanNode) GetRawValues

func (p *InsertPlanNode) GetRawValues() [][]types.Value

GetRawValues returns the raw values to be inserted

func (*InsertPlanNode) GetTableOID

func (p *InsertPlanNode) GetTableOID() uint32

GetTableOID returns the identifier of the table that should be inserted into

func (*InsertPlanNode) GetType

func (p *InsertPlanNode) GetType() PlanType

type LimitPlanNode

type LimitPlanNode struct {
	*AbstractPlanNode
	// contains filtered or unexported fields
}

func (*LimitPlanNode) GetLimit

func (p *LimitPlanNode) GetLimit() uint32

func (*LimitPlanNode) GetOffset

func (p *LimitPlanNode) GetOffset() uint32

func (*LimitPlanNode) GetTableOID added in v0.0.2

func (p *LimitPlanNode) GetTableOID() uint32

func (*LimitPlanNode) GetType

func (p *LimitPlanNode) GetType() PlanType

type OrderbyPlanNode

type OrderbyPlanNode struct {
	*AbstractPlanNode
	// contains filtered or unexported fields
}

*

  • OrderbyPlanNode represents the ORDER BY clause of SQL.

func NewOrderbyPlanNode

func NewOrderbyPlanNode(child_schema *schema.Schema, child Plan, col_idxs []int,
	order_types []OrderbyType) *OrderbyPlanNode

*

  • Creates a new OrderbyPlanNode.
  • @param output_schema the output format of this plan node. it is same with output schema of child
  • @param child the child plan to sort data over
  • @param col_idxs the specified columns idx at ORDER BY clause
  • @param order_types the order types of sorting with specifed columns

func (*OrderbyPlanNode) GetChildAt

func (p *OrderbyPlanNode) GetChildAt(childIndex uint32) Plan

func (*OrderbyPlanNode) GetChildPlan

func (p *OrderbyPlanNode) GetChildPlan() Plan

* @return the child of this aggregation plan node

func (*OrderbyPlanNode) GetChildren

func (p *OrderbyPlanNode) GetChildren() []Plan

func (*OrderbyPlanNode) GetColIdxAt

func (p *OrderbyPlanNode) GetColIdxAt(idx uint32) int

* @return the idx'th group by expression

func (*OrderbyPlanNode) GetColIdxs

func (p *OrderbyPlanNode) GetColIdxs() []int

* @return column indexes to deside sort order

func (*OrderbyPlanNode) GetOrderbyTypes

func (p *OrderbyPlanNode) GetOrderbyTypes() []OrderbyType

* @return the Order type ASC or DESC

func (*OrderbyPlanNode) GetTableOID added in v0.0.2

func (p *OrderbyPlanNode) GetTableOID() uint32

func (*OrderbyPlanNode) GetType

func (p *OrderbyPlanNode) GetType() PlanType

type OrderbyType

type OrderbyType int32

/** OrderbyType enumerates all the possible aggregation functions in our system. */

const (
	ASC OrderbyType = iota
	DESC
)

* The type of the sort order.

type Plan

type Plan interface {
	OutputSchema() *schema.Schema
	GetChildAt(childIndex uint32) Plan
	GetChildren() []Plan
	GetType() PlanType
	GetTableOID() uint32
}

func NewDeletePlanNode

func NewDeletePlanNode(child Plan) Plan

func NewDeletePlanNode(predicate expression.Expression, oid uint32) Plan {

func NewFilterPlanNode

func NewFilterPlanNode(child Plan, selectColumns *schema.Schema, predicate expression.Expression) Plan

func NewInsertPlanNode

func NewInsertPlanNode(rawValues [][]types.Value, oid uint32) Plan

NewInsertPlanNode creates a new insert plan node for inserting raw values

func NewLimitPlanNode

func NewLimitPlanNode(child Plan, limit uint32, offset uint32) Plan

func NewPointScanWithIndexPlanNode added in v0.0.2

func NewPointScanWithIndexPlanNode(schema *schema.Schema, predicate *expression.Comparison, tableOID uint32) Plan

func NewRangeScanWithIndexPlanNode added in v0.0.2

func NewRangeScanWithIndexPlanNode(schema *schema.Schema, tableOID uint32, colIdx int32, predicate expression.Expression, startRange *types.Value, endRange *types.Value) Plan

func NewSeqScanPlanNode

func NewSeqScanPlanNode(schema *schema.Schema, predicate expression.Expression, tableOID uint32) Plan

func NewUpdatePlanNode

func NewUpdatePlanNode(rawValues []types.Value, update_col_idxs []int, child Plan) Plan

if you update all column, you can specify nil to update_col_idxs. then all data of existed tuple is replaced with rawValues if you want update specifed columns only, you should specify columns with update_col_idxs and pass rawValues of all columns defined in schema. but not update target column value can be dummy value! func NewUpdatePlanNode(rawValues []types.Value, update_col_idxs []int, predicate expression.Expression, oid uint32) Plan {

type PlanType

type PlanType int
const (
	SeqScan PlanType = iota
	Insert
	Delete
	Limit
	IndexPointScan
	IndexRangeScan
	HashJoin
	Aggregation
	Orderby
	Filter
)

* PlanType represents the types of plans that we have in our system.

type PointScanWithIndexPlanNode added in v0.0.2

type PointScanWithIndexPlanNode struct {
	*AbstractPlanNode
	// contains filtered or unexported fields
}

*

  • PointScanWithIndexPlanNode use hash index to filter rows matches predicate.

func (*PointScanWithIndexPlanNode) GetPredicate added in v0.0.2

func (*PointScanWithIndexPlanNode) GetTableOID added in v0.0.2

func (p *PointScanWithIndexPlanNode) GetTableOID() uint32

func (*PointScanWithIndexPlanNode) GetType added in v0.0.2

func (p *PointScanWithIndexPlanNode) GetType() PlanType

type RangeScanWithIndexPlanNode added in v0.0.2

type RangeScanWithIndexPlanNode struct {
	*AbstractPlanNode
	// contains filtered or unexported fields
}

*

  • RangeScanWithIndexPlanNode use hash index to filter rows matches predicate.

func (*RangeScanWithIndexPlanNode) GetColIdx added in v0.0.2

func (p *RangeScanWithIndexPlanNode) GetColIdx() int32

func (*RangeScanWithIndexPlanNode) GetEndRange added in v0.0.2

func (p *RangeScanWithIndexPlanNode) GetEndRange() *types.Value

func (*RangeScanWithIndexPlanNode) GetPredicate added in v0.0.2

func (*RangeScanWithIndexPlanNode) GetStartRange added in v0.0.2

func (p *RangeScanWithIndexPlanNode) GetStartRange() *types.Value

func (*RangeScanWithIndexPlanNode) GetTableOID added in v0.0.2

func (p *RangeScanWithIndexPlanNode) GetTableOID() uint32

func (*RangeScanWithIndexPlanNode) GetType added in v0.0.2

func (p *RangeScanWithIndexPlanNode) GetType() PlanType

type SeqScanPlanNode

type SeqScanPlanNode struct {
	*AbstractPlanNode
	// contains filtered or unexported fields
}

*

  • SeqScanPlanNode identifies a table that should be scanned with an optional predicate.

func (*SeqScanPlanNode) GetPredicate

func (p *SeqScanPlanNode) GetPredicate() expression.Expression

func (*SeqScanPlanNode) GetTableOID

func (p *SeqScanPlanNode) GetTableOID() uint32

func (*SeqScanPlanNode) GetType

func (p *SeqScanPlanNode) GetType() PlanType

type UpdatePlanNode

type UpdatePlanNode struct {
	*AbstractPlanNode
	// contains filtered or unexported fields
}

*

  • UpdatePlanNode identifies a table and conditions specify record to be deleted.

func (*UpdatePlanNode) GetRawValues

func (p *UpdatePlanNode) GetRawValues() []types.Value

GetRawValues returns the raw values to be overwrite data

func (*UpdatePlanNode) GetTableOID

func (p *UpdatePlanNode) GetTableOID() uint32

func (*UpdatePlanNode) GetType

func (p *UpdatePlanNode) GetType() PlanType

func (*UpdatePlanNode) GetUpdateColIdxs

func (p *UpdatePlanNode) GetUpdateColIdxs() []int

Jump to

Keyboard shortcuts

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