pub struct DataChunk { /* private fields */ }
Expand description
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.
Implementations§
Source§impl DataChunk
impl DataChunk
Sourcepub fn new(types: Vec<LogicalType>) -> Self
pub fn new(types: Vec<LogicalType>) -> Self
Creates an empty DataChunk with the specified set of types.
§Arguments
types
: An array of types of the data chunk.
Sourcepub fn get_vector<T>(&self, column_index: idx_t) -> Vector<T>
pub fn get_vector<T>(&self, column_index: idx_t) -> Vector<T>
Retrieves the vector at the specified column index in the data chunk.
The pointer to the vector is valid for as long as the chunk is alive. It does NOT need to be destroyed.
Sourcepub fn reset(&self)
pub fn reset(&self)
Resets a data chunk, clearing the validity masks and setting the cardinality of the data chunk to 0.
Sourcepub fn get_column_count(&self) -> idx_t
pub fn get_column_count(&self) -> idx_t
Retrieves the number of columns in a data chunk.