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::DataChunk Class Reference

A Data Chunk represents a set of vectors. More...

#include <duckdb.hpp>

Collaboration diagram for duckdb::DataChunk:

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.

Detailed 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.

Constructor & Destructor Documentation

◆ DataChunk()

duckdb::DataChunk::DataChunk ( )

Creates an empty DataChunk.

116777 : count(0), capacity(STANDARD_VECTOR_SIZE) {
116778}
idx_t capacity
The amount of tuples that can be stored in the data chunk.
Definition duckdb.hpp:11566
idx_t count
The amount of tuples stored in the data chunk.
Definition duckdb.hpp:11564
Here is the caller graph for this function:

◆ ~DataChunk()

duckdb::DataChunk::~DataChunk ( )
116780 {
116781}

Member Function Documentation

◆ size()

idx_t duckdb::DataChunk::size ( ) const
inline
11448 { // NOLINT
11449 return count;
11450 }

◆ ColumnCount()

idx_t duckdb::DataChunk::ColumnCount ( ) const
inline
11451 {
11452 return data.size();
11453 }
vector< Vector > data
The vectors owned by the DataChunk.
Definition duckdb.hpp:11445

◆ SetCardinality() [1/2]

void duckdb::DataChunk::SetCardinality ( idx_t count_p)
inline
11454 {
11455 D_ASSERT(count_p <= capacity);
11456 this->count = count_p;
11457 }

◆ SetCardinality() [2/2]

void duckdb::DataChunk::SetCardinality ( const DataChunk & other)
inline
11458 {
11459 SetCardinality(other.size());
11460 }

◆ GetCapacity()

idx_t duckdb::DataChunk::GetCapacity ( ) const
inline
11461 {
11462 return capacity;
11463 }

◆ SetCapacity() [1/2]

void duckdb::DataChunk::SetCapacity ( idx_t capacity_p)
inline
11464 {
11465 this->capacity = capacity_p;
11466 }

◆ SetCapacity() [2/2]

void duckdb::DataChunk::SetCapacity ( const DataChunk & other)
inline
11467 {
11468 SetCapacity(other.capacity);
11469 }
idx_t capacity
The amount of tuples that can be stored in the data chunk.
Definition duckdb.hpp:11566

◆ GetValue()

Value duckdb::DataChunk::GetValue ( idx_t col_idx,
idx_t index ) const
116861 {
116862 D_ASSERT(index < size());
116863 return data[col_idx].GetValue(index);
116864}

◆ SetValue()

void duckdb::DataChunk::SetValue ( idx_t col_idx,
idx_t index,
const Value & val )
116866 {
116867 data[col_idx].SetValue(index, val);
116868}

◆ GetAllocationSize()

idx_t duckdb::DataChunk::GetAllocationSize ( ) const
116831 {
116832 idx_t total_size = 0;
116833 auto cardinality = size();
116834 for (auto &vec : data) {
116835 total_size += vec.GetAllocationSize(cardinality);
116836 }
116837 return total_size;
116838}
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237

◆ AllConstant()

bool duckdb::DataChunk::AllConstant ( ) const

Returns true if all vectors in the DataChunk are constant.

116870 {
116871 for (auto &v : data) {
116872 if (v.GetVectorType() != VectorType::CONSTANT_VECTOR) {
116873 return false;
116874 }
116875 }
116876 return true;
116877}
uint32_t v
Here is the caller graph for this function:

◆ Reference()

void duckdb::DataChunk::Reference ( DataChunk & chunk)

Set the DataChunk to reference another data chunk.

116879 {
116880 D_ASSERT(chunk.ColumnCount() <= ColumnCount());
116881 SetCapacity(chunk);
116882 SetCardinality(chunk);
116883 for (idx_t i = 0; i < chunk.ColumnCount(); i++) {
116884 data[i].Reference(chunk.data[i]);
116885 }
116886}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Move()

void duckdb::DataChunk::Move ( DataChunk & chunk)

Set the DataChunk to own the data of data chunk, destroying the other chunk in the process.

116888 {
116889 SetCapacity(chunk);
116890 SetCardinality(chunk);
116891 data = std::move(chunk.data);
116892 vector_caches = std::move(chunk.vector_caches);
116893
116894 chunk.Destroy();
116895}
vector< VectorCache > vector_caches
Vector caches, used to store data when Initialize is called.
Definition duckdb.hpp:11570
DUCKDB_API void Destroy()
Destroy all data and columns owned by this DataChunk.
Definition duckdb.cpp:116854
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitializeEmpty()

void duckdb::DataChunk::InitializeEmpty ( const vector< LogicalType > & types)

Initializes a DataChunk with the given types and without any vector data allocation.

116783 {
116784 D_ASSERT(data.empty());
116785 capacity = STANDARD_VECTOR_SIZE;
116786 for (idx_t i = 0; i < types.size(); i++) {
116787 data.emplace_back(types[i], nullptr);
116788 }
116789}
Here is the caller graph for this function:

◆ Initialize() [1/4]

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.

116791 {
116792 Initialize(Allocator::Get(context), types, capacity_p);
116793}
DUCKDB_API void Initialize(ClientContext &context, const vector< LogicalType > &types, idx_t capacity=STANDARD_VECTOR_SIZE)
Definition duckdb.cpp:116791
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Initialize() [2/4]

void duckdb::DataChunk::Initialize ( Allocator & allocator,
const vector< LogicalType > & types,
idx_t capacity = STANDARD_VECTOR_SIZE )
116795 {
116796 auto initialize = vector<bool>(types.size(), true);
116797 Initialize(allocator, types, initialize, capacity_p);
116798}

◆ Initialize() [3/4]

void duckdb::DataChunk::Initialize ( ClientContext & context,
const vector< LogicalType > & types,
const vector< bool > & initialize,
idx_t capacity = STANDARD_VECTOR_SIZE )
116801 {
116802 Initialize(Allocator::Get(context), types, initialize, capacity_p);
116803}

◆ Initialize() [4/4]

void duckdb::DataChunk::Initialize ( Allocator & allocator,
const vector< LogicalType > & types,
const vector< bool > & initialize,
idx_t capacity = STANDARD_VECTOR_SIZE )
116806 {
116807 D_ASSERT(types.size() == initialize.size());
116808 D_ASSERT(data.empty());
116809
116810 capacity = capacity_p;
116811 initial_capacity = capacity_p;
116812 for (idx_t i = 0; i < types.size(); i++) {
116813 // We copy the type here so we don't create another reference to the same shared_ptr<ExtraTypeInfo>
116814 // Otherwise, threads will constantly increment/decrement the atomic ref count to the same shared_ptr
116815 // This is necessary to avoid heavy contention on the atomic on many-core machines
116816 // Note that for nested types, there will still be contention on the atomic(s) one level down,
116817 // because this is a shallow copy (only copies ExtraTypeInfo to depth=1)
116818 auto copied_type = types[i].Copy();
116819 if (!initialize[i]) {
116820 data.emplace_back(copied_type, nullptr);
116821 vector_caches.emplace_back();
116822 continue;
116823 }
116824
116825 VectorCache cache(allocator, copied_type, capacity);
116826 data.emplace_back(cache);
116827 vector_caches.push_back(std::move(cache));
116828 }
116829}
idx_t initial_capacity
The initial capacity of this chunk set during Initialize, used when resetting.
Definition duckdb.hpp:11568

◆ Append()

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.

116959 {
116960 idx_t new_size = sel ? size() + sel_count : size() + other.size();
116961 if (other.size() == 0) {
116962 return;
116963 }
116964 if (ColumnCount() != other.ColumnCount()) {
116965 throw InternalException("Column counts of appending chunk doesn't match!");
116966 }
116967 if (new_size > capacity) {
116968 if (resize) {
116969 auto new_capacity = NextPowerOfTwo(new_size);
116970 for (idx_t i = 0; i < ColumnCount(); i++) {
116971 data[i].Resize(size(), new_capacity);
116972 }
116973 capacity = new_capacity;
116974 } else {
116975 throw InternalException("Can't append chunk to other chunk without resizing");
116976 }
116977 }
116978 for (idx_t i = 0; i < ColumnCount(); i++) {
116979 D_ASSERT(data[i].GetVectorType() == VectorType::FLAT_VECTOR);
116980 if (sel) {
116981 VectorOperations::Copy(other.data[i], data[i], *sel, sel_count, 0, size());
116982 } else {
116983 VectorOperations::Copy(other.data[i], data[i], other.size(), 0, size());
116984 }
116985 }
116986 SetCardinality(new_size);
116987}
Here is the call graph for this function:

◆ Destroy()

void duckdb::DataChunk::Destroy ( )

Destroy all data and columns owned by this DataChunk.

116854 {
116855 data.clear();
116856 vector_caches.clear();
116857 capacity = 0;
116858 SetCardinality(0);
116859}
Here is the caller graph for this function:

◆ Copy() [1/2]

void duckdb::DataChunk::Copy ( DataChunk & other,
idx_t offset = 0 ) const

Copies the data from this chunk to another chunk.

116897 {
116898 D_ASSERT(ColumnCount() == other.ColumnCount());
116899 D_ASSERT(other.size() == 0);
116900
116901 for (idx_t i = 0; i < ColumnCount(); i++) {
116902 D_ASSERT(other.data[i].GetVectorType() == VectorType::FLAT_VECTOR);
116903 VectorOperations::Copy(data[i], other.data[i], size(), offset, 0);
116904 }
116905 other.SetCardinality(size() - offset);
116906}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Copy() [2/2]

void duckdb::DataChunk::Copy ( DataChunk & other,
const SelectionVector & sel,
const idx_t source_count,
const idx_t offset = 0 ) const
116908 {
116909 D_ASSERT(ColumnCount() == other.ColumnCount());
116910 D_ASSERT(other.size() == 0);
116911 D_ASSERT(source_count <= size());
116912
116913 for (idx_t i = 0; i < ColumnCount(); i++) {
116914 D_ASSERT(other.data[i].GetVectorType() == VectorType::FLAT_VECTOR);
116915 VectorOperations::Copy(data[i], other.data[i], sel, source_count, offset, 0);
116916 }
116917 other.SetCardinality(source_count - offset);
116918}

◆ Split()

void duckdb::DataChunk::Split ( DataChunk & other,
idx_t split_idx )

Splits the DataChunk in two.

116920 {
116921 D_ASSERT(other.size() == 0);
116922 D_ASSERT(other.data.empty());
116923 D_ASSERT(split_idx < data.size());
116924 const idx_t num_cols = data.size();
116925 for (idx_t col_idx = split_idx; col_idx < num_cols; col_idx++) {
116926 other.data.push_back(std::move(data[col_idx]));
116927 other.vector_caches.push_back(std::move(vector_caches[col_idx]));
116928 }
116929 for (idx_t col_idx = split_idx; col_idx < num_cols; col_idx++) {
116930 data.pop_back();
116931 vector_caches.pop_back();
116932 }
116933 other.SetCapacity(*this);
116934 other.SetCardinality(*this);
116935}
Here is the call graph for this function:

◆ Fuse()

void duckdb::DataChunk::Fuse ( DataChunk & other)

Fuses a DataChunk onto the right of this one, and destroys the other. Inverse of Split.

116937 {
116938 D_ASSERT(other.size() == size());
116939 const idx_t num_cols = other.data.size();
116940 for (idx_t col_idx = 0; col_idx < num_cols; ++col_idx) {
116941 data.emplace_back(std::move(other.data[col_idx]));
116942 vector_caches.emplace_back(std::move(other.vector_caches[col_idx]));
116943 }
116944 other.Destroy();
116945}
Here is the call graph for this function:

◆ ReferenceColumns()

void duckdb::DataChunk::ReferenceColumns ( DataChunk & other,
const vector< column_t > & column_ids )

Makes this DataChunk reference the specified columns in the other DataChunk.

116947 {
116948 D_ASSERT(ColumnCount() == column_ids.size());
116949 Reset();
116950 for (idx_t col_idx = 0; col_idx < ColumnCount(); col_idx++) {
116951 auto &other_col = other.data[column_ids[col_idx]];
116952 auto &this_col = data[col_idx];
116953 D_ASSERT(other_col.GetType() == this_col.GetType());
116954 this_col.Reference(other_col);
116955 }
116956 SetCardinality(other.size());
116957}
DUCKDB_API void Reset()
Definition duckdb.cpp:116840
Here is the call graph for this function:

◆ Flatten()

void duckdb::DataChunk::Flatten ( )

Turn all the vectors from the chunk into flat vectors.

116989 {
116990 for (idx_t i = 0; i < ColumnCount(); i++) {
116991 data[i].Flatten(size());
116992 }
116993}
Here is the caller graph for this function:

◆ ToUnifiedFormat()

unsafe_unique_array< UnifiedVectorFormat > duckdb::DataChunk::ToUnifiedFormat ( )
117089 {
117090 auto unified_data = make_unsafe_uniq_array<UnifiedVectorFormat>(ColumnCount());
117091 for (idx_t col_idx = 0; col_idx < ColumnCount(); col_idx++) {
117092 data[col_idx].ToUnifiedFormat(size(), unified_data[col_idx]);
117093 }
117094 return unified_data;
117095}

◆ Slice() [1/3]

void duckdb::DataChunk::Slice ( const SelectionVector & sel_vector,
idx_t count )
117057 {
117058 this->count = count_p;
117059 SelCache merge_cache;
117060 for (idx_t c = 0; c < ColumnCount(); c++) {
117061 data[c].Slice(sel_vector, count_p, merge_cache);
117062 }
117063}

◆ Slice() [2/3]

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'

117065 {
117066 D_ASSERT(other.ColumnCount() <= col_offset + ColumnCount());
117067 this->count = count_p;
117068 SelCache merge_cache;
117069 for (idx_t c = 0; c < other.ColumnCount(); c++) {
117070 if (other.data[c].GetVectorType() == VectorType::DICTIONARY_VECTOR) {
117071 // already a dictionary! merge the dictionaries
117072 data[col_offset + c].Reference(other.data[c]);
117073 data[col_offset + c].Slice(sel, count_p, merge_cache);
117074 } else {
117075 data[col_offset + c].Slice(other.data[c], sel, count_p);
117076 }
117077 }
117078}
Here is the call graph for this function:

◆ Slice() [3/3]

void duckdb::DataChunk::Slice ( idx_t offset,
idx_t count )

Slice a DataChunk from "offset" to "offset + count".

117080 {
117081 D_ASSERT(offset + slice_count <= size());
117082 SelectionVector sel(slice_count);
117083 for (idx_t i = 0; i < slice_count; i++) {
117084 sel.set_index(i, offset + i);
117085 }
117086 Slice(sel, slice_count);
117087}

◆ Reset()

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.

116840 {
116841 SetCardinality(0);
116842 if (data.empty() || vector_caches.empty()) {
116843 return;
116844 }
116845 if (vector_caches.size() != data.size()) {
116846 throw InternalException("VectorCache and column count mismatch in DataChunk::Reset");
116847 }
116848 for (idx_t i = 0; i < ColumnCount(); i++) {
116849 data[i].ResetFromCache(vector_caches[i]);
116850 }
116852}
Here is the caller graph for this function:

◆ Serialize()

void duckdb::DataChunk::Serialize ( Serializer & serializer,
bool compressed_serialization = true ) const
117011 {
117012 // write the count
117013 auto row_count = size();
117014 serializer.WriteProperty<sel_t>(100, "rows", NumericCast<sel_t>(row_count));
117015
117016 // we should never try to serialize empty data chunks
117017 auto column_count = ColumnCount();
117018 D_ASSERT(column_count);
117019
117020 // write the types
117021 serializer.WriteList(101, "types", column_count,
117022 [&](Serializer::List &list, idx_t i) { list.WriteElement(data[i].GetType()); });
117023
117024 // write the data
117025 serializer.WriteList(102, "columns", column_count, [&](Serializer::List &list, idx_t i) {
117026 list.WriteObject([&](Serializer &object) {
117027 // Reference the vector to avoid potentially mutating it during serialization
117028 Vector serialized_vector(data[i].GetType());
117029 serialized_vector.Reference(data[i]);
117030 serialized_vector.Serialize(object, row_count, compressed_serialization);
117031 });
117032 });
117033}
uint32_t sel_t
Type used for the selection vector.
Definition duckdb.hpp:251

◆ Deserialize()

void duckdb::DataChunk::Deserialize ( Deserializer & source)
117035 {
117036 // read and set the row count
117037 auto row_count = deserializer.ReadProperty<sel_t>(100, "rows");
117038
117039 // read the types
117040 vector<LogicalType> types;
117041 deserializer.ReadList(101, "types", [&](Deserializer::List &list, idx_t i) {
117042 auto type = list.ReadElement<LogicalType>();
117043 types.push_back(type);
117044 });
117045
117046 // initialize the data chunk
117047 D_ASSERT(!types.empty());
117048 Initialize(Allocator::DefaultAllocator(), types, MaxValue<idx_t>(row_count, STANDARD_VECTOR_SIZE));
117049 SetCardinality(row_count);
117050
117051 // read the data
117052 deserializer.ReadList(102, "columns", [&](Deserializer::List &list, idx_t i) {
117053 list.ReadObject([&](Deserializer &object) { data[i].Deserialize(object, row_count); });
117054 });
117055}

◆ Hash() [1/2]

void duckdb::DataChunk::Hash ( Vector & result)

Hashes the DataChunk to the target vector.

117097 {
117098 D_ASSERT(result.GetType().id() == LogicalType::HASH);
117099 VectorOperations::Hash(data[0], result, size());
117100 for (idx_t i = 1; i < ColumnCount(); i++) {
117101 VectorOperations::CombineHash(result, data[i], size());
117102 }
117103}
Here is the caller graph for this function:

◆ Hash() [2/2]

void duckdb::DataChunk::Hash ( vector< idx_t > & column_ids,
Vector & result )

Hashes specific vectors of the DataChunk to the target vector.

117105 {
117106 D_ASSERT(result.GetType().id() == LogicalType::HASH);
117107 D_ASSERT(!column_ids.empty());
117108
117109 VectorOperations::Hash(data[column_ids[0]], result, size());
117110 for (idx_t i = 1; i < column_ids.size(); i++) {
117111 VectorOperations::CombineHash(result, data[column_ids[i]], size());
117112 }
117113}

◆ GetTypes()

vector< LogicalType > duckdb::DataChunk::GetTypes ( ) const

Returns a list of types of the vectors of this data chunk.

116995 {
116996 vector<LogicalType> types;
116997 for (idx_t i = 0; i < ColumnCount(); i++) {
116998 types.push_back(data[i].GetType());
116999 }
117000 return types;
117001}
Here is the caller graph for this function:

◆ ToString()

string duckdb::DataChunk::ToString ( ) const

Converts this DataChunk to a printable string representation.

117003 {
117004 string retval = "Chunk - [" + to_string(ColumnCount()) + " Columns]\n";
117005 for (idx_t i = 0; i < ColumnCount(); i++) {
117006 retval += "- " + data[i].ToString(size()) + "\n";
117007 }
117008 return retval;
117009}
std::string to_string(const T &value)
Definition duckdb.cpp:19425
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Print()

void duckdb::DataChunk::Print ( ) const
117153 {
117155}
DUCKDB_API string ToString() const
Converts this DataChunk to a printable string representation.
Definition duckdb.cpp:117003
static DUCKDB_API void Print(OutputStream stream, const string &str)
Print the object to the stream.
Definition duckdb.cpp:92556

◆ Verify()

void duckdb::DataChunk::Verify ( )

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

117115 {
117116#ifdef DEBUG
117117 D_ASSERT(size() <= capacity);
117118
117119 // verify that all vectors in this chunk have the chunk selection vector
117120 for (idx_t i = 0; i < ColumnCount(); i++) {
117121 data[i].Verify(size());
117122 }
117123
117124 if (!ColumnCount()) {
117125 // don't try to round-trip dummy data chunks with no data
117126 // e.g., these exist in queries like 'SELECT distinct(col0, col1) FROM tbl', where we have groups, but no
117127 // payload so the payload will be such an empty data chunk
117128 return;
117129 }
117130
117131 // verify that we can round-trip chunk serialization
117132 Allocator allocator;
117133 MemoryStream mem_stream(allocator);
117134 BinarySerializer serializer(mem_stream);
117135
117136 serializer.Begin();
117137 Serialize(serializer);
117138 serializer.End();
117139
117140 mem_stream.Rewind();
117141
117142 BinaryDeserializer deserializer(mem_stream);
117143 DataChunk new_chunk;
117144
117145 deserializer.Begin();
117146 new_chunk.Deserialize(deserializer);
117147 deserializer.End();
117148
117149 D_ASSERT(size() == new_chunk.size());
117150#endif
117151}
DUCKDB_API DataChunk()
Creates an empty DataChunk.
Definition duckdb.cpp:116777
Here is the call graph for this function:
Here is the caller graph for this function:

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