vector

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendBytes added in v0.6.0

func AppendBytes(v *Vector, arg [][]byte, m *mpool.MPool) error

func AppendFixed added in v0.6.0

func AppendFixed[T any](v *Vector, arg []T, m *mpool.MPool) error

func AppendFixedRaw added in v0.6.0

func AppendFixedRaw(v *Vector, data []byte, m *mpool.MPool) error

func AppendString added in v0.6.0

func AppendString(v *Vector, arg []string, m *mpool.MPool) error

func AppendTuple added in v0.6.0

func AppendTuple(v *Vector, arg [][]interface{}) error

func Clean

func Clean(v *Vector, m *mpool.MPool)

func Copy

func Copy(v, w *Vector, vi, wi int64, m *mpool.MPool) error

XXX Old Copy is FUBAR. Copy simply does v[vi] = w[wi]

func DecodeFixedCol

func DecodeFixedCol[T types.FixedSizeT](v *Vector, sz int) []T

func GetBytesVectorValues added in v0.6.0

func GetBytesVectorValues(v *Vector) [][]byte

func GetColumn added in v0.5.1

func GetColumn[T any](v *Vector) []T

XXX A huge hammer, get rid of any typing and totally depends on v.Col We should really not using this one but it is wide spread already.

func GetFixedVectorValues added in v0.5.0

func GetFixedVectorValues[T types.FixedSizeT](v *Vector) []T

GetFixedVector decode data and return decoded []T. For const/scalar vector we expand and return newly allocated slice.

func GetInitConstVal added in v0.6.0

func GetInitConstVal(typ types.Type) any

func GetPtrAt added in v0.6.0

func GetPtrAt(v *Vector, idx int64) unsafe.Pointer

Get the pointer to idx-th fixed size entry.

func GetStrColumn added in v0.6.0

func GetStrColumn(v *Vector) []string

XXX Compatibility: how many aliases do we need ...

func GetStrVectorValues added in v0.5.0

func GetStrVectorValues(v *Vector) []string

func GetValueAt added in v0.6.0

func GetValueAt[T types.FixedSizeT](v *Vector, idx int64) T

Get Value at index

func GetValueAtOrZero added in v0.6.0

func GetValueAtOrZero[T types.FixedSizeT](v *Vector, idx int64) T

func Length

func Length(v *Vector) int

func MustBytesCols added in v0.5.0

func MustBytesCols(v *Vector) [][]byte

func MustStrCols added in v0.6.0

func MustStrCols(v *Vector) []string

func MustTCols added in v0.5.0

func MustTCols[T types.FixedSizeT](v *Vector) []T

func MustVarlenaRawData added in v0.6.0

func MustVarlenaRawData(v *Vector) (data []types.Varlena, area []byte)

func PreAlloc

func PreAlloc(v *Vector, rows, cap int, m *mpool.MPool)

XXX: PreAlloc create a empty v, with enough fixed slots to cap entry.

func ProtoTypeToType added in v0.6.0

func ProtoTypeToType(typ *plan.Type) types.Type

func Reset

func Reset(v *Vector)

XXX Old Reset is FUBAR FUBAR. I will put the code here just for fun.

func SetBytesAt added in v0.6.0

func SetBytesAt(v *Vector, idx int, bs []byte, m *mpool.MPool) error

func SetCol

func SetCol(v *Vector, col interface{})

func SetLength

func SetLength(v *Vector, n int)

func SetStringAt added in v0.6.0

func SetStringAt(v *Vector, idx int, bs string, m *mpool.MPool) error

func SetTAt added in v0.6.0

func SetTAt[T types.FixedSizeT](v *Vector, idx int, t T) error

func SetVectorLength added in v0.5.0

func SetVectorLength(v *Vector, n int)

func Shrink

func Shrink(v *Vector, sels []int64)

func ShrinkFixed added in v0.6.0

func ShrinkFixed[T types.FixedSizeT](v *Vector, sels []int64)

func Shuffle

func Shuffle(v *Vector, sels []int64, m *mpool.MPool) error

func ShuffleFixed added in v0.6.0

func ShuffleFixed[T types.FixedSizeT](v *Vector, sels []int64, m *mpool.MPool) error

Shuffle assumes we do not have dup in sels.

func TypeToProtoType added in v0.6.0

func TypeToProtoType(typ types.Type) *plan.Type

func Union

func Union(v, w *Vector, sels []int64, hasNull bool, m *mpool.MPool) (err error)

XXX Old Union is FUBAR Union is just append.

func UnionBatch

func UnionBatch(v, w *Vector, offset int64, cnt int, flags []uint8, m *mpool.MPool) (err error)

XXX Old UnionBatch is FUBAR.

func UnionMulti added in v0.6.0

func UnionMulti(v, w *Vector, sel int64, cnt int, m *mpool.MPool) (err error)

func UnionNull added in v0.5.0

func UnionNull(v, _ *Vector, m *mpool.MPool) error

XXX Old UnionNull is FUBAR func UnionNull(v, _ *Vector, m *mpool.MPool) error It seems to do UnionOne(v, v, 0, m), only that if v is empty, append a zero value instead of v[0]. I don't know why this is called UnionNull -- it does not have much to do with Null.

XXX Original code alloc or grow typesize * 8 bytes. It is not clear people want to amortize alloc/grow, or it is a bug.

func UnionOne

func UnionOne(v, w *Vector, sel int64, m *mpool.MPool) (err error)

XXX Old UnionOne is FUBAR It is simply append. We do not go through appendOne interface because we don't want to horrible type switch.

func VecToString added in v0.6.0

func VecToString[T types.FixedSizeT](v *Vector) string

XXX What are these stuff, who use it?

func VectorToProtoVector added in v0.6.0

func VectorToProtoVector(vec *Vector) (*api.Vector, error)

Types

type Vector

type Vector struct {
	// XXX There was Ref and Link, from the impl, it is totally wrong stuff.
	// Removed.
	Typ types.Type
	Col interface{}  // column data, encoded Data
	Nsp *nulls.Nulls // nulls list
	// contains filtered or unexported fields
}

XXX Moved vector from types.go to vector.go XXX Deleted vector interface, which was commented out and outdated anyway.

Vector vector
* origin true:
* 				count || type || bitmap size || bitmap || vector
* origin false:
*  			count || vector

func BuildVarlenaVector added in v0.6.0

func BuildVarlenaVector(typ types.Type, data []types.Varlena, area []byte) (vec *Vector, err error)

func CheckInsertVector added in v0.6.0

func CheckInsertVector(v *Vector, m *mpool.MPool) *Vector

CheckInsertVector vector.data will not be nil when insert rows

func Dup

func Dup(v *Vector, m *mpool.MPool) (*Vector, error)

XXX Original code is really confused by what is dup ...

func New

func New(typ types.Type) *Vector

func NewConst added in v0.5.0

func NewConst(typ types.Type, length int) *Vector

func NewConstBytes added in v0.6.0

func NewConstBytes(typ types.Type, length int, val []byte, mp *mpool.MPool) *Vector

func NewConstFixed added in v0.6.0

func NewConstFixed[T types.FixedSizeT](typ types.Type, length int, val T, mp *mpool.MPool) *Vector

func NewConstNull added in v0.5.0

func NewConstNull(typ types.Type, length int) *Vector

func NewConstNullWithData added in v0.6.0

func NewConstNullWithData(typ types.Type, length int, mp *mpool.MPool) *Vector

func NewConstString added in v0.6.0

func NewConstString(typ types.Type, length int, val string, mp *mpool.MPool) *Vector

func NewOriginal added in v0.6.0

func NewOriginal(typ types.Type) *Vector

func NewOriginalWithData added in v0.6.0

func NewOriginalWithData(typ types.Type, data []byte, nsp *nulls.Nulls) *Vector

func NewWithBytes added in v0.6.0

func NewWithBytes(typ types.Type, vals [][]byte, nsp *nulls.Nulls, m *mpool.MPool) *Vector

func NewWithFixed added in v0.6.0

func NewWithFixed[T any](typ types.Type, vals []T, nsp *nulls.Nulls, m *mpool.MPool) *Vector

func NewWithNspSize added in v0.6.0

func NewWithNspSize(typ types.Type, n int64) *Vector

func NewWithStrings added in v0.6.0

func NewWithStrings(typ types.Type, vals []string, nsp *nulls.Nulls, m *mpool.MPool) *Vector

func PreAllocType added in v0.6.0

func PreAllocType(t types.Type, rows, cap int, m *mpool.MPool) *Vector

func ProtoVectorToVector added in v0.6.0

func ProtoVectorToVector(vec *api.Vector) (*Vector, error)

func Window

func Window(v *Vector, start, end int, w *Vector) *Vector

Window just returns a window out of input and no deep copy.

func (*Vector) Append added in v0.5.0

func (v *Vector) Append(w any, isNull bool, m *mpool.MPool) error

func (*Vector) CompareAndCheckAnyResultIsTrue added in v0.6.0

func (v *Vector) CompareAndCheckAnyResultIsTrue(vec *Vector, funName string) (bool, error)

CompareAndCheckAnyResultIsTrue we use this method for eval expr by zonemap funName must be ">,<,>=,<="

func (*Vector) CompareAndCheckIntersect added in v0.6.0

func (v *Vector) CompareAndCheckIntersect(vec *Vector) (bool, error)

CompareAndCheckIntersect we use this method for eval expr by zonemap

func (*Vector) ConstExpand added in v0.5.0

func (v *Vector) ConstExpand(m *mpool.MPool) *Vector

func (*Vector) ConstVectorIsNull added in v0.5.0

func (v *Vector) ConstVectorIsNull() bool

XXX aliases ...

func (*Vector) FillDefaultValue added in v0.5.0

func (v *Vector) FillDefaultValue()

func (*Vector) Free added in v0.5.0

func (v *Vector) Free(m *mpool.MPool)

func (*Vector) FreeOriginal added in v0.6.0

func (v *Vector) FreeOriginal(m *mpool.MPool)

func (*Vector) GetArea added in v0.6.0

func (v *Vector) GetArea() []byte

func (*Vector) GetBytes added in v0.6.0

func (v *Vector) GetBytes(i int64) []byte

func (*Vector) GetIsBin added in v0.6.0

func (v *Vector) GetIsBin() bool

func (*Vector) GetNulls added in v0.5.1

func (v *Vector) GetNulls() *nulls.Nulls

func (*Vector) GetString added in v0.5.1

func (v *Vector) GetString(i int64) string

func (*Vector) GetType added in v0.5.1

func (v *Vector) GetType() types.Type

func (*Vector) Index added in v0.6.0

func (v *Vector) Index() any

func (*Vector) IsConst added in v0.5.0

func (v *Vector) IsConst() bool

func (*Vector) IsLowCardinality added in v0.6.0

func (v *Vector) IsLowCardinality() bool

func (*Vector) IsOriginal added in v0.6.0

func (v *Vector) IsOriginal() bool

func (*Vector) IsScalar added in v0.5.0

func (v *Vector) IsScalar() bool

IsScalar return true if the vector means a scalar value. e.g.

a + 1, and 1's vector will return true

func (*Vector) IsScalarNull added in v0.5.0

func (v *Vector) IsScalarNull() bool

IsScalarNull return true if the vector means a scalar Null. e.g.

a + Null, and the vector of right part will return true

func (*Vector) Length added in v0.5.0

func (v *Vector) Length() int

func (*Vector) MakeScalar added in v0.6.0

func (v *Vector) MakeScalar(length int)

MakeScalar converts a vector to a scalar vec of length.

func (*Vector) MarshalBinary added in v0.6.0

func (v *Vector) MarshalBinary() ([]byte, error)

func (*Vector) Read

func (v *Vector) Read(data []byte) error

func (*Vector) ScalarLength added in v0.6.0

func (v *Vector) ScalarLength() int

func (*Vector) SetIndex added in v0.6.0

func (v *Vector) SetIndex(idx any)

func (*Vector) SetIsBin added in v0.6.0

func (v *Vector) SetIsBin(isBin bool)

func (*Vector) SetOriginal added in v0.6.0

func (v *Vector) SetOriginal(status bool)

func (*Vector) SetScalarLength added in v0.6.0

func (v *Vector) SetScalarLength(length int)

func (*Vector) Show

func (v *Vector) Show() ([]byte, error)

func (*Vector) Size added in v0.6.0

func (v *Vector) Size() int

Size of data, I think this function is inherently broken. This Size is not meaningful other than used in (approximate) memory accounting.

func (*Vector) String

func (v *Vector) String() string

func (*Vector) ToConst added in v0.5.0

func (v *Vector) ToConst(row int, mp *mpool.MPool) *Vector

func (*Vector) TryExpandNulls added in v0.5.1

func (v *Vector) TryExpandNulls(n int)

func (*Vector) UnmarshalBinary added in v0.6.0

func (v *Vector) UnmarshalBinary(data []byte) error

Jump to

Keyboard shortcuts

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