vectors

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateVectorBytes

func CalculateVectorBytes(dataType common.DataType, size int) int

CalculateVectorBytes calculates bytes the vector will occupy given data type and size without actual allocation.

func CalculateVectorPartyBytes

func CalculateVectorPartyBytes(dataType common.DataType, size int, hasNulls bool, hasCounts bool) int

CalculateVectorPartyBytes calculates bytes the vector party will occupy. Note: data type supported in go memory will report memory usage when value is actually set, therefore report 0 here

Types

type Vector

type Vector struct {
	// The data type of the value stored in the vector.
	DataType common.DataType
	CmpFunc  common.CompareFunc

	// Max number of values that can be stored in the vector.
	Size int
	// Allocated size of the vector in bytes.
	Bytes int
	// contains filtered or unexported fields
}

Vector stores a batch of columnar data (values, nulls, or counts) for a column.

func NewVector

func NewVector(dataType common.DataType, size int) *Vector

NewVector creates a vector with the specified bits per unit and size(capacity). The majority of its storage space is managed in C.

func (*Vector) Buffer

func (v *Vector) Buffer() unsafe.Pointer

Buffer returns the pointer to the underlying buffer.

func (*Vector) CheckAllValid

func (v *Vector) CheckAllValid() bool

CheckAllValid checks whether all bits are 1 in a bool typed vector.

func (*Vector) GetBool

func (v *Vector) GetBool(index int) bool

GetBool returns the bool value for the specified index. index bound is not checked!

func (*Vector) GetMaxValue

func (v *Vector) GetMaxValue() uint32

GetMaxValue return the max value of the Vector Party

func (*Vector) GetMinValue

func (v *Vector) GetMinValue() uint32

GetMinValue return the min value of the Vector Party

func (*Vector) GetSliceBytesAligned

func (v *Vector) GetSliceBytesAligned(lowerBound int, upperBound int) (buffer unsafe.Pointer, startIndex int, bytes int)

GetSliceBytesAligned calculate the number of bytes of a slice of the vector, represented by [lowerBound, upperBound), aligned to 64-byte return the buffer pointer, new start index (start entry in vector), and length in bytes

func (*Vector) GetValue

func (v *Vector) GetValue(index int) unsafe.Pointer

GetValue returns the data value for the specified index. index bound is not checked! The return value points to the internal buffer location that stores the value.

func (*Vector) LowerBound

func (v *Vector) LowerBound(first int, last int, value unsafe.Pointer) int

LowerBound returns the index of the first element in vector[first, last) that is greater or equal to the given value. The result is only valid if vector[first, last) is fully sorted in ascendant order. If all values in the given range is less than the given value, LowerBound returns last. Note that first/last is not checked against vector bound.

func (*Vector) SafeDestruct

func (v *Vector) SafeDestruct()

SafeDestruct destructs this vector's storage space managed in C.

func (*Vector) SetAllValid

func (v *Vector) SetAllValid()

SetAllValid set all bits to be 1 in a bool typed vector.

func (*Vector) SetBool

func (v *Vector) SetBool(index int, value bool)

SetBool sets the bool value for the specified index.

func (*Vector) SetValue

func (v *Vector) SetValue(index int, data unsafe.Pointer)

SetValue sets the data value for the specified index. index bound is not checked! data points to a buffer (in UpsertBatch for instance) that contains the value to be set.

func (*Vector) UpperBound

func (v *Vector) UpperBound(first int, last int, value unsafe.Pointer) int

UpperBound returns the index of the first element in vector[first, last) that is greater than the given value. The result is only valid if vector[first, last) is fully sorted in ascendant order. If all values in the given range is less than the given value, LowerBound returns last. Note that first/last is not checked against vector bound.

Jump to

Keyboard shortcuts

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