containers

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForeachVector added in v0.8.0

func ForeachVector(vec Vector, op any, sel *nulls.Bitmap) (err error)

func ForeachVectorWindow added in v0.8.0

func ForeachVectorWindow(
	vec Vector,
	start, length int,
	op1 any,
	op2 ItOp,
	sel *nulls.Bitmap,
) (err error)

func ForeachWindowBytes added in v0.8.0

func ForeachWindowBytes(
	vec *movec.Vector,
	start, length int,
	op ItOpT[[]byte],
	sels *nulls.Bitmap,
) (err error)

func ForeachWindowFixed added in v0.8.0

func ForeachWindowFixed[T any](
	vec *movec.Vector,
	start, length int,
	op ItOpT[T],
	opAny ItOp,
	sels *nulls.Bitmap,
) (err error)

func ForeachWindowVarlen added in v0.8.0

func ForeachWindowVarlen(
	vec *movec.Vector,
	start, length int,
	op ItOpT[[]byte],
	opAny ItOp,
	sels *nulls.Bitmap,
) (err error)

func GenericUpdateBytes added in v0.6.0

func GenericUpdateBytes(
	vec *movec.Vector, row uint32, v any, isNull bool, mp *mpool.MPool,
)

func GenericUpdateFixedValue added in v0.6.0

func GenericUpdateFixedValue[T types.FixedSizeT](
	vec *movec.Vector, row uint32, v any, isNull bool, _ *mpool.MPool,
)

func GetDefaultVectorPoolALLocator added in v1.0.0

func GetDefaultVectorPoolALLocator() *mpool.MPool

func MakeForeachVectorOp added in v0.8.0

func MakeForeachVectorOp(t types.T, overloads map[types.T]any, args ...any) any

func NewConstBytes added in v1.0.0

func NewConstBytes(typ types.Type, val []byte, length int, opts ...Options) *vectorWrapper

func NewConstFixed added in v1.0.0

func NewConstFixed[T any](typ types.Type, val T, length int, opts ...Options) *vectorWrapper

func NewConstNullVector added in v1.0.0

func NewConstNullVector(
	typ types.Type,
	length int,
	mp *mpool.MPool,
) *vectorWrapper

func NewVector

func NewVector(typ types.Type, opts ...Options) *vectorWrapper

func SplitBatch added in v0.6.0

func SplitBatch(bat *batch.Batch, cnt int) []*batch.Batch

func ToCNBatch added in v0.8.0

func ToCNBatch(tnBat *Batch) *batch.Batch

func UpdateValue added in v0.6.0

func UpdateValue(col *movec.Vector, row uint32, val any, isNull bool, mp *mpool.MPool)

Types

type BaseView added in v0.8.0

type BaseView struct {
	DeleteMask *nulls.Bitmap
}

type Batch

type Batch struct {
	Attrs   []string
	Vecs    []Vector
	Deletes *nulls.Bitmap
	Nameidx map[string]int
	Pool    *VectorPool
}

func BuildBatch

func BuildBatch(attrs []string, colTypes []types.Type, opts Options) *Batch

func BuildBatchWithPool added in v0.8.0

func BuildBatchWithPool(
	attrs []string, colTypes []types.Type, capacity int, pool *VectorPool,
) *Batch

func MockBatch

func MockBatch(vecTypes []types.Type, rows int, uniqueIdx int, provider *MockDataProvider) (bat *Batch)

func MockBatchWithAttrs

func MockBatchWithAttrs(vecTypes []types.Type, attrs []string, rows int, uniqueIdx int, provider *MockDataProvider) (bat *Batch)

func MockNullableBatch

func MockNullableBatch(vecTypes []types.Type, rows int, uniqueIdx int, provider *MockDataProvider) (bat *Batch)

func NewBatch

func NewBatch() *Batch

func NewBatchWithCapacity added in v0.8.0

func NewBatchWithCapacity(cap int) *Batch

func NewEmptyBatch

func NewEmptyBatch() *Batch

func NewNonNullBatchWithSharedMemory added in v0.7.0

func NewNonNullBatchWithSharedMemory(b *batch.Batch, mp *mpool.MPool) *Batch

func ToTNBatch added in v1.0.0

func ToTNBatch(cnBat *batch.Batch, mp *mpool.MPool) *Batch

func (*Batch) AddVector

func (bat *Batch) AddVector(attr string, vec Vector)

func (*Batch) Allocated

func (bat *Batch) Allocated() int

func (*Batch) Append added in v0.7.0

func (bat *Batch) Append(src *Batch) (err error)

func (*Batch) AppendPlaceholder added in v0.8.0

func (bat *Batch) AppendPlaceholder()

AddPlaceholder is used to consctruct batch sent to CN. The vectors in the batch are sorted by seqnum, if the seqnum was dropped, a zero value will be fill as placeholder. This is space-time tradeoff.

func (*Batch) ApproxSize added in v1.0.0

func (bat *Batch) ApproxSize() int

func (*Batch) CloneWindow

func (bat *Batch) CloneWindow(offset, length int, allocator ...*mpool.MPool) (cloned *Batch)

func (*Batch) CloneWindowWithPool added in v0.8.0

func (bat *Batch) CloneWindowWithPool(offset, length int, pool *VectorPool) (cloned *Batch)

func (*Batch) Close

func (bat *Batch) Close()

func (*Batch) Compact

func (bat *Batch) Compact()

func (*Batch) Delete

func (bat *Batch) Delete(i int)

func (*Batch) DeleteCnt

func (bat *Batch) DeleteCnt() int

func (*Batch) Equals

func (bat *Batch) Equals(o *Batch) bool

func (*Batch) Extend added in v0.6.0

func (bat *Batch) Extend(src *Batch)

extend vector with same name, consume src batch

func (*Batch) GetVectorByName

func (bat *Batch) GetVectorByName(name string) Vector

func (*Batch) HasDelete

func (bat *Batch) HasDelete() bool

func (*Batch) IsDeleted

func (bat *Batch) IsDeleted(i int) bool

func (*Batch) Length

func (bat *Batch) Length() int

func (*Batch) PPString added in v0.6.0

func (bat *Batch) PPString(num int) string

func (*Batch) RangeDelete

func (bat *Batch) RangeDelete(start, end int)

func (*Batch) ReadFrom

func (bat *Batch) ReadFrom(r io.Reader) (n int64, err error)

func (*Batch) ReadFromV1 added in v0.8.0

func (bat *Batch) ReadFromV1(r io.Reader) (n int64, err error)

in version1, batch.Deletes is roaring.Bitmap

func (*Batch) Reset added in v1.0.0

func (bat *Batch) Reset()

func (*Batch) Split

func (bat *Batch) Split(cnt int) []*Batch

func (*Batch) String

func (bat *Batch) String() string

func (*Batch) Window

func (bat *Batch) Window(offset, length int) *Batch

func (*Batch) WindowDeletes added in v0.8.0

func (bat *Batch) WindowDeletes(offset, length int, deep bool) *nulls.Bitmap

func (*Batch) WriteTo

func (bat *Batch) WriteTo(w io.Writer) (n int64, err error)

type BatchSplitter added in v1.0.0

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

BatchSplitter is used to split a batch into several batches with the same size.

func NewBatchSplitter added in v1.0.0

func NewBatchSplitter(bat *Batch, sliceSize int) *BatchSplitter

func (*BatchSplitter) Next added in v1.0.0

func (bs *BatchSplitter) Next() (*Batch, error)

type BatchWithVersion added in v0.8.0

type BatchWithVersion struct {
	*Batch
	Seqnums    []uint16
	NextSeqnum uint16
	Version    uint32
}

func (*BatchWithVersion) Len added in v0.8.0

func (b *BatchWithVersion) Len() int

func (*BatchWithVersion) Less added in v0.8.0

func (b *BatchWithVersion) Less(i, j int) bool

Sort by seqnum

func (*BatchWithVersion) Swap added in v0.8.0

func (b *BatchWithVersion) Swap(i, j int)

type BlockView added in v0.8.0

type BlockView struct {
	*BaseView
	Columns map[int]*ColumnView
}

TODO: remove this BlockView later Use Batch instead

func NewBlockView added in v0.8.0

func NewBlockView() *BlockView

func (*BlockView) ApplyDeletes added in v0.8.0

func (view *BlockView) ApplyDeletes()

func (*BlockView) ApproxSize added in v1.0.0

func (view *BlockView) ApproxSize() (size int)

func (*BlockView) Close added in v0.8.0

func (view *BlockView) Close()

func (*BlockView) GetColumnData added in v0.8.0

func (view *BlockView) GetColumnData(i int) Vector

func (*BlockView) Orphan added in v0.8.0

func (view *BlockView) Orphan(i int) Vector

func (*BlockView) SetBatch added in v0.8.0

func (view *BlockView) SetBatch(bat *Batch)

func (*BlockView) SetData added in v0.8.0

func (view *BlockView) SetData(i int, data Vector)

FIXME: i should not be idx in schema

type ColumnView added in v0.8.0

type ColumnView struct {
	*BaseView
	ColIdx int
	// contains filtered or unexported fields
}

TODO: remove this ColumnView later Use Batch with one vector instead

func NewColumnView added in v0.8.0

func NewColumnView(colIdx int) *ColumnView

func (*ColumnView) ApplyDeletes added in v0.8.0

func (view *ColumnView) ApplyDeletes() Vector

func (*ColumnView) Close added in v0.8.0

func (view *ColumnView) Close()

func (*ColumnView) GetData added in v0.8.0

func (view *ColumnView) GetData() Vector

func (*ColumnView) GetValue added in v0.8.0

func (view *ColumnView) GetValue(row int) (any, bool)

func (*ColumnView) IsDeleted added in v0.8.0

func (view *ColumnView) IsDeleted(row int) bool

func (*ColumnView) Length added in v0.8.0

func (view *ColumnView) Length() int

func (*ColumnView) Orphan added in v0.8.0

func (view *ColumnView) Orphan() Vector

func (*ColumnView) SetData added in v0.8.0

func (view *ColumnView) SetData(data Vector)

func (*ColumnView) String added in v0.8.0

func (view *ColumnView) String() string

type ItOp

type ItOp = func(v any, isNull bool, row int) error

type ItOpT added in v0.8.0

type ItOpT[T any] func(v T, isNull bool, row int) error

type MockDataProvider

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

func NewMockDataProvider

func NewMockDataProvider() *MockDataProvider

func (*MockDataProvider) AddColumnProvider

func (p *MockDataProvider) AddColumnProvider(colIdx int, provider Vector)

func (*MockDataProvider) GetColumnProvider

func (p *MockDataProvider) GetColumnProvider(colIdx int) Vector

func (*MockDataProvider) Reset

func (p *MockDataProvider) Reset()

type Options

type Options struct {
	Capacity  int
	Allocator *mpool.MPool
}

type Vector

type Vector interface {
	GetType() *types.Type

	IsConst() bool
	IsConstNull() bool

	// Deep copy ops
	Get(i int) any
	Append(v any, isNull bool)
	CloneWindow(offset, length int, allocator ...*mpool.MPool) Vector
	CloneWindowWithPool(offset, length int, pool *VectorPool) Vector
	PreExtend(length int) error

	WriteTo(w io.Writer) (int64, error)
	ReadFrom(r io.Reader) (int64, error)

	// Shallow Ops
	ShallowGet(i int) any
	Window(offset, length int) Vector

	// Deepcopy if const
	TryConvertConst() Vector

	GetDownstreamVector() *cnVector.Vector

	Update(i int, v any, isNull bool)
	Compact(*roaring.Bitmap)
	CompactByBitmap(*nulls.Bitmap)

	Extend(o Vector)
	ExtendWithOffset(src Vector, srcOff, srcLen int)
	ExtendVec(o *cnVector.Vector) error

	Foreach(op ItOp, sels *nulls.Bitmap) error
	ForeachWindow(offset, length int, op ItOp, sels *nulls.Bitmap) error

	Length() int
	ApproxSize() int
	Allocated() int
	GetAllocator() *mpool.MPool

	IsNull(i int) bool
	HasNull() bool
	NullMask() *nulls.Nulls
	// NullCount will consider ConstNull and Const vector
	NullCount() int

	Close()

	// Test functions
	Equals(o Vector) bool
	String() string
	PPString(num int) string
	AppendMany(vs []any, isNulls []bool)
	Delete(i int)
	// contains filtered or unexported methods
}
var EMPTY_VECTOR Vector

func MakeVector

func MakeVector(typ types.Type, mp *mpool.MPool) (vec Vector)

func MockVector

func MockVector(t types.Type, rows int, unique bool, provider Vector) (vec Vector)

func MockVector2

func MockVector2(typ types.Type, rows int, offset int) Vector

func ToTNVector added in v1.0.0

func ToTNVector(v *movec.Vector, mp *mpool.MPool) Vector

type VectorPool added in v0.8.0

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

func NewVectorPool added in v0.8.0

func NewVectorPool(name string, cnt int, opts ...VectorPoolOption) *VectorPool

func (*VectorPool) Allocated added in v0.8.0

func (p *VectorPool) Allocated() int

func (*VectorPool) Destory added in v1.0.0

func (p *VectorPool) Destory()

Only for test It is not safe to call Destory

func (*VectorPool) FixedSizeAllocated added in v0.8.0

func (p *VectorPool) FixedSizeAllocated() int

func (*VectorPool) FixedSizeUsed added in v0.8.0

func (p *VectorPool) FixedSizeUsed(isUnsafe bool) (int, int)

func (*VectorPool) GetVector added in v0.8.0

func (p *VectorPool) GetVector(t *types.Type) *vectorWrapper

func (*VectorPool) String added in v0.8.0

func (p *VectorPool) String() string

func (*VectorPool) Used added in v0.8.0

func (p *VectorPool) Used(isUnsafe bool) (int, int)

func (*VectorPool) VarlenUsed added in v0.8.0

func (p *VectorPool) VarlenUsed(isUnsafe bool) (int, int)

func (*VectorPool) VarlenaSizeAllocated added in v0.8.0

func (p *VectorPool) VarlenaSizeAllocated() int

type VectorPoolOption added in v0.8.0

type VectorPoolOption func(*VectorPool)

func WithAllocationLimit added in v0.8.0

func WithAllocationLimit(maxv int) VectorPoolOption

func WithFixedSizeRatio added in v0.8.0

func WithFixedSizeRatio(ratio float64) VectorPoolOption

func WithMPool added in v0.8.0

func WithMPool(mp *mpool.MPool) VectorPoolOption

Jump to

Keyboard shortcuts

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