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::VectorCacheBuffer Class Reference
Inheritance diagram for duckdb::VectorCacheBuffer:
Collaboration diagram for duckdb::VectorCacheBuffer:

Public Member Functions

 VectorCacheBuffer (Allocator &allocator, const LogicalType &type_p, idx_t capacity_p=STANDARD_VECTOR_SIZE)
void ResetFromCache (Vector &result, const buffer_ptr< VectorBuffer > &buffer)
optional_ptr< Allocator > GetAllocator () const override
const LogicalType & GetType ()
Public Member Functions inherited from duckdb::VectorBuffer
 VectorBuffer (VectorBufferType type)
 VectorBuffer (idx_t data_size)
 VectorBuffer (AllocatedData &&data_p)
data_ptr_t GetData ()
void SetData (AllocatedData &&new_data)
VectorAuxiliaryData * GetAuxiliaryData ()
void SetAuxiliaryData (unique_ptr< VectorAuxiliaryData > aux_data_p)
void MoveAuxiliaryData (VectorBuffer &source_buffer)
VectorBufferType GetBufferType () const
VectorAuxiliaryDataType GetAuxiliaryDataType () const
template<class TARGET>
TARGET & Cast ()
template<class TARGET>
const TARGET & Cast () const

Private Attributes

LogicalType type
 The type of the vector cache.
AllocatedData owned_data
 Owned data.
vector< buffer_ptr< VectorBuffer > > child_caches
 Child caches (if any). Used for nested types.
buffer_ptr< VectorBuffer > auxiliary
 Aux data for the vector (if any).
idx_t capacity
 Capacity of the vector.

Additional Inherited Members

Static Public Member Functions inherited from duckdb::VectorBuffer
static buffer_ptr< VectorBuffer > CreateStandardVector (PhysicalType type, idx_t capacity=STANDARD_VECTOR_SIZE)
static buffer_ptr< VectorBuffer > CreateConstantVector (PhysicalType type)
static buffer_ptr< VectorBuffer > CreateConstantVector (const LogicalType &logical_type)
static buffer_ptr< VectorBuffer > CreateStandardVector (const LogicalType &logical_type, idx_t capacity=STANDARD_VECTOR_SIZE)
Protected Attributes inherited from duckdb::VectorBuffer
VectorBufferType buffer_type
unique_ptr< VectorAuxiliaryData > aux_data
AllocatedData data

Constructor & Destructor Documentation

◆ VectorCacheBuffer()

duckdb::VectorCacheBuffer::VectorCacheBuffer ( Allocator & allocator,
const LogicalType & type_p,
idx_t capacity_p = STANDARD_VECTOR_SIZE )
inlineexplicit
138862 : VectorBuffer(VectorBufferType::OPAQUE_BUFFER), type(type_p), capacity(capacity_p) {
138863 auto internal_type = type.InternalType();
138864 switch (internal_type) {
138865 case PhysicalType::LIST: {
138866 // memory for the list offsets
138867 owned_data = allocator.Allocate(capacity * GetTypeIdSize(internal_type));
138868 // child data of the list
138869 auto &child_type = ListType::GetChildType(type);
138870 child_caches.push_back(make_buffer<VectorCacheBuffer>(allocator, child_type, capacity));
138871 auto child_vector = make_uniq<Vector>(child_type, false, false);
138872 auxiliary = make_shared_ptr<VectorListBuffer>(std::move(child_vector));
138873 break;
138874 }
138875 case PhysicalType::ARRAY: {
138876 auto &child_type = ArrayType::GetChildType(type);
138877 auto array_size = ArrayType::GetSize(type);
138878 child_caches.push_back(make_buffer<VectorCacheBuffer>(allocator, child_type, array_size * capacity));
138879 auto child_vector = make_uniq<Vector>(child_type, true, false, array_size * capacity);
138880 auxiliary = make_shared_ptr<VectorArrayBuffer>(std::move(child_vector), array_size, capacity);
138881 break;
138882 }
138883 case PhysicalType::STRUCT: {
138884 auto &child_types = StructType::GetChildTypes(type);
138885 for (auto &child_type : child_types) {
138886 child_caches.push_back(make_buffer<VectorCacheBuffer>(allocator, child_type.second, capacity));
138887 }
138888 auto struct_buffer = make_shared_ptr<VectorStructBuffer>(type);
138889 auxiliary = std::move(struct_buffer);
138890 break;
138891 }
138892 default:
138893 owned_data = allocator.Allocate(capacity * GetTypeIdSize(internal_type));
138894 break;
138895 }
138896 }
vector< buffer_ptr< VectorBuffer > > child_caches
Child caches (if any). Used for nested types.
Definition duckdb.cpp:138969
LogicalType type
The type of the vector cache.
Definition duckdb.cpp:138965
buffer_ptr< VectorBuffer > auxiliary
Aux data for the vector (if any).
Definition duckdb.cpp:138971
idx_t capacity
Capacity of the vector.
Definition duckdb.cpp:138973
AllocatedData owned_data
Owned data.
Definition duckdb.cpp:138967
@ LIST
A list of some logical data type.
Definition duckdb.hpp:2813
@ STRUCT
Struct of logical types.
Definition duckdb.hpp:2816

Member Function Documentation

◆ ResetFromCache()

void duckdb::VectorCacheBuffer::ResetFromCache ( Vector & result,
const buffer_ptr< VectorBuffer > & buffer )
inline
138898 {
138899 D_ASSERT(type == result.GetType());
138900 auto internal_type = type.InternalType();
138901 result.vector_type = VectorType::FLAT_VECTOR;
138902 AssignSharedPointer(result.buffer, buffer);
138903 result.validity.Reset(capacity);
138904 switch (internal_type) {
138905 case PhysicalType::LIST: {
138906 result.data = owned_data.get();
138907 // reinitialize the VectorListBuffer
138908 AssignSharedPointer(result.auxiliary, auxiliary);
138909 // propagate through child
138910 auto &child_cache = child_caches[0]->Cast<VectorCacheBuffer>();
138911 auto &list_buffer = result.auxiliary->Cast<VectorListBuffer>();
138912 list_buffer.SetCapacity(child_cache.capacity);
138913 list_buffer.SetSize(0);
138914 list_buffer.SetAuxiliaryData(nullptr);
138915
138916 auto &list_child = list_buffer.GetChild();
138917 child_cache.ResetFromCache(list_child, child_caches[0]);
138918 break;
138919 }
138920 case PhysicalType::ARRAY: {
138921 // fixed size list does not have own data
138922 result.data = nullptr;
138923 // reinitialize the VectorArrayBuffer
138924 // auxiliary->SetAuxiliaryData(nullptr);
138925 AssignSharedPointer(result.auxiliary, auxiliary);
138926
138927 // propagate through child
138928 auto &child_cache = child_caches[0]->Cast<VectorCacheBuffer>();
138929 auto &array_child = result.auxiliary->Cast<VectorArrayBuffer>().GetChild();
138930 child_cache.ResetFromCache(array_child, child_caches[0]);
138931 break;
138932 }
138933 case PhysicalType::STRUCT: {
138934 // struct does not have data
138935 result.data = nullptr;
138936 // reinitialize the VectorStructBuffer
138937 auxiliary->SetAuxiliaryData(nullptr);
138938 AssignSharedPointer(result.auxiliary, auxiliary);
138939 // propagate through children
138940 auto &children = result.auxiliary->Cast<VectorStructBuffer>().GetChildren();
138941 for (idx_t i = 0; i < children.size(); i++) {
138942 auto &child_cache = child_caches[i]->Cast<VectorCacheBuffer>();
138943 child_cache.ResetFromCache(*children[i], child_caches[i]);
138944 }
138945 break;
138946 }
138947 default:
138948 // regular type: no aux data and reset data to cached data
138949 result.data = owned_data.get();
138950 result.auxiliary.reset();
138951 break;
138952 }
138953 }
void AssignSharedPointer(shared_ptr< T > &target, const shared_ptr< T > &source)
Definition duckdb.hpp:2180
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ GetAllocator()

optional_ptr< Allocator > duckdb::VectorCacheBuffer::GetAllocator ( ) const
inlineoverridevirtual

Reimplemented from duckdb::VectorBuffer.

138955 {
138956 return owned_data.GetAllocator();
138957 }

◆ GetType()

const LogicalType & duckdb::VectorCacheBuffer::GetType ( )
inline
138959 {
138960 return type;
138961 }

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