hybridqp

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SecToNs is the number of nanoseconds in a second.
	SecToNs = int64(time.Second)
)

Variables

This section is empty.

Functions

func Abs

func Abs(v int64) int64

func AbsInt added in v1.0.0

func AbsInt(x int) int

func BinarySearch

func BinarySearch(target int, nums []int) bool

func BinarySearchForNils

func BinarySearchForNils(array []uint16, k uint16) int

func CompareSlice

func CompareSlice(a, b []int) bool

func EqualMap

func EqualMap(tags1, tags2 map[string]string) bool

func FilterNullColumnQuery

func FilterNullColumnQuery(stmt *influxql.SelectStatement) bool

FilterNullColumnQuery Hint

func GenerateNodeId

func GenerateNodeId() uint64

func Intersect

func Intersect(a, b []int) []int

func IsExactStatisticQuery

func IsExactStatisticQuery(stmt *influxql.SelectStatement) bool

IsExactStatisticQuery Hint

func IsFullSeriesQuery

func IsFullSeriesQuery(stmt *influxql.SelectStatement) bool

IsFullSeriesQuery Hint

func IsSpecificSeriesQuery

func IsSpecificSeriesQuery(stmt *influxql.SelectStatement) bool

IsSpecificSeriesQuery Hint

func IsSubSlice

func IsSubSlice(subS, s []int) bool

func LinearInterpolateFloat

func LinearInterpolateFloat(currTime, prevTime, nextTime int64, prevValue, nextValue float64) float64

func LinearInterpolateInteger

func LinearInterpolateInteger(currTime, prevTime, nextTime int64, prevValue, nextValue int64) int64

func MaxInt added in v1.0.1

func MaxInt(x, y int) int

func MaxInt64 added in v1.0.0

func MaxInt64(x, y int64) int64

func MustParseExpr

func MustParseExpr(s string) influxql.Expr

MustParseExpr parses an expression. Panic on error.

func ParseFields

func ParseFields(s string) (influxql.Fields, error)

func RegistryCatalogCreator

func RegistryCatalogCreator(creator CatalogCreator) bool

func SortS1ByS2

func SortS1ByS2(s1, s2 []int)

func TransToBoolean

func TransToBoolean(v interface{}) (bool, bool)

func TransToFloat

func TransToFloat(v interface{}) (float64, bool)

func TransToInteger

func TransToInteger(v interface{}) (int64, bool)

func TransToString

func TransToString(v interface{}) (string, bool)

func VerifyHintStmt

func VerifyHintStmt(stmt *influxql.SelectStatement, opt Options) error

func WalkQueryNodeInPostOrder

func WalkQueryNodeInPostOrder(v QueryNodeVisitor, node QueryNode)

func WalkQueryNodeInPreOrder

func WalkQueryNodeInPreOrder(v QueryNodeVisitor, node QueryNode)

Types

type Catalog

type Catalog interface {
	GetColumnNames() []string
	GetQueryFields() influxql.Fields
	CloneField(f *influxql.Field) *influxql.Field
	HasCall() bool
	HasRowCount() bool
	HasMath() bool
	HasString() bool
	HasNonPreCall() bool
	CountField() map[int]bool
	HasMeanCall() bool
	HasBlankRowCall() bool
	HasInterval() bool
	HasFieldCondition() bool
	HasAuxTag() bool
	HasPercentileOGSketch() bool
	Options() Options
	Symbols() map[string]influxql.VarRef
	Mapping() map[influxql.Expr]influxql.VarRef
	Refs() map[string]*influxql.VarRef
	DerivedOrigCall(call *influxql.Call) influxql.VarRef
	DerivedRef(ref *influxql.VarRef) influxql.VarRef
	MakeRefs() []influxql.VarRef
	OrigCalls() map[string]*influxql.Call
	SetOpt(opt Options)
	Calls() map[string]*influxql.Call
	SlidingWindow() map[string]*influxql.Call
	HoltWinters() []*influxql.Field
	CompositeCall() map[string]*OGSketchCompositeOperator
	Binarys() map[string]*influxql.BinaryExpr
	Fields() influxql.Fields
	FieldsRef() influxql.VarRefs
	CountDistinct() *influxql.Call
	OnlyOneCallRef() *influxql.VarRef
	LimitType() LimitType
	HasLimit() bool
	HasCastorCall() bool
	LimitAndOffset() (int, int)
	MatchPreAgg() bool
	HasInSeriesAgg() bool
	CanSeqAggPushDown() bool
	CanCallsPushdown() bool
	CanAggPushDown() bool
	ContainSeriesIgnoreCall() bool
	IsRefInQueryFields(ref *influxql.VarRef) bool
	IsRefInSymbolFields(ref *influxql.VarRef) bool
	IsTimeZero() bool
	HasStreamCall() bool
	HasSlidingWindowCall() bool
	HasHoltWintersCall() bool
	IsMultiMeasurements() bool
	HasGroupBy() bool
	Sources() influxql.Sources
	HasSubQuery() bool
	HasOptimizeAgg() bool
	HasOptimizeCall() bool
	GetSourcesNames() []string
	GetFieldType(i int) (int64, error)
	GetJoinCaseCount() int
	GetJoinCases() []*influxql.Join
	IsHoltWinters(val string) bool
	GetSortFields() influxql.SortFields
	SetUnnests(unnests []*influxql.Unnest)
	GetUnnests() influxql.Unnests
	HasUnnests() bool
	GetTimeRangeByTC() util.TimeRange
}

type CatalogCreator

type CatalogCreator interface {
	Create(fields influxql.Fields, columnNames []string, opt Options) Catalog
}

type CatalogCreatorFactory

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

func GetCatalogFactoryInstance

func GetCatalogFactoryInstance() *CatalogCreatorFactory

func NewCatalogCreatorFactory

func NewCatalogCreatorFactory() *CatalogCreatorFactory

func (*CatalogCreatorFactory) Attach

func (r *CatalogCreatorFactory) Attach(creator CatalogCreator)

func (*CatalogCreatorFactory) Create

func (r *CatalogCreatorFactory) Create(fields influxql.Fields, columnNames []string, opt Options) Catalog

type Executor

type Executor interface {
}

type ExecutorBuilderCreator

type ExecutorBuilderCreator func() PipelineExecutorBuilder

type ExecutorBuilderOptimizer

type ExecutorBuilderOptimizer func() Planner

type ExprOptions

type ExprOptions struct {
	Expr influxql.Expr
	Ref  influxql.VarRef
}

func (*ExprOptions) DerivativeInterval

func (o *ExprOptions) DerivativeInterval(interval Interval) Interval

DerivativeInterval returns the time interval for the derivative function.

func (*ExprOptions) ElapsedInterval

func (o *ExprOptions) ElapsedInterval() Interval

func (*ExprOptions) IntegralInterval

func (o *ExprOptions) IntegralInterval() Interval

func (*ExprOptions) Marshal

func (o *ExprOptions) Marshal() *internal.ExprOptions

func (*ExprOptions) SlidingWindowInterval

func (o *ExprOptions) SlidingWindowInterval(interval Interval) Interval

SlidingWindowInterval returns the time interval for the sliding window function.

func (*ExprOptions) Unmarshal

func (o *ExprOptions) Unmarshal(pb *internal.ExprOptions) error

type FlattenQueryNodeVisitor

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

func (*FlattenQueryNodeVisitor) Nodes

func (visitor *FlattenQueryNodeVisitor) Nodes() []QueryNode

func (*FlattenQueryNodeVisitor) Visit

func (visitor *FlattenQueryNodeVisitor) Visit(node QueryNode) QueryNodeVisitor

type HintType

type HintType int64
const (
	DefaultNoHint HintType = iota
	FilterNullColumn
	ExactStatisticQuery
	FullSeriesQuery
	SpecificSeriesQuery
)

type IShardsFragments added in v1.1.0

type IShardsFragments interface{}

type Interval

type Interval struct {
	Duration time.Duration
	Offset   time.Duration
}

Interval represents a repeating interval for a query.

func (Interval) IsZero

func (i Interval) IsZero() bool

IsZero returns true if the interval has no duration.

type LimitType

type LimitType int
const (
	//SingleRowLimit means single row represents one Point and return number of limit points Per Tag.
	SingleRowLimit LimitType = 1
	//MultipleRowsLimit means single row represents one Point and return number of limit points Per Tag.
	MultipleRowsLimit LimitType = 2
	//SingleRowIgnoreTagLimit means single row represents one Point and return only number of limit points.
	SingleRowIgnoreTagLimit LimitType = 3
	//MultipleRowsIgnoreTagLimit means single row represents one Point and return only number of limit points.
	MultipleRowsIgnoreTagLimit LimitType = 4
)

type LogicalPlanCost

type LogicalPlanCost struct {
	// The total number of shards that are touched by this Logical.
	NumShards int64

	// The total number of non-unique series that are accessed by this Logical.
	// This number matches the number of cursors created by the Logical since
	// one cursor is created for every series.
	NumSeries int64

	// CachedValues returns the number of cached values that may be read by this
	// Logical.
	CachedValues int64

	// The total number of non-unique files that may be accessed by this Logical.
	// This will count the number of files accessed by each series so files
	// will likely be double counted.
	NumFiles int64

	// The number of blocks that had the potential to be accessed.
	BlocksRead int64

	// The amount of data that can be potentially read.
	BlockSize int64
}

IteratorCost contains statistics retrieved for explaining what potential cost may be incurred by instantiating an iterator.

type MapConvert

type MapConvert struct {
}

func (*MapConvert) BoolToStruct

func (c *MapConvert) BoolToStruct(m map[string]bool) map[string]struct{}

func (*MapConvert) Int64ToInt

func (c *MapConvert) Int64ToInt(m map[string]int64) map[string]int

Int64ToInt convert map[string] int64 to map[string] int

func (*MapConvert) IntToInt64

func (c *MapConvert) IntToInt64(m map[string]int) map[string]int64

IntToInt64 convert map[string] int to map[string] int64

func (*MapConvert) StructToBool

func (c *MapConvert) StructToBool(m map[string]struct{}) map[string]bool

type OGSketchCompositeOperator added in v1.0.0

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

func NewOGSketchCompositeOperator added in v1.0.0

func NewOGSketchCompositeOperator(i, m, qp *influxql.Call) *OGSketchCompositeOperator

func (*OGSketchCompositeOperator) GetInsertOp added in v1.0.0

func (o *OGSketchCompositeOperator) GetInsertOp() *influxql.Call

func (*OGSketchCompositeOperator) GetMergeOp added in v1.0.0

func (o *OGSketchCompositeOperator) GetMergeOp() *influxql.Call

func (*OGSketchCompositeOperator) GetQueryPerOp added in v1.0.0

func (o *OGSketchCompositeOperator) GetQueryPerOp() *influxql.Call

type Options

type Options interface {
	GetLimit() int
	GetOffset() int
	HasInterval() bool
	GetCondition() influxql.Expr
	GetLocation() *time.Location
	GetOptDimension() []string
	GetHintType() HintType
	ISChunked() bool
	SetHintType(HintType)
	OptionsName() string
	IsAscending() bool
	SetAscending(bool)
	ChunkSizeNum() int
	GetStartTime() int64
	GetEndTime() int64
	GetMaxParallel() int
	Window(t int64) (start, end int64)
	GetGroupBy() map[string]struct{}
	GetInterval() time.Duration
	IsGroupByAllDims() bool
	GetSourcesNames() []string
	GetMeasurements() []*influxql.Measurement
	HaveOnlyCSStore() bool
	GetDimensions() []string
	SetFill(influxql.FillOption)
	IsTimeSorted() bool
	IsUnifyPlan() bool
	SetSortFields(influxql.SortFields)
	GetSortFields() influxql.SortFields
	FieldWildcard() bool
	GetStmtId() int
	GetLogQueryCurrId() string
	GetIterId() int32
	IsIncQuery() bool
}

type PipelineExecutorBuilder

type PipelineExecutorBuilder interface {
	Analyze(span *tracing.Span)

	Build(node QueryNode) (Executor, error)
}

type Planner

type Planner interface {
	SetRoot(QueryNode)
	FindBestExp() QueryNode
}

type QueryNode

type QueryNode interface {
	ID() uint64
	Digest() string
	Children() []QueryNode
	String() string
	Type() string
	ReplaceChild(int, QueryNode)
	ReplaceChildren([]QueryNode)
	Clone() QueryNode
	RowDataType() RowDataType
	RowExprOptions() []ExprOptions
	Dummy() bool
	DeriveOperations()
	Schema() Catalog
	Trait() Trait
	ApplyTrait(Trait)

	SetInputs([]QueryNode)
	SetSchema(Catalog)
	New(inputs []QueryNode, schema Catalog, eTrait []Trait) QueryNode
}

type QueryNodeVisitor

type QueryNodeVisitor interface {
	Visit(QueryNode) QueryNodeVisitor
}

type RowDataType

type RowDataType interface {
	Aux() []int
	Equal(RowDataType) bool
	Fields() influxql.Fields
	MakeRefs() []influxql.VarRef
	Field(int) *influxql.Field
	FieldIndex(string) int
	NumColumn() int
	SlimFields(ridIdx []int) RowDataType
	CopyTo(dst *RowDataTypeImpl)

	IndexByName() map[string]int
	UpdateByDownSampleFields(map[string]string)
	SetDataType(i int, t influxql.DataType)
}

type RowDataTypeImpl

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

func NewRowDataTypeImpl

func NewRowDataTypeImpl(refs ...influxql.VarRef) *RowDataTypeImpl

func (*RowDataTypeImpl) Aux

func (s *RowDataTypeImpl) Aux() []int

func (*RowDataTypeImpl) CopyTo

func (s *RowDataTypeImpl) CopyTo(dst *RowDataTypeImpl)

func (*RowDataTypeImpl) DeepEqual

func (s *RowDataTypeImpl) DeepEqual(to *RowDataTypeImpl) bool

func (*RowDataTypeImpl) Equal

func (s *RowDataTypeImpl) Equal(to RowDataType) bool

func (*RowDataTypeImpl) Field

func (s *RowDataTypeImpl) Field(i int) *influxql.Field

func (*RowDataTypeImpl) FieldIndex

func (s *RowDataTypeImpl) FieldIndex(name string) int

func (*RowDataTypeImpl) Fields

func (s *RowDataTypeImpl) Fields() influxql.Fields

func (*RowDataTypeImpl) IndexByName added in v1.0.0

func (s *RowDataTypeImpl) IndexByName() map[string]int

func (*RowDataTypeImpl) MakeRefs

func (s *RowDataTypeImpl) MakeRefs() []influxql.VarRef

func (*RowDataTypeImpl) NumColumn

func (s *RowDataTypeImpl) NumColumn() int

func (*RowDataTypeImpl) SetDataType added in v1.1.0

func (s *RowDataTypeImpl) SetDataType(i int, t influxql.DataType)

func (*RowDataTypeImpl) SetIndexByName added in v1.0.0

func (s *RowDataTypeImpl) SetIndexByName(m map[string]int)

func (*RowDataTypeImpl) SlimFields

func (s *RowDataTypeImpl) SlimFields(ridIdx []int) RowDataType

func (*RowDataTypeImpl) UpdateByDownSampleFields added in v1.0.0

func (s *RowDataTypeImpl) UpdateByDownSampleFields(m map[string]string)

type SelectDuration

type SelectDuration struct {
	TotalDuration    int64
	PrepareDuration  int64
	IteratorDuration int64
	LocalDuration    ShardSelectDuration
	RemoteDuration   ShardSelectDuration
	EmitDuration     int64
	Query            string
	DB               string
	QueryBatch       int
}

func (*SelectDuration) Duration

func (s *SelectDuration) Duration(name string, d int64)

func (*SelectDuration) SetDatabase

func (s *SelectDuration) SetDatabase(db string)

func (*SelectDuration) SetQuery

func (s *SelectDuration) SetQuery(q string)

func (*SelectDuration) SetQueryBatch

func (s *SelectDuration) SetQueryBatch(n int)

type ShardSelectDuration

type ShardSelectDuration struct {
	IteratorDuration int64
	TagSetDuration   int64
	LocationDuration int64
}

func (*ShardSelectDuration) Duration

func (r *ShardSelectDuration) Duration(name string, d int64)

type StoreEngine

type StoreEngine interface {
	ReportLoad()
	CreateLogicPlan(ctx context.Context, db string, ptId uint32, shardID uint64, sources influxql.Sources, schema Catalog) (QueryNode, error)
	ScanWithSparseIndex(ctx context.Context, db string, ptId uint32, shardIDS []uint64, schema Catalog) (IShardsFragments, error)
	GetIndexInfo(db string, ptId uint32, shardID uint64, schema Catalog) (interface{}, error)
	RowCount(db string, ptId uint32, shardIDS []uint64, schema Catalog) (int64, error)
	UnrefEngineDbPt(db string, ptId uint32)
	GetShardDownSampleLevel(db string, ptId uint32, shardID uint64) int
}

type Trait

type Trait interface{}

Jump to

Keyboard shortcuts

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