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

Public Member Functions

 TupleDataCollection (BufferManager &buffer_manager, shared_ptr< TupleDataLayout > layout_ptr, MemoryTag tag, shared_ptr< ArenaAllocator > stl_allocator=nullptr)
 Constructs a TupleDataCollection with the specified layout.
 
 TupleDataCollection (ClientContext &context, shared_ptr< TupleDataLayout > layout_ptr, MemoryTag tag, shared_ptr< ArenaAllocator > stl_allocator=nullptr)
 
unique_ptr< TupleDataCollectionCreateUnique () const
 Create a TupleDataCollection with the same layout.
 
shared_ptr< TupleDataLayoutGetLayoutPtr () const
 Get the layout (shared pointer) of the rows.
 
const TupleDataLayoutGetLayout () const
 The layout of the stored rows.
 
idx_t TuplesPerBlock () const
 How many tuples fit per block.
 
const idx_tCount () const
 The number of rows stored in the tuple data collection.
 
idx_t ChunkCount () const
 The number of chunks stored in the tuple data collection.
 
idx_t SizeInBytes () const
 The size (in bytes) of the blocks held by this tuple data collection.
 
void Unpin ()
 Unpins all held pins.
 
void SetPartitionIndex (idx_t index)
 Sets the partition index of this tuple data collection.
 
vector< data_ptr_t > GetRowBlockPointers () const
 Gets the pointers to the start of every block.
 
void DestroyChunks (idx_t chunk_idx_begin, idx_t chunk_idx_end)
 Destroy the blocks corresponding to the chunk indices.
 
void InitializeAppend (TupleDataAppendState &append_state, TupleDataPinProperties properties=TupleDataPinProperties::UNPIN_AFTER_DONE)
 Initializes an Append state - useful for optimizing many appends made to the same tuple data collection.
 
void InitializeAppend (TupleDataAppendState &append_state, vector< column_t > column_ids, TupleDataPinProperties properties=TupleDataPinProperties::UNPIN_AFTER_DONE)
 Initializes an Append state - useful for optimizing many appends made to the same tuple data collection.
 
void InitializeAppend (TupleDataPinState &pin_state, TupleDataPinProperties=TupleDataPinProperties::UNPIN_AFTER_DONE)
 
void InitializeChunkState (TupleDataChunkState &chunk_state, vector< column_t > column_ids={})
 
void Append (DataChunk &new_chunk, const SelectionVector &append_sel= *FlatVector::IncrementalSelectionVector(), idx_t append_count=DConstants::INVALID_INDEX)
 Append a DataChunk directly to this TupleDataCollection - calls InitializeAppend and Append internally.
 
void Append (DataChunk &new_chunk, vector< column_t > column_ids, const SelectionVector &append_sel= *FlatVector::IncrementalSelectionVector(), const idx_t append_count=DConstants::INVALID_INDEX)
 Append a DataChunk directly to this TupleDataCollection - calls InitializeAppend and Append internally.
 
void Append (TupleDataAppendState &append_state, DataChunk &new_chunk, const SelectionVector &append_sel= *FlatVector::IncrementalSelectionVector(), const idx_t append_count=DConstants::INVALID_INDEX)
 Append a DataChunk to this TupleDataCollection using the specified Append state.
 
void Append (TupleDataPinState &pin_state, TupleDataChunkState &chunk_state, DataChunk &new_chunk, const SelectionVector &append_sel= *FlatVector::IncrementalSelectionVector(), const idx_t append_count=DConstants::INVALID_INDEX)
 Append a DataChunk to this TupleDataCollection using the specified pin and Chunk states.
 
void AppendUnified (TupleDataPinState &pin_state, TupleDataChunkState &chunk_state, DataChunk &new_chunk, const SelectionVector &append_sel= *FlatVector::IncrementalSelectionVector(), const idx_t append_count=DConstants::INVALID_INDEX)
 
void Build (TupleDataPinState &pin_state, TupleDataChunkState &chunk_state, const idx_t append_offset, const idx_t append_count)
 Builds out the buffer space for the specified Chunk state.
 
void Scatter (TupleDataChunkState &chunk_state, const DataChunk &new_chunk, const SelectionVector &append_sel, const idx_t append_count) const
 Scatters the given DataChunk to the rows in the specified Chunk state.
 
void Scatter (TupleDataChunkState &chunk_state, const Vector &source, const column_t column_id, const SelectionVector &append_sel, const idx_t append_count) const
 Scatters the given Vector to the given column id to the rows in the specified Chunk state.
 
void CopyRows (TupleDataChunkState &chunk_state, TupleDataChunkState &input, const SelectionVector &append_sel, const idx_t append_count) const
 Copy rows from input to the built Chunk state.
 
void FindHeapPointers (TupleDataChunkState &chunk_state, const idx_t chunk_count) const
 Finds the heap pointers of the rows in the given Chunk state.
 
void FinalizePinState (TupleDataPinState &pin_state, TupleDataSegment &segment)
 Finalizes the Pin state, releasing or storing blocks.
 
void FinalizePinState (TupleDataPinState &pin_state)
 Finalizes the Pin state, releasing or storing blocks.
 
void Combine (TupleDataCollection &other)
 Appends the other TupleDataCollection to this, destroying the other data collection.
 
void Combine (unique_ptr< TupleDataCollection > other)
 Appends the other TupleDataCollection to this, destroying the other data collection.
 
void Reset ()
 Resets the TupleDataCollection, clearing all data.
 
void InitializeChunk (DataChunk &chunk) const
 Initializes a chunk with the correct types that can be used to call Append/Scan.
 
void InitializeChunk (DataChunk &chunk, const vector< column_t > &columns) const
 Initializes a chunk with the correct types that can be used to call Append/Scan for the given columns.
 
void InitializeScanChunk (const TupleDataScanState &state, DataChunk &chunk) const
 Initializes a chunk with the correct types for a given scan state.
 
void InitializeScan (TupleDataScanState &state, TupleDataPinProperties properties=TupleDataPinProperties::UNPIN_AFTER_DONE) const
 Initializes a Scan state for scanning all columns.
 
void InitializeScan (TupleDataScanState &state, vector< column_t > column_ids, TupleDataPinProperties properties=TupleDataPinProperties::UNPIN_AFTER_DONE) const
 Initializes a Scan state for scanning a subset of the columns.
 
void InitializeScan (TupleDataParallelScanState &state, TupleDataPinProperties properties=TupleDataPinProperties::UNPIN_AFTER_DONE) const
 Initialize a parallel scan over the tuple data collection over all columns.
 
void InitializeScan (TupleDataParallelScanState &gstate, vector< column_t > column_ids, TupleDataPinProperties properties=TupleDataPinProperties::UNPIN_AFTER_DONE) const
 Initialize a parallel scan over the tuple data collection over a subset of the columns.
 
idx_t FetchChunk (TupleDataScanState &state, idx_t chunk_idx, bool init_heap, optional_ptr< SortKeyPayloadState > sort_key_payload_state=nullptr)
 Grab the chunk state for the given chunk index, returns the count of the chunk.
 
bool Scan (TupleDataScanState &state, DataChunk &result)
 Scans a DataChunk from the TupleDataCollection.
 
bool Scan (TupleDataParallelScanState &gstate, TupleDataLocalScanState &lstate, DataChunk &result)
 Scans a DataChunk from the TupleDataCollection.
 
bool ScanComplete (const TupleDataScanState &state) const
 Whether the last scan has been completed on this TupleDataCollection.
 
idx_t Seek (TupleDataScanState &state, const idx_t target_chunk)
 Seeks to the specified chunk index, returning the total row count before it.
 
void Gather (Vector &row_locations, const SelectionVector &scan_sel, const idx_t scan_count, DataChunk &result, const SelectionVector &target_sel, vector< unique_ptr< Vector > > &cached_cast_vectors) const
 Gathers a DataChunk from the TupleDataCollection, given the specific row locations (requires full pin)
 
void Gather (Vector &row_locations, const SelectionVector &scan_sel, const idx_t scan_count, const vector< column_t > &column_ids, DataChunk &result, const SelectionVector &target_sel, vector< unique_ptr< Vector > > &cached_cast_vectors) const
 
void Gather (Vector &row_locations, const SelectionVector &sel, const idx_t scan_count, const column_t column_id, Vector &result, const SelectionVector &target_sel, optional_ptr< Vector > cached_cast_vector) const
 
string ToString ()
 Converts this TupleDataCollection to a string representation.
 
void Print ()
 Prints the string representation of this TupleDataCollection.
 
void VerifyEverythingPinned () const
 Verify that all blocks are pinned.
 

Static Public Member Functions

static TupleDataScatterFunction GetScatterFunction (const LogicalType &type, bool within_collection=false)
 Gets the scatter function for the given type.
 
static TupleDataGatherFunction GetGatherFunction (const LogicalType &type)
 Gets the gather function for the given type.
 
static TupleDataScatterFunction GetSortKeyScatterFunction (const LogicalType &type, SortKeyType sort_key_type)
 Gets the scatter function for the given sort key type.
 
static TupleDataGatherFunction GetSortKeyGatherFunction (const LogicalType &type, SortKeyType sort_key_type)
 Gets the gather function for the given sort key type.
 
static void InitializeChunkState (TupleDataChunkState &chunk_state, const vector< LogicalType > &types, vector< column_t > column_ids={})
 
static void ToUnifiedFormat (TupleDataChunkState &chunk_state, DataChunk &new_chunk)
 Creates a UnifiedVectorFormat in the given Chunk state for the given DataChunk.
 
static void GetVectorData (const TupleDataChunkState &chunk_state, UnifiedVectorFormat result[])
 Gets the UnifiedVectorFormat from the Chunk state as an array.
 
static void ResetCachedCastVectors (TupleDataChunkState &chunk_state, const vector< column_t > &column_ids)
 Resets the cached cache vectors (used for ARRAY/LIST casts)
 
static void ComputeHeapSizes (TupleDataChunkState &chunk_state, const DataChunk &new_chunk, const SelectionVector &append_sel, const idx_t append_count)
 Computes the heap sizes for the new DataChunk that will be appended.
 
static void SortKeyComputeHeapSizes (TupleDataChunkState &chunk_state, const DataChunk &new_chunk, const SelectionVector &append_sel, const idx_t append_count, const SortKeyType sort_key_type)
 Computes the heap sizes for a SortKey layout.
 

Private Member Functions

void Initialize ()
 Initializes the TupleDataCollection (called by the constructor)
 
void GetAllColumnIDs (vector< column_t > &column_ids)
 Gets all column ids.
 
void AddSegment (unsafe_arena_ptr< TupleDataSegment > segment)
 Adds a segment to this TupleDataCollection.
 
bool NextScanIndex (TupleDataScanState &scan_state, idx_t &segment_index, idx_t &chunk_index)
 Get the next segment/chunk index for the scan.
 
void ScanAtIndex (TupleDataPinState &pin_state, TupleDataChunkState &chunk_state, const vector< column_t > &column_ids, idx_t segment_index, idx_t chunk_index, DataChunk &result)
 Scans the chunk at the given segment/chunk indices.
 
void Verify () const
 Verify count/data size of this collection.
 

Static Private Member Functions

static void ComputeHeapSizes (Vector &heap_sizes_v, const Vector &source_v, TupleDataVectorFormat &source, const SelectionVector &append_sel, const idx_t append_count)
 Computes the heap sizes for the specific Vector that will be appended.
 
static void WithinCollectionComputeHeapSizes (Vector &heap_sizes_v, const Vector &source_v, TupleDataVectorFormat &source_format, const SelectionVector &append_sel, const idx_t append_count, const UnifiedVectorFormat &list_data)
 Computes the heap sizes for the specific Vector that will be appended (within a list)
 
static void ComputeFixedWithinCollectionHeapSizes (Vector &heap_sizes_v, const Vector &source_v, TupleDataVectorFormat &source_format, const SelectionVector &append_sel, const idx_t append_count, const UnifiedVectorFormat &list_data)
 Computes the heap sizes for the fixed-size type Vector that will be appended (within a list)
 
static void StringWithinCollectionComputeHeapSizes (Vector &heap_sizes_v, const Vector &source_v, TupleDataVectorFormat &source_format, const SelectionVector &append_sel, const idx_t append_count, const UnifiedVectorFormat &list_data)
 Computes the heap sizes for the string Vector that will be appended (within a list)
 
static void StructWithinCollectionComputeHeapSizes (Vector &heap_sizes_v, const Vector &source_v, TupleDataVectorFormat &source_format, const SelectionVector &append_sel, const idx_t append_count, const UnifiedVectorFormat &list_data)
 Computes the heap sizes for the struct Vector that will be appended (within a list)
 
static void CollectionWithinCollectionComputeHeapSizes (Vector &heap_sizes_v, const Vector &source_v, TupleDataVectorFormat &source_format, const SelectionVector &append_sel, const idx_t append_count, const UnifiedVectorFormat &list_data)
 Computes the heap sizes for the list Vector that will be appended (within a list)
 

Private Attributes

TaskSchedulerscheduler
 Task scheduler for parallel destruction.
 
shared_ptr< ArenaAllocatorstl_allocator
 Shared allocator for STL allocations.
 
shared_ptr< TupleDataLayoutlayout_ptr
 The layout of the TupleDataCollection.
 
const TupleDataLayoutlayout
 
const MemoryTag tag
 Memory tag (for keeping track what the allocated memory belongs to)
 
shared_ptr< TupleDataAllocatorallocator
 The TupleDataAllocator.
 
idx_t count
 The number of entries stored in the TupleDataCollection.
 
idx_t data_size
 The size (in bytes) of this TupleDataCollection.
 
unsafe_arena_vector< unsafe_arena_ptr< TupleDataSegment > > segments
 The data segments of the TupleDataCollection.
 
unsafe_arena_vector< TupleDataScatterFunctionscatter_functions
 The set of scatter functions.
 
unsafe_arena_vector< TupleDataGatherFunctiongather_functions
 The set of gather functions.
 
optional_idx partition_index
 Partition index (optional, if partitioned)
 

Friends

class TupleDataChunkIterator
 
class PartitionedTupleData
 

Detailed Description

TupleDataCollection represents a set of buffer-managed data stored in row format FIXME: rename to RowDataCollection after we phase it out

Member Function Documentation

◆ InitializeAppend()

void duckdb::TupleDataCollection::InitializeAppend ( TupleDataPinState pin_state,
TupleDataPinProperties  = TupleDataPinProperties::UNPIN_AFTER_DONE 
)

Initializes the Pin state of an Append state

  • Useful for optimizing many appends made to the same tuple data collection

◆ InitializeChunkState() [1/2]

void duckdb::TupleDataCollection::InitializeChunkState ( TupleDataChunkState chunk_state,
vector< column_t column_ids = {} 
)

Initializes the Chunk state of an Append state

  • Useful for optimizing many appends made to the same tuple data collection

◆ InitializeChunkState() [2/2]

static void duckdb::TupleDataCollection::InitializeChunkState ( TupleDataChunkState chunk_state,
const vector< LogicalType > &  types,
vector< column_t column_ids = {} 
)
static

Initializes the Chunk state of an Append state

  • Useful for optimizing many appends made to the same tuple data collection

◆ AppendUnified()

void duckdb::TupleDataCollection::AppendUnified ( TupleDataPinState pin_state,
TupleDataChunkState chunk_state,
DataChunk new_chunk,
const SelectionVector append_sel = *FlatVector::IncrementalSelectionVector(),
const idx_t  append_count = DConstants::INVALID_INDEX 
)

Append a DataChunk to this TupleDataCollection using the specified pin and Chunk states

  • ToUnifiedFormat has already been called

◆ Gather() [1/2]

void duckdb::TupleDataCollection::Gather ( Vector row_locations,
const SelectionVector scan_sel,
const idx_t  scan_count,
const vector< column_t > &  column_ids,
DataChunk result,
const SelectionVector target_sel,
vector< unique_ptr< Vector > > &  cached_cast_vectors 
) const

Gathers a DataChunk (only the columns given by column_ids) from the TupleDataCollection, given the specific row locations (requires full pin)

◆ Gather() [2/2]

void duckdb::TupleDataCollection::Gather ( Vector row_locations,
const SelectionVector sel,
const idx_t  scan_count,
const column_t  column_id,
Vector result,
const SelectionVector target_sel,
optional_ptr< Vector cached_cast_vector 
) const

Gathers a Vector (from the given column id) from the TupleDataCollection given the specific row locations (requires full pin)


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