Documentation
¶
Overview ¶
Licensed to Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Apache Software Foundation (ASF) licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Licensed to Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Apache Software Foundation (ASF) licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Licensed to Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Apache Software Foundation (ASF) licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Licensed to Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. Apache Software Foundation (ASF) licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func Format(p Plan) string
- func SortedByIndex(elements []*streamv1.Element, tagFamilyIdx, tagIdx int, ...) bool
- func SortedByTimestamp(elements []*streamv1.Element, sortDirection modelv1.Sort) bool
- type ComparableExpr
- type Expr
- func Eq(l, r Expr) Expr
- func Ge(l, r Expr) Expr
- func Gt(l, r Expr) Expr
- func Having(l, r Expr) Expr
- func ID(id string) Expr
- func Int(num int64) Expr
- func Ints(ints ...int64) Expr
- func Le(l, r Expr) Expr
- func Lt(l, r Expr) Expr
- func Ne(l, r Expr) Expr
- func NotHaving(l, r Expr) Expr
- func Str(str string) Expr
- func Strs(strs ...string) Expr
- type Field
- type FieldRef
- type ItemIterator
- type LiteralExpr
- type MeasureAnalyzer
- type Plan
- type PlanType
- type ResolvableExpr
- type Schema
- type StreamAnalyzer
- type Tag
- type TagRef
- type TopElement
- type TopQueue
- type UnresolvedOrderBy
- type UnresolvedPlan
- func Aggregation(input UnresolvedPlan, aggrField *Field, aggrFunc modelv1.AggregationFunction, ...) UnresolvedPlan
- func GlobalIndexScan(metadata *commonv1.Metadata, conditions []Expr, projection ...[]*Tag) UnresolvedPlan
- func GroupBy(input UnresolvedPlan, groupBy [][]*Tag, groupByEntity bool) UnresolvedPlan
- func Limit(input UnresolvedPlan, num uint32) UnresolvedPlan
- func MeasureIndexScan(startTime, endTime time.Time, metadata *commonv1.Metadata, conditions []Expr, ...) UnresolvedPlan
- func MeasureLimit(input UnresolvedPlan, offset, limit uint32) UnresolvedPlan
- func Offset(input UnresolvedPlan, num uint32) UnresolvedPlan
- func TagFilter(startTime, endTime time.Time, metadata *commonv1.Metadata, conditions []Expr, ...) UnresolvedPlan
- func Top(input UnresolvedPlan, top *measurev1.QueryRequest_Top) UnresolvedPlan
Constants ¶
This section is empty.
Variables ¶
var ( ErrTagNotDefined = errors.New("tag is not defined") ErrFieldNotDefined = errors.New("field is not defined") ErrInvalidConditionType = errors.New("invalid pair type") ErrIncompatibleQueryCondition = errors.New("incompatible query condition type") ErrIndexNotDefined = errors.New("index is not define for the tag") ErrMultipleGlobalIndexes = errors.New("multiple global indexes are not supported") )
var (
DefaultLimit uint32 = 100
)
var ErrInvalidData = errors.New("data is invalid")
Functions ¶
func SortedByIndex ¶
func SortedByIndex(elements []*streamv1.Element, tagFamilyIdx, tagIdx int, sortDirection modelv1.Sort) bool
SortedByIndex is used to test whether the given entities are sorted by the sortDirection The given entities MUST satisfy both the positive check and the negative check for the reversed direction
Types ¶
type ComparableExpr ¶
type FieldRef ¶
type FieldRef struct {
// spec contains the index of the key in the measureSchema, as well as the underlying FieldSpec
Spec *fieldSpec
// contains filtered or unexported fields
}
FieldRef is the reference to the field also it holds the definition (derived from measureSchema) of the field
type ItemIterator ¶
func NewItemIter ¶
func NewItemIter(iters []tsdb.Iterator, c comparator) ItemIterator
type LiteralExpr ¶
type MeasureAnalyzer ¶
type MeasureAnalyzer struct {
// contains filtered or unexported fields
}
func CreateMeasureAnalyzerFromMetaService ¶
func CreateMeasureAnalyzerFromMetaService(metaSvc metadata.Service) (*MeasureAnalyzer, error)
func (*MeasureAnalyzer) Analyze ¶
func (a *MeasureAnalyzer) Analyze(_ context.Context, criteria *measurev1.QueryRequest, metadata *commonv1.Metadata, s Schema) (Plan, error)
func (*MeasureAnalyzer) BuildMeasureSchema ¶
type Plan ¶
type Plan interface {
fmt.Stringer
Type() PlanType
Equal(Plan) bool
Children() []Plan
Schema() Schema
}
func NewTagFilter ¶
type ResolvableExpr ¶
type Schema ¶
type Schema interface {
Scope() tsdb.Entry
EntityList() []string
IndexDefined(*Tag) (bool, *databasev1.IndexRule)
IndexRuleDefined(string) (bool, *databasev1.IndexRule)
CreateTagRef(tags ...[]*Tag) ([][]*TagRef, error)
CreateFieldRef(fields ...*Field) ([]*FieldRef, error)
ProjTags(refs ...[]*TagRef) Schema
ProjFields(refs ...*FieldRef) Schema
Equal(Schema) bool
ShardNumber() uint32
TraceIDFieldName() string
}
type StreamAnalyzer ¶
type StreamAnalyzer struct {
// contains filtered or unexported fields
}
func CreateStreamAnalyzerFromMetaService ¶
func CreateStreamAnalyzerFromMetaService(metaSvc metadata.Service) (*StreamAnalyzer, error)
func (*StreamAnalyzer) Analyze ¶
func (a *StreamAnalyzer) Analyze(_ context.Context, criteria *streamv1.QueryRequest, metadata *commonv1.Metadata, s Schema) (Plan, error)
func (*StreamAnalyzer) BuildStreamSchema ¶
type Tag ¶
type Tag struct {
// contains filtered or unexported fields
}
func (*Tag) GetCompoundName ¶
GetCompoundName is only used for error message
func (*Tag) GetFamilyName ¶
func (*Tag) GetTagName ¶
type TagRef ¶
type TagRef struct {
// spec contains the index of the key in the streamSchema/measureSchema, as well as the underlying tagSpec
Spec *tagSpec
// contains filtered or unexported fields
}
TagRef is the reference to the field also it holds the definition (derived from the streamSchema, measureSchema) of the tag
func NewSearchableTagRef ¶
NewSearchableTagRef is a short-handed method for creating a TagRef to the tag in the searchable family
type TopElement ¶
type TopElement struct {
// contains filtered or unexported fields
}
func NewTopElement ¶
func NewTopElement(dp *measurev1.DataPoint, value int64) TopElement
func (TopElement) Val ¶
func (e TopElement) Val() int64
type TopQueue ¶
type TopQueue struct {
// contains filtered or unexported fields
}
func NewTopQueue ¶
func (*TopQueue) Elements ¶
func (s *TopQueue) Elements() []TopElement
func (*TopQueue) Insert ¶
func (s *TopQueue) Insert(element TopElement) bool
type UnresolvedOrderBy ¶
type UnresolvedOrderBy struct {
// contains filtered or unexported fields
}
type UnresolvedPlan ¶
func Aggregation ¶
func Aggregation(input UnresolvedPlan, aggrField *Field, aggrFunc modelv1.AggregationFunction, isGroup bool) UnresolvedPlan
func GlobalIndexScan ¶
func GlobalIndexScan(metadata *commonv1.Metadata, conditions []Expr, projection ...[]*Tag) UnresolvedPlan
GlobalIndexScan is a short-handed method for composing a globalIndexScan plan
func GroupBy ¶
func GroupBy(input UnresolvedPlan, groupBy [][]*Tag, groupByEntity bool) UnresolvedPlan
func Limit ¶
func Limit(input UnresolvedPlan, num uint32) UnresolvedPlan
func MeasureIndexScan ¶
func MeasureLimit ¶
func MeasureLimit(input UnresolvedPlan, offset, limit uint32) UnresolvedPlan
func Offset ¶
func Offset(input UnresolvedPlan, num uint32) UnresolvedPlan
func TagFilter ¶
func TagFilter(startTime, endTime time.Time, metadata *commonv1.Metadata, conditions []Expr, entity tsdb.Entity, orderBy *UnresolvedOrderBy, projection ...[]*Tag) UnresolvedPlan
func Top ¶
func Top(input UnresolvedPlan, top *measurev1.QueryRequest_Top) UnresolvedPlan
Source Files
¶
- common.go
- expr.go
- expr_literal.go
- format.go
- interface.go
- iter.go
- measure_analyzer.go
- measure_plan.go
- measure_plan_aggregation.go
- measure_plan_groupby.go
- measure_plan_indexscan_local.go
- measure_plan_top.go
- measure_top.go
- plan_orderby.go
- schema.go
- stream_analyzer.go
- stream_plan.go
- stream_plan_indexscan_global.go
- stream_plan_indexscan_local.go
- stream_plan_tag_filter.go