Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ vector<VariantValue> VariantShreddedConversion::ConvertShreddedObject(Vector &me
value.ToUnifiedFormat(total_size, value_format);
auto value_data = value_format.GetData<string_t>(value_format);
auto &validity = value_format.validity;
(void)validity;

//! 'metadata'
UnifiedVectorFormat metadata_format;
Expand Down
4 changes: 2 additions & 2 deletions src/duckdb/src/common/types/column/column_data_allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ ColumnDataAllocator::ColumnDataAllocator(ColumnDataAllocator &other) {
switch (type) {
case ColumnDataAllocatorType::BUFFER_MANAGER_ALLOCATOR:
case ColumnDataAllocatorType::HYBRID:
alloc.allocator = other.alloc.allocator;
alloc.buffer_manager = other.alloc.buffer_manager;
break;
case ColumnDataAllocatorType::IN_MEMORY_ALLOCATOR:
alloc.buffer_manager = other.alloc.buffer_manager;
alloc.allocator = other.alloc.allocator;
break;
default:
throw InternalException("Unrecognized column data allocator type");
Expand Down
10 changes: 8 additions & 2 deletions src/duckdb/src/common/types/row/tuple_data_allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,14 @@ TupleDataChunkPart TupleDataAllocator::BuildChunkPart(TupleDataPinState &pin_sta
if (total_heap_size == 0) {
result.SetHeapEmpty();
} else {
const auto heap_remaining = MaxValue<idx_t>(
heap_blocks.empty() ? block_size : heap_blocks.back().RemainingCapacity(), heap_sizes[append_offset]);
idx_t heap_remaining;
if (!heap_blocks.empty() && heap_blocks.back().RemainingCapacity() >= heap_sizes[append_offset]) {
// We have enough room for the current entry
heap_remaining = heap_blocks.back().RemainingCapacity();
} else {
// We need to allocate a new block
heap_remaining = MaxValue<idx_t>(block_size, heap_sizes[append_offset]);
}

if (total_heap_size <= heap_remaining) {
// Everything fits
Expand Down
1 change: 1 addition & 0 deletions src/duckdb/src/function/scalar/variant/variant_extract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ static void VariantExtractFunction(DataChunk &input, ExpressionState &state, Vec

auto &path = input.data[1];
D_ASSERT(path.GetVectorType() == VectorType::CONSTANT_VECTOR);
(void)path;

auto &func_expr = state.expr.Cast<BoundFunctionExpression>();
auto &info = func_expr.bind_info->Cast<BindData>();
Expand Down
3 changes: 3 additions & 0 deletions src/duckdb/src/function/scalar/variant/variant_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,14 @@ bool VariantUtils::Verify(Vector &variant, const SelectionVector &sel_p, idx_t c
if (key_id.validity.RowIsValid(key_id_index)) {
auto children_key_id = key_id_data[key_id_index];
D_ASSERT(children_key_id < keys_list_entry.length);
(void)children_key_id;
}

auto value_id_index = value_id.sel->get_index(j + children_list_entry.offset);
D_ASSERT(value_id.validity.RowIsValid(value_id_index));
auto children_value_id = value_id_data[value_id_index];
D_ASSERT(children_value_id < values_list_entry.length);
(void)children_value_id;
}

//! verify values
Expand Down Expand Up @@ -397,6 +399,7 @@ bool VariantUtils::Verify(Vector &variant, const SelectionVector &sel_p, idx_t c
} else {
D_ASSERT(!key_id.validity.RowIsValid(child_key_id_index));
}
(void)child_key_id_index;
}
break;
}
Expand Down
6 changes: 3 additions & 3 deletions src/duckdb/src/function/table/version/pragma_version.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef DUCKDB_PATCH_VERSION
#define DUCKDB_PATCH_VERSION "0-dev4146"
#define DUCKDB_PATCH_VERSION "0-dev4159"
#endif
#ifndef DUCKDB_MINOR_VERSION
#define DUCKDB_MINOR_VERSION 4
Expand All @@ -8,10 +8,10 @@
#define DUCKDB_MAJOR_VERSION 1
#endif
#ifndef DUCKDB_VERSION
#define DUCKDB_VERSION "v1.4.0-dev4146"
#define DUCKDB_VERSION "v1.4.0-dev4159"
#endif
#ifndef DUCKDB_SOURCE_ID
#define DUCKDB_SOURCE_ID "19dd651b26"
#define DUCKDB_SOURCE_ID "b081b761ec"
#endif
#include "duckdb/function/table/system_functions.hpp"
#include "duckdb/main/database.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ enum class AlterDatabaseType : uint8_t { RENAME_DATABASE = 0 };

struct AlterDatabaseInfo : public AlterInfo {
public:
explicit AlterDatabaseInfo(AlterDatabaseType alter_database_type);
AlterDatabaseInfo(AlterDatabaseType alter_database_type, string catalog_p, OnEntryNotFound if_not_found);
~AlterDatabaseInfo() override;

Expand All @@ -25,12 +26,15 @@ struct AlterDatabaseInfo : public AlterInfo {
CatalogType GetCatalogType() const override;
string ToString() const override = 0;

static unique_ptr<AlterInfo> Deserialize(Deserializer &deserializer);

protected:
void Serialize(Serializer &serializer) const override;
};

struct RenameDatabaseInfo : public AlterDatabaseInfo {
public:
RenameDatabaseInfo();
RenameDatabaseInfo(string catalog_p, string new_name_p, OnEntryNotFound if_not_found);

string new_name;
Expand All @@ -39,6 +43,8 @@ struct RenameDatabaseInfo : public AlterDatabaseInfo {
unique_ptr<AlterInfo> Copy() const override;
string ToString() const override;

static unique_ptr<AlterDatabaseInfo> Deserialize(Deserializer &deserializer);

protected:
void Serialize(Serializer &serializer) const override;
};
Expand Down
22 changes: 13 additions & 9 deletions src/duckdb/src/parser/parsed_data/alter_database_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

namespace duckdb {

AlterDatabaseInfo::AlterDatabaseInfo(AlterDatabaseType alter_database_type)
: AlterInfo(AlterType::ALTER_DATABASE, string(), "", "", OnEntryNotFound::THROW_EXCEPTION),
alter_database_type(alter_database_type) {
}

AlterDatabaseInfo::AlterDatabaseInfo(AlterDatabaseType alter_database_type, string catalog_p,
OnEntryNotFound if_not_found)
: AlterInfo(AlterType::ALTER_DATABASE, std::move(catalog_p), "", "", if_not_found),
Expand All @@ -16,9 +21,7 @@ CatalogType AlterDatabaseInfo::GetCatalogType() const {
return CatalogType::DATABASE_ENTRY;
}

void AlterDatabaseInfo::Serialize(Serializer &serializer) const {
AlterInfo::Serialize(serializer);
serializer.WriteProperty(100, "alter_database_type", alter_database_type);
RenameDatabaseInfo::RenameDatabaseInfo() : AlterDatabaseInfo(AlterDatabaseType::RENAME_DATABASE) {
}

RenameDatabaseInfo::RenameDatabaseInfo(string catalog_p, string new_name_p, OnEntryNotFound if_not_found)
Expand All @@ -31,12 +34,13 @@ unique_ptr<AlterInfo> RenameDatabaseInfo::Copy() const {
}

string RenameDatabaseInfo::ToString() const {
return "ALTER DATABASE " + catalog + " RENAME TO " + new_name;
}

void RenameDatabaseInfo::Serialize(Serializer &serializer) const {
AlterDatabaseInfo::Serialize(serializer);
serializer.WriteProperty(200, "new_name", new_name);
string result;
result = "ALTER DATABASE ";
if (if_not_found == OnEntryNotFound::RETURN_NULL) {
result += "IF EXISTS ";
}
result += StringUtil::Format("%s RENAME TO %s", SQLIdentifier(catalog), SQLIdentifier(new_name));
return result;
}

} // namespace duckdb
33 changes: 33 additions & 0 deletions src/duckdb/src/storage/serialization/serialize_parse_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "duckdb/parser/parsed_data/alter_info.hpp"
#include "duckdb/parser/parsed_data/alter_table_info.hpp"
#include "duckdb/parser/parsed_data/comment_on_column_info.hpp"
#include "duckdb/parser/parsed_data/alter_database_info.hpp"
#include "duckdb/parser/parsed_data/attach_info.hpp"
#include "duckdb/parser/parsed_data/copy_database_info.hpp"
#include "duckdb/parser/parsed_data/copy_info.hpp"
Expand Down Expand Up @@ -92,6 +93,9 @@ unique_ptr<ParseInfo> AlterInfo::Deserialize(Deserializer &deserializer) {
auto allow_internal = deserializer.ReadPropertyWithDefault<bool>(205, "allow_internal");
unique_ptr<AlterInfo> result;
switch (type) {
case AlterType::ALTER_DATABASE:
result = AlterDatabaseInfo::Deserialize(deserializer);
break;
case AlterType::ALTER_TABLE:
result = AlterTableInfo::Deserialize(deserializer);
break;
Expand Down Expand Up @@ -196,6 +200,24 @@ unique_ptr<AlterInfo> AlterViewInfo::Deserialize(Deserializer &deserializer) {
return std::move(result);
}

void AlterDatabaseInfo::Serialize(Serializer &serializer) const {
AlterInfo::Serialize(serializer);
serializer.WriteProperty<AlterDatabaseType>(300, "alter_database_type", alter_database_type);
}

unique_ptr<AlterInfo> AlterDatabaseInfo::Deserialize(Deserializer &deserializer) {
auto alter_database_type = deserializer.ReadProperty<AlterDatabaseType>(300, "alter_database_type");
unique_ptr<AlterDatabaseInfo> result;
switch (alter_database_type) {
case AlterDatabaseType::RENAME_DATABASE:
result = RenameDatabaseInfo::Deserialize(deserializer);
break;
default:
throw SerializationException("Unsupported type for deserialization of AlterDatabaseInfo!");
}
return std::move(result);
}

void AddColumnInfo::Serialize(Serializer &serializer) const {
AlterTableInfo::Serialize(serializer);
serializer.WriteProperty<ColumnDefinition>(400, "new_column", new_column);
Expand Down Expand Up @@ -482,6 +504,17 @@ unique_ptr<AlterTableInfo> RenameColumnInfo::Deserialize(Deserializer &deseriali
return std::move(result);
}

void RenameDatabaseInfo::Serialize(Serializer &serializer) const {
AlterDatabaseInfo::Serialize(serializer);
serializer.WritePropertyWithDefault<string>(400, "new_name", new_name);
}

unique_ptr<AlterDatabaseInfo> RenameDatabaseInfo::Deserialize(Deserializer &deserializer) {
auto result = duckdb::unique_ptr<RenameDatabaseInfo>(new RenameDatabaseInfo());
deserializer.ReadPropertyWithDefault<string>(400, "new_name", result->new_name);
return std::move(result);
}

void RenameFieldInfo::Serialize(Serializer &serializer) const {
AlterTableInfo::Serialize(serializer);
serializer.WritePropertyWithDefault<vector<string>>(400, "column_path", column_path);
Expand Down
Loading