mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Rename method for consistency
This commit is contained in:
parent
478b721b36
commit
270a31abb5
@ -383,7 +383,7 @@ ColumnsDescription InterpreterCreateQuery::setColumns(
|
|||||||
else if (!create.as_table.empty())
|
else if (!create.as_table.empty())
|
||||||
{
|
{
|
||||||
columns = as_storage->getColumns();
|
columns = as_storage->getColumns();
|
||||||
indices = as_storage->getIndicesDescription();
|
indices = as_storage->getIndices();
|
||||||
}
|
}
|
||||||
else if (create.select)
|
else if (create.select)
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,7 @@ void IStorage::alter(const AlterCommands & params, const String & database_name,
|
|||||||
|
|
||||||
lockStructureExclusively(table_lock_holder, context.getCurrentQueryId());
|
lockStructureExclusively(table_lock_holder, context.getCurrentQueryId());
|
||||||
auto new_columns = getColumns();
|
auto new_columns = getColumns();
|
||||||
auto new_indices = getIndicesDescription();
|
auto new_indices = getIndices();
|
||||||
params.apply(new_columns);
|
params.apply(new_columns);
|
||||||
context.getDatabase(database_name)->alterTable(context, table_name, new_columns, new_indices, {});
|
context.getDatabase(database_name)->alterTable(context, table_name, new_columns, new_indices, {});
|
||||||
setColumns(std::move(new_columns));
|
setColumns(std::move(new_columns));
|
||||||
|
@ -31,7 +31,7 @@ void ITableDeclaration::setColumns(ColumnsDescription columns_)
|
|||||||
columns = std::move(columns_);
|
columns = std::move(columns_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ITableDeclaration::setIndicesDescription(IndicesDescription indices_)
|
void ITableDeclaration::setIndices(IndicesDescription indices_)
|
||||||
{
|
{
|
||||||
indices = std::move(indices_);
|
indices = std::move(indices_);
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,8 @@ public:
|
|||||||
virtual const ColumnsDescription & getColumns() const { return columns; }
|
virtual const ColumnsDescription & getColumns() const { return columns; }
|
||||||
virtual void setColumns(ColumnsDescription columns_);
|
virtual void setColumns(ColumnsDescription columns_);
|
||||||
|
|
||||||
virtual const IndicesDescription & getIndicesDescription() const { return indices; }
|
virtual const IndicesDescription & getIndices() const { return indices; }
|
||||||
virtual void setIndicesDescription(IndicesDescription indices_);
|
virtual void setIndices(IndicesDescription indices_);
|
||||||
|
|
||||||
/// NOTE: These methods should include virtual columns, but should NOT include ALIAS columns
|
/// NOTE: These methods should include virtual columns, but should NOT include ALIAS columns
|
||||||
/// (they are treated separately).
|
/// (they are treated separately).
|
||||||
|
@ -420,7 +420,7 @@ void MergeTreeData::setPrimaryKeyIndicesAndColumns(
|
|||||||
primary_key_sample = std::move(new_primary_key_sample);
|
primary_key_sample = std::move(new_primary_key_sample);
|
||||||
primary_key_data_types = std::move(new_primary_key_data_types);
|
primary_key_data_types = std::move(new_primary_key_data_types);
|
||||||
|
|
||||||
setIndicesDescription(indices_description);
|
setIndices(indices_description);
|
||||||
skip_indices = std::move(new_indices);
|
skip_indices = std::move(new_indices);
|
||||||
|
|
||||||
primary_key_and_skip_indices_expr = new_indices_with_primary_key_expr;
|
primary_key_and_skip_indices_expr = new_indices_with_primary_key_expr;
|
||||||
@ -1177,13 +1177,13 @@ void MergeTreeData::checkAlter(const AlterCommands & commands, const Context & c
|
|||||||
{
|
{
|
||||||
/// Check that needed transformations can be applied to the list of columns without considering type conversions.
|
/// Check that needed transformations can be applied to the list of columns without considering type conversions.
|
||||||
auto new_columns = getColumns();
|
auto new_columns = getColumns();
|
||||||
auto new_indices = getIndicesDescription();
|
auto new_indices = getIndices();
|
||||||
ASTPtr new_order_by_ast = order_by_ast;
|
ASTPtr new_order_by_ast = order_by_ast;
|
||||||
ASTPtr new_primary_key_ast = primary_key_ast;
|
ASTPtr new_primary_key_ast = primary_key_ast;
|
||||||
ASTPtr new_ttl_table_ast = ttl_table_ast;
|
ASTPtr new_ttl_table_ast = ttl_table_ast;
|
||||||
commands.apply(new_columns, new_indices, new_order_by_ast, new_primary_key_ast, new_ttl_table_ast);
|
commands.apply(new_columns, new_indices, new_order_by_ast, new_primary_key_ast, new_ttl_table_ast);
|
||||||
|
|
||||||
if (getIndicesDescription().empty() && !new_indices.empty() &&
|
if (getIndices().empty() && !new_indices.empty() &&
|
||||||
!context.getSettingsRef().allow_experimental_data_skipping_indices)
|
!context.getSettingsRef().allow_experimental_data_skipping_indices)
|
||||||
throw Exception("You must set the setting `allow_experimental_data_skipping_indices` to 1 " \
|
throw Exception("You must set the setting `allow_experimental_data_skipping_indices` to 1 " \
|
||||||
"before using data skipping indices.", ErrorCodes::BAD_ARGUMENTS);
|
"before using data skipping indices.", ErrorCodes::BAD_ARGUMENTS);
|
||||||
@ -1274,7 +1274,7 @@ void MergeTreeData::checkAlter(const AlterCommands & commands, const Context & c
|
|||||||
NameToNameMap unused_map;
|
NameToNameMap unused_map;
|
||||||
bool unused_bool;
|
bool unused_bool;
|
||||||
createConvertExpression(nullptr, getColumns().getAllPhysical(), new_columns.getAllPhysical(),
|
createConvertExpression(nullptr, getColumns().getAllPhysical(), new_columns.getAllPhysical(),
|
||||||
getIndicesDescription().indices, new_indices.indices, unused_expression, unused_map, unused_bool);
|
getIndices().indices, new_indices.indices, unused_expression, unused_map, unused_bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MergeTreeData::createConvertExpression(const DataPartPtr & part, const NamesAndTypesList & old_columns, const NamesAndTypesList & new_columns,
|
void MergeTreeData::createConvertExpression(const DataPartPtr & part, const NamesAndTypesList & old_columns, const NamesAndTypesList & new_columns,
|
||||||
@ -1445,7 +1445,7 @@ MergeTreeData::AlterDataPartTransactionPtr MergeTreeData::alterDataPart(
|
|||||||
AlterDataPartTransactionPtr transaction(new AlterDataPartTransaction(part)); /// Blocks changes to the part.
|
AlterDataPartTransactionPtr transaction(new AlterDataPartTransaction(part)); /// Blocks changes to the part.
|
||||||
bool force_update_metadata;
|
bool force_update_metadata;
|
||||||
createConvertExpression(part, part->columns, new_columns,
|
createConvertExpression(part, part->columns, new_columns,
|
||||||
getIndicesDescription().indices, new_indices,
|
getIndices().indices, new_indices,
|
||||||
expression, transaction->rename_map, force_update_metadata);
|
expression, transaction->rename_map, force_update_metadata);
|
||||||
|
|
||||||
size_t num_files_to_modify = transaction->rename_map.size();
|
size_t num_files_to_modify = transaction->rename_map.size();
|
||||||
@ -1597,7 +1597,7 @@ void MergeTreeData::removeEmptyColumnsFromPart(MergeTreeData::MutableDataPartPtr
|
|||||||
|
|
||||||
LOG_INFO(log, "Removing empty columns: " << log_message.str() << " from part " << data_part->name);
|
LOG_INFO(log, "Removing empty columns: " << log_message.str() << " from part " << data_part->name);
|
||||||
|
|
||||||
if (auto transaction = alterDataPart(data_part, new_columns, getIndicesDescription().indices, false))
|
if (auto transaction = alterDataPart(data_part, new_columns, getIndices().indices, false))
|
||||||
transaction->commit();
|
transaction->commit();
|
||||||
empty_columns.clear();
|
empty_columns.clear();
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ void ReplicatedMergeTreeAlterThread::run()
|
|||||||
parts = storage.data.getDataParts();
|
parts = storage.data.getDataParts();
|
||||||
|
|
||||||
const auto columns_for_parts = storage.getColumns().getAllPhysical();
|
const auto columns_for_parts = storage.getColumns().getAllPhysical();
|
||||||
const auto indices_for_parts = storage.getIndicesDescription();
|
const auto indices_for_parts = storage.getIndices();
|
||||||
|
|
||||||
for (const MergeTreeData::DataPartPtr & part : parts)
|
for (const MergeTreeData::DataPartPtr & part : parts)
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ ReplicatedMergeTreeTableMetadata::ReplicatedMergeTreeTableMetadata(const MergeTr
|
|||||||
if (data.format_version >= MERGE_TREE_DATA_MIN_FORMAT_VERSION_WITH_CUSTOM_PARTITIONING)
|
if (data.format_version >= MERGE_TREE_DATA_MIN_FORMAT_VERSION_WITH_CUSTOM_PARTITIONING)
|
||||||
partition_key = formattedAST(MergeTreeData::extractKeyExpressionList(data.partition_by_ast));
|
partition_key = formattedAST(MergeTreeData::extractKeyExpressionList(data.partition_by_ast));
|
||||||
|
|
||||||
skip_indices = data.getIndicesDescription().toString();
|
skip_indices = data.getIndices().toString();
|
||||||
index_granularity_bytes = data.index_granularity_info.index_granularity_bytes;
|
index_granularity_bytes = data.index_granularity_info.index_granularity_bytes;
|
||||||
ttl_table = formattedAST(data.ttl_table_ast);
|
ttl_table = formattedAST(data.ttl_table_ast);
|
||||||
}
|
}
|
||||||
|
@ -700,7 +700,7 @@ void StorageBuffer::alter(const AlterCommands & params, const String & database_
|
|||||||
optimize({} /*query*/, {} /*partition_id*/, false /*final*/, false /*deduplicate*/, context);
|
optimize({} /*query*/, {} /*partition_id*/, false /*final*/, false /*deduplicate*/, context);
|
||||||
|
|
||||||
auto new_columns = getColumns();
|
auto new_columns = getColumns();
|
||||||
auto new_indices = getIndicesDescription();
|
auto new_indices = getIndices();
|
||||||
params.apply(new_columns);
|
params.apply(new_columns);
|
||||||
context.getDatabase(database_name)->alterTable(context, table_name, new_columns, new_indices, {});
|
context.getDatabase(database_name)->alterTable(context, table_name, new_columns, new_indices, {});
|
||||||
setColumns(std::move(new_columns));
|
setColumns(std::move(new_columns));
|
||||||
|
@ -344,7 +344,7 @@ void StorageDistributed::alter(
|
|||||||
lockStructureExclusively(table_lock_holder, context.getCurrentQueryId());
|
lockStructureExclusively(table_lock_holder, context.getCurrentQueryId());
|
||||||
|
|
||||||
auto new_columns = getColumns();
|
auto new_columns = getColumns();
|
||||||
auto new_indices = getIndicesDescription();
|
auto new_indices = getIndices();
|
||||||
params.apply(new_columns);
|
params.apply(new_columns);
|
||||||
context.getDatabase(database_name)->alterTable(context, current_table_name, new_columns, new_indices, {});
|
context.getDatabase(database_name)->alterTable(context, current_table_name, new_columns, new_indices, {});
|
||||||
setColumns(std::move(new_columns));
|
setColumns(std::move(new_columns));
|
||||||
|
@ -402,7 +402,7 @@ void StorageMerge::alter(
|
|||||||
lockStructureExclusively(table_lock_holder, context.getCurrentQueryId());
|
lockStructureExclusively(table_lock_holder, context.getCurrentQueryId());
|
||||||
|
|
||||||
auto new_columns = getColumns();
|
auto new_columns = getColumns();
|
||||||
auto new_indices = getIndicesDescription();
|
auto new_indices = getIndices();
|
||||||
params.apply(new_columns);
|
params.apply(new_columns);
|
||||||
context.getDatabase(database_name)->alterTable(context, table_name, new_columns, new_indices, {});
|
context.getDatabase(database_name)->alterTable(context, table_name, new_columns, new_indices, {});
|
||||||
setColumns(new_columns);
|
setColumns(new_columns);
|
||||||
|
@ -204,7 +204,7 @@ void StorageMergeTree::alter(
|
|||||||
{
|
{
|
||||||
lockStructureExclusively(table_lock_holder, context.getCurrentQueryId());
|
lockStructureExclusively(table_lock_holder, context.getCurrentQueryId());
|
||||||
auto new_columns = getColumns();
|
auto new_columns = getColumns();
|
||||||
auto new_indices = getIndicesDescription();
|
auto new_indices = getIndices();
|
||||||
params.apply(new_columns);
|
params.apply(new_columns);
|
||||||
context.getDatabase(current_database_name)->alterTable(context, current_table_name, new_columns, new_indices, {});
|
context.getDatabase(current_database_name)->alterTable(context, current_table_name, new_columns, new_indices, {});
|
||||||
setColumns(std::move(new_columns));
|
setColumns(std::move(new_columns));
|
||||||
@ -219,7 +219,7 @@ void StorageMergeTree::alter(
|
|||||||
data.checkAlter(params, context);
|
data.checkAlter(params, context);
|
||||||
|
|
||||||
auto new_columns = data.getColumns();
|
auto new_columns = data.getColumns();
|
||||||
auto new_indices = data.getIndicesDescription();
|
auto new_indices = data.getIndices();
|
||||||
ASTPtr new_order_by_ast = data.order_by_ast;
|
ASTPtr new_order_by_ast = data.order_by_ast;
|
||||||
ASTPtr new_primary_key_ast = data.primary_key_ast;
|
ASTPtr new_primary_key_ast = data.primary_key_ast;
|
||||||
ASTPtr new_ttl_table_ast = data.ttl_table_ast;
|
ASTPtr new_ttl_table_ast = data.ttl_table_ast;
|
||||||
@ -800,7 +800,7 @@ void StorageMergeTree::clearColumnInPartition(const ASTPtr & partition, const Fi
|
|||||||
alter_command.column_name = get<String>(column_name);
|
alter_command.column_name = get<String>(column_name);
|
||||||
|
|
||||||
auto new_columns = getColumns();
|
auto new_columns = getColumns();
|
||||||
auto new_indices = getIndicesDescription();
|
auto new_indices = getIndices();
|
||||||
ASTPtr ignored_order_by_ast;
|
ASTPtr ignored_order_by_ast;
|
||||||
ASTPtr ignored_primary_key_ast;
|
ASTPtr ignored_primary_key_ast;
|
||||||
ASTPtr ignored_ttl_table_ast;
|
ASTPtr ignored_ttl_table_ast;
|
||||||
|
@ -43,8 +43,8 @@ public:
|
|||||||
const ColumnsDescription & getColumns() const override { return data.getColumns(); }
|
const ColumnsDescription & getColumns() const override { return data.getColumns(); }
|
||||||
void setColumns(ColumnsDescription columns_) override { return data.setColumns(std::move(columns_)); }
|
void setColumns(ColumnsDescription columns_) override { return data.setColumns(std::move(columns_)); }
|
||||||
|
|
||||||
virtual const IndicesDescription & getIndicesDescription() const override { return data.getIndicesDescription(); }
|
virtual const IndicesDescription & getIndices() const override { return data.getIndices(); }
|
||||||
virtual void setIndicesDescription(IndicesDescription indices_) override { data.setIndicesDescription(std::move(indices_)); }
|
virtual void setIndices(IndicesDescription indices_) override { data.setIndices(std::move(indices_)); }
|
||||||
|
|
||||||
NameAndTypePair getColumn(const String & column_name) const override { return data.getColumn(column_name); }
|
NameAndTypePair getColumn(const String & column_name) const override { return data.getColumn(column_name); }
|
||||||
bool hasColumn(const String & column_name) const override { return data.hasColumn(column_name); }
|
bool hasColumn(const String & column_name) const override { return data.hasColumn(column_name); }
|
||||||
|
@ -37,7 +37,7 @@ void StorageNull::alter(
|
|||||||
lockStructureExclusively(table_lock_holder, context.getCurrentQueryId());
|
lockStructureExclusively(table_lock_holder, context.getCurrentQueryId());
|
||||||
|
|
||||||
ColumnsDescription new_columns = getColumns();
|
ColumnsDescription new_columns = getColumns();
|
||||||
IndicesDescription new_indices = getIndicesDescription();
|
IndicesDescription new_indices = getIndices();
|
||||||
params.apply(new_columns);
|
params.apply(new_columns);
|
||||||
context.getDatabase(current_database_name)->alterTable(context, current_table_name, new_columns, new_indices, {});
|
context.getDatabase(current_database_name)->alterTable(context, current_table_name, new_columns, new_indices, {});
|
||||||
setColumns(std::move(new_columns));
|
setColumns(std::move(new_columns));
|
||||||
|
@ -426,7 +426,7 @@ void StorageReplicatedMergeTree::setTableStructure(ColumnsDescription new_column
|
|||||||
{
|
{
|
||||||
ASTPtr new_primary_key_ast = data.primary_key_ast;
|
ASTPtr new_primary_key_ast = data.primary_key_ast;
|
||||||
ASTPtr new_order_by_ast = data.order_by_ast;
|
ASTPtr new_order_by_ast = data.order_by_ast;
|
||||||
auto new_indices = data.getIndicesDescription();
|
auto new_indices = data.getIndices();
|
||||||
ASTPtr new_ttl_table_ast = data.ttl_table_ast;
|
ASTPtr new_ttl_table_ast = data.ttl_table_ast;
|
||||||
IDatabase::ASTModifier storage_modifier;
|
IDatabase::ASTModifier storage_modifier;
|
||||||
if (!metadata_diff.empty())
|
if (!metadata_diff.empty())
|
||||||
@ -1511,7 +1511,7 @@ void StorageReplicatedMergeTree::executeClearColumnInPartition(const LogEntry &
|
|||||||
alter_command.column_name = entry.column_name;
|
alter_command.column_name = entry.column_name;
|
||||||
|
|
||||||
auto new_columns = getColumns();
|
auto new_columns = getColumns();
|
||||||
auto new_indices = getIndicesDescription();
|
auto new_indices = getIndices();
|
||||||
ASTPtr ignored_order_by_ast;
|
ASTPtr ignored_order_by_ast;
|
||||||
ASTPtr ignored_primary_key_ast;
|
ASTPtr ignored_primary_key_ast;
|
||||||
ASTPtr ignored_ttl_table_ast;
|
ASTPtr ignored_ttl_table_ast;
|
||||||
@ -3117,7 +3117,7 @@ void StorageReplicatedMergeTree::alter(
|
|||||||
data.checkAlter(params, query_context);
|
data.checkAlter(params, query_context);
|
||||||
|
|
||||||
ColumnsDescription new_columns = data.getColumns();
|
ColumnsDescription new_columns = data.getColumns();
|
||||||
IndicesDescription new_indices = data.getIndicesDescription();
|
IndicesDescription new_indices = data.getIndices();
|
||||||
ASTPtr new_order_by_ast = data.order_by_ast;
|
ASTPtr new_order_by_ast = data.order_by_ast;
|
||||||
ASTPtr new_primary_key_ast = data.primary_key_ast;
|
ASTPtr new_primary_key_ast = data.primary_key_ast;
|
||||||
ASTPtr new_ttl_table_ast = data.ttl_table_ast;
|
ASTPtr new_ttl_table_ast = data.ttl_table_ast;
|
||||||
@ -3135,7 +3135,7 @@ void StorageReplicatedMergeTree::alter(
|
|||||||
new_metadata.ttl_table = serializeAST(*new_ttl_table_ast);
|
new_metadata.ttl_table = serializeAST(*new_ttl_table_ast);
|
||||||
|
|
||||||
String new_indices_str = new_indices.toString();
|
String new_indices_str = new_indices.toString();
|
||||||
if (new_indices_str != data.getIndicesDescription().toString())
|
if (new_indices_str != data.getIndices().toString())
|
||||||
new_metadata.skip_indices = new_indices_str;
|
new_metadata.skip_indices = new_indices_str;
|
||||||
|
|
||||||
String new_metadata_str = new_metadata.toString();
|
String new_metadata_str = new_metadata.toString();
|
||||||
|
Loading…
Reference in New Issue
Block a user