octosql: github.com/cube2222/octosql/physical Index | Files | Directories

package physical

import "github.com/cube2222/octosql/physical"

Index

Package Files

config.go datasource.go distinct.go filter.go function.go group_by.go innerjoin.go leftjoin.go limit.go logic.go map.go offset.go order_by.go physical.go relation.go requalifier.go tvf.go union_all.go

type Aggregate Uses

type Aggregate string
const (
    Avg           Aggregate = "avg"
    AvgDistinct   Aggregate = "avg_distinct"
    Count         Aggregate = "count"
    CountDistinct Aggregate = "count_distinct"
    First         Aggregate = "first"
    Last          Aggregate = "last"
    Max           Aggregate = "max"
    Min           Aggregate = "min"
    Sum           Aggregate = "sum"
    SumDistinct   Aggregate = "sum_distinct"
)

func NewAggregate Uses

func NewAggregate(aggregate string) Aggregate

type AliasedExpression Uses

type AliasedExpression struct {
    Name octosql.VariableName
    Expr Expression
}

AliasedExpression describes an expression which is explicitly named.

func NewAliasedExpression Uses

func NewAliasedExpression(name octosql.VariableName, expr Expression) *AliasedExpression

func (*AliasedExpression) Materialize Uses

func (alExpr *AliasedExpression) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Expression, error)

func (*AliasedExpression) MaterializeNamed Uses

func (alExpr *AliasedExpression) MaterializeNamed(ctx context.Context, matCtx *MaterializationContext) (execution.NamedExpression, error)

func (*AliasedExpression) Transform Uses

func (alExpr *AliasedExpression) Transform(ctx context.Context, transformers *Transformers) Expression

func (*AliasedExpression) TransformNamed Uses

func (alExpr *AliasedExpression) TransformNamed(ctx context.Context, transformers *Transformers) NamedExpression

type And Uses

type And struct {
    Left, Right Formula
}

func NewAnd Uses

func NewAnd(left Formula, right Formula) *And

func (*And) ExtractPredicates Uses

func (f *And) ExtractPredicates() []*Predicate

func (*And) Materialize Uses

func (f *And) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Formula, error)

func (*And) SplitByAnd Uses

func (f *And) SplitByAnd() []Formula

func (*And) Transform Uses

func (f *And) Transform(ctx context.Context, transformers *Transformers) Formula

type Constant Uses

type Constant struct {
    Value bool
}

func NewConstant Uses

func NewConstant(value bool) *Constant

func (*Constant) ExtractPredicates Uses

func (f *Constant) ExtractPredicates() []*Predicate

func (*Constant) Materialize Uses

func (f *Constant) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Formula, error)

func (*Constant) SplitByAnd Uses

func (f *Constant) SplitByAnd() []Formula

func (*Constant) Transform Uses

func (f *Constant) Transform(ctx context.Context, transformers *Transformers) Formula

type DataSourceBuilder Uses

type DataSourceBuilder struct {
    Materializer     func(ctx context.Context, matCtx *MaterializationContext, dbConfig map[string]interface{}, filter Formula, alias string) (execution.Node, error)
    PrimaryKeys      []octosql.VariableName
    AvailableFilters map[FieldType]map[Relation]struct{}
    Filter           Formula
    Name             string
    Alias            string

    // This field will be used to decide on join strategies or if the source is a stream.
    Cardinality metadata.Cardinality
}

DataSourceBuilder is used to build a data source instance with an alias. It may be given filters, which are later executed at the database level.

func (*DataSourceBuilder) Materialize Uses

func (dsb *DataSourceBuilder) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Node, error)

func (*DataSourceBuilder) Metadata Uses

func (dsb *DataSourceBuilder) Metadata() *metadata.NodeMetadata

func (*DataSourceBuilder) Transform Uses

func (dsb *DataSourceBuilder) Transform(ctx context.Context, transformers *Transformers) Node

type DataSourceBuilderFactory Uses

type DataSourceBuilderFactory func(name, alias string) *DataSourceBuilder

DataSourceBuilderFactory is a function used to create a new aliased data source builder.

func NewDataSourceBuilderFactory Uses

func NewDataSourceBuilderFactory(materializer func(ctx context.Context, matCtx *MaterializationContext, dbConfig map[string]interface{}, filter Formula, alias string) (execution.Node, error), primaryKeys []octosql.VariableName, availableFilters map[FieldType]map[Relation]struct{}, cardinality metadata.Cardinality) DataSourceBuilderFactory

type DataSourceRepository Uses

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

DataSourceRepository is used to register factories for builders for any data source. It can also later create a builder for any of those data source.

func CreateDataSourceRepositoryFromConfig Uses

func CreateDataSourceRepositoryFromConfig(factories map[string]Factory, config *config.Config) (*DataSourceRepository, error)

CreateDataSourceRepositoryFromConfig creates a DataSourceRepository from a config, using the given configuration reading data source factories. The map should be given as databaseType -> Factory.

func NewDataSourceRepository Uses

func NewDataSourceRepository() *DataSourceRepository

func (*DataSourceRepository) Get Uses

func (repo *DataSourceRepository) Get(dataSourceName, alias string) (*DataSourceBuilder, error)

Get gets a new builder for a given data source.

func (*DataSourceRepository) Register Uses

func (repo *DataSourceRepository) Register(dataSourceName string, factory DataSourceBuilderFactory) error

Register registers a builder factory for the given data source ColumnName.

type Distinct Uses

type Distinct struct {
    Source Node
}

func NewDistinct Uses

func NewDistinct(child Node) *Distinct

func (*Distinct) Materialize Uses

func (node *Distinct) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Node, error)

func (*Distinct) Metadata Uses

func (node *Distinct) Metadata() *metadata.NodeMetadata

func (*Distinct) Transform Uses

func (node *Distinct) Transform(ctx context.Context, transformers *Transformers) Node

type Expression Uses

type Expression interface {
    // Transform returns a new Expression after recursively calling Transform
    Transform(ctx context.Context, transformers *Transformers) Expression
    Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Expression, error)
}

Expressions describes a single value source.

type Factory Uses

type Factory func(dbConfig map[string]interface{}) (DataSourceBuilderFactory, error)

type FieldType Uses

type FieldType string

FieldType describes if a key is a primary or secondary attribute.

const (
    Primary   FieldType = "primary"
    Secondary FieldType = "secondary"
)

type Filter Uses

type Filter struct {
    Formula Formula
    Source  Node
}

func NewFilter Uses

func NewFilter(formula Formula, child Node) *Filter

func (*Filter) Materialize Uses

func (node *Filter) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Node, error)

func (*Filter) Metadata Uses

func (node *Filter) Metadata() *metadata.NodeMetadata

func (*Filter) Transform Uses

func (node *Filter) Transform(ctx context.Context, transformers *Transformers) Node

type Formula Uses

type Formula interface {
    // Transform returns a new Formula after recursively calling Transform
    Transform(ctx context.Context, transformers *Transformers) Formula
    SplitByAnd() []Formula
    ExtractPredicates() []*Predicate
    Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Formula, error)
}

Formula describes any source of a logical value.

type FunctionExpression Uses

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

func NewFunctionExpression Uses

func NewFunctionExpression(name string, args []Expression) *FunctionExpression

func (*FunctionExpression) Materialize Uses

func (fe *FunctionExpression) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Expression, error)

func (*FunctionExpression) Transform Uses

func (fe *FunctionExpression) Transform(ctx context.Context, transformers *Transformers) Expression

type GroupBy Uses

type GroupBy struct {
    Source Node
    Key    []Expression

    Fields     []octosql.VariableName
    Aggregates []Aggregate

    As  []octosql.VariableName
}

func NewGroupBy Uses

func NewGroupBy(source Node, key []Expression, fields []octosql.VariableName, aggregates []Aggregate, as []octosql.VariableName) *GroupBy

func (*GroupBy) Materialize Uses

func (node *GroupBy) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Node, error)

func (*GroupBy) Metadata Uses

func (node *GroupBy) Metadata() *metadata.NodeMetadata

func (*GroupBy) Transform Uses

func (node *GroupBy) Transform(ctx context.Context, transformers *Transformers) Node

type InnerJoin Uses

type InnerJoin struct {
    Source Node
    Joined Node
}

func NewInnerJoin Uses

func NewInnerJoin(source Node, joined Node) *InnerJoin

func (*InnerJoin) Materialize Uses

func (node *InnerJoin) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Node, error)

func (*InnerJoin) Metadata Uses

func (node *InnerJoin) Metadata() *metadata.NodeMetadata

func (*InnerJoin) Transform Uses

func (node *InnerJoin) Transform(ctx context.Context, transformers *Transformers) Node

type LeftJoin Uses

type LeftJoin struct {
    Source Node
    Joined Node
}

func NewLeftJoin Uses

func NewLeftJoin(source Node, joined Node) *LeftJoin

func (*LeftJoin) Materialize Uses

func (node *LeftJoin) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Node, error)

func (*LeftJoin) Metadata Uses

func (node *LeftJoin) Metadata() *metadata.NodeMetadata

func (*LeftJoin) Transform Uses

func (node *LeftJoin) Transform(ctx context.Context, transformers *Transformers) Node

type Limit Uses

type Limit struct {
    Source    Node
    LimitExpr Expression
}

func NewLimit Uses

func NewLimit(data Node, expr Expression) *Limit

func (*Limit) Materialize Uses

func (node *Limit) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Node, error)

func (*Limit) Metadata Uses

func (node *Limit) Metadata() *metadata.NodeMetadata

func (*Limit) Transform Uses

func (node *Limit) Transform(ctx context.Context, transformers *Transformers) Node

type LogicExpression Uses

type LogicExpression struct {
    Formula Formula
}

LogicExpressions describes a boolean expression which get's it's value from the logic formula underneath.

func NewLogicExpression Uses

func NewLogicExpression(formula Formula) *LogicExpression

func (*LogicExpression) Materialize Uses

func (le *LogicExpression) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Expression, error)

func (*LogicExpression) Transform Uses

func (le *LogicExpression) Transform(ctx context.Context, transformers *Transformers) Expression

type Map Uses

type Map struct {
    Expressions []NamedExpression
    Source      Node
    Keep        bool
}

func NewMap Uses

func NewMap(expressions []NamedExpression, child Node, keep bool) *Map

func (*Map) Materialize Uses

func (node *Map) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Node, error)

func (*Map) Metadata Uses

func (node *Map) Metadata() *metadata.NodeMetadata

func (*Map) Transform Uses

func (node *Map) Transform(ctx context.Context, transformers *Transformers) Node

type MaterializationContext Uses

type MaterializationContext struct {
    Config *config.Config
}

MaterializationContext is a structure containing the configuration for the materialization.

func NewMaterializationContext Uses

func NewMaterializationContext(config *config.Config) *MaterializationContext

type NamedExpression Uses

type NamedExpression interface {
    Expression
    // TransformNamed returns a new NamedExpression after recursively calling Transform
    TransformNamed(ctx context.Context, transformers *Transformers) NamedExpression
    MaterializeNamed(ctx context.Context, matCtx *MaterializationContext) (execution.NamedExpression, error)
}

NamedExpressions describes a single named value source.

type Node Uses

type Node interface {
    // Transform returns a new Node after recursively calling Transform
    Transform(ctx context.Context, transformers *Transformers) Node
    Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Node, error)
    Metadata() *metadata.NodeMetadata
}

Node describes a single record stream source.

type NodeExpression Uses

type NodeExpression struct {
    Node Node
}

NodeExpressions describes an expression which gets it's value from a node underneath.

func NewNodeExpression Uses

func NewNodeExpression(node Node) *NodeExpression

func (*NodeExpression) Materialize Uses

func (ne *NodeExpression) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Expression, error)

func (*NodeExpression) Transform Uses

func (ne *NodeExpression) Transform(ctx context.Context, transformers *Transformers) Expression

type Not Uses

type Not struct {
    Child Formula
}

func NewNot Uses

func NewNot(child Formula) *Not

func (*Not) ExtractPredicates Uses

func (f *Not) ExtractPredicates() []*Predicate

func (*Not) Materialize Uses

func (f *Not) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Formula, error)

func (*Not) SplitByAnd Uses

func (f *Not) SplitByAnd() []Formula

func (*Not) Transform Uses

func (f *Not) Transform(ctx context.Context, transformers *Transformers) Formula

type Offset Uses

type Offset struct {
    Source     Node
    OffsetExpr Expression
}

func NewOffset Uses

func NewOffset(data Node, expr Expression) *Offset

func (*Offset) Materialize Uses

func (node *Offset) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Node, error)

func (*Offset) Metadata Uses

func (node *Offset) Metadata() *metadata.NodeMetadata

func (*Offset) Transform Uses

func (node *Offset) Transform(ctx context.Context, transformers *Transformers) Node

type Or Uses

type Or struct {
    Left, Right Formula
}

func NewOr Uses

func NewOr(left Formula, right Formula) *Or

func (*Or) ExtractPredicates Uses

func (f *Or) ExtractPredicates() []*Predicate

func (*Or) Materialize Uses

func (f *Or) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Formula, error)

func (*Or) SplitByAnd Uses

func (f *Or) SplitByAnd() []Formula

func (*Or) Transform Uses

func (f *Or) Transform(ctx context.Context, transformers *Transformers) Formula

type OrderBy Uses

type OrderBy struct {
    Expressions []Expression
    Directions  []OrderDirection
    Source      Node
}

func NewOrderBy Uses

func NewOrderBy(expressions []Expression, directions []OrderDirection, source Node) *OrderBy

func (*OrderBy) Materialize Uses

func (node *OrderBy) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Node, error)

func (*OrderBy) Metadata Uses

func (node *OrderBy) Metadata() *metadata.NodeMetadata

func (*OrderBy) Transform Uses

func (node *OrderBy) Transform(ctx context.Context, transformers *Transformers) Node

type OrderDirection Uses

type OrderDirection string
const (
    Ascending  OrderDirection = "asc"
    Descending OrderDirection = "desc"
)

type Predicate Uses

type Predicate struct {
    Left     Expression
    Relation Relation
    Right    Expression
}

func NewPredicate Uses

func NewPredicate(left Expression, relation Relation, right Expression) *Predicate

func (*Predicate) ExtractPredicates Uses

func (f *Predicate) ExtractPredicates() []*Predicate

func (*Predicate) Materialize Uses

func (f *Predicate) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Formula, error)

func (*Predicate) SplitByAnd Uses

func (f *Predicate) SplitByAnd() []Formula

func (*Predicate) Transform Uses

func (f *Predicate) Transform(ctx context.Context, transformers *Transformers) Formula

type Relation Uses

type Relation string

Relation describes a comparison operator.

const (
    Equal        Relation = "equal"
    NotEqual     Relation = "not_equal"
    MoreThan     Relation = "more_than"
    LessThan     Relation = "less_than"
    Like         Relation = "like"
    In           Relation = "in"
    NotIn        Relation = "not_in"
    GreaterEqual Relation = "greater_equal"
    LessEqual    Relation = "less_equal"
    Regexp       Relation = "regexp"
)

func NewRelation Uses

func NewRelation(relation string) Relation

func (Relation) Materialize Uses

func (rel Relation) Materialize(ctx context.Context, matCtx *MaterializationContext) execution.Relation

type Requalifier Uses

type Requalifier struct {
    Qualifier string
    Source    Node
}

func NewRequalifier Uses

func NewRequalifier(qualifier string, child Node) *Requalifier

func (*Requalifier) Materialize Uses

func (node *Requalifier) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Node, error)

func (*Requalifier) Metadata Uses

func (node *Requalifier) Metadata() *metadata.NodeMetadata

func (*Requalifier) Transform Uses

func (node *Requalifier) Transform(ctx context.Context, transformers *Transformers) Node

type TableValuedFunction Uses

type TableValuedFunction struct {
    Name      string
    Arguments map[octosql.VariableName]TableValuedFunctionArgumentValue
}

func NewTableValuedFunction Uses

func NewTableValuedFunction(name string, args map[octosql.VariableName]TableValuedFunctionArgumentValue) *TableValuedFunction

func (*TableValuedFunction) Materialize Uses

func (node *TableValuedFunction) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Node, error)

func (*TableValuedFunction) Metadata Uses

func (node *TableValuedFunction) Metadata() *metadata.NodeMetadata

func (*TableValuedFunction) Transform Uses

func (node *TableValuedFunction) Transform(ctx context.Context, transformers *Transformers) Node

type TableValuedFunctionArgumentValue Uses

type TableValuedFunctionArgumentValue interface {
    Transform(ctx context.Context, transformers *Transformers) TableValuedFunctionArgumentValue
    // contains filtered or unexported methods
}

type TableValuedFunctionArgumentValueDescriptor Uses

type TableValuedFunctionArgumentValueDescriptor struct {
    Descriptor octosql.VariableName
}

func NewTableValuedFunctionArgumentValueDescriptor Uses

func NewTableValuedFunctionArgumentValueDescriptor(descriptor octosql.VariableName) *TableValuedFunctionArgumentValueDescriptor

func (*TableValuedFunctionArgumentValueDescriptor) Transform Uses

func (arg *TableValuedFunctionArgumentValueDescriptor) Transform(ctx context.Context, transformers *Transformers) TableValuedFunctionArgumentValue

type TableValuedFunctionArgumentValueExpression Uses

type TableValuedFunctionArgumentValueExpression struct {
    Expression Expression
}

func NewTableValuedFunctionArgumentValueExpression Uses

func NewTableValuedFunctionArgumentValueExpression(expression Expression) *TableValuedFunctionArgumentValueExpression

func (*TableValuedFunctionArgumentValueExpression) Transform Uses

func (arg *TableValuedFunctionArgumentValueExpression) Transform(ctx context.Context, transformers *Transformers) TableValuedFunctionArgumentValue

type TableValuedFunctionArgumentValueTable Uses

type TableValuedFunctionArgumentValueTable struct {
    Source Node
}

func NewTableValuedFunctionArgumentValueTable Uses

func NewTableValuedFunctionArgumentValueTable(source Node) *TableValuedFunctionArgumentValueTable

func (*TableValuedFunctionArgumentValueTable) Transform Uses

func (arg *TableValuedFunctionArgumentValueTable) Transform(ctx context.Context, transformers *Transformers) TableValuedFunctionArgumentValue

type Transformers Uses

type Transformers struct {
    NodeT                             func(Node) Node
    ExprT                             func(Expression) Expression
    NamedExprT                        func(NamedExpression) NamedExpression
    FormulaT                          func(Formula) Formula
    TableValuedFunctionArgumentValueT func(TableValuedFunctionArgumentValue) TableValuedFunctionArgumentValue
}

Transformers is a structure containing functions to transform each of the physical plan components.

type Tuple Uses

type Tuple struct {
    Expressions []Expression
}

TupleExpression describes an expression which is a tuple of subexpressions.

func NewTuple Uses

func NewTuple(expressions []Expression) *Tuple

func (*Tuple) Materialize Uses

func (tup *Tuple) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Expression, error)

func (*Tuple) Transform Uses

func (tup *Tuple) Transform(ctx context.Context, transformers *Transformers) Expression

type UnionAll Uses

type UnionAll struct {
    First, Second Node
}

func NewUnionAll Uses

func NewUnionAll(first, second Node) *UnionAll

func (*UnionAll) Materialize Uses

func (node *UnionAll) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Node, error)

func (*UnionAll) Metadata Uses

func (node *UnionAll) Metadata() *metadata.NodeMetadata

func (*UnionAll) Transform Uses

func (node *UnionAll) Transform(ctx context.Context, transformers *Transformers) Node

type Variable Uses

type Variable struct {
    Name octosql.VariableName
}

Variables describes a variable Name.

func NewVariable Uses

func NewVariable(name octosql.VariableName) *Variable

func (*Variable) Materialize Uses

func (v *Variable) Materialize(ctx context.Context, matCtx *MaterializationContext) (execution.Expression, error)

func (*Variable) MaterializeNamed Uses

func (v *Variable) MaterializeNamed(ctx context.Context, matCtx *MaterializationContext) (execution.NamedExpression, error)

func (*Variable) Transform Uses

func (v *Variable) Transform(ctx context.Context, transformers *Transformers) Expression

func (*Variable) TransformNamed Uses

func (v *Variable) TransformNamed(ctx context.Context, transformers *Transformers) NamedExpression

Directories

PathSynopsis
matcher
metadata
optimizer

Package physical imports 13 packages (graph) and is imported by 11 packages. Updated 2020-01-20. Refresh now. Tools for package owners.