Skip to content

Commit

Permalink
Merge pull request #1 from taniabogatsch/ser-verify
Browse files Browse the repository at this point in the history
make data chunk initialization optional during deserialization
  • Loading branch information
maiadegraaf authored Sep 20, 2023
2 parents be7d64e + 2d3c55b commit 033f0f9
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/common/types/data_chunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,21 +256,24 @@ void DataChunk::Serialize(Serializer &serializer) const {
}

void DataChunk::Deserialize(Deserializer &deserializer) {
// read the count

// read and set the row count
auto row_count = deserializer.ReadProperty<sel_t>(100, "rows");
SetCardinality(row_count);

// Read the types
// read the types
vector<LogicalType> types;
deserializer.ReadList(101, "types", [&](Deserializer::List &list, idx_t i) {
auto type = list.ReadElement<LogicalType>();
types.push_back(type);
});
Initialize(Allocator::DefaultAllocator(), types);

// now load the column data
SetCardinality(row_count);
// initialize the data chunk
if (!types.empty()) {
Initialize(Allocator::DefaultAllocator(), types);
}

// Read the data
// read the data
deserializer.ReadList(102, "columns", [&](Deserializer::List &list, idx_t i) {
list.ReadObject([&](Deserializer &object) { data[i].Deserialize(object, row_count); });
});
Expand Down

0 comments on commit 033f0f9

Please sign in to comment.