![]() |
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.
|
A Data Chunk represents a set of vectors. More...
#include <duckdb.hpp>

Public Member Functions | |
| DUCKDB_API | DataChunk () |
| Creates an empty DataChunk. | |
| idx_t | size () const |
| idx_t | ColumnCount () const |
| void | SetCardinality (idx_t count_p) |
| void | SetCardinality (const DataChunk &other) |
| idx_t | GetCapacity () const |
| void | SetCapacity (idx_t capacity_p) |
| void | SetCapacity (const DataChunk &other) |
| DUCKDB_API Value | GetValue (idx_t col_idx, idx_t index) const |
| DUCKDB_API void | SetValue (idx_t col_idx, idx_t index, const Value &val) |
| idx_t | GetAllocationSize () const |
| DUCKDB_API bool | AllConstant () const |
| Returns true if all vectors in the DataChunk are constant. | |
| DUCKDB_API void | Reference (DataChunk &chunk) |
| Set the DataChunk to reference another data chunk. | |
| DUCKDB_API void | Move (DataChunk &chunk) |
| Set the DataChunk to own the data of data chunk, destroying the other chunk in the process. | |
| DUCKDB_API void | InitializeEmpty (const vector< LogicalType > &types) |
| Initializes a DataChunk with the given types and without any vector data allocation. | |
| DUCKDB_API void | Initialize (ClientContext &context, const vector< LogicalType > &types, idx_t capacity=STANDARD_VECTOR_SIZE) |
| DUCKDB_API void | Initialize (Allocator &allocator, const vector< LogicalType > &types, idx_t capacity=STANDARD_VECTOR_SIZE) |
| DUCKDB_API void | Initialize (ClientContext &context, const vector< LogicalType > &types, const vector< bool > &initialize, idx_t capacity=STANDARD_VECTOR_SIZE) |
| DUCKDB_API void | Initialize (Allocator &allocator, const vector< LogicalType > &types, const vector< bool > &initialize, idx_t capacity=STANDARD_VECTOR_SIZE) |
| DUCKDB_API void | Append (const DataChunk &other, bool resize=false, SelectionVector *sel=nullptr, idx_t count=0) |
| DUCKDB_API void | Destroy () |
| Destroy all data and columns owned by this DataChunk. | |
| DUCKDB_API void | Copy (DataChunk &other, idx_t offset=0) const |
| Copies the data from this chunk to another chunk. | |
| DUCKDB_API void | Copy (DataChunk &other, const SelectionVector &sel, const idx_t source_count, const idx_t offset=0) const |
| DUCKDB_API void | Split (DataChunk &other, idx_t split_idx) |
| Splits the DataChunk in two. | |
| DUCKDB_API void | Fuse (DataChunk &other) |
| Fuses a DataChunk onto the right of this one, and destroys the other. Inverse of Split. | |
| DUCKDB_API void | ReferenceColumns (DataChunk &other, const vector< column_t > &column_ids) |
| Makes this DataChunk reference the specified columns in the other DataChunk. | |
| DUCKDB_API void | Flatten () |
| Turn all the vectors from the chunk into flat vectors. | |
| DUCKDB_API unsafe_unique_array< UnifiedVectorFormat > | ToUnifiedFormat () |
| DUCKDB_API void | Slice (const SelectionVector &sel_vector, idx_t count) |
| DUCKDB_API void | Slice (const DataChunk &other, const SelectionVector &sel, idx_t count, idx_t col_offset=0) |
| DUCKDB_API void | Slice (idx_t offset, idx_t count) |
| Slice a DataChunk from "offset" to "offset + count". | |
| DUCKDB_API void | Reset () |
| DUCKDB_API void | Serialize (Serializer &serializer, bool compressed_serialization=true) const |
| DUCKDB_API void | Deserialize (Deserializer &source) |
| DUCKDB_API void | Hash (Vector &result) |
| Hashes the DataChunk to the target vector. | |
| DUCKDB_API void | Hash (vector< idx_t > &column_ids, Vector &result) |
| Hashes specific vectors of the DataChunk to the target vector. | |
| DUCKDB_API vector< LogicalType > | GetTypes () const |
| Returns a list of types of the vectors of this data chunk. | |
| DUCKDB_API string | ToString () const |
| Converts this DataChunk to a printable string representation. | |
| DUCKDB_API void | Print () const |
| DataChunk (const DataChunk &)=delete | |
| DUCKDB_API void | Verify () |
Public Attributes | |
| vector< Vector > | data |
| The vectors owned by the DataChunk. | |
Private Attributes | |
| idx_t | count |
| The amount of tuples stored in the data chunk. | |
| idx_t | capacity |
| The amount of tuples that can be stored in the data chunk. | |
| idx_t | initial_capacity |
| The initial capacity of this chunk set during Initialize, used when resetting. | |
| vector< VectorCache > | vector_caches |
| Vector caches, used to store data when Initialize is called. | |
A Data Chunk represents a set of vectors.
The data chunk class is the intermediate representation used by the execution engine of DuckDB. It effectively represents a subset of a relation. It holds a set of vectors that all have the same length.
DataChunk is initialized using the DataChunk::Initialize function by providing it with a vector of TypeIds for the Vector members. By default, this function will also allocate a chunk of memory in the DataChunk for the vectors and all the vectors will be referencing vectors to the data owned by the chunk. The reason for this behavior is that the underlying vectors can become referencing vectors to other chunks as well (i.e. in the case an operator does not alter the data, such as a Filter operator which only adds a selection vector).
In addition to holding the data of the vectors, the DataChunk also owns the selection vector that underlying vectors can point to.
|
inline |
|
inline |
| DUCKDB_API void duckdb::DataChunk::Initialize | ( | ClientContext & | context, |
| const vector< LogicalType > & | types, | ||
| idx_t | capacity = STANDARD_VECTOR_SIZE |
||
| ) |
Initializes a DataChunk with the given types. Then, if the corresponding boolean in the initialize-vector is true, it initializes the vector for that data type.
| DUCKDB_API void duckdb::DataChunk::Append | ( | const DataChunk & | other, |
| bool | resize = false, |
||
| SelectionVector * | sel = nullptr, |
||
| idx_t | count = 0 |
||
| ) |
Append the other DataChunk to this one. The column count and types of the two DataChunks have to match exactly. Throws an exception if there is not enough space in the chunk and resize is not allowed.
| DUCKDB_API void duckdb::DataChunk::Slice | ( | const DataChunk & | other, |
| const SelectionVector & | sel, | ||
| idx_t | count, | ||
| idx_t | col_offset = 0 |
||
| ) |
Slice all Vectors from other.data[i] to data[i + 'col_offset'] Turning all Vectors into Dictionary Vectors, using 'sel'
| DUCKDB_API void duckdb::DataChunk::Reset | ( | ) |
Resets the DataChunk to its state right after the DataChunk::Initialize function was called. This sets the count to 0, the capacity to initial_capacity and resets each member Vector to point back to the data owned by this DataChunk.
| DUCKDB_API void duckdb::DataChunk::Verify | ( | ) |
Verify that the DataChunk is in a consistent, not corrupt state. DEBUG FUNCTION ONLY!