compute

package
v3.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package compute implements stateless computational operations over columnar data.

Compute functions operate on one or more columnar.Datum values, which is an opaque representation of either an array or a scalar value of a specific value kind.

Unless otherwise specified, all compute functions return data allocated with the memory.Allocator provided to the compute function.

Package compute is EXPERIMENTAL and currently only intended to be used by github.com/grafana/loki/v3/pkg/dataobj.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func And

func And(alloc *memory.Allocator, left, right columnar.Datum, selection memory.Bitmap) (columnar.Datum, error)

And computes the logical AND of two input boolean datums. And returns an error if the input kind of either datum is not a boolean. If both input datums are arrays, they must be of the same length.

Special cases:

  • If either side of the AND is null, the result is null.

func Equals

func Equals(alloc *memory.Allocator, left, right columnar.Datum, selection memory.Bitmap) (columnar.Datum, error)

Equals compares the two input datum. Equals returns an error if the input kinds are not identical, or if the datum types are not considered comparable.

Special cases:

  • If a null is found on either side, the result is null.

func GreaterOrEqual

func GreaterOrEqual(alloc *memory.Allocator, left, right columnar.Datum, selection memory.Bitmap) (columnar.Datum, error)

GreaterOrEqual compares the two input datum for greater-than-or-equal ordering. GreaterOrEqual returns an error if the input kinds are not identical, or if the datum types are not ordered.

Special cases:

  • If a null is found on either side, the result is null.

func GreaterThan

func GreaterThan(alloc *memory.Allocator, left, right columnar.Datum, selection memory.Bitmap) (columnar.Datum, error)

GreaterThan compares the two input datum for greater-than ordering. GreaterThan returns an error if the input kinds are not identical, or if the datum types are not ordered.

Special cases:

  • If a null is found on either side, the result is null.

func IsMember

func IsMember(alloc *memory.Allocator, datum columnar.Datum, values *columnar.Set, selection memory.Bitmap) (columnar.Datum, error)

IsMember checks if each item in datum is a member of the values set. The selection parameter controls which rows are evaluated:

  • If selection.Len(), all rows are evaluated
  • Otherwise, only rows where selection bit is true are evaluated, non-selected rows result in null

func LessOrEqual

func LessOrEqual(alloc *memory.Allocator, left, right columnar.Datum, selection memory.Bitmap) (columnar.Datum, error)

LessOrEqual compares the two input datum for less-than-or-equal ordering. LessOrEqual returns an error if the input kinds are not identical, or if the datum types are not ordered.

Special cases:

  • If a null is found on either side, the result is null.

func LessThan

func LessThan(alloc *memory.Allocator, left, right columnar.Datum, selection memory.Bitmap) (columnar.Datum, error)

LessThan compares the two input datum for less-than ordering. LessThan returns an error if the input kinds are not identical, or if the datum types are not ordered.

Special cases:

  • If a null is found on either side, the result is null.

func Not

func Not(alloc *memory.Allocator, input columnar.Datum, selection memory.Bitmap) (columnar.Datum, error)

Not negates the input boolean datum. Not returns an error if the input kind is not a boolean.

Special cases:

  • The negation of null is null.

func NotEquals

func NotEquals(alloc *memory.Allocator, left, right columnar.Datum, selection memory.Bitmap) (columnar.Datum, error)

NotEquals compares the two input datum for inequality. NotEquals returns an error if the input kinds are not identical, or if the datum types are not considered comparable.

Special cases:

  • If a null is found on either side, the result is null.

func Or

func Or(alloc *memory.Allocator, left, right columnar.Datum, selection memory.Bitmap) (columnar.Datum, error)

Or computes the logical OR of two input boolean datums. Or returns an error if the input kind of either datum is not a boolean. If both input datums are arrays, they must be of the same length.

Special cases:

  • If either side of the OR is null, the result is null.

func RegexpMatch

func RegexpMatch(alloc *memory.Allocator, haystack columnar.Datum, regexp *regexp.Regexp, selection memory.Bitmap) (columnar.Datum, error)

RegexpMatch computes the regular expression match against a datum. It returns a boolean datum indicating whether the regular expression matched the haystack datum.

Special cases:

  • If a value in the haystack is null, the result for that value is null.
  • If the regexp is null, the result is null.

func Substr

func Substr(alloc *memory.Allocator, haystack columnar.Datum, needle columnar.Datum, selection memory.Bitmap) (columnar.Datum, error)

Substr computes the case sensitive match of a needle datum against haystack datum It returns a boolean datum indicating whether the needle was found in the haystack.

Special cases:

  • If a value in the haystack is null, the result for that value is null.
  • If the needle is null, the result is null.

func SubstrInsensitive

func SubstrInsensitive(alloc *memory.Allocator, haystack columnar.Datum, needle columnar.Datum, selection memory.Bitmap) (columnar.Datum, error)

SubstrInsensitive computes the case insensitive match of a needle datum against haystack datum It returns a boolean datum indicating whether the needle was found in the haystack.

Special cases:

  • If a value in the haystack is null, the result for that value is null.
  • If the needle is null, the result is null.

Types

This section is empty.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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