processor

package
v0.64.1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndexFetch

func IndexFetch(ids []seq.ID, sw *stopwatch.Stopwatch, fetchIndex fetchIndex, res [][]byte) error

func IndexSearch

func IndexSearch(
	ctx context.Context,
	params SearchParams,
	index searchIndex,
	aggLimits AggLimits,
	sw *stopwatch.Stopwatch,
) (*seq.QPR, error)

func MergeQPRs

func MergeQPRs(qprs []*seq.QPR, params SearchParams) *seq.QPR

Types

type AggBin

type AggBin[T comparable] struct {
	MID    seq.MID
	Source T
}

AggBin is a container for documents which were written in the same time interval. When dealing with aggregation (without need in building time series) [AggBin.MID] is equal to [DummyMID].

type AggLimits

type AggLimits struct {
	// MaxFieldTokens max AggQuery.Field uniq values to parse.
	MaxFieldTokens int
	// MaxGroupTokens max AggQuery.GroupBy unique values.
	MaxGroupTokens int
	// MaxTIDsPerFraction max number of tokens per fraction.
	MaxTIDsPerFraction int
}

type AggQuery

type AggQuery struct {
	Field     *parser.Literal
	GroupBy   *parser.Literal
	Func      seq.AggFunc
	Quantiles []float64
	Interval  int64
}

type Aggregator

type Aggregator interface {
	// Next iterates to count the next lid.
	Next(lid uint32) error
	// Aggregate processes and returns the final aggregation result.
	Aggregate() (seq.AggregatableSamples, error)
}

type ExtractMIDFunc

type ExtractMIDFunc func(seq.LID) seq.MID

ExtractMIDFunc is necessary since in aggregators we do not have [idsIndex] interface, we need a way to extract timestamp of document to build time series.

type SearchParams

type SearchParams struct {
	AST *parser.ASTNode `json:"-"`

	AggQ         []AggQuery
	HistInterval uint64

	From  seq.MID
	To    seq.MID
	Limit int

	WithTotal bool
	Order     seq.DocsOrder
}

func (*SearchParams) HasAgg

func (p *SearchParams) HasAgg() bool

func (*SearchParams) HasHist

func (p *SearchParams) HasHist() bool

func (*SearchParams) IsScanAllRequest

func (p *SearchParams) IsScanAllRequest() bool

type SingleSourceCountAggregator

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

SingleSourceCountAggregator aggregates counts for a single source.

func NewSingleSourceCountAggregator

func NewSingleSourceCountAggregator(
	iterator *SourcedNodeIterator, fn ExtractMIDFunc,
) *SingleSourceCountAggregator

func (*SingleSourceCountAggregator) Aggregate

func (*SingleSourceCountAggregator) Next

Next iterates over groupBy tree to count occurrence.

type SingleSourceHistogramAggregator

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

func NewSingleSourceHistogramAggregator

func NewSingleSourceHistogramAggregator(
	field *SourcedNodeIterator, collectSamples bool, fn ExtractMIDFunc,
) *SingleSourceHistogramAggregator

func (*SingleSourceHistogramAggregator) Aggregate

func (*SingleSourceHistogramAggregator) Next

type SingleSourceUniqueAggregator

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

SingleSourceUniqueAggregator aggregates unique values for a single source.

func NewSingleSourceUniqueAggregator

func NewSingleSourceUniqueAggregator(iterator *SourcedNodeIterator) *SingleSourceUniqueAggregator

func (*SingleSourceUniqueAggregator) Aggregate

func (*SingleSourceUniqueAggregator) Next

Next iterates over groupBy tree to count occurrence.

type SourcedNodeIterator

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

SourcedNodeIterator can iterate the sourced node that returns source, which means index in a tids slice.

func NewSourcedNodeIterator

func NewSourcedNodeIterator(sourced node.Sourced, ti tokenIndex, tids []uint32, limit iteratorLimit, reverse bool) *SourcedNodeIterator

func (*SourcedNodeIterator) ConsumeTokenSource

func (s *SourcedNodeIterator) ConsumeTokenSource(lid uint32) (uint32, bool, error)

func (*SourcedNodeIterator) UniqueSources

func (s *SourcedNodeIterator) UniqueSources() int

func (*SourcedNodeIterator) ValueBySource

func (s *SourcedNodeIterator) ValueBySource(source uint32) string

type TwoSourceAggregator

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

TwoSourceAggregator implements Aggregator interface and can iterate over groupBy and field node.Sourced to collect a histogram.

func NewGroupAndFieldAggregator

func NewGroupAndFieldAggregator(
	fieldIterator, groupByIterator *SourcedNodeIterator,
	fn ExtractMIDFunc, collectSamples bool,
) *TwoSourceAggregator

func (*TwoSourceAggregator) Aggregate

Aggregate processes and returns the final aggregation result.

func (*TwoSourceAggregator) Next

func (n *TwoSourceAggregator) Next(lid uint32) error

Next iterates over groupBy and field iterators (actually trees) to count occurrence.

Jump to

Keyboard shortcuts

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