binops

package
v0.0.0-...-f8e07d0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOrBinaryOperation

func NewOrBinaryOperation(
	left types.InstantVectorOperator,
	right types.InstantVectorOperator,
	vectorMatching parser.VectorMatching,
	memoryConsumptionTracker *limiting.MemoryConsumptionTracker,
	timeRange types.QueryTimeRange,
	expressionPosition posrange.PositionRange,
) types.InstantVectorOperator

Types

type AndUnlessBinaryOperation

type AndUnlessBinaryOperation struct {
	Left                     types.InstantVectorOperator
	Right                    types.InstantVectorOperator
	VectorMatching           parser.VectorMatching
	MemoryConsumptionTracker *limiting.MemoryConsumptionTracker
	IsUnless                 bool // If true, this operator represents an 'unless', if false, this operator represents an 'and'
	// contains filtered or unexported fields
}

AndUnlessBinaryOperation represents a logical 'and' or 'unless' between two vectors.

func NewAndUnlessBinaryOperation

func NewAndUnlessBinaryOperation(
	left types.InstantVectorOperator,
	right types.InstantVectorOperator,
	vectorMatching parser.VectorMatching,
	memoryConsumptionTracker *limiting.MemoryConsumptionTracker,
	isUnless bool,
	timeRange types.QueryTimeRange,
	expressionPosition posrange.PositionRange,
) *AndUnlessBinaryOperation

func (*AndUnlessBinaryOperation) Close

func (a *AndUnlessBinaryOperation) Close()

func (*AndUnlessBinaryOperation) ExpressionPosition

func (a *AndUnlessBinaryOperation) ExpressionPosition() posrange.PositionRange

func (*AndUnlessBinaryOperation) NextSeries

func (*AndUnlessBinaryOperation) SeriesMetadata

func (a *AndUnlessBinaryOperation) SeriesMetadata(ctx context.Context) ([]types.SeriesMetadata, error)

type OrBinaryOperation

type OrBinaryOperation struct {
	Left                     types.InstantVectorOperator
	Right                    types.InstantVectorOperator
	VectorMatching           parser.VectorMatching
	MemoryConsumptionTracker *limiting.MemoryConsumptionTracker
	// contains filtered or unexported fields
}

OrBinaryOperation represents a logical 'or' between two vectors.

func (*OrBinaryOperation) Close

func (o *OrBinaryOperation) Close()

func (*OrBinaryOperation) ExpressionPosition

func (o *OrBinaryOperation) ExpressionPosition() posrange.PositionRange

func (*OrBinaryOperation) NextSeries

func (*OrBinaryOperation) SeriesMetadata

func (o *OrBinaryOperation) SeriesMetadata(ctx context.Context) ([]types.SeriesMetadata, error)

type ScalarScalarBinaryOperation

type ScalarScalarBinaryOperation struct {
	Left                     types.ScalarOperator
	Right                    types.ScalarOperator
	Op                       parser.ItemType
	MemoryConsumptionTracker *limiting.MemoryConsumptionTracker
	// contains filtered or unexported fields
}

func NewScalarScalarBinaryOperation

func NewScalarScalarBinaryOperation(
	left, right types.ScalarOperator,
	op parser.ItemType,
	memoryConsumptionTracker *limiting.MemoryConsumptionTracker,
	expressionPosition posrange.PositionRange,
) (*ScalarScalarBinaryOperation, error)

func (*ScalarScalarBinaryOperation) Close

func (s *ScalarScalarBinaryOperation) Close()

func (*ScalarScalarBinaryOperation) ExpressionPosition

func (s *ScalarScalarBinaryOperation) ExpressionPosition() posrange.PositionRange

func (*ScalarScalarBinaryOperation) GetValues

type VectorScalarBinaryOperation

type VectorScalarBinaryOperation struct {
	Scalar                   types.ScalarOperator
	Vector                   types.InstantVectorOperator
	ScalarIsLeftSide         bool
	Op                       parser.ItemType
	ReturnBool               bool
	MemoryConsumptionTracker *limiting.MemoryConsumptionTracker
	// contains filtered or unexported fields
}

VectorScalarBinaryOperation represents a binary operation between an instant vector and a scalar such as "<expr> + 2" or "3 * <expr>".

func NewVectorScalarBinaryOperation

func NewVectorScalarBinaryOperation(
	scalar types.ScalarOperator,
	vector types.InstantVectorOperator,
	scalarIsLeftSide bool,
	op parser.ItemType,
	returnBool bool,
	timeRange types.QueryTimeRange,
	memoryConsumptionTracker *limiting.MemoryConsumptionTracker,
	annotations *annotations.Annotations,
	expressionPosition posrange.PositionRange,
) (*VectorScalarBinaryOperation, error)

func (*VectorScalarBinaryOperation) Close

func (v *VectorScalarBinaryOperation) Close()

func (*VectorScalarBinaryOperation) ExpressionPosition

func (v *VectorScalarBinaryOperation) ExpressionPosition() posrange.PositionRange

func (*VectorScalarBinaryOperation) NextSeries

func (*VectorScalarBinaryOperation) SeriesMetadata

type VectorVectorBinaryOperation

type VectorVectorBinaryOperation struct {
	Left                     types.InstantVectorOperator
	Right                    types.InstantVectorOperator
	Op                       parser.ItemType
	ReturnBool               bool
	MemoryConsumptionTracker *limiting.MemoryConsumptionTracker

	VectorMatching parser.VectorMatching
	// contains filtered or unexported fields
}

VectorVectorBinaryOperation represents a binary operation between instant vectors such as "<expr> + <expr>" or "<expr> - <expr>".

func NewVectorVectorBinaryOperation

func NewVectorVectorBinaryOperation(
	left types.InstantVectorOperator,
	right types.InstantVectorOperator,
	vectorMatching parser.VectorMatching,
	op parser.ItemType,
	returnBool bool,
	memoryConsumptionTracker *limiting.MemoryConsumptionTracker,
	annotations *annotations.Annotations,
	expressionPosition posrange.PositionRange,
) (*VectorVectorBinaryOperation, error)

func (*VectorVectorBinaryOperation) Close

func (b *VectorVectorBinaryOperation) Close()

func (*VectorVectorBinaryOperation) ExpressionPosition

func (b *VectorVectorBinaryOperation) ExpressionPosition() posrange.PositionRange

func (*VectorVectorBinaryOperation) NextSeries

func (*VectorVectorBinaryOperation) SeriesMetadata

SeriesMetadata returns the series expected to be produced by this operator.

Note that it is possible that this method returns a series which will not have any points, as the list of possible output series is generated based solely on the series labels, not their data.

For example, if this operator is for a range query with the expression "left_metric + right_metric", but left_metric has points at T=0 and T=1 in the query range, and right_metric has points at T=2 and T=3 in the query range, then SeriesMetadata will return a series, but NextSeries will return no points for that series.

If this affects many series in the query, this may cause consuming operators to be less efficient, but in practice this rarely happens.

(The alternative would be to compute the entire result here in SeriesMetadata and only return the series that contain points, but that would mean we'd need to hold the entire result in memory at once, which we want to avoid.)

Jump to

Keyboard shortcuts

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