ClickHouse/src/Storages/StorageInMemoryMetadata.cpp
2020-06-15 21:08:05 +03:00

93 lines
2.5 KiB
C++

#include <Storages/StorageInMemoryMetadata.h>
namespace DB
{
StorageInMemoryMetadata::StorageInMemoryMetadata(
const ColumnsDescription & columns_,
const IndicesDescription & secondary_indices_,
const ConstraintsDescription & constraints_)
: columns(columns_)
, secondary_indices(secondary_indices_)
, constraints(constraints_)
{
}
StorageInMemoryMetadata::StorageInMemoryMetadata(const StorageInMemoryMetadata & other)
: columns(other.columns)
, secondary_indices(other.secondary_indices)
, constraints(other.constraints)
, partition_key(other.partition_key)
, primary_key(other.primary_key)
, sorting_key(other.sorting_key)
, sampling_key(other.sampling_key)
, column_ttls_by_name(other.column_ttls_by_name)
, table_ttl(other.table_ttl)
, settings_changes(other.settings_changes ? other.settings_changes->clone() : nullptr)
, select(other.select)
{
}
StorageInMemoryMetadata & StorageInMemoryMetadata::operator=(const StorageInMemoryMetadata & other)
{
if (&other == this)
return *this;
columns = other.columns;
secondary_indices = other.secondary_indices;
constraints = other.constraints;
partition_key = other.partition_key;
primary_key = other.primary_key;
sorting_key = other.sorting_key;
sampling_key = other.sampling_key;
column_ttls_by_name = other.column_ttls_by_name;
table_ttl = other.table_ttl;
if (other.settings_changes)
settings_changes = other.settings_changes->clone();
else
settings_changes.reset();
select = other.select;
return *this;
}
void StorageInMemoryMetadata::setColumns(ColumnsDescription columns_)
{
columns = std::move(columns_);
}
void StorageInMemoryMetadata::setSecondaryIndices(IndicesDescription secondary_indices_)
{
secondary_indices = std::move(secondary_indices_);
}
void StorageInMemoryMetadata::setConstraints(ConstraintsDescription constraints_)
{
constraints = std::move(constraints_);
}
void StorageInMemoryMetadata::setTableTTLs(const TTLTableDescription & table_ttl_)
{
table_ttl = table_ttl_;
}
void StorageInMemoryMetadata::setColumnTTLs(const TTLColumnsDescription & column_ttls_by_name_)
{
column_ttls_by_name = column_ttls_by_name_;
}
void StorageInMemoryMetadata::setSettingsChanges(const ASTPtr & settings_changes_)
{
if (settings_changes_)
settings_changes = settings_changes_;
else
settings_changes = nullptr;
}
void StorageInMemoryMetadata::setSelectQuery(const SelectQueryDescription & select_)
{
select = select_;
}
}