Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::Vector Class Reference

Vector of values of a specified PhysicalType. More...

#include <duckdb.hpp>

Collaboration diagram for duckdb::Vector:

Public Member Functions

DUCKDB_API Vector (Vector &other)
 Create a vector that references the other vector.
 
DUCKDB_API Vector (const Vector &other, const SelectionVector &sel, idx_t count)
 Create a vector that slices another vector.
 
DUCKDB_API Vector (const Vector &other, idx_t offset, idx_t end)
 Create a vector that slices another vector between a pair of offsets.
 
DUCKDB_API Vector (const Value &value)
 Create a vector of size one holding the passed on value.
 
DUCKDB_API Vector (LogicalType type, idx_t capacity=STANDARD_VECTOR_SIZE)
 Create a vector of size tuple_count (non-standard)
 
DUCKDB_API Vector (const VectorCache &cache)
 Create an empty standard vector with a type, equivalent to calling Vector(type, true, false)
 
DUCKDB_API Vector (LogicalType type, data_ptr_t dataptr)
 Create a non-owning vector that references the specified data.
 
DUCKDB_API Vector (LogicalType type, bool create_data, bool initialize_to_zero, idx_t capacity=STANDARD_VECTOR_SIZE)
 Create an owning vector that holds at most STANDARD_VECTOR_SIZE entries.
 
 Vector (const Vector &)=delete
 
DUCKDB_API Vector (Vector &&other) noexcept
 
DUCKDB_API void Reference (const Value &value)
 Create a vector that references the specified value.
 
DUCKDB_API void Reference (const Vector &other)
 
DUCKDB_API void Reinterpret (const Vector &other)
 
DUCKDB_API void ReferenceAndSetType (const Vector &other)
 Causes this vector to reference the data held by the other vector, changes the type if required.
 
DUCKDB_API void ResetFromCache (const VectorCache &cache)
 
DUCKDB_API void Slice (const Vector &other, idx_t offset, idx_t end)
 Creates a reference to a slice of the other vector.
 
DUCKDB_API void Slice (const Vector &other, const SelectionVector &sel, idx_t count)
 Creates a reference to a slice of the other vector.
 
DUCKDB_API void Slice (const SelectionVector &sel, idx_t count)
 Turns the vector into a dictionary vector with the specified dictionary.
 
DUCKDB_API void Slice (const SelectionVector &sel, idx_t count, SelCache &cache)
 Slice the vector, keeping the result around in a cache or potentially using the cache instead of slicing.
 
DUCKDB_API void Dictionary (idx_t dictionary_size, const SelectionVector &sel, idx_t count)
 Turn this vector into a dictionary vector.
 
DUCKDB_API void Dictionary (Vector &dict, idx_t dictionary_size, const SelectionVector &sel, idx_t count)
 Creates a reference to a dictionary of the other vector.
 
DUCKDB_API void Dictionary (buffer_ptr< VectorChildBuffer > reusable_dict, const SelectionVector &sel)
 Creates a dictionary on the reusable dict.
 
DUCKDB_API void Initialize (bool initialize_to_zero=false, idx_t capacity=STANDARD_VECTOR_SIZE)
 
DUCKDB_API string ToString (idx_t count) const
 Converts this Vector to a printable string representation.
 
DUCKDB_API void Print (idx_t count) const
 
DUCKDB_API string ToString () const
 
DUCKDB_API void Print () const
 
DUCKDB_API void Flatten (idx_t count)
 Flatten the vector, removing any compression and turning it into a FLAT_VECTOR.
 
DUCKDB_API void Flatten (const SelectionVector &sel, idx_t count)
 
DUCKDB_API void ToUnifiedFormat (idx_t count, UnifiedVectorFormat &data)
 
DUCKDB_API void Sequence (int64_t start, int64_t increment, idx_t count)
 Turn the vector into a sequence vector.
 
DUCKDB_API void Verify (idx_t count)
 
DUCKDB_API void UTFVerify (idx_t count)
 
DUCKDB_API void UTFVerify (const SelectionVector &sel, idx_t count)
 
DUCKDB_API Value GetValue (idx_t index) const
 Returns the [index] element of the Vector as a Value.
 
DUCKDB_API void SetValue (idx_t index, const Value &val)
 Sets the [index] element of the Vector to the specified Value.
 
void SetAuxiliary (buffer_ptr< VectorBuffer > new_buffer)
 
void CopyBuffer (Vector &other)
 
DUCKDB_API void Resize (idx_t cur_size, idx_t new_size)
 Resizes the vector.
 
DUCKDB_API void FindResizeInfos (vector< ResizeInfo > &resize_infos, const idx_t multiplier)
 Returns a vector of ResizeInfo containing each (nested) vector to resize.
 
DUCKDB_API void Serialize (Serializer &serializer, idx_t count, bool compressed_serialization=true)
 
DUCKDB_API void Deserialize (Deserializer &deserializer, idx_t count)
 
idx_t GetAllocationSize (idx_t cardinality) const
 
VectorType GetVectorType () const
 
const LogicalTypeGetType () const
 
data_ptr_t GetData () const
 
buffer_ptr< VectorBufferGetAuxiliary ()
 
buffer_ptr< VectorBufferGetBuffer ()
 
DUCKDB_API void SetVectorType (VectorType vector_type)
 

Static Public Member Functions

static void RecursiveToUnifiedFormat (Vector &input, idx_t count, RecursiveUnifiedVectorFormat &data)
 Recursively calls UnifiedVectorFormat on a vector and its child vectors (for nested types)
 
static DUCKDB_API void VerifyMap (Vector &map, const SelectionVector &sel, idx_t count)
 Asserts that the CheckMapValidity returns MapInvalidReason::VALID.
 
static DUCKDB_API void VerifyUnion (Vector &map, const SelectionVector &sel, idx_t count)
 
static DUCKDB_API void VerifyVariant (Vector &map, const SelectionVector &sel, idx_t count)
 
static DUCKDB_API void Verify (Vector &vector, const SelectionVector &sel, idx_t count)
 
static void DebugTransformToDictionary (Vector &vector, idx_t count)
 
static void DebugShuffleNestedVector (Vector &vector, idx_t count)
 

Protected Attributes

VectorType vector_type
 
LogicalType type
 The type of the elements stored in the vector (e.g. integer, float)
 
data_ptr_t data
 A pointer to the data.
 
ValidityMask validity
 The validity mask of the vector.
 
buffer_ptr< VectorBufferbuffer
 The main buffer holding the data of the vector.
 
buffer_ptr< VectorBufferauxiliary
 

Static Private Member Functions

static Value GetValue (const Vector &v, idx_t index)
 Returns the [index] element of the Vector as a Value.
 
static Value GetValueInternal (const Vector &v, idx_t index)
 Returns the [index] element of the Vector as a Value.
 

Friends

struct ConstantVector
 
struct DictionaryVector
 
struct FlatVector
 
struct ListVector
 
struct StringVector
 
struct FSSTVector
 
struct StructVector
 
struct UnionVector
 
struct SequenceVector
 
struct ArrayVector
 
class DataChunk
 
class VectorCacheBuffer
 

Detailed Description

Vector of values of a specified PhysicalType.

Constructor & Destructor Documentation

◆ Vector()

DUCKDB_API duckdb::Vector::Vector ( LogicalType  type,
bool  create_data,
bool  initialize_to_zero,
idx_t  capacity = STANDARD_VECTOR_SIZE 
)

Create an owning vector that holds at most STANDARD_VECTOR_SIZE entries.

Create a new vector If create_data is true, the vector will be an owning empty vector. If initialize_to_zero is true, the allocated data will be zero-initialized.

Member Function Documentation

◆ Reference()

DUCKDB_API void duckdb::Vector::Reference ( const Vector other)

Causes this vector to reference the data held by the other vector. The type of the "other" vector should match the type of this vector

◆ Reinterpret()

DUCKDB_API void duckdb::Vector::Reinterpret ( const Vector other)

Reinterpret the data of the other vector as the type of this vector Note that this takes the data of the other vector as-is and places it in this vector Without changing the type of this vector

◆ ResetFromCache()

DUCKDB_API void duckdb::Vector::ResetFromCache ( const VectorCache cache)

Resets a vector from a vector cache. This turns the vector back into an empty FlatVector with STANDARD_VECTOR_SIZE entries. The VectorCache is used so this can be done without requiring any allocations.

◆ Initialize()

DUCKDB_API void duckdb::Vector::Initialize ( bool  initialize_to_zero = false,
idx_t  capacity = STANDARD_VECTOR_SIZE 
)

Creates the data of this vector with the specified type. Any data that is currently in the vector is destroyed.

◆ ToUnifiedFormat()

DUCKDB_API void duckdb::Vector::ToUnifiedFormat ( idx_t  count,
UnifiedVectorFormat data 
)

Creates a UnifiedVectorFormat of a vector The UnifiedVectorFormat allows efficient reading of vectors regardless of their vector type It contains (1) a data pointer, (2) a validity mask, and (3) a selection vector Access to the individual vector elements can be performed through data_pointer[sel_idx[i]]/validity[sel_idx[i]] The most common vector types (flat, constant & dictionary) can be converted to the canonical format "for free" ToUnifiedFormat was originally called Orrify, as a tribute to Orri Erling who came up with it

◆ Verify()

DUCKDB_API void duckdb::Vector::Verify ( idx_t  count)

Verify that the Vector is in a consistent, not corrupt state. DEBUG FUNCTION ONLY!

◆ SetAuxiliary()

void duckdb::Vector::SetAuxiliary ( buffer_ptr< VectorBuffer new_buffer)
inline
10708 {
10709 auxiliary = std::move(new_buffer);
10710 };
buffer_ptr< VectorBuffer > auxiliary
Definition duckdb.hpp:10774

◆ CopyBuffer()

void duckdb::Vector::CopyBuffer ( Vector other)
inline
10712 {
10713 buffer = other.buffer;
10714 data = other.data;
10715 }
buffer_ptr< VectorBuffer > buffer
The main buffer holding the data of the vector.
Definition duckdb.hpp:10771
data_ptr_t data
A pointer to the data.
Definition duckdb.hpp:10767

◆ GetVectorType()

VectorType duckdb::Vector::GetVectorType ( ) const
inline
10728 {
10729 return vector_type;
10730 }
VectorType vector_type
Definition duckdb.hpp:10763

◆ GetType()

const LogicalType & duckdb::Vector::GetType ( ) const
inline
10731 {
10732 return type;
10733 }
LogicalType type
The type of the elements stored in the vector (e.g. integer, float)
Definition duckdb.hpp:10765

◆ GetData()

data_ptr_t duckdb::Vector::GetData ( ) const
inline
10734 {
10735 return data;
10736 }

◆ GetAuxiliary()

buffer_ptr< VectorBuffer > duckdb::Vector::GetAuxiliary ( )
inline
10738 {
10739 return auxiliary;
10740 }

◆ GetBuffer()

buffer_ptr< VectorBuffer > duckdb::Vector::GetBuffer ( )
inline
10742 {
10743 return buffer;
10744 }

Member Data Documentation

◆ vector_type

VectorType duckdb::Vector::vector_type
protected

The vector type specifies how the data of the vector is physically stored (i.e. if it is a single repeated constant, if it is compressed)

◆ auxiliary

buffer_ptr<VectorBuffer> duckdb::Vector::auxiliary
protected

The buffer holding auxiliary data of the vector e.g. a string vector uses this to store strings


The documentation for this class was generated from the following file: