logicalplan

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DataTypeForExprWithSchema

func DataTypeForExprWithSchema(expr Expr, s *dynparquet.Schema) (arrow.DataType, error)

func Validate

func Validate(plan *LogicalPlan) error

Validate validates the logical plan.

Types

type AggFunc

type AggFunc uint32
const (
	AggFuncUnknown AggFunc = iota
	AggFuncSum
	AggFuncMin
	AggFuncMax
	AggFuncCount
	AggFuncAvg
	AggFuncUnique
	AggFuncAnd
)

func (AggFunc) String

func (f AggFunc) String() string

type AggFuncPushDown

type AggFuncPushDown struct{}

AggFuncPushDown optimizer tries to push down an aggregation function operator to the table provider. This can be done in the case of some aggregation functions on global aggregations (i.e. no group by) without filters. The storage engine can make smarter decisions than just returning all the data, such as in the case of max functions, memoizing the max value seen so far and only scanning row groups that contain a value greater than the memoized value. It modifies the plan in place.

func (*AggFuncPushDown) Optimize

func (p *AggFuncPushDown) Optimize(plan *LogicalPlan) *LogicalPlan

type Aggregation

type Aggregation struct {
	AggExprs   []*AggregationFunction
	GroupExprs []Expr
}

func (*Aggregation) String

func (a *Aggregation) String() string

type AggregationFunction

type AggregationFunction struct {
	Func AggFunc
	Expr Expr
}

func AndAgg

func AndAgg(expr Expr) *AggregationFunction

func Avg

func Avg(expr Expr) *AggregationFunction

func Count

func Count(expr Expr) *AggregationFunction

func Max

func Max(expr Expr) *AggregationFunction

func Min

func Min(expr Expr) *AggregationFunction

func Sum

func Sum(expr Expr) *AggregationFunction

func Unique

func Unique(expr Expr) *AggregationFunction

func (*AggregationFunction) Accept

func (f *AggregationFunction) Accept(visitor Visitor) bool

func (*AggregationFunction) Alias

func (f *AggregationFunction) Alias(alias string) *AliasExpr

func (*AggregationFunction) Clone

func (f *AggregationFunction) Clone() Expr

func (*AggregationFunction) ColumnsUsedExprs

func (f *AggregationFunction) ColumnsUsedExprs() []Expr

func (*AggregationFunction) Computed

func (f *AggregationFunction) Computed() bool

func (*AggregationFunction) DataType

func (*AggregationFunction) Equal

func (f *AggregationFunction) Equal(other Expr) bool

func (*AggregationFunction) MatchColumn

func (f *AggregationFunction) MatchColumn(columnName string) bool

func (*AggregationFunction) MatchPath

func (f *AggregationFunction) MatchPath(path string) bool

func (*AggregationFunction) Name

func (f *AggregationFunction) Name() string

func (*AggregationFunction) String

func (f *AggregationFunction) String() string

type AliasExpr

type AliasExpr struct {
	Expr  Expr
	Alias string
}

func (*AliasExpr) Accept

func (e *AliasExpr) Accept(visitor Visitor) bool

func (*AliasExpr) Clone

func (e *AliasExpr) Clone() Expr

func (*AliasExpr) ColumnsUsedExprs

func (e *AliasExpr) ColumnsUsedExprs() []Expr

func (*AliasExpr) Computed

func (e *AliasExpr) Computed() bool

func (*AliasExpr) DataType

func (e *AliasExpr) DataType(l ExprTypeFinder) (arrow.DataType, error)

func (*AliasExpr) Equal

func (e *AliasExpr) Equal(other Expr) bool

func (*AliasExpr) MatchColumn

func (e *AliasExpr) MatchColumn(columnName string) bool

func (*AliasExpr) MatchPath

func (e *AliasExpr) MatchPath(path string) bool

func (*AliasExpr) Name

func (e *AliasExpr) Name() string

func (*AliasExpr) String

func (e *AliasExpr) String() string

type AllExpr

type AllExpr struct{}

func All

func All() *AllExpr

func (*AllExpr) Accept

func (a *AllExpr) Accept(visitor Visitor) bool

func (*AllExpr) Clone

func (a *AllExpr) Clone() Expr

func (*AllExpr) ColumnsUsedExprs

func (a *AllExpr) ColumnsUsedExprs() []Expr

func (*AllExpr) Computed

func (a *AllExpr) Computed() bool

func (*AllExpr) DataType

func (a *AllExpr) DataType(ExprTypeFinder) (arrow.DataType, error)

func (*AllExpr) Equal

func (a *AllExpr) Equal(other Expr) bool

func (*AllExpr) MatchColumn

func (a *AllExpr) MatchColumn(_ string) bool

func (*AllExpr) MatchPath

func (a *AllExpr) MatchPath(_ string) bool

func (*AllExpr) Name

func (a *AllExpr) Name() string

func (*AllExpr) String

func (a *AllExpr) String() string

type BinaryExpr

type BinaryExpr struct {
	Left  Expr
	Op    Op
	Right Expr
}

func Add

func Add(left, right Expr) *BinaryExpr

func Div

func Div(left, right Expr) *BinaryExpr

func Mul

func Mul(left, right Expr) *BinaryExpr

func Sub

func Sub(left, right Expr) *BinaryExpr

func (*BinaryExpr) Accept

func (e *BinaryExpr) Accept(visitor Visitor) bool

func (*BinaryExpr) Alias

func (e *BinaryExpr) Alias(alias string) *AliasExpr

func (*BinaryExpr) Clone

func (e *BinaryExpr) Clone() Expr

func (*BinaryExpr) ColumnsUsedExprs

func (e *BinaryExpr) ColumnsUsedExprs() []Expr

func (*BinaryExpr) Computed

func (e *BinaryExpr) Computed() bool

func (*BinaryExpr) DataType

func (e *BinaryExpr) DataType(l ExprTypeFinder) (arrow.DataType, error)

func (*BinaryExpr) Equal

func (e *BinaryExpr) Equal(other Expr) bool

func (*BinaryExpr) MatchColumn

func (e *BinaryExpr) MatchColumn(columnName string) bool

func (*BinaryExpr) MatchPath

func (e *BinaryExpr) MatchPath(path string) bool

func (*BinaryExpr) Name

func (e *BinaryExpr) Name() string

func (*BinaryExpr) String

func (e *BinaryExpr) String() string

type Builder

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

func (Builder) Aggregate

func (b Builder) Aggregate(
	aggExpr []*AggregationFunction,
	groupExprs []Expr,
) Builder

func (Builder) Build

func (b Builder) Build() (*LogicalPlan, error)

func (Builder) Distinct

func (b Builder) Distinct(
	exprs ...Expr,
) Builder

func (Builder) Filter

func (b Builder) Filter(expr Expr) Builder

func (Builder) Limit

func (b Builder) Limit(expr Expr) Builder

func (Builder) Project

func (b Builder) Project(
	exprs ...Expr,
) Builder

func (Builder) Scan

func (b Builder) Scan(
	provider TableProvider,
	tableName string,
) Builder

func (Builder) ScanSchema

func (b Builder) ScanSchema(
	provider TableProvider,
	tableName string,
) Builder

type Callback

type Callback func(ctx context.Context, r arrow.Record) error

Callback is a function that is called throughout a chain of operators modifying the underlying data.

type Column

type Column struct {
	ColumnName string
}

func Col

func Col(name string) *Column

func (*Column) Accept

func (c *Column) Accept(visitor Visitor) bool

func (*Column) Alias

func (c *Column) Alias(alias string) *AliasExpr

func (*Column) Clone

func (c *Column) Clone() Expr

func (*Column) ColumnsUsedExprs

func (c *Column) ColumnsUsedExprs() []Expr

func (*Column) Computed

func (c *Column) Computed() bool

func (*Column) Contains

func (c *Column) Contains(pattern string) *BinaryExpr

func (*Column) ContainsNot

func (c *Column) ContainsNot(pattern string) *BinaryExpr

func (*Column) DataType

func (c *Column) DataType(l ExprTypeFinder) (arrow.DataType, error)

func (*Column) Eq

func (c *Column) Eq(e Expr) *BinaryExpr

func (*Column) Equal

func (c *Column) Equal(other Expr) bool

func (*Column) Gt

func (c *Column) Gt(e Expr) *BinaryExpr

func (*Column) GtEq

func (c *Column) GtEq(e Expr) *BinaryExpr

func (*Column) Lt

func (c *Column) Lt(e Expr) *BinaryExpr

func (*Column) LtEq

func (c *Column) LtEq(e Expr) *BinaryExpr

func (*Column) MatchColumn

func (c *Column) MatchColumn(columnName string) bool

func (*Column) MatchPath

func (c *Column) MatchPath(path string) bool

func (*Column) Name

func (c *Column) Name() string

func (*Column) NotEq

func (c *Column) NotEq(e Expr) *BinaryExpr

func (*Column) RegexMatch

func (c *Column) RegexMatch(pattern string) *BinaryExpr

func (*Column) RegexNotMatch

func (c *Column) RegexNotMatch(pattern string) *BinaryExpr

func (*Column) String

func (c *Column) String() string

type ConvertExpr

type ConvertExpr struct {
	Expr Expr
	Type arrow.DataType
}

func Convert

func Convert(e Expr, t arrow.DataType) *ConvertExpr

func (*ConvertExpr) Accept

func (e *ConvertExpr) Accept(visitor Visitor) bool

func (*ConvertExpr) Alias

func (e *ConvertExpr) Alias(alias string) *AliasExpr

func (*ConvertExpr) Clone

func (e *ConvertExpr) Clone() Expr

func (*ConvertExpr) ColumnsUsedExprs

func (e *ConvertExpr) ColumnsUsedExprs() []Expr

func (*ConvertExpr) Computed

func (e *ConvertExpr) Computed() bool

func (*ConvertExpr) DataType

func (e *ConvertExpr) DataType(l ExprTypeFinder) (arrow.DataType, error)

func (*ConvertExpr) Equal

func (e *ConvertExpr) Equal(other Expr) bool

func (*ConvertExpr) MatchColumn

func (e *ConvertExpr) MatchColumn(columnName string) bool

func (*ConvertExpr) MatchPath

func (e *ConvertExpr) MatchPath(path string) bool

func (*ConvertExpr) Name

func (e *ConvertExpr) Name() string

func (*ConvertExpr) String

func (e *ConvertExpr) String() string

type Distinct

type Distinct struct {
	Exprs []Expr
}

func (*Distinct) String

func (d *Distinct) String() string

type DistinctPushDown

type DistinctPushDown struct{}

DistinctPushDown optimizer tries to push down the distinct operator to the table provider. There are certain cases of distinct queries where the storage engine can make smarter decisions than just returning all the data, such as with dictionary encoded columns that are not filtered they can return only the dictionary avoiding unnecessary decoding and deduplication in downstream distinct operators. It modifies the plan in place.

func (*DistinctPushDown) Optimize

func (p *DistinctPushDown) Optimize(plan *LogicalPlan) *LogicalPlan

type DurationExpr

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

func Duration

func Duration(d time.Duration) *DurationExpr

func (*DurationExpr) Accept

func (d *DurationExpr) Accept(visitor Visitor) bool

func (*DurationExpr) Clone

func (d *DurationExpr) Clone() Expr

func (*DurationExpr) ColumnsUsedExprs

func (d *DurationExpr) ColumnsUsedExprs() []Expr

func (*DurationExpr) Computed

func (d *DurationExpr) Computed() bool

func (*DurationExpr) DataType

func (d *DurationExpr) DataType(_ ExprTypeFinder) (arrow.DataType, error)

func (*DurationExpr) Equal

func (d *DurationExpr) Equal(other Expr) bool

func (*DurationExpr) MatchColumn

func (d *DurationExpr) MatchColumn(columnName string) bool

func (*DurationExpr) MatchPath

func (d *DurationExpr) MatchPath(_ string) bool

func (*DurationExpr) Name

func (d *DurationExpr) Name() string

func (*DurationExpr) String

func (d *DurationExpr) String() string

func (*DurationExpr) Value

func (d *DurationExpr) Value() time.Duration

type DynamicColumn

type DynamicColumn struct {
	ColumnName string
}

func DynCol

func DynCol(name string) *DynamicColumn

func (*DynamicColumn) Accept

func (c *DynamicColumn) Accept(visitor Visitor) bool

func (*DynamicColumn) Clone

func (c *DynamicColumn) Clone() Expr

func (*DynamicColumn) ColumnsUsedExprs

func (c *DynamicColumn) ColumnsUsedExprs() []Expr

func (*DynamicColumn) Computed

func (c *DynamicColumn) Computed() bool

func (*DynamicColumn) DataType

func (c *DynamicColumn) DataType(l ExprTypeFinder) (arrow.DataType, error)

func (*DynamicColumn) Equal

func (c *DynamicColumn) Equal(other Expr) bool

func (*DynamicColumn) MatchColumn

func (c *DynamicColumn) MatchColumn(columnName string) bool

func (*DynamicColumn) MatchPath

func (c *DynamicColumn) MatchPath(path string) bool

func (*DynamicColumn) Name

func (c *DynamicColumn) Name() string

func (*DynamicColumn) String

func (c *DynamicColumn) String() string

type Expr

type Expr interface {
	DataType(ExprTypeFinder) (arrow.DataType, error)
	Accept(Visitor) bool
	Name() string
	Equal(Expr) bool
	fmt.Stringer

	// ColumnsUsedExprs extracts all the expressions that are used that cause
	// physical data to be read from a column.
	ColumnsUsedExprs() []Expr

	// MatchColumn returns whether it would operate on the passed column. In
	// contrast to the ColumnUsedExprs function from the Expr interface, it is not
	// useful to identify which columns are to be read physically. This is
	// necessary to distinguish between projections.
	//
	// Take the example of a column that projects `XYZ > 0`. Matcher can be
	// used to identify the column in the resulting Apache Arrow frames, while
	// ColumnsUsed will return `XYZ` to be necessary to be loaded physically.
	MatchColumn(columnName string) bool

	// MatchPath returns whether it would operate on the passed path. This is nessesary for nested schemas.
	MatchPath(path string) bool

	// Computed returns whether the expression is computed as opposed to being
	// a static value or unmodified physical column.
	Computed() bool

	// Clone returns a deep copy of the expression.
	Clone() Expr
}

func And

func And(exprs ...Expr) Expr

func Cols

func Cols(names ...string) []Expr

func Or

func Or(exprs ...Expr) Expr

type ExprTypeFinder

type ExprTypeFinder interface {
	DataTypeForExpr(expr Expr) (arrow.DataType, error)
}

type ExprValidationError

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

ExprValidationError is the error for an invalid expression that was found during validation.

func ValidateAggregationExpr

func ValidateAggregationExpr(plan *LogicalPlan) *ExprValidationError

func ValidateComparingTypes

func ValidateComparingTypes(columnType *format.LogicalType, literal scalar.Scalar) *ExprValidationError

ValidateComparingTypes validates if the types being compared by a binary expression are compatible.

func ValidateFilterAndBinaryExpr

func ValidateFilterAndBinaryExpr(plan *LogicalPlan, expr *BinaryExpr) *ExprValidationError

ValidateFilterAndBinaryExpr validates the filter's binary expression where Op = AND.

func ValidateFilterBinaryExpr

func ValidateFilterBinaryExpr(plan *LogicalPlan, expr *BinaryExpr) *ExprValidationError

ValidateFilterBinaryExpr validates the filter's binary expression.

func ValidateFilterExpr

func ValidateFilterExpr(plan *LogicalPlan, e Expr) *ExprValidationError

ValidateFilterExpr validates filter's expression.

func (*ExprValidationError) Error

func (e *ExprValidationError) Error() string

ExprValidationError.Error prints the error message in a human-readable format. implements the error interface.

type Filter

type Filter struct {
	Expr Expr
}

func (*Filter) String

func (f *Filter) String() string

type FilterPushDown

type FilterPushDown struct{}

FilterPushDown optimizer tries to push down the filters of a query down to the actual physical table scan. This allows the table provider to make smarter decisions about which pieces of data to load in the first place or which are definitely not useful to the query at all. It does not guarantee that all data will be filtered accordingly, it is just a mechanism to read less data from disk. It modifies the plan in place.

func (*FilterPushDown) Optimize

func (p *FilterPushDown) Optimize(plan *LogicalPlan) *LogicalPlan

type IfExpr

type IfExpr struct {
	Cond Expr
	Then Expr
	Else Expr
}

func If

func If(cond, then, els Expr) *IfExpr

func (*IfExpr) Accept

func (e *IfExpr) Accept(visitor Visitor) bool

func (*IfExpr) Alias

func (e *IfExpr) Alias(name string) *AliasExpr

func (*IfExpr) Clone

func (e *IfExpr) Clone() Expr

func (*IfExpr) ColumnsUsedExprs

func (e *IfExpr) ColumnsUsedExprs() []Expr

func (*IfExpr) Computed

func (e *IfExpr) Computed() bool

func (*IfExpr) DataType

func (e *IfExpr) DataType(l ExprTypeFinder) (arrow.DataType, error)

func (*IfExpr) Equal

func (e *IfExpr) Equal(other Expr) bool

func (*IfExpr) MatchColumn

func (e *IfExpr) MatchColumn(columnName string) bool

func (*IfExpr) MatchPath

func (e *IfExpr) MatchPath(path string) bool

func (*IfExpr) Name

func (e *IfExpr) Name() string

func (*IfExpr) String

func (e *IfExpr) String() string

type IsNullExpr

type IsNullExpr struct {
	Expr Expr
}

func IsNull

func IsNull(expr Expr) *IsNullExpr

func (*IsNullExpr) Accept

func (e *IsNullExpr) Accept(visitor Visitor) bool

func (*IsNullExpr) Clone

func (e *IsNullExpr) Clone() Expr

func (*IsNullExpr) ColumnsUsedExprs

func (e *IsNullExpr) ColumnsUsedExprs() []Expr

func (*IsNullExpr) Computed

func (e *IsNullExpr) Computed() bool

func (*IsNullExpr) DataType

func (e *IsNullExpr) DataType(l ExprTypeFinder) (arrow.DataType, error)

func (*IsNullExpr) Equal

func (e *IsNullExpr) Equal(other Expr) bool

func (*IsNullExpr) MatchColumn

func (e *IsNullExpr) MatchColumn(columnName string) bool

func (*IsNullExpr) MatchPath

func (e *IsNullExpr) MatchPath(path string) bool

func (*IsNullExpr) Name

func (e *IsNullExpr) Name() string

func (*IsNullExpr) String

func (e *IsNullExpr) String() string

type IterOptions

type IterOptions struct {
	PhysicalProjection []Expr
	Projection         []Expr
	Filter             Expr
	DistinctColumns    []Expr
	ReadMode           ReadMode
}

IterOptions are a set of options for the TableReader Iterators.

type Limit

type Limit struct {
	Expr Expr
}

func (*Limit) String

func (l *Limit) String() string

type LiteralExpr

type LiteralExpr struct {
	Value scalar.Scalar
}

func Literal

func Literal(v interface{}) *LiteralExpr

func (*LiteralExpr) Accept

func (e *LiteralExpr) Accept(visitor Visitor) bool

func (*LiteralExpr) Clone

func (e *LiteralExpr) Clone() Expr

func (*LiteralExpr) ColumnsUsedExprs

func (e *LiteralExpr) ColumnsUsedExprs() []Expr

func (*LiteralExpr) Computed

func (e *LiteralExpr) Computed() bool

func (*LiteralExpr) DataType

func (e *LiteralExpr) DataType(_ ExprTypeFinder) (arrow.DataType, error)

func (*LiteralExpr) Equal

func (e *LiteralExpr) Equal(other Expr) bool

func (*LiteralExpr) MatchColumn

func (e *LiteralExpr) MatchColumn(columnName string) bool

func (*LiteralExpr) MatchPath

func (e *LiteralExpr) MatchPath(path string) bool

func (*LiteralExpr) Name

func (e *LiteralExpr) Name() string

func (*LiteralExpr) String

func (e *LiteralExpr) String() string

type LogicalPlan

type LogicalPlan struct {
	Input *LogicalPlan

	// Each LogicalPlan struct must only have one of the following.
	SchemaScan  *SchemaScan
	TableScan   *TableScan
	Filter      *Filter
	Distinct    *Distinct
	Projection  *Projection
	Aggregation *Aggregation
	Limit       *Limit
}

LogicalPlan is a logical representation of a query. Each LogicalPlan is a sub-tree of the query. It is built recursively.

func (*LogicalPlan) Accept

func (plan *LogicalPlan) Accept(visitor PlanVisitor) bool

func (*LogicalPlan) DataTypeForExpr

func (plan *LogicalPlan) DataTypeForExpr(expr Expr) (arrow.DataType, error)

func (*LogicalPlan) InputSchema

func (plan *LogicalPlan) InputSchema() *dynparquet.Schema

InputSchema returns the schema that the query will execute against.

func (*LogicalPlan) String

func (plan *LogicalPlan) String() string

func (*LogicalPlan) TableReader

func (plan *LogicalPlan) TableReader() (TableReader, error)

TableReader returns the table reader.

type Named

type Named interface {
	Name() string
}

type NotExpr

type NotExpr struct {
	Expr Expr
}

func Not

func Not(expr Expr) *NotExpr

func (*NotExpr) Accept

func (n *NotExpr) Accept(visitor Visitor) bool

func (*NotExpr) Clone

func (n *NotExpr) Clone() Expr

func (*NotExpr) ColumnsUsedExprs

func (n *NotExpr) ColumnsUsedExprs() []Expr

func (*NotExpr) Computed

func (n *NotExpr) Computed() bool

func (*NotExpr) DataType

func (n *NotExpr) DataType(l ExprTypeFinder) (arrow.DataType, error)

func (*NotExpr) Equal

func (n *NotExpr) Equal(other Expr) bool

func (*NotExpr) MatchColumn

func (n *NotExpr) MatchColumn(columnName string) bool

func (*NotExpr) MatchPath

func (n *NotExpr) MatchPath(path string) bool

func (*NotExpr) Name

func (n *NotExpr) Name() string

func (*NotExpr) String

func (n *NotExpr) String() string

type Op

type Op uint32
const (
	OpUnknown Op = iota
	OpEq
	OpNotEq
	OpLt
	OpLtEq
	OpGt
	OpGtEq
	OpRegexMatch
	OpRegexNotMatch
	OpAnd
	OpOr
	OpAdd
	OpSub
	OpMul
	OpDiv
	OpContains
	OpNotContains
)

func (Op) ArrowString

func (o Op) ArrowString() string

func (Op) String

func (o Op) String() string

type Optimizer

type Optimizer interface {
	Optimize(plan *LogicalPlan) *LogicalPlan
}

func DefaultOptimizers

func DefaultOptimizers() []Optimizer

type Option

type Option func(opts *IterOptions)

func WithDistinctColumns

func WithDistinctColumns(e ...Expr) Option

func WithFilter

func WithFilter(e Expr) Option

func WithPhysicalProjection

func WithPhysicalProjection(e ...Expr) Option

func WithProjection

func WithProjection(e ...Expr) Option

func WithReadMode

func WithReadMode(m ReadMode) Option

type PhysicalProjectionPushDown

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

PhysicalProjectionPushDown finds the first projecting logical plan and collects all columns it needs, it is concatenated with all other columns used until it, for example a filter layer. Because the tree has the scan layer as the inner most layer, the logic actually works by resetting the list every time a projecting layer is found.

func (*PhysicalProjectionPushDown) Optimize

type PlanValidationError

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

PlanValidationError is the error representing a logical plan that is not valid.

func ValidateAggregation

func ValidateAggregation(plan *LogicalPlan) *PlanValidationError

ValidateAggregation validates the logical plan's aggregation step.

func ValidateFilter

func ValidateFilter(plan *LogicalPlan) *PlanValidationError

ValidateFilter validates the logical plan's filter step.

func ValidateInput

func ValidateInput(plan *LogicalPlan) *PlanValidationError

ValidateInput validates that the current logical plans input is valid. It returns nil if the plan has no input.

func ValidateSchemaScan

func ValidateSchemaScan(plan *LogicalPlan) *PlanValidationError

func ValidateSingleFieldSet

func ValidateSingleFieldSet(plan *LogicalPlan) *PlanValidationError

ValidateSingleFieldSet checks that only a single field is set on the plan.

func ValidateTableScan

func ValidateTableScan(plan *LogicalPlan) *PlanValidationError

func (*PlanValidationError) Error

func (e *PlanValidationError) Error() string

PlanValidationError.Error prints the error message in a human-readable format. implements the error interface.

type PlanVisitor

type PlanVisitor interface {
	PreVisit(plan *LogicalPlan) bool
	PostVisit(plan *LogicalPlan) bool
}

type Projection

type Projection struct {
	Exprs []Expr
}

func (*Projection) String

func (p *Projection) String() string

type ReadMode

type ReadMode int
const (
	// ReadModeDefault is the default read mode. Reads from in-memory and object
	// storage.
	ReadModeDefault ReadMode = iota
	// ReadModeInMemoryOnly reads from in-memory storage only.
	ReadModeInMemoryOnly
	// ReadModeDataSourcesOnly reads from data sources only.
	ReadModeDataSourcesOnly
)

type SchemaScan

type SchemaScan struct {
	TableProvider TableProvider
	TableName     string

	// PhysicalProjection describes the columns that are to be physically read
	// by the table scan.
	PhysicalProjection []Expr

	// filter is the predicate that is to be applied by the table scan to rule
	// out any blocks of data to be scanned at all.
	Filter Expr

	// Distinct describes the columns that are to be distinct.
	Distinct []Expr

	// Projection is the list of columns that are to be projected.
	Projection []Expr

	// ReadMode indicates the mode to use when reading.
	ReadMode ReadMode
}

func (*SchemaScan) DataTypeForExpr

func (s *SchemaScan) DataTypeForExpr(expr Expr) (arrow.DataType, error)

func (*SchemaScan) String

func (s *SchemaScan) String() string

type TableProvider

type TableProvider interface {
	GetTable(name string) (TableReader, error)
}

type TableReader

type TableReader interface {
	View(ctx context.Context, fn func(ctx context.Context, tx uint64) error) error
	Iterator(
		ctx context.Context,
		tx uint64,
		pool memory.Allocator,
		callbacks []Callback,
		options ...Option,
	) error
	SchemaIterator(
		ctx context.Context,
		tx uint64,
		pool memory.Allocator,
		callbacks []Callback,
		options ...Option,
	) error
	Schema() *dynparquet.Schema
}

type TableScan

type TableScan struct {
	TableProvider TableProvider
	TableName     string

	// PhysicalProjection describes the columns that are to be physically read
	// by the table scan. This is an Expr so it can be either a column or
	// dynamic column.
	PhysicalProjection []Expr

	// Filter is the predicate that is to be applied by the table scan to rule
	// out any blocks of data to be scanned at all.
	Filter Expr

	// Distinct describes the columns that are to be distinct.
	Distinct []Expr

	// Projection is the list of columns that are to be projected.
	Projection []Expr

	// ReadMode indicates the mode to use when reading.
	ReadMode ReadMode
}

func (*TableScan) DataTypeForExpr

func (scan *TableScan) DataTypeForExpr(expr Expr) (arrow.DataType, error)

func (*TableScan) String

func (scan *TableScan) String() string

type Visitor

type Visitor interface {
	PreVisit(expr Expr) bool
	Visit(expr Expr) bool
	PostVisit(expr Expr) bool
}

Jump to

Keyboard shortcuts

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