agg

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agg

type Agg[T any] interface {
	// Dup will duplicate a new agg with the same type.
	Dup() Agg[any]

	// Type return the type of the agg's result.
	OutputType() types.Type

	// InputType return the type of the agg's input.
	InputTypes() []types.Type

	// String return related information of the agg.
	// used to show query plans.
	String() string

	// Free the agg.
	Free(*mheap.Mheap)

	// Grows allocates n groups for the agg.
	Grows(n int, _ *mheap.Mheap) error

	// Eval method calculates and returns the final result of the aggregate function.
	Eval(_ *mheap.Mheap) (*vector.Vector, error)

	// Fill use the rowIndex-rows of vector to update the data of groupIndex-group.
	// rowCount indicates the number of times the rowIndex-row is repeated.
	Fill(groupIndex int64, rowIndex int64, rowCount int64, vecs []*vector.Vector)

	// BulkFill use a whole vector to update the data of agg's group
	// groupIndex is the index number of the group
	// rowCounts is the count number of each row.
	BulkFill(groupIndex int64, rowCounts []int64, vecs []*vector.Vector)

	// BatchFill use part of the vector to update the data of agg's group
	//      os(origin-s) records information about which groups need to be updated
	//      if length of os is N, we use first N of vps to do update work.
	//      And if os[i] > 0, it means the agg's (vps[i]-1)th group is a new one (never been assigned a value),
	//      Maybe this feature can help us to do some optimization work.
	//      So we use the os as a parameter but not len(os).
	//
	//      agg's (vps[i]-1)th group is related to vector's (offset+i)th row.
	//      rowCounts[i] is count number of the row[i]
	// For a more detailed introduction of rowCounts, please refer to comments of Function Fill.
	BatchFill(offset int64, os []uint8, vps []uint64, rowCounts []int64, vecs []*vector.Vector)

	// Merge will merge a couple of group between 2 aggregate function structures.
	// It merges the groupIndex1-group of agg1 and
	// groupIndex2-group of agg2
	Merge(agg2 Agg[any], groupIndex1 int64, groupIndex2 int64)

	// BatchAdd merges multi groups of agg1 and agg2
	//  agg1's (vps[i]-1)th group is related to agg2's (start+i)th group
	// For more introduction of os, please refer to comments of Function BatchFill.
	BatchMerge(agg2 Agg[any], start int64, os []uint8, vps []uint64)
}

func NewUnaryAgg

func NewUnaryAgg[T1, T2 any](isCount bool, ityp, otyp types.Type, grows func(int),
	eval func([]T2) []T2, merge func(T2, T2, bool, bool) (T2, bool),
	fill func(T1, T2, int64, bool, bool) (T2, bool)) Agg[*UnaryAgg[T1, T2]]

func NewUnaryDistAgg

func NewUnaryDistAgg[T1, T2 any](isCount bool, ityp, otyp types.Type, grows func(int),
	eval func([]T2) []T2, merge func(T2, T2, bool, bool) (T2, bool),
	fill func(T1, T2, int64, bool, bool) (T2, bool)) Agg[*UnaryDistAgg[T1, T2]]

type UnaryAgg

type UnaryAgg[T1, T2 any] struct {
	// contains filtered or unexported fields
}

generic aggregation function with one input vector and without distinct

func (*UnaryAgg[T1, T2]) BatchFill

func (a *UnaryAgg[T1, T2]) BatchFill(start int64, os []uint8, vps []uint64, zs []int64, vecs []*vector.Vector)

func (*UnaryAgg[T1, T2]) BatchMerge

func (a *UnaryAgg[T1, T2]) BatchMerge(b Agg[any], start int64, os []uint8, vps []uint64)

func (*UnaryAgg[T1, T2]) BulkFill

func (a *UnaryAgg[T1, T2]) BulkFill(i int64, zs []int64, vecs []*vector.Vector)

func (*UnaryAgg[T1, T2]) Dup

func (a *UnaryAgg[T1, T2]) Dup() Agg[any]

func (*UnaryAgg[T1, T2]) Eval

func (a *UnaryAgg[T1, T2]) Eval(m *mheap.Mheap) (*vector.Vector, error)

func (*UnaryAgg[T1, T2]) Fill

func (a *UnaryAgg[T1, T2]) Fill(i int64, sel, z int64, vecs []*vector.Vector)

func (*UnaryAgg[T1, T2]) Free

func (a *UnaryAgg[T1, T2]) Free(m *mheap.Mheap)

func (*UnaryAgg[T1, T2]) Grows

func (a *UnaryAgg[T1, T2]) Grows(size int, m *mheap.Mheap) error

func (*UnaryAgg[T1, T2]) InputTypes

func (a *UnaryAgg[T1, T2]) InputTypes() []types.Type

func (*UnaryAgg[T1, T2]) Merge

func (a *UnaryAgg[T1, T2]) Merge(b Agg[any], x, y int64)

a[x] += b[y]

func (*UnaryAgg[T1, T2]) OutputType

func (a *UnaryAgg[T1, T2]) OutputType() types.Type

func (*UnaryAgg[T1, T2]) String

func (a *UnaryAgg[T1, T2]) String() string

type UnaryDistAgg

type UnaryDistAgg[T1, T2 any] struct {
	// contains filtered or unexported fields
}

generic aggregation function with one input vector and with distinct

func (*UnaryDistAgg[T1, T2]) BatchFill

func (a *UnaryDistAgg[T1, T2]) BatchFill(start int64, os []uint8, vps []uint64, zs []int64, vecs []*vector.Vector)

func (*UnaryDistAgg[T1, T2]) BatchMerge

func (a *UnaryDistAgg[T1, T2]) BatchMerge(b Agg[any], start int64, os []uint8, vps []uint64)

func (*UnaryDistAgg[T1, T2]) BulkFill

func (a *UnaryDistAgg[T1, T2]) BulkFill(i int64, zs []int64, vecs []*vector.Vector)

func (*UnaryDistAgg[T1, T2]) Dup

func (a *UnaryDistAgg[T1, T2]) Dup() Agg[any]

func (*UnaryDistAgg[T1, T2]) Eval

func (a *UnaryDistAgg[T1, T2]) Eval(m *mheap.Mheap) (*vector.Vector, error)

func (*UnaryDistAgg[T1, T2]) Fill

func (a *UnaryDistAgg[T1, T2]) Fill(i int64, sel, z int64, vecs []*vector.Vector)

func (*UnaryDistAgg[T1, T2]) Free

func (a *UnaryDistAgg[T1, T2]) Free(m *mheap.Mheap)

func (*UnaryDistAgg[T1, T2]) Grows

func (a *UnaryDistAgg[T1, T2]) Grows(size int, m *mheap.Mheap) error

func (*UnaryDistAgg[T1, T2]) InputTypes

func (a *UnaryDistAgg[T1, T2]) InputTypes() []types.Type

func (*UnaryDistAgg[T1, T2]) Merge

func (a *UnaryDistAgg[T1, T2]) Merge(b Agg[any], x, y int64)

a[x] += b[y]

func (*UnaryDistAgg[T1, T2]) OutputType

func (a *UnaryDistAgg[T1, T2]) OutputType() types.Type

func (*UnaryDistAgg[T1, T2]) String

func (a *UnaryDistAgg[T1, T2]) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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